Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Merge changes for ACPI-CA 20050408



details:   https://anonhg.NetBSD.org/src/rev/ca44a0c5dd9f
branches:  trunk
changeset: 580650:ca44a0c5dd9f
user:      kochi <kochi%NetBSD.org@localhost>
date:      Mon May 02 14:53:04 2005 +0000

description:
Merge changes for ACPI-CA 20050408

diffstat:

 sys/dev/acpi/acpi.c                    |  34 ++++++++++++++++++++-
 sys/dev/acpi/acpi_button.c             |   6 ++-
 sys/dev/acpi/acpi_ec.c                 |  52 +++++++++++++++++++++++++++------
 sys/dev/acpi/acpi_lid.c                |   6 ++-
 sys/dev/acpi/acpi_tz.c                 |   6 +-
 sys/dev/acpi/acpica/Osd/OsdInterrupt.c |  11 +++---
 sys/dev/acpi/acpica/Osd/OsdSchedule.c  |  33 ++++++++++++++++++---
 sys/dev/acpi/acpivar.h                 |   3 +-
 8 files changed, 121 insertions(+), 30 deletions(-)

diffs (truncated from 390 to 300 lines):

diff -r 936bbc32b30a -r ca44a0c5dd9f sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Mon May 02 14:52:09 2005 +0000
+++ b/sys/dev/acpi/acpi.c       Mon May 02 14:53:04 2005 +0000
@@ -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 @@
        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.
diff -r 936bbc32b30a -r ca44a0c5dd9f sys/dev/acpi/acpi_button.c
--- a/sys/dev/acpi/acpi_button.c        Mon May 02 14:52:09 2005 +0000
+++ b/sys/dev/acpi/acpi_button.c        Mon May 02 14:53:04 2005 +0000
@@ -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 @@
                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;
diff -r 936bbc32b30a -r ca44a0c5dd9f sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c    Mon May 02 14:52:09 2005 +0000
+++ b/sys/dev/acpi/acpi_ec.c    Mon May 02 14:53:04 2005 +0000
@@ -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 @@
        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 @@
                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 @@
         * 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 @@
        return_VOID;
 }
 
-static void
+static UINT32
 EcGpeHandler(void *Context)
 {
        struct acpi_ec_softc *sc = Context;
@@ -716,6 +746,8 @@
                        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
diff -r 936bbc32b30a -r ca44a0c5dd9f sys/dev/acpi/acpi_lid.c
--- a/sys/dev/acpi/acpi_lid.c   Mon May 02 14:52:09 2005 +0000
+++ b/sys/dev/acpi/acpi_lid.c   Mon May 02 14:53:04 2005 +0000
@@ -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 @@
                    sc->sc_dev.dv_xname, AcpiFormatException(rv));
                return;
        }
+
+       acpi_set_wake_gpe(sc->sc_node->ad_handle);
 }
 
 /*
diff -r 936bbc32b30a -r ca44a0c5dd9f sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c    Mon May 02 14:52:09 2005 +0000
+++ b/sys/dev/acpi/acpi_tz.c    Mon May 02 14:53:04 2005 +0000
@@ -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@localhost>
@@ -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 @@
 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;
 
diff -r 936bbc32b30a -r ca44a0c5dd9f sys/dev/acpi/acpica/Osd/OsdInterrupt.c
--- a/sys/dev/acpi/acpica/Osd/OsdInterrupt.c    Mon May 02 14:52:09 2005 +0000
+++ b/sys/dev/acpi/acpica/Osd/OsdInterrupt.c    Mon May 02 14:53:04 2005 +0000
@@ -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 @@
 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 @@
  */
 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 @@
  *     Remove an interrupt handler.
  */
 ACPI_STATUS
-AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine)
+AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber,
+    ACPI_OSD_HANDLER ServiceRoutine)
 {



Home | Main Index | Thread Index | Old Index