Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/acpitools/acpidump On UEFI environment, ACPI table ...
details: https://anonhg.NetBSD.org/src/rev/a842d28aac62
branches: trunk
changeset: 825862:a842d28aac62
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu Aug 03 05:54:45 2017 +0000
description:
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 e41c6ad27e72 -r a842d28aac62 usr.sbin/acpitools/acpidump/acpi_user.c
--- a/usr.sbin/acpitools/acpidump/acpi_user.c Thu Aug 03 04:42:26 2017 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi_user.c Thu Aug 03 05:54:45 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.3 2017/08/03 05:54:45 msaitoh 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.3 2017/08/03 05:54:45 msaitoh 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