Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/usr.sbin/acpitools/acpidump Pull up following revision(s)...



details:   https://anonhg.NetBSD.org/src/rev/7292b195eea8
branches:  netbsd-8
changeset: 434418:7292b195eea8
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Nov 22 15:35:52 2017 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #377):
        usr.sbin/acpitools/acpidump/acpi_user.c: revision 1.3
  On UEFI environment, ACPI table is not at low address. Get ACPI root pointer
from hw.acpi.root first. Same as FreeBSD. This change fixes a problem that
acpidump(8) showed "acpidump: Can't find ACPI information".
XXX pullup-8

diffstat:

 usr.sbin/acpitools/acpidump/acpi_user.c |  25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diffs (56 lines):

diff -r 5fd28ebf5af3 -r 7292b195eea8 usr.sbin/acpitools/acpidump/acpi_user.c
--- a/usr.sbin/acpitools/acpidump/acpi_user.c   Wed Nov 22 15:20:15 2017 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi_user.c   Wed Nov 22 15:35:52 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_user.c,v 1.2 2009/12/22 08:44:03 cegger Exp $ */
+/* $NetBSD: acpi_user.c,v 1.2.38.1 2017/11/22 15:35:52 martin Exp $ */
 
 /*-
  * Copyright (c) 1999 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi_user.c,v 1.2 2009/12/22 08:44:03 cegger Exp $");
+__RCSID("$NetBSD: acpi_user.c,v 1.2.38.1 2017/11/22 15:35:52 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -46,6 +46,7 @@
 
 #include "acpidump.h"
 
+static char    machdep_acpi_root[] = "hw.acpi.root";
 static int      acpi_mem_fd = -1;
 
 struct acpi_user_mapping {
@@ -164,22 +165,16 @@
 ACPI_TABLE_RSDP *
 acpi_find_rsd_ptr(void)
 {
-       int i;
-       uint8_t         buf[sizeof(ACPI_TABLE_RSDP)];
+       ACPI_TABLE_RSDP *rsdp;
+       u_long          addr = 0;
+       size_t          len = sizeof(addr);
 
        acpi_user_init();
-       for (i = 0; i < 1024 * 1024; i += 16) {
-               read(acpi_mem_fd, buf, 16);
-               if (!memcmp(buf, "RSD PTR ", 8)) {
-                       /* Read the rest of the structure */
-                       read(acpi_mem_fd, buf + 16, sizeof(ACPI_TABLE_RSDP) - 16);
 
-                       /* Verify checksum before accepting it. */
-                       if (acpi_checksum(buf, sizeof(ACPI_TABLE_RSDP)))
-                               continue;
-                       return (acpi_map_physical(i, sizeof(ACPI_TABLE_RSDP)));
-               }
-       }
+       if (sysctlbyname(machdep_acpi_root, &addr, &len, NULL, 0) != 0)
+               addr = 0;
+       if (addr != 0 && (rsdp = acpi_get_rsdp(addr)) != NULL)
+               return rsdp;
 
        return acpi_scan_rsd_ptr();
 }



Home | Main Index | Thread Index | Old Index