From e10e6f849d328a47ca878b8d4428751f25508341 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 21 Jun 2008 19:46:43 -0400 Subject: [PATCH] Scan for and relocate mptable when using coreboot. --- src/acpi.h | 16 ++++++++++++++++ src/coreboot.c | 23 ++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/acpi.h b/src/acpi.h index ab1f75d..50ba135 100644 --- a/src/acpi.h +++ b/src/acpi.h @@ -8,6 +8,8 @@ void acpi_bios_init(void); // XXX - move to better header. extern int smp_cpus; +#define RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR " + struct rsdp_descriptor /* Root System Descriptor Pointer */ { u8 signature [8]; /* ACPI signature, contains "RSD PTR " */ @@ -21,4 +23,18 @@ struct rsdp_descriptor /* Root System Descriptor Pointer */ u8 reserved [3]; /* Reserved field must be 0 */ }; +// XXX - not really part of acpi. +struct mptable_floating_s { + u32 signature; + u32 physaddr; + u8 length; + u8 spec_rev; + u8 checksum; + u8 feature1; + u8 feature2; + u8 reserved[3]; +}; + +#define MPTABLE_SIGNAURE 0x5f504d5f // "_MP_" + #endif // acpi.h diff --git a/src/coreboot.c b/src/coreboot.c index 635c2f6..534a3c0 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -37,7 +37,27 @@ copy_pir(void *pos) bios_table_cur_addr += p->size; } -#define RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR " +static void +copy_mptable(void *pos) +{ + struct mptable_floating_s *p = pos; + if (p->signature != MPTABLE_SIGNAURE) + return; + if (!p->physaddr) + return; + if (checksum(pos, sizeof(*p)) != 0) + 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) { + dprintf(1, "No room to copy MPTABLE!\n"); + return; + } + dprintf(1, "Copying MPTABLE from %p to %x\n", pos, bios_table_cur_addr); + memcpy((void*)bios_table_cur_addr, pos, length); + SET_EBDA(pir_loc, bios_table_cur_addr); + bios_table_cur_addr += length; +} static void copy_acpi_rsdp(void *pos) @@ -72,6 +92,7 @@ scan_tables(u32 start, u32 size) void *end = (void*)start + size; for (; p