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.
This commit is contained in:
parent
5e90e0f641
commit
3de4cab6f7
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.77 2005/12/11 12:21:01 christos Exp $");
|
||||
#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 @@ 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
|
||||
|
@ -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 @@ 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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user