diff options
author | njl <njl@FreeBSD.org> | 2004-05-16 05:31:40 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-05-16 05:31:40 +0000 |
commit | 826ff6bea7dea6477b0d86591b50be84d27190c4 (patch) | |
tree | dbc07ae5ff86568ae74622b11f5d798ff4328187 /usr.sbin/acpi | |
parent | fa3c563daeb9d1d616966edd74c7b48b314129e7 (diff) | |
download | FreeBSD-src-826ff6bea7dea6477b0d86591b50be84d27190c4.zip FreeBSD-src-826ff6bea7dea6477b0d86591b50be84d27190c4.tar.gz |
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>
Diffstat (limited to 'usr.sbin/acpi')
-rw-r--r-- | usr.sbin/acpi/acpidump/acpi_user.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/acpi/acpidump/acpi_user.c b/usr.sbin/acpi/acpidump/acpi_user.c index a8e56a6..91017f1 100644 --- a/usr.sbin/acpi/acpidump/acpi_user.c +++ b/usr.sbin/acpi/acpidump/acpi_user.c @@ -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)); } /* |