Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Two bug fixes:



details:   https://anonhg.NetBSD.org/src/rev/43fd524279fa
branches:  trunk
changeset: 750521:43fd524279fa
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Jan 04 09:43:30 2010 +0000

description:
Two bug fixes:

        - Use ACPI_ALL_NOTIFY instead of ACPI_DEVICE_NOTIFY.

        - Fix the data query method: this fails without input.

ok pgoyette@

diffstat:

 sys/dev/acpi/wmi_acpi.c    |  28 +++++++++++++++++-----------
 sys/dev/acpi/wmi_acpivar.h |   7 ++++---
 2 files changed, 21 insertions(+), 14 deletions(-)

diffs (110 lines):

diff -r 608d154d3744 -r 43fd524279fa sys/dev/acpi/wmi_acpi.c
--- a/sys/dev/acpi/wmi_acpi.c   Mon Jan 04 09:34:47 2010 +0000
+++ b/sys/dev/acpi/wmi_acpi.c   Mon Jan 04 09:43:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wmi_acpi.c,v 1.5 2010/01/04 09:34:47 jruoho Exp $      */
+/*     $NetBSD: wmi_acpi.c,v 1.6 2010/01/04 09:43:30 jruoho Exp $      */
 
 /*-
  * Copyright (c) 2009 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.5 2010/01/04 09:34:47 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.6 2010/01/04 09:43:30 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -391,7 +391,7 @@
        ACPI_STATUS rv;
 
        rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle,
-           ACPI_DEVICE_NOTIFY, acpi_wmi_event_handler, sc);
+           ACPI_ALL_NOTIFY, acpi_wmi_event_handler, sc);
 
        if (ACPI_FAILURE(rv)) {
                aprint_error_dev(sc->sc_dev, "failed to install notify "
@@ -429,7 +429,7 @@
        ACPI_STATUS rv;
 
        rv = AcpiRemoveNotifyHandler(sc->sc_node->ad_handle,
-           ACPI_DEVICE_NOTIFY, acpi_wmi_event_handler);
+           ACPI_ALL_NOTIFY, acpi_wmi_event_handler);
 
        if (ACPI_FAILURE(rv)) {
                aprint_debug_dev(sc->sc_dev, "failed to remove notify "
@@ -596,12 +596,15 @@
  * method for data collection will be invoked if it is available.
  */
 ACPI_STATUS
-acpi_wmi_data_query(device_t self, const char *guid, ACPI_BUFFER *obuf)
+acpi_wmi_data_query(device_t self, const char *guid,
+    uint8_t idx, ACPI_BUFFER *obuf)
 {
        struct acpi_wmi_softc *sc = device_private(self);
        struct wmi_t *wmi;
        char path[5] = "WQ";
+       ACPI_OBJECT_LIST arg;
        ACPI_STATUS rv, rvxx;
+       ACPI_OBJECT obj;
 
        rvxx = AE_SUPPORT;
 
@@ -613,14 +616,17 @@
        if (ACPI_FAILURE(rv))
                return rv;
 
-       if (!(wmi->guid.flags & ACPI_WMI_FLAG_DATA))
-               return AE_BAD_PARAMETER;
-
-       if (wmi->guid.count == 0x00 || wmi->guid.flags == 0x00)
-               return AE_BAD_VALUE;
+       if (acpi_wmi_input(wmi, ACPI_WMI_FLAG_DATA, idx) != true)
+               return AE_BAD_DATA;
 
        (void)strlcat(path, wmi->guid.oid, sizeof(path));
 
+       obj.Type = ACPI_TYPE_INTEGER;
+       obj.Integer.Value = idx;
+
+       arg.Count = 0x01;
+       arg.Pointer = &obj;
+
        obuf->Pointer = NULL;
        obuf->Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
@@ -634,7 +640,7 @@
                    wmi->guid.oid, true, true);
        }
 
-       rv = acpi_eval_struct(sc->sc_node->ad_handle, path, obuf);
+       rv = AcpiEvaluateObject(sc->sc_node->ad_handle, path, &arg, obuf);
 
        /* No longer needed. */
        if (ACPI_SUCCESS(rvxx)) {
diff -r 608d154d3744 -r 43fd524279fa sys/dev/acpi/wmi_acpivar.h
--- a/sys/dev/acpi/wmi_acpivar.h        Mon Jan 04 09:34:47 2010 +0000
+++ b/sys/dev/acpi/wmi_acpivar.h        Mon Jan 04 09:43:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wmi_acpivar.h,v 1.4 2010/01/04 09:34:47 jruoho Exp $   */
+/*     $NetBSD: wmi_acpivar.h,v 1.5 2010/01/04 09:43:30 jruoho Exp $   */
 
 /*-
  * Copyright (c) 2009 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -30,12 +30,13 @@
 #define WMI_ACPIVAR_H
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpivar.h,v 1.4 2010/01/04 09:34:47 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpivar.h,v 1.5 2010/01/04 09:43:30 jruoho Exp $");
 
 ACPI_STATUS acpi_wmi_event_register(device_t, ACPI_NOTIFY_HANDLER);
 ACPI_STATUS acpi_wmi_event_get(device_t, uint32_t, ACPI_BUFFER *);
 int         acpi_wmi_guid_match(device_t, const char *);
-ACPI_STATUS acpi_wmi_data_query(device_t, const char *, ACPI_BUFFER *);
+ACPI_STATUS acpi_wmi_data_query(device_t, const char *,
+                                uint8_t, ACPI_BUFFER *);
 ACPI_STATUS acpi_wmi_data_write(device_t, const char *,
                                 uint8_t, ACPI_BUFFER *);
 ACPI_STATUS acpi_wmi_method(device_t, const char *, uint8_t,



Home | Main Index | Thread Index | Old Index