summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorDaniel Dickman <daniel@cvs.openbsd.org>2014-06-08 17:53:15 +0000
committerDaniel Dickman <daniel@cvs.openbsd.org>2014-06-08 17:53:15 +0000
commit0c33dd63e43ac6016924f418ae487d25401d5645 (patch)
tree9805423821c468931b7da344182caf047ca5cff4 /sys/arch/amd64
parent50b213c5632e77774c90cae9f727806221745661 (diff)
check both rsdp checksums in the case of rsdp revision >= 2.
ok mlarkin@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 540469e52d5..215dc23ab4f 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.60 2014/04/25 14:37:06 mlarkin Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.61 2014/06/08 17:53:14 daniel Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -106,22 +106,23 @@ acpi_scan(struct acpi_mem_map *handle, paddr_t pa, size_t len)
if (acpi_map(pa, len, handle))
return (NULL);
- for (ptr = handle->va, i = 0;
- i < len;
- ptr += 16, i += 16)
- if (memcmp(ptr, RSDP_SIG, sizeof(RSDP_SIG) - 1) == 0) {
- rsdp = (struct acpi_rsdp1 *)ptr;
- /*
- * Only checksum whichever portion of the
- * RSDP that is actually present
- */
- if (rsdp->revision == 0 &&
- acpi_checksum(ptr, sizeof(struct acpi_rsdp1)) == 0)
- return (ptr);
- else if (rsdp->revision >= 2 && rsdp->revision <= 4 &&
- acpi_checksum(ptr, sizeof(struct acpi_rsdp)) == 0)
+ for (ptr = handle->va, i = 0; i < len; ptr += 16, i += 16) {
+ /* is there a valid signature? */
+ if (memcmp(ptr, RSDP_SIG, sizeof(RSDP_SIG) - 1))
+ continue;
+
+ /* is the checksum valid? */
+ if (acpi_checksum(ptr, sizeof(struct acpi_rsdp1)) != 0)
+ continue;
+
+ /* check the extended checksum as needed */
+ rsdp = (struct acpi_rsdp1 *)ptr;
+ if (rsdp->revision == 0)
+ return (ptr);
+ else if (rsdp->revision >= 2 && rsdp->revision <= 4)
+ if (acpi_checksum(ptr, sizeof(struct acpi_rsdp)) == 0)
return (ptr);
- }
+ }
acpi_unmap(handle);
return (NULL);