Zheng Bao ([email protected]) just uploaded a new patch set to gerrit, which 
you can find at http://review.coreboot.org/1529

-gerrit

commit 1d6e58401b9cd182a59471d34bd0563a05cfca67
Author: Zheng Bao <[email protected]>
Date:   Mon Sep 24 14:05:22 2012 +0800

    AMD hudson: Round the float pointing number to integer
    
    Try
    sh> printf %d 0x005500AA | LC_ALL=C awk '{printf("%c%c%c%c", \
        $1 % 256, $1/256 % 256, $1/65536 % 256, $1/16777216);}' | \
        od -Ax -t x
    On Linux with gawk, we get
       000000 005500aa
       000004
    On FreeBSD with nongnu-awk, we get
       000000 000055aa
       000002
    
    In awk, all the numbers are floating point number. So division doesn't
    round the result from 0.75 (3/4) to 0.
    And, There is a fact that, for the FreeBSD awk,
    sh> awk 'BEGIN {printf("%c", 0.75)}';
    produces nothing, instead of 0.
    
    Here we need to convert the floating point number to
    integer by int(X), which is an awk built-in function, instead of GNU
    extension.
    
    Change-Id: I3470d5f13e7ea59a978d5575a54c0d56368dc78d
    Signed-off-by: Zheng Bao <[email protected]>
    Signed-off-by: Zheng Bao <[email protected]>
---
 src/southbridge/amd/agesa/hudson/Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc 
b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 014524d..6a47080 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -58,7 +58,7 @@ $(obj)/hudson_romsig.bin: $(call strip_quotes, 
$(CONFIG_HUDSON_XHCI_FWM_FILE)) \
                $(HUDSON_IMC_POSITION) \
                $(HUDSON_GEC_POSITION) \
                $(HUDSON_XHCI_POSITION) ; do \
-               echo  $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, 
$$1/256 % 256, $$1/65536 % 256, $$1/16777216);}'; \
+               echo  $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, 
int($$1/256) % 256, int($$1/65536) % 256, int($$1/16777216));}'; \
        done > $@
 
 ifeq ($(CONFIG_HUDSON_FWM), y)

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to