Expand int155f "vgahook" detection.
[seabios.git] / src / coreboot.c
index 7d4ca835f2c90352b058bc542f577387ba2cb32b..a7604141e217d6d895a746af1adf936b6e65b732 100644 (file)
@@ -62,8 +62,7 @@ copy_mptable(void *pos)
     memcpy((void*)bios_table_cur_addr, pos, length);
     struct mptable_floating_s *newp = (void*)bios_table_cur_addr;
     newp->physaddr = bios_table_cur_addr + length;
-    newp->checksum = 0;
-    newp->checksum = -checksum(newp, sizeof(*newp));
+    newp->checksum -= checksum(newp, sizeof(*newp));
     memcpy((void*)bios_table_cur_addr + length, (void*)p->physaddr, mpclength);
     bios_table_cur_addr += length + mpclength;
 }
@@ -144,6 +143,16 @@ struct cb_memory {
 #define MEM_RANGE_COUNT(_rec) \
         (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))
 
+struct cb_mainboard {
+    u32 tag;
+    u32 size;
+    u8  vendor_idx;
+    u8  part_idx;
+    char  strings[0];
+};
+
+#define CB_TAG_MAINBOARD 0x0003
+
 struct cb_forward {
     u32 tag;
     u32 size;
@@ -261,6 +270,15 @@ coreboot_fill_map()
     // smbios/dmi table is found from coreboot and use that instead.
     smbios_init();
 
+    struct cb_mainboard *cbmb = find_cb_subtable(cbh, CB_TAG_MAINBOARD);
+    if (cbmb) {
+        const char *vendor = &cbmb->strings[cbmb->vendor_idx];
+        const char *part = &cbmb->strings[cbmb->part_idx];
+        dprintf(1, "Found mainboard %s %s\n", vendor, part);
+
+        vgahook_setup(vendor, part);
+    }
+
     return;
 
 fail:
@@ -496,7 +514,7 @@ cbfs_copy_optionrom(void *dst, u32 maxlen, u32 vendev)
 
 // Copy the next file with the given prefix - starting at pos 'last'.
 struct cbfs_file *
-cbfs_copyfile_prefix(void *dst, u32 maxlen, char *prefix
+cbfs_copyfile_prefix(void *dst, u32 maxlen, const char *prefix
                      , struct cbfs_file *last)
 {
     if (! CONFIG_COREBOOT_FLASH)