summaryrefslogtreecommitdiff
path: root/usr.sbin/acpidump
diff options
context:
space:
mode:
authorLawrence Teo <lteo@cvs.openbsd.org>2019-05-11 19:17:57 +0000
committerLawrence Teo <lteo@cvs.openbsd.org>2019-05-11 19:17:57 +0000
commit2b87b4bb1e28e68b133067164e311e83bd9d71ed (patch)
treed405570795bf2b1f759c7116225d135d8239a928 /usr.sbin/acpidump
parent7df3af1c0416b3acb35b1064f98d7697da6767c2 (diff)
Make acpidump match the kernel's acpi_loadtables() behavior by
preferring XSDT over RSDT. Thanks to kettenis@ who pointed out the mismatch. ok guenther@ kettenis@
Diffstat (limited to 'usr.sbin/acpidump')
-rw-r--r--usr.sbin/acpidump/acpidump.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/acpidump/acpidump.c b/usr.sbin/acpidump/acpidump.c
index 18c0e6d1382..ff10d766445 100644
--- a/usr.sbin/acpidump/acpidump.c
+++ b/usr.sbin/acpidump/acpidump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpidump.c,v 1.22 2019/01/12 17:01:31 kettenis Exp $ */
+/* $OpenBSD: acpidump.c,v 1.23 2019/05/11 19:17:56 lteo Exp $ */
/*
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* All rights reserved.
@@ -640,21 +640,23 @@ asl_dump_from_devmem(void)
err(1, "asl_dump_from_devmem");
acpi_print_rsd_ptr(rp);
- if (rp->addr != 0) {
- rsdp = (struct ACPIsdt *) acpi_map_sdt(rp->addr);
- if (memcmp(rsdp->signature, "RSDT", 4) ||
- acpi_checksum(rsdp, rsdp->len))
- errx(1, "RSDT is corrupted");
- acpi_handle_rsdt(rsdp);
- } else {
+ if (rp->rev == 2 && rp->xaddr) {
rsdp = (struct ACPIsdt *) acpi_map_sdt(rp->xaddr);
if (memcmp(rsdp->signature, "XSDT", 4) ||
acpi_checksum(rsdp, rsdp->len))
errx(1, "XSDT is corrupted");
acpi_handle_xsdt(rsdp);
- }
+ } else if (rp->addr) {
+ rsdp = (struct ACPIsdt *) acpi_map_sdt(rp->addr);
+ if (memcmp(rsdp->signature, "RSDT", 4) ||
+ acpi_checksum(rsdp, rsdp->len))
+ errx(1, "RSDT is corrupted");
+
+ acpi_handle_rsdt(rsdp);
+ } else
+ errx(1, "XSDT or RSDT not found");
fclose(fhdr);
}