// 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 " */
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
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)
void *end = (void*)start + size;
for (; p<end; p += 16) {
copy_pir(p);
+ copy_mptable(p);
copy_acpi_rsdp(p);
}
}