Cleanup access to vendor/part # info
[coreboot.git] / payloads / libpayload / arch / i386 / coreboot.c
index 3c99c4fde089ee8f60527616db8707683ba81c91..06acc17b1d244d0bd4713515bc173a61fc1edd62 100644 (file)
@@ -113,6 +113,7 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 {
        struct cb_header *header;
        unsigned char *ptr = addr;
+       void *forward;
        int i;
 
        for (i = 0; i < len; i += 16, ptr += 16) {
@@ -136,6 +137,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                     header->table_bytes) != header->table_checksum)
                return -1;
 
+       info->header = header;
+
        /* Now, walk the tables. */
        ptr += header->header_bytes;
 
@@ -145,7 +148,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                /* We only care about a few tags here (maybe more later). */
                switch (rec->tag) {
                case CB_TAG_FORWARD:
-                       return cb_parse_header((void *)(unsigned long)((struct cb_forward *)rec)->forward, len, info);
+                       forward = phys_to_virt((void *)(unsigned long)((struct cb_forward *)rec)->forward);
+                       return cb_parse_header(forward, len, info);
                        continue;
                case CB_TAG_MEMORY:
                        cb_parse_memory(ptr, info);
@@ -171,6 +175,9 @@ static int cb_parse_header(void *addr, int len, 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;