summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@openbios.org>2004-01-29 17:31:34 +0000
committerStefan Reinauer <stepan@openbios.org>2004-01-29 17:31:34 +0000
commita7648c2942448bdbb2813868ac305df24a69fcd0 (patch)
treebf664a9f8045da85d487f0e2fba2425c71504691
parentd4ece6620745bd288821d879c96be12fa5fb13ae (diff)
downloadcoreboot-a7648c2942448bdbb2813868ac305df24a69fcd0.tar.xz
acpi fixes:
* move acpi to right position * change acpi checksums * clean hpet area before creating table * calculate hpet checksum git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1364 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r--src/arch/i386/boot/acpi.c17
-rw-r--r--src/arch/i386/boot/tables.c6
2 files changed, 15 insertions, 8 deletions
diff --git a/src/arch/i386/boot/acpi.c b/src/arch/i386/boot/acpi.c
index 6afcd9c276..271de845de 100644
--- a/src/arch/i386/boot/acpi.c
+++ b/src/arch/i386/boot/acpi.c
@@ -26,7 +26,7 @@ static u8 acpi_checksum(u8 *table, u32 length)
ret += *table;
table++;
}
- return ret;
+ return -ret;
}
static void acpi_add_table(acpi_rsdt_t *rsdt, void *table)
@@ -42,7 +42,7 @@ static void acpi_add_table(acpi_rsdt_t *rsdt, void *table)
rsdt->header.checksum=acpi_checksum((u8 *)rsdt,
rsdt->header.length);
- printk_debug("ACPI: added table %d/8\n",i);
+ printk_debug("ACPI: added table %d/8\n",i+1);
return;
}
}
@@ -56,6 +56,8 @@ static void acpi_create_hpet(acpi_hpet_t *hpet)
acpi_header_t *header=&(hpet->header);
acpi_addr_t *addr=&(hpet->addr);
+ memset((void *)hpet, 0, sizeof(acpi_hpet_t));
+
/* fill out header fields */
memcpy(header->signature, HPET_NAME, 4);
memcpy(header->oem_id, OEM_ID, 6);
@@ -76,6 +78,7 @@ static void acpi_create_hpet(acpi_hpet_t *hpet)
hpet->number = 0;
hpet->min_tick = 4096;
+ header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
}
static void acpi_write_rsdt(acpi_rsdt_t *rsdt)
@@ -107,17 +110,22 @@ static void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt)
rsdp->length = sizeof(acpi_rsdp_t);
rsdp->rsdt_address = (u32)rsdt;
- rsdp->checksum = acpi_checksum((void *)rsdp, sizeof(acpi_rsdp_t));
+ rsdp->checksum = acpi_checksum((void *)rsdp, 20);
+ rsdp->ext_checksum = acpi_checksum((void *)rsdp, sizeof(acpi_rsdp_t));
}
unsigned long write_acpi_tables(unsigned long start)
{
- unsigned long current = start;
+ unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
+ /* Align ACPI tables to 16byte */
+ start = ( start + 0x0f ) & -0x10;
+ current = start;
+
printk_info("ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
@@ -141,7 +149,6 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
-
acpi_create_hpet(hpet);
acpi_add_table(rsdt,hpet);
#endif
diff --git a/src/arch/i386/boot/tables.c b/src/arch/i386/boot/tables.c
index b0fdd23105..827b46ed32 100644
--- a/src/arch/i386/boot/tables.c
+++ b/src/arch/i386/boot/tables.c
@@ -58,14 +58,14 @@ struct lb_memory *write_tables(struct mem_range *mem, unsigned long *processor_m
remove_logical_cpus(processor_map);
low_table_end = write_smp_table(low_table_end, processor_map);
+ /* Write ACPI tables */
+ low_table_end = write_acpi_tables(low_table_end);
+
/* Don't write anything in the traditional x86 BIOS data segment */
if (low_table_end < 0x500) {
low_table_end = 0x500;
}
- /* Write ACPI tables */
- low_table_end = write_acpi_tables(low_table_end);
-
/* The linuxbios table must be in 0-4K or 960K-1M */
write_linuxbios_table(processor_map, mem,
low_table_start, low_table_end,