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;
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