Copy mptable floater and config tables when on coreboot.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 28 Feb 2009 02:04:09 +0000 (21:04 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 28 Feb 2009 02:04:09 +0000 (21:04 -0500)
Linux kernels don't like the mp config table being in high memory - so
    copy it to low memory during scan.

src/coreboot.c

index 62f8ff67b7cbc4ebe1e35861bd188e7941a1eb19..7b8c86f1168021d24237930a6dc9a7a05e537247 100644 (file)
@@ -51,13 +51,20 @@ copy_mptable(void *pos)
         return;
     u32 length = p->length * 16;
     bios_table_cur_addr = ALIGN(bios_table_cur_addr, 16);
-    if (bios_table_cur_addr + length > bios_table_end_addr) {
+    u16 mpclength = ((struct mptable_config_s *)p->physaddr)->length;
+    if (bios_table_cur_addr + length + mpclength > bios_table_end_addr) {
         dprintf(1, "No room to copy MPTABLE!\n");
         return;
     }
-    dprintf(1, "Copying MPTABLE from %p to %x\n", pos, bios_table_cur_addr);
+    dprintf(1, "Copying MPTABLE from %p/%x to %x\n"
+            , pos, p->physaddr, bios_table_cur_addr);
     memcpy((void*)bios_table_cur_addr, pos, length);
-    bios_table_cur_addr += 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));
+    memcpy((void*)bios_table_cur_addr + length, (void*)p->physaddr, mpclength);
+    bios_table_cur_addr += length + mpclength;
 }
 
 static void