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

-gerrit

commit a1ce169728cbae26db404959bc35f4779604d7ad
Author: Philip Prindeville <[email protected]>
Date:   Sat Dec 24 22:12:37 2011 -0700

    Cleanup access to vendor/part # info
    
    Instead of macros to access MAINBOARD record, use convenience functions.
    
    Store pointers to MAINBOARD and HEADER for use outside of CB code.
    
    Change-Id: I074e3a0df7d25726cbd942538bfdc5a63dd17e12
    Signed-off-by: Philip Prindeville <[email protected]>
---
 payloads/coreinfo/coreboot_module.c           |    4 ++--
 payloads/libpayload/arch/i386/coreboot.c      |    5 +++++
 payloads/libpayload/include/coreboot_tables.h |   16 ++++++++++------
 payloads/libpayload/include/sysinfo.h         |    3 +++
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/payloads/coreinfo/coreboot_module.c 
b/payloads/coreinfo/coreboot_module.c
index 7289366..d33ea9e 100644
--- a/payloads/coreinfo/coreboot_module.c
+++ b/payloads/coreinfo/coreboot_module.c
@@ -142,8 +142,8 @@ static void parse_mainboard(unsigned char *ptr)
 {
        struct cb_mainboard *mb = (struct cb_mainboard *)ptr;
 
-       strncpy(cb_info.vendor, (const char *)MB_VENDOR_STRING(mb), 31);
-       strncpy(cb_info.part, (const char *)MB_PART_STRING(mb), 31);
+       strncpy(cb_info.vendor, cb_mb_vendor_part(mb), 31);
+       strncpy(cb_info.part, cb_mb_part_string(mb), 31);
 }
 
 static void parse_strings(unsigned char *ptr)
diff --git a/payloads/libpayload/arch/i386/coreboot.c 
b/payloads/libpayload/arch/i386/coreboot.c
index 135c59c..7fe286e 100644
--- a/payloads/libpayload/arch/i386/coreboot.c
+++ b/payloads/libpayload/arch/i386/coreboot.c
@@ -137,6 +137,8 @@ static int cb_parse_header(void *addr, void *end, struct 
sysinfo_t *info)
                     header->table_bytes) != header->table_checksum)
                return -1;
 
+       info->header = header;
+
        /* Now, walk the tables. */
        ptr += header->header_bytes;
 
@@ -173,6 +175,9 @@ static int cb_parse_header(void *addr, void *end, struct 
sysinfo_t *info)
                        cb_parse_framebuffer(ptr, info);
                        break;
 #endif
+               case CB_TAG_MAINBOARD:
+                       info->mainboard = (struct cb_mainboard *)ptr;
+                       break;
                }
 
                ptr += rec->size;
diff --git a/payloads/libpayload/include/coreboot_tables.h 
b/payloads/libpayload/include/coreboot_tables.h
index e362d06..c68ccc9 100644
--- a/payloads/libpayload/include/coreboot_tables.h
+++ b/payloads/libpayload/include/coreboot_tables.h
@@ -228,6 +228,16 @@ static inline u16 cb_checksum(const void *ptr, unsigned 
len)
        return ipchksum(ptr, len);
 }
 
+static inline const char *cb_mb_vendor_string(const struct cb_mainboard *cbm)
+{
+       return (char *)(cbm->strings + cbm->vendor_idx);
+}
+
+static inline const char *cb_mb_part_string(const struct cb_mainboard *cbm)
+{
+       return (char *)(cbm->strings + cbm->part_number_idx);
+}
+
 /* Helpful macros */
 
 #define MEM_RANGE_COUNT(_rec) \
@@ -237,10 +247,4 @@ static inline u16 cb_checksum(const void *ptr, unsigned 
len)
        (void *)(((u8 *) (_rec)) + sizeof(*(_rec)) \
                + (sizeof((_rec)->map[0]) * (_idx)))
 
-#define MB_VENDOR_STRING(_mb) \
-       (((unsigned char *) ((_mb)->strings)) + (_mb)->vendor_idx)
-
-#define MB_PART_STRING(_mb) \
-       (((unsigned char *) ((_mb)->strings)) + (_mb)->part_number_idx)
-
 #endif
diff --git a/payloads/libpayload/include/sysinfo.h 
b/payloads/libpayload/include/sysinfo.h
index c1d2002..778dfe9 100644
--- a/payloads/libpayload/include/sysinfo.h
+++ b/payloads/libpayload/include/sysinfo.h
@@ -56,6 +56,9 @@ struct sysinfo_t {
        struct cb_framebuffer *framebuffer;
 
        unsigned long *mbtable; /** Pointer to the multiboot table */
+
+       struct cb_header *header;
+       struct cb_mainboard *mainboard;
 };
 
 extern struct sysinfo_t lib_sysinfo;

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

Reply via email to