Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Move the (one liner) logic of AcpiOsGetRootPoin...
details: https://anonhg.NetBSD.org/src/rev/3fbcd84af5a3
branches: trunk
changeset: 586275:3fbcd84af5a3
user: cube <cube%NetBSD.org@localhost>
date: Mon Dec 12 15:04:50 2005 +0000
description:
Move the (one liner) logic of AcpiOsGetRootPointer() out of acpica/Osd to
acpi.c and take the opportunity to create a sysctl node that contains the
address of the main ACPI table.
The name of the node, "machdep.acpi_root", is questionable but matches the
one FreeBSD has, which will make it easier to port their acpidump(8)
program.
diffstat:
sys/dev/acpi/acpi.c | 37 ++++++++++++++++++++++++++++++-
sys/dev/acpi/acpica/Osd/OsdEnvironment.c | 17 +++-----------
sys/dev/acpi/acpivar.h | 3 +-
3 files changed, 41 insertions(+), 16 deletions(-)
diffs (136 lines):
diff -r 899f948733b0 -r 3fbcd84af5a3 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Mon Dec 12 15:00:51 2005 +0000
+++ b/sys/dev/acpi/acpi.c Mon Dec 12 15:04:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.77 2005/12/11 12:21:01 christos Exp $ */
+/* $NetBSD: acpi.c,v 1.78 2005/12/12 15:04:50 cube Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.77 2005/12/11 12:21:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.78 2005/12/12 15:04:50 cube Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@@ -88,6 +88,7 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/proc.h>
+#include <sys/sysctl.h>
#include <dev/acpi/acpica.h>
#include <dev/acpi/acpireg.h>
@@ -148,6 +149,8 @@
static struct simplelock acpi_slock;
static int acpi_locked;
+static uint64_t acpi_root_pointer;
+
/*
* Prototypes.
*/
@@ -220,6 +223,29 @@
return 1;
}
+ACPI_STATUS
+acpi_OsGetRootPointer(UINT32 Flags, ACPI_POINTER *PhysicalAddress)
+{
+ ACPI_STATUS rv;
+
+ /*
+ * IA-32: Use AcpiFindRootPointer() to locate the RSDP.
+ *
+ * IA-64: Use the EFI.
+ *
+ * We let MD code handle this since there are multiple
+ * ways to do it.
+ */
+
+ rv = acpi_md_OsGetRootPointer(Flags, PhysicalAddress);
+
+ if (acpi_root_pointer == 0 && ACPI_SUCCESS(rv))
+ acpi_root_pointer =
+ (uint64_t)PhysicalAddress->Pointer.Physical;
+
+ return rv;
+}
+
/*
* acpi_match:
*
@@ -336,6 +362,13 @@
acpi_md_callback((struct device *)sc);
acpi_build_tree(sc);
+ if (acpi_root_pointer != 0)
+ (void)sysctl_createv(NULL, 0, NULL, NULL,
+ CTLFLAG_IMMEDIATE,
+ CTLTYPE_QUAD, "acpi_root", NULL, NULL,
+ acpi_root_pointer, NULL, 0,
+ CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+
/*
* Register a shutdown hook that disables certain ACPI
* events that might happen and confuse us while we're
diff -r 899f948733b0 -r 3fbcd84af5a3 sys/dev/acpi/acpica/Osd/OsdEnvironment.c
--- a/sys/dev/acpi/acpica/Osd/OsdEnvironment.c Mon Dec 12 15:00:51 2005 +0000
+++ b/sys/dev/acpi/acpica/Osd/OsdEnvironment.c Mon Dec 12 15:04:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: OsdEnvironment.c,v 1.5 2005/12/11 12:21:02 christos Exp $ */
+/* $NetBSD: OsdEnvironment.c,v 1.6 2005/12/12 15:04:50 cube Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -42,11 +42,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: OsdEnvironment.c,v 1.5 2005/12/11 12:21:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdEnvironment.c,v 1.6 2005/12/12 15:04:50 cube Exp $");
#include <sys/types.h>
#include <dev/acpi/acpica.h>
+#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpi_osd.h>
#include <machine/acpi_machdep.h>
@@ -102,15 +103,5 @@
ACPI_STATUS
AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *PhysicalAddress)
{
-
- /*
- * IA-32: Use AcpiFindRootPointer() to locate the RSDP.
- *
- * IA-64: Use the EFI.
- *
- * We let MD code handle this since there are multiple
- * ways to do it.
- */
-
- return acpi_md_OsGetRootPointer(Flags, PhysicalAddress);
+ return acpi_OsGetRootPointer(Flags, PhysicalAddress);
}
diff -r 899f948733b0 -r 3fbcd84af5a3 sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h Mon Dec 12 15:00:51 2005 +0000
+++ b/sys/dev/acpi/acpivar.h Mon Dec 12 15:04:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpivar.h,v 1.24 2005/12/11 12:21:02 christos Exp $ */
+/* $NetBSD: acpivar.h,v 1.25 2005/12/12 15:04:50 cube Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -258,6 +258,7 @@
extern const struct acpi_resource_parse_ops acpi_resource_parse_ops_default;
int acpi_probe(void);
+ACPI_STATUS acpi_OsGetRootPointer(UINT32, ACPI_POINTER *);
int acpi_match_hid(ACPI_DEVICE_INFO *, const char * const *);
void acpi_set_wake_gpe(ACPI_HANDLE);
Home |
Main Index |
Thread Index |
Old Index