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
This commit is contained in:
Stefan Reinauer 2004-01-29 17:31:34 +00:00
parent d4ece66207
commit a7648c2942
2 changed files with 15 additions and 8 deletions

View File

@ -26,7 +26,7 @@ static u8 acpi_checksum(u8 *table, u32 length)
ret += *table; ret += *table;
table++; table++;
} }
return ret; return -ret;
} }
static void acpi_add_table(acpi_rsdt_t *rsdt, void *table) 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.checksum=acpi_checksum((u8 *)rsdt,
rsdt->header.length); rsdt->header.length);
printk_debug("ACPI: added table %d/8\n",i); printk_debug("ACPI: added table %d/8\n",i+1);
return; return;
} }
} }
@ -56,6 +56,8 @@ static void acpi_create_hpet(acpi_hpet_t *hpet)
acpi_header_t *header=&(hpet->header); acpi_header_t *header=&(hpet->header);
acpi_addr_t *addr=&(hpet->addr); acpi_addr_t *addr=&(hpet->addr);
memset((void *)hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */ /* fill out header fields */
memcpy(header->signature, HPET_NAME, 4); memcpy(header->signature, HPET_NAME, 4);
memcpy(header->oem_id, OEM_ID, 6); memcpy(header->oem_id, OEM_ID, 6);
@ -76,6 +78,7 @@ static void acpi_create_hpet(acpi_hpet_t *hpet)
hpet->number = 0; hpet->number = 0;
hpet->min_tick = 4096; hpet->min_tick = 4096;
header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
} }
static void acpi_write_rsdt(acpi_rsdt_t *rsdt) 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->length = sizeof(acpi_rsdp_t);
rsdp->rsdt_address = (u32)rsdt; 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 write_acpi_tables(unsigned long start)
{ {
unsigned long current = start; unsigned long current;
acpi_rsdp_t *rsdp; acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt; acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet; 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); printk_info("ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */ /* 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; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdt,hpet); acpi_add_table(rsdt,hpet);
#endif #endif

View File

@ -58,14 +58,14 @@ struct lb_memory *write_tables(struct mem_range *mem, unsigned long *processor_m
remove_logical_cpus(processor_map); remove_logical_cpus(processor_map);
low_table_end = write_smp_table(low_table_end, 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 */ /* Don't write anything in the traditional x86 BIOS data segment */
if (low_table_end < 0x500) { if (low_table_end < 0x500) {
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 */ /* The linuxbios table must be in 0-4K or 960K-1M */
write_linuxbios_table(processor_map, mem, write_linuxbios_table(processor_map, mem,
low_table_start, low_table_end, low_table_start, low_table_end,