Read in the entire RSDP but only run the standard checksum over the

version 1 header.  Add comments to explain what we're doing here better.

Reported by:	Alex Vasylenko <lxv@omut.org>
This commit is contained in:
Nate Lawson 2004-05-16 05:31:40 +00:00
parent 9049715ff9
commit 2ff84d1485
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129272

View File

@ -96,19 +96,24 @@ static struct ACPIrsdp *
acpi_get_rsdp(u_long addr)
{
struct ACPIrsdp rsdp;
size_t len;
/* Read in the table signature and check it. */
pread(acpi_mem_fd, &rsdp, 8, addr);
if (memcmp(rsdp.signature, "RSD PTR ", 8))
return (NULL);
/* Read the entire table. */
len = sizeof(rsdp);
pread(acpi_mem_fd, &rsdp, len, addr);
if (acpi_checksum(&rsdp, len))
pread(acpi_mem_fd, &rsdp, sizeof(rsdp), addr);
/* Run the checksum only over the version 1 header. */
if (acpi_checksum(&rsdp, 20))
return (NULL);
if (rsdp.revision > 0)
len = rsdp.length;
return (acpi_map_physical(addr, len));
if (rsdp.revision == 0)
return (NULL);
/* XXX Should handle ACPI 2.0 RSDP extended checksum here. */
return (acpi_map_physical(addr, rsdp.length));
}
/*