Merge changes for ACPI-CA 20050408
This commit is contained in:
parent
57d7792cce
commit
a7c9d49c21
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi.c,v 1.68 2005/02/27 00:26:58 perry Exp $ */
|
||||
/* $NetBSD: acpi.c,v 1.69 2005/05/02 14:53:59 kochi Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -77,7 +77,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.68 2005/02/27 00:26:58 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.69 2005/05/02 14:53:59 kochi Exp $");
|
||||
|
||||
#include "opt_acpi.h"
|
||||
|
||||
|
@ -949,6 +949,36 @@ acpi_match_hid(ACPI_DEVICE_INFO *ad, const char * const *ids)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* acpi_set_wake_gpe
|
||||
*
|
||||
* Set GPE as both Runtime and Wake
|
||||
*/
|
||||
void
|
||||
acpi_set_wake_gpe(ACPI_HANDLE handle)
|
||||
{
|
||||
ACPI_BUFFER buf;
|
||||
ACPI_STATUS rv;
|
||||
ACPI_OBJECT *p, *elt;
|
||||
|
||||
rv = acpi_eval_struct(handle, METHOD_NAME__PRW, &buf);
|
||||
if (ACPI_FAILURE(rv))
|
||||
return; /* just ignore */
|
||||
|
||||
p = buf.Pointer;
|
||||
if (p->Type != ACPI_TYPE_PACKAGE || p->Package.Count < 2)
|
||||
goto out; /* just ignore */
|
||||
|
||||
elt = p->Package.Elements;
|
||||
|
||||
/* TBD: package support */
|
||||
AcpiSetGpeType(NULL, elt[0].Integer.Value, ACPI_GPE_TYPE_WAKE_RUN);
|
||||
AcpiEnableGpe(NULL, elt[0].Integer.Value, ACPI_NOT_ISR);
|
||||
|
||||
out:
|
||||
AcpiOsFree(buf.Pointer);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* ACPI sleep support.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi_button.c,v 1.16 2004/05/01 12:03:48 kochi Exp $ */
|
||||
/* $NetBSD: acpi_button.c,v 1.17 2005/05/02 14:54:00 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001, 2003 Wasabi Systems, Inc.
|
||||
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_button.c,v 1.16 2004/05/01 12:03:48 kochi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_button.c,v 1.17 2005/05/02 14:54:00 kochi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -146,6 +146,8 @@ acpibut_attach(struct device *parent, struct device *self, void *aux)
|
|||
return;
|
||||
}
|
||||
|
||||
acpi_set_wake_gpe(sc->sc_node->ad_handle);
|
||||
|
||||
#ifdef ACPI_BUT_DEBUG
|
||||
/* Display the current state when it changes. */
|
||||
sc->sc_flags = ACPIBUT_F_VERBOSE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi_ec.c,v 1.32 2004/06/25 11:15:15 yamt Exp $ */
|
||||
/* $NetBSD: acpi_ec.c,v 1.33 2005/05/02 14:54:00 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
|
@ -172,7 +172,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.32 2004/06/25 11:15:15 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.33 2005/05/02 14:54:00 kochi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -246,7 +246,7 @@ typedef struct {
|
|||
UINT8 Data;
|
||||
} EC_REQUEST;
|
||||
|
||||
static void EcGpeHandler(void *Context);
|
||||
static UINT32 EcGpeHandler(void *Context);
|
||||
static ACPI_STATUS EcSpaceSetup(ACPI_HANDLE Region, UINT32 Function,
|
||||
void *Context, void **return_Context);
|
||||
static ACPI_STATUS EcSpaceHandler(UINT32 Function,
|
||||
|
@ -426,14 +426,27 @@ acpiec_early_attach(struct device *parent)
|
|||
ecdt_sc->sc_glk = 1;
|
||||
|
||||
rv = AcpiInstallGpeHandler(NULL, ecdt_sc->sc_gpebit,
|
||||
ACPI_EVENT_EDGE_TRIGGERED, EcGpeHandler, ecdt_sc);
|
||||
ACPI_GPE_EDGE_TRIGGERED, EcGpeHandler, ecdt_sc);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to install GPE handler: %s\n",
|
||||
parent->dv_xname,
|
||||
AcpiFormatException(rv));
|
||||
parent->dv_xname, AcpiFormatException(rv));
|
||||
goto out3;
|
||||
}
|
||||
|
||||
rv = AcpiSetGpeType(NULL, ecdt_sc->sc_gpebit, ACPI_GPE_TYPE_RUNTIME);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to set GPE type: %s\n",
|
||||
parent->dv_xname, AcpiFormatException(rv));
|
||||
goto out4;
|
||||
}
|
||||
|
||||
rv = AcpiEnableGpe(NULL, ecdt_sc->sc_gpebit, ACPI_NOT_ISR);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to enable GPE: %s\n",
|
||||
parent->dv_xname, AcpiFormatException(rv));
|
||||
goto out4;
|
||||
}
|
||||
|
||||
rv = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT,
|
||||
ACPI_ADR_SPACE_EC, EcSpaceHandler, EcSpaceSetup, ecdt_sc);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
|
@ -592,23 +605,40 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
|
|||
* cleared before re-enabling the GPE.
|
||||
*/
|
||||
rv = AcpiInstallGpeHandler(NULL, sc->sc_gpebit,
|
||||
ACPI_EVENT_EDGE_TRIGGERED, EcGpeHandler, sc);
|
||||
ACPI_GPE_EDGE_TRIGGERED, EcGpeHandler, sc);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to install GPE handler: %s\n",
|
||||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
goto out;
|
||||
}
|
||||
|
||||
rv = AcpiSetGpeType(NULL, sc->sc_gpebit, ACPI_GPE_TYPE_RUNTIME);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to set GPE type: %s\n",
|
||||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
goto out2;
|
||||
}
|
||||
|
||||
rv = AcpiEnableGpe(NULL, sc->sc_gpebit, ACPI_NOT_ISR);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to enable GPE: %s\n",
|
||||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
goto out2;
|
||||
}
|
||||
|
||||
/* Install address space handler. */
|
||||
rv = AcpiInstallAddressSpaceHandler(sc->sc_handle,
|
||||
ACPI_ADR_SPACE_EC, EcSpaceHandler, EcSpaceSetup, sc);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
printf("%s: unable to install address space handler: %s\n",
|
||||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
(void)AcpiRemoveGpeHandler(NULL, sc->sc_gpebit,
|
||||
EcGpeHandler);
|
||||
goto out2;
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
out2:
|
||||
(void)AcpiRemoveGpeHandler(NULL, sc->sc_gpebit, EcGpeHandler);
|
||||
|
||||
out:
|
||||
acpi_resource_cleanup(&res);
|
||||
return_VOID;
|
||||
|
@ -685,7 +715,7 @@ EcGpeQueryHandler(void *Context)
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
static void
|
||||
static UINT32
|
||||
EcGpeHandler(void *Context)
|
||||
{
|
||||
struct acpi_ec_softc *sc = Context;
|
||||
|
@ -716,6 +746,8 @@ EcGpeHandler(void *Context)
|
|||
printf("%s: failed to enqueue query handler: %s\n",
|
||||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
}
|
||||
|
||||
return 0; /* XXX not yet used in ACPI-CA */
|
||||
}
|
||||
|
||||
static ACPI_STATUS
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi_lid.c,v 1.15 2004/05/01 12:03:48 kochi Exp $ */
|
||||
/* $NetBSD: acpi_lid.c,v 1.16 2005/05/02 14:54:00 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001, 2003 Wasabi Systems, Inc.
|
||||
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.15 2004/05/01 12:03:48 kochi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.16 2005/05/02 14:54:00 kochi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -119,6 +119,8 @@ acpilid_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
return;
|
||||
}
|
||||
|
||||
acpi_set_wake_gpe(sc->sc_node->ad_handle);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi_tz.c,v 1.14 2004/06/06 17:27:05 martin Exp $ */
|
||||
/* $NetBSD: acpi_tz.c,v 1.15 2005/05/02 14:54:00 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.14 2004/06/06 17:27:05 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.15 2005/05/02 14:54:00 kochi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -508,7 +508,7 @@ static void
|
|||
acpitz_notify_handler(ACPI_HANDLE hdl, UINT32 notify, void *opaque)
|
||||
{
|
||||
struct acpitz_softc *sc = opaque;
|
||||
OSD_EXECUTION_CALLBACK func = NULL;
|
||||
ACPI_OSD_EXEC_CALLBACK func = NULL;
|
||||
const char *name;
|
||||
int rv;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: OsdInterrupt.c,v 1.5 2004/05/01 12:03:27 kochi Exp $ */
|
||||
/* $NetBSD: OsdInterrupt.c,v 1.6 2005/05/02 14:53:04 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: OsdInterrupt.c,v 1.5 2004/05/01 12:03:27 kochi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: OsdInterrupt.c,v 1.6 2005/05/02 14:53:04 kochi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@ -68,7 +68,7 @@ MALLOC_DEFINE(M_ACPI, "acpi", "Advanced Configuration and Power Interface");
|
|||
struct acpi_interrupt_handler {
|
||||
LIST_ENTRY(acpi_interrupt_handler) aih_list;
|
||||
UINT32 aih_intrnum;
|
||||
OSD_HANDLER aih_func;
|
||||
ACPI_OSD_HANDLER aih_func;
|
||||
void *aih_ih;
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ do { \
|
|||
*/
|
||||
ACPI_STATUS
|
||||
AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
|
||||
OSD_HANDLER ServiceRoutine, void *Context)
|
||||
ACPI_OSD_HANDLER ServiceRoutine, void *Context)
|
||||
{
|
||||
struct acpi_interrupt_handler *aih;
|
||||
ACPI_STATUS rv;
|
||||
|
@ -133,7 +133,8 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
|
|||
* Remove an interrupt handler.
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine)
|
||||
AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber,
|
||||
ACPI_OSD_HANDLER ServiceRoutine)
|
||||
{
|
||||
struct acpi_interrupt_handler *aih;
|
||||
int s;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: OsdSchedule.c,v 1.10 2003/08/15 17:07:04 kochi Exp $ */
|
||||
/* $NetBSD: OsdSchedule.c,v 1.11 2005/05/02 14:53:04 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.10 2003/08/15 17:07:04 kochi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.11 2005/05/02 14:53:04 kochi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@ -114,7 +114,7 @@ AcpiOsGetThreadId(void)
|
|||
* Schedule a procedure for deferred execution.
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function,
|
||||
AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function,
|
||||
void *Context)
|
||||
{
|
||||
int pri;
|
||||
|
@ -160,13 +160,13 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function,
|
|||
* Suspend the running task (coarse granularity).
|
||||
*/
|
||||
void
|
||||
AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds)
|
||||
AcpiOsSleep(ACPI_INTEGER Milliseconds)
|
||||
{
|
||||
int timo;
|
||||
|
||||
ACPI_FUNCTION_TRACE(__FUNCTION__);
|
||||
|
||||
timo = Seconds * hz + Milliseconds * hz / 1000;
|
||||
timo = Milliseconds * hz / 1000;
|
||||
if (timo == 0)
|
||||
timo = 1;
|
||||
|
||||
|
@ -200,4 +200,27 @@ AcpiOsStall(UINT32 Microseconds)
|
|||
delay(Microseconds);
|
||||
|
||||
return_VOID;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* AcpiOsStall:
|
||||
*
|
||||
* Get the current system time in 100 nanosecond units
|
||||
*/
|
||||
UINT64
|
||||
AcpiOsGetTimer(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
UINT64 t;
|
||||
|
||||
/* XXX During early boot there is no (decent) timer available yet. */
|
||||
if (cold)
|
||||
panic("acpi: timer op not yet supported during boot");
|
||||
|
||||
microtime(&tv);
|
||||
t = (UINT64)10 * tv.tv_usec;
|
||||
t += (UINT64)10000000 * tv.tv_sec;
|
||||
|
||||
return (t);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpivar.h,v 1.20 2004/05/26 17:15:17 kochi Exp $ */
|
||||
/* $NetBSD: acpivar.h,v 1.21 2005/05/02 14:54:00 kochi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
|
@ -260,6 +260,7 @@ extern const struct acpi_resource_parse_ops acpi_resource_parse_ops_default;
|
|||
|
||||
int acpi_probe(void);
|
||||
int acpi_match_hid(ACPI_DEVICE_INFO *, const char * const *);
|
||||
void acpi_set_wake_gpe(ACPI_HANDLE);
|
||||
|
||||
ACPI_STATUS acpi_eval_integer(ACPI_HANDLE, char *, ACPI_INTEGER *);
|
||||
ACPI_STATUS acpi_eval_string(ACPI_HANDLE, char *, char **);
|
||||
|
|
Loading…
Reference in New Issue