1 // Coreboot interface support.
3 // Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
5 // This file may be distributed under the terms of the GNU LGPLv3 license.
7 #include "config.h" // CONFIG_*
8 #include "util.h" // dprintf
9 #include "pci.h" // struct pir_header
10 #include "acpi.h" // struct rsdp_descriptor
11 #include "mptable.h" // MPTABLE_SIGNATURE
16 struct pir_header *p = pos;
17 if (p->signature != PIR_SIGNATURE)
21 if (p->size < sizeof(*p))
23 if (checksum(pos, p->size) != 0)
25 void *newpos = malloc_fseg(p->size);
30 dprintf(1, "Copying PIR from %p to %p\n", pos, newpos);
31 memcpy(newpos, pos, p->size);
32 PirOffset = (u32)newpos - BUILD_BIOS_ADDR;
36 copy_mptable(void *pos)
38 struct mptable_floating_s *p = pos;
39 if (p->signature != MPTABLE_SIGNATURE)
43 if (checksum(pos, sizeof(*p)) != 0)
45 u32 length = p->length * 16;
46 u16 mpclength = ((struct mptable_config_s *)p->physaddr)->length;
47 struct mptable_floating_s *newpos = malloc_fseg(length + mpclength);
52 dprintf(1, "Copying MPTABLE from %p/%x to %p\n", pos, p->physaddr, newpos);
53 memcpy(newpos, pos, length);
54 newpos->physaddr = (u32)newpos + length;
55 newpos->checksum -= checksum(newpos, sizeof(*newpos));
56 memcpy((void*)newpos + length, (void*)p->physaddr, mpclength);
60 copy_acpi_rsdp(void *pos)
64 struct rsdp_descriptor *p = pos;
65 if (p->signature != RSDP_SIGNATURE)
68 if (checksum(pos, length) != 0)
70 if (p->revision > 1) {
72 if (checksum(pos, length) != 0)
75 void *newpos = malloc_fseg(length);
80 dprintf(1, "Copying ACPI RSDP from %p to %p\n", pos, newpos);
81 memcpy(newpos, pos, length);