Clean up acpi table writing code, and don't rely
on a given alignment for the RSDP and RSDT - look it up instead. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4311 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
5429e26b9c
commit
bab4f92c8b
|
@ -429,9 +429,8 @@ unsigned long write_coreboot_table(
|
||||||
low_table_end);
|
low_table_end);
|
||||||
head = lb_table_init(low_table_end);
|
head = lb_table_init(low_table_end);
|
||||||
lb_forward(head, (struct lb_header*)rom_table_end);
|
lb_forward(head, (struct lb_header*)rom_table_end);
|
||||||
lb_table_fini(head, 0);
|
|
||||||
|
|
||||||
low_table_end = (unsigned long)head;
|
low_table_end = (unsigned long) lb_table_fini(head, 0);
|
||||||
printk_debug("New low_table_end: 0x%08lx\n", low_table_end);
|
printk_debug("New low_table_end: 0x%08lx\n", low_table_end);
|
||||||
printk_debug("Now going to write high coreboot table at 0x%08lx\n",
|
printk_debug("Now going to write high coreboot table at 0x%08lx\n",
|
||||||
rom_table_end);
|
rom_table_end);
|
||||||
|
|
|
@ -63,20 +63,15 @@ struct lb_memory *write_tables(void)
|
||||||
{
|
{
|
||||||
unsigned long low_table_start, low_table_end;
|
unsigned long low_table_start, low_table_end;
|
||||||
unsigned long rom_table_start, rom_table_end;
|
unsigned long rom_table_start, rom_table_end;
|
||||||
#if HAVE_MP_TABLE == 1
|
|
||||||
unsigned long new_low_table_end;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Even if high tables are configured, some tables are copied both to
|
/* Even if high tables are configured, some tables are copied both to
|
||||||
* the low and the high area, so payloads and OSes don't need to know
|
* the low and the high area, so payloads and OSes don't need to know
|
||||||
* about the high tables.
|
* about the high tables.
|
||||||
*/
|
*/
|
||||||
unsigned long high_rsdp;
|
unsigned long high_table_end=0;
|
||||||
unsigned long high_table_start=0, high_table_end=0;
|
|
||||||
|
|
||||||
if (high_tables_base) {
|
if (high_tables_base) {
|
||||||
printk_debug("High Tables Base is %llx.\n", high_tables_base);
|
printk_debug("High Tables Base is %llx.\n", high_tables_base);
|
||||||
high_table_start = high_tables_base;
|
|
||||||
high_table_end = high_tables_base;
|
high_table_end = high_tables_base;
|
||||||
} else {
|
} else {
|
||||||
printk_err("ERROR: High Tables Base is not set.\n");
|
printk_err("ERROR: High Tables Base is not set.\n");
|
||||||
|
@ -111,14 +106,22 @@ struct lb_memory *write_tables(void)
|
||||||
/* Write ACPI tables to F segment and high tables area */
|
/* Write ACPI tables to F segment and high tables area */
|
||||||
#if HAVE_ACPI_TABLES == 1
|
#if HAVE_ACPI_TABLES == 1
|
||||||
if (high_tables_base) {
|
if (high_tables_base) {
|
||||||
unsigned long rsdt_location;
|
unsigned long acpi_start = high_table_end;
|
||||||
high_rsdp = ALIGN(high_table_end, 16);
|
rom_table_end = ALIGN(rom_table_end, 16);
|
||||||
high_table_end = write_acpi_tables(high_table_end);
|
high_table_end = write_acpi_tables(high_table_end);
|
||||||
|
while (acpi_start < high_table_end) {
|
||||||
|
if (memcmp(((acpi_rsdp_t *)acpi_start)->signature, RSDP_SIG, 8) == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
acpi_start++;
|
||||||
|
}
|
||||||
|
if (acpi_start != high_table_end) {
|
||||||
|
acpi_write_rsdp((acpi_rsdp_t *)rom_table_end, ((acpi_rsdp_t *)acpi_start)->rsdt_address);
|
||||||
|
} else {
|
||||||
|
printk_err("ERROR: Didn't find RSDP in high table.\n");
|
||||||
|
}
|
||||||
high_table_end = ALIGN(high_table_end, 1024);
|
high_table_end = ALIGN(high_table_end, 1024);
|
||||||
rsdt_location = (unsigned long)(((acpi_rsdp_t*)high_rsdp)->rsdt_address);
|
rom_table_end = ALIGN(rom_table_end + sizeof(acpi_rsdp_t), 16);
|
||||||
printk_debug("high mem RSDP at %x, RSDT at %x\n", high_rsdp, rsdt_location);
|
|
||||||
acpi_write_rsdp((acpi_rsdp_t *)rom_table_end, (acpi_rsdt_t *)rsdt_location);
|
|
||||||
rom_table_end = ALIGN(ALIGN(rom_table_end, 16) + sizeof(acpi_rsdp_t), 16);
|
|
||||||
} else {
|
} else {
|
||||||
rom_table_end = write_acpi_tables(rom_table_end);
|
rom_table_end = write_acpi_tables(rom_table_end);
|
||||||
rom_table_end = ALIGN(rom_table_end, 1024);
|
rom_table_end = ALIGN(rom_table_end, 1024);
|
||||||
|
@ -164,7 +167,11 @@ struct lb_memory *write_tables(void)
|
||||||
if (high_tables_base) {
|
if (high_tables_base) {
|
||||||
/* Also put a forwarder entry into 0-4K */
|
/* Also put a forwarder entry into 0-4K */
|
||||||
write_coreboot_table(low_table_start, low_table_end,
|
write_coreboot_table(low_table_start, low_table_end,
|
||||||
high_table_start, high_table_end);
|
high_tables_base, high_table_end);
|
||||||
|
if (high_table_end > high_tables_base + high_tables_size)
|
||||||
|
printk_err("%s: High tables didn't fit in %llx (%llx)\n",
|
||||||
|
__func__, high_tables_size, high_table_end -
|
||||||
|
high_tables_base);
|
||||||
} else {
|
} else {
|
||||||
/* The coreboot table must be in 0-4K or 960K-1M */
|
/* The coreboot table must be in 0-4K or 960K-1M */
|
||||||
write_coreboot_table(low_table_start, low_table_end,
|
write_coreboot_table(low_table_start, low_table_end,
|
||||||
|
|
Loading…
Reference in New Issue