[coreboot] Patch set updated for coreboot: 250f8aa Replace UNPACK_CB64 macro with inline

Philip Prindeville (pprindeville@gmail.com) gerrit at coreboot.org
Sat Dec 24 01:45:54 CET 2011


Philip Prindeville (pprindeville at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/495

-gerrit

commit 250f8aa63a19efbeecca74d4330dd5c483c741d3
Author: Philip Prindeville <philipp at redfish-solutions.com>
Date:   Fri Dec 23 17:09:02 2011 -0700

    Replace UNPACK_CB64 macro with inline
    
    Having submitted a module based on coreboot to LKML for acceptance,
    it was requested that fewer macros and more inlines be used (because
    of their superior type-checking when performing pointer casts, etc).
    
    This is the first of several changes to make the relevant parts of
    coreboot comply to linux code standards.
    
    Change-Id: Iffe7061fa62fa639e0cb6ccb9125eb3403d06b1a
    Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 payloads/coreinfo/coreboot_module.c           |    6 +++---
 payloads/libpayload/arch/i386/coreboot.c      |    4 ++--
 payloads/libpayload/include/coreboot_tables.h |   10 +++++++---
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c
index dd589ac..5d13128 100644
--- a/payloads/coreinfo/coreboot_module.c
+++ b/payloads/coreinfo/coreboot_module.c
@@ -112,9 +112,9 @@ int coreboot_module_redraw(WINDOW *win)
 		}
 
 		wprintw(win, "%16.16llx - %16.16llx",
-			UNPACK_CB64(cb_info.range[i].start),
-			UNPACK_CB64(cb_info.range[i].start) +
-			UNPACK_CB64(cb_info.range[i].size) - 1);
+			cb_unpack64(cb_info.range[i].start),
+			cb_unpack64(cb_info.range[i].start) +
+			cb_unpack64(cb_info.range[i].size) - 1);
 	}
 
 	return 0;
diff --git a/payloads/libpayload/arch/i386/coreboot.c b/payloads/libpayload/arch/i386/coreboot.c
index 365445e..a77144b 100644
--- a/payloads/libpayload/arch/i386/coreboot.c
+++ b/payloads/libpayload/arch/i386/coreboot.c
@@ -63,10 +63,10 @@ static void cb_parse_memory(unsigned char *ptr, struct sysinfo_t *info)
 #endif
 
 		info->memrange[info->n_memranges].base =
-		    UNPACK_CB64(range->start);
+		    cb_unpack64(range->start);
 
 		info->memrange[info->n_memranges].size =
-		    UNPACK_CB64(range->size);
+		    cb_unpack64(range->size);
 
 		info->memrange[info->n_memranges].type = range->type;
 
diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h
index d342c99..3b3b7d2 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -216,6 +216,13 @@ struct	cb_cmos_checksum {
 	u32 type;
 };
 
+/* Helpful inlines */
+
+static inline u64 cb_unpack64(struct cbuint64 val)
+{
+	return (((u64) val.hi) << 32) | val.lo;
+}
+
 /* Helpful macros */
 
 #define MEM_RANGE_COUNT(_rec) \
@@ -231,7 +238,4 @@ struct	cb_cmos_checksum {
 #define MB_PART_STRING(_mb) \
 	(((unsigned char *) ((_mb)->strings)) + (_mb)->part_number_idx)
 
-#define UNPACK_CB64(_in) \
-	( (((u64) _in.hi) << 32) | _in.lo )
-
 #endif




More information about the coreboot mailing list