diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 86ca73b0599b..1dd3ae571f82 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -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 -__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 @@ __KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.77 2005/12/11 12:21:01 christos Exp $"); #include #include #include +#include #include #include @@ -148,6 +149,8 @@ struct acpi_softc *acpi_softc; static struct simplelock acpi_slock; static int acpi_locked; +static uint64_t acpi_root_pointer; + /* * Prototypes. */ @@ -220,6 +223,29 @@ acpi_probe(void) 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_attach(struct device *parent, struct device *self, void *aux) 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 --git a/sys/dev/acpi/acpica/Osd/OsdEnvironment.c b/sys/dev/acpi/acpica/Osd/OsdEnvironment.c index cae16d9485e3..bc431c2a4475 100644 --- a/sys/dev/acpi/acpica/Osd/OsdEnvironment.c +++ b/sys/dev/acpi/acpica/Osd/OsdEnvironment.c @@ -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 -__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 #include +#include #include #include @@ -102,15 +103,5 @@ AcpiOsTerminate(void) 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 --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 5ee40fe87f1a..ea07e9397e64 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -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 int acpi_active; 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);