[coreboot] New patch to review for coreboot: 4e390b1 Change multiply ONE_MB to bit shifting.

Zheng Bao (zheng.bao@amd.com) gerrit at coreboot.org
Mon Jul 23 12:15:46 CEST 2012


Zheng Bao (zheng.bao at amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1263

-gerrit

commit 4e390b13b760ca44be993d40fc653bfcb487588c
Author: zbao <fishbaozi at gmail.com>
Date:   Mon Jul 23 19:44:29 2012 +0800

    Change multiply ONE_MB to bit shifting.
    
    2048 * ONE_MB will cause warning,
    src/northbridge/amd/agesa/family15tn/northbridge.c:667:50: warning: integer overflow in expression [-Woverflow]
    I guess it will change the data type to signed integer.
    I think the bit shifting is better.
    
    Change-Id: I823f7ead1f7d622bf653cb3bf2ae2343f5e76805
    Signed-off-by: Zheng Bao <zheng.bao at amd.com>
    Signed-off-by: zbao <fishbaozi at gmail.com>
---
 src/northbridge/amd/agesa/family15tn/northbridge.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c
index c7a87db..bc3877f 100644
--- a/src/northbridge/amd/agesa/family15tn/northbridge.c
+++ b/src/northbridge/amd/agesa/family15tn/northbridge.c
@@ -636,7 +636,7 @@ static struct hw_mem_hole_info get_hw_mem_hole_info(void)
 }
 #endif
 
-#define ONE_MB  0x100000
+#define ONE_MB_SHIFT  20
 
 void setup_uma_memory(void)
 {
@@ -663,13 +663,13 @@ void setup_uma_memory(void)
 	 *     >=1G                  256M
 	 *     <1G                    64M
 	 */
-	sys_mem = msr.lo + 16 * ONE_MB;   // Ignore 16MB allocated for C6 when finding UMA size
-	if ((msr2.hi & 0x0000000F) || (sys_mem >= 2048 * ONE_MB)) {
-		uma_memory_size = 512 * ONE_MB;
-	} else if (sys_mem >= 1024 * ONE_MB) {
-		uma_memory_size = 256 * ONE_MB;
+	sys_mem = msr.lo + (16 << ONE_MB_SHIFT);   // Ignore 16MB allocated for C6 when finding UMA size
+	if ((msr2.hi & 0x0000000F) || (sys_mem >= 2048 << ONE_MB_SHIFT)) {
+		uma_memory_size = 512 << ONE_MB_SHIFT;
+	} else if (sys_mem >= 1024 << ONE_MB_SHIFT) {
+		uma_memory_size = 256 << ONE_MB_SHIFT;
 	} else {
-		uma_memory_size = 64 * ONE_MB;
+		uma_memory_size = 64 << ONE_MB_SHIFT;
 	}
 	uma_memory_base = msr.lo - uma_memory_size; /* TOP_MEM1 */
 
@@ -678,8 +678,8 @@ void setup_uma_memory(void)
 
 	/* TODO: TOP_MEM2 */
 #else
-	uma_memory_size = 256 * ONE_MB; /* 256M recommended UMA */
-	uma_memory_base = 768 * ONE_MB; /* 1GB  system memory supported */
+	uma_memory_size = 256 << ONE_MB_SHIFT; /* 256M recommended UMA */
+	uma_memory_base = 768 << ONE_MB_SHIFT; /* 1GB  system memory supported */
 #endif
 }
 




More information about the coreboot mailing list