From 2b87b4bb1e28e68b133067164e311e83bd9d71ed Mon Sep 17 00:00:00 2001 From: Lawrence Teo Date: Sat, 11 May 2019 19:17:57 +0000 Subject: 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@ --- usr.sbin/acpidump/acpidump.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'usr.sbin/acpidump') 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 * 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); } -- cgit v1.2.3