summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/acpi/acpidump/acpi_user.c19
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));
}
/*
OpenPOWER on IntegriCloud