Source-Changes-HG archive

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

[src/trunk]: src/sys Allow for 'options ACPI_DEBUG' by providing module decla...



details:   https://anonhg.NetBSD.org/src/rev/ac9ca7857a60
branches:  trunk
changeset: 747460:ac9ca7857a60
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Wed Sep 16 10:47:54 2009 +0000

description:
Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.

diffstat:

 sys/arch/i386/acpi/vald_acpi.c |  21 ++++++++++++---------
 sys/arch/x86/x86/mpacpi.c      |  19 +++++++++++--------
 sys/dev/acpi/acpi.c            |  33 ++++++++++++++++++---------------
 sys/dev/acpi/acpi_bat.c        |  11 +++++++----
 sys/dev/acpi/acpi_ec.c         |  22 +++++++++++++---------
 sys/dev/acpi/acpi_pci_link.c   |  28 ++++++++++++++++------------
 sys/dev/acpi/acpi_powerres.c   |  16 ++++++++--------
 sys/dev/acpi/acpi_resource.c   |  28 ++++++++++++++--------------
 sys/dev/acpi/acpi_tz.c         |  13 ++++++++-----
 sys/dev/acpi/acpireg.h         |   3 ++-
 sys/dev/acpi/aiboost.c         |  19 +++++++++++--------
 sys/dev/acpi/asus_acpi.c       |  14 +++++++++-----
 sys/dev/acpi/dalb_acpi.c       |  16 ++++++++++------
 sys/dev/acpi/fdc_acpi.c        |  11 +++++++----
 sys/dev/acpi/sony_acpi.c       |  10 +++++++---
 15 files changed, 153 insertions(+), 111 deletions(-)

diffs (truncated from 1076 to 300 lines):

diff -r af484701f554 -r ac9ca7857a60 sys/arch/i386/acpi/vald_acpi.c
--- a/sys/arch/i386/acpi/vald_acpi.c    Wed Sep 16 10:40:02 2009 +0000
+++ b/sys/arch/i386/acpi/vald_acpi.c    Wed Sep 16 10:47:54 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vald_acpi.c,v 1.29 2008/05/04 16:16:56 xtraeme Exp $   */
+/*     $NetBSD: vald_acpi.c,v 1.30 2009/09/16 10:47:54 mlelstv Exp $   */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vald_acpi.c,v 1.29 2008/05/04 16:16:56 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vald_acpi.c,v 1.30 2009/09/16 10:47:54 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,6 +86,9 @@
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
 
+#define _COMPONENT          ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME            ("vald_acpi")
+
 #define GHCI_WORDS 6
 #define GHCI_FIFO_EMPTY  0x8c00
 #define GHCI_NOT_SUPPORT  0x8000
@@ -350,7 +353,7 @@
        ArgList.Pointer = Arg;
 
        buf.Pointer = NULL;
-       buf.Length = ACPI_ALLOCATE_BUFFER;
+       buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
        rv = AcpiEvaluateObject(sc->sc_node->ad_handle,
            "GHCI", &ArgList, &buf);
@@ -374,7 +377,7 @@
        }
 
        if (buf.Pointer)
-               AcpiOsFree(buf.Pointer);
+               ACPI_FREE(buf.Pointer);
        return (rv);
 }
 
@@ -408,7 +411,7 @@
        ArgList.Pointer = Arg;
 
        buf.Pointer = NULL;
-       buf.Length = ACPI_ALLOCATE_BUFFER;
+       buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
        rv = AcpiEvaluateObject(sc->sc_node->ad_handle,
            "GHCI", &ArgList, &buf);
@@ -427,7 +430,7 @@
        }
 
        if (buf.Pointer)
-               AcpiOsFree(buf.Pointer);
+               ACPI_FREE(buf.Pointer);
        return (rv);
 }
 
@@ -457,10 +460,10 @@
                printf("_BCL retrun: %d packages\n", param->Package.Count);
 
                sc->lcd_num = param->Package.Count;
-               sc->lcd_level = AcpiOsAllocate(sizeof(int) * sc->lcd_num);
+               sc->lcd_level = ACPI_ALLOCATE(sizeof(int) * sc->lcd_num);
                if (sc->lcd_level == NULL) {
                        if (buf.Pointer)
-                               AcpiOsFree(buf.Pointer);
+                               ACPI_FREE(buf.Pointer);
                        return (AE_NO_MEMORY);
                }
 
@@ -490,7 +493,7 @@
        }
 
        if (buf.Pointer)
-               AcpiOsFree(buf.Pointer);
+               ACPI_FREE(buf.Pointer);
        return (AE_OK);
 }
 
diff -r af484701f554 -r ac9ca7857a60 sys/arch/x86/x86/mpacpi.c
--- a/sys/arch/x86/x86/mpacpi.c Wed Sep 16 10:40:02 2009 +0000
+++ b/sys/arch/x86/x86/mpacpi.c Wed Sep 16 10:47:54 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpacpi.c,v 1.77 2009/08/18 16:41:03 jmcneill Exp $     */
+/*     $NetBSD: mpacpi.c,v 1.78 2009/09/16 10:47:54 mlelstv Exp $      */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.77 2009/08/18 16:41:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.78 2009/09/16 10:47:54 mlelstv Exp $");
 
 #include "acpica.h"
 #include "opt_acpi.h"
@@ -75,6 +75,9 @@
 
 #include <dev/cons.h>
 
+#define _COMPONENT     ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME       ("mpacpi")
+
 #include "pci.h"
 #include "ioapic.h"
 #include "lapic.h"
@@ -554,14 +557,14 @@
                /* add this device to the list only if it's active */
                if ((devinfo->Valid & ACPI_VALID_STA) == 0 ||
                    (devinfo->CurrentStatus & ACPI_STA_OK) == ACPI_STA_OK) {
-                       AcpiOsFree(devinfo);
+                       ACPI_FREE(devinfo);
                        dev = kmem_zalloc(sizeof(struct ac_dev), KM_SLEEP);
                        if (dev == NULL)
                                return -1;
                        dev->handle = current;
                        TAILQ_INSERT_HEAD(&dev_list, dev, list);
                } else
-                       AcpiOsFree(devinfo);
+                       ACPI_FREE(devinfo);
 
                rv = AcpiGetParent(current, &parent);
                if (ACPI_FAILURE(rv))
@@ -578,7 +581,7 @@
                        break;
                }
 
-               AcpiOsFree(devinfo);
+               ACPI_FREE(devinfo);
        }
 
        /*
@@ -645,7 +648,7 @@
 
        mpr = kmem_zalloc(sizeof(struct mpacpi_pcibus), KM_SLEEP);
        if (mpr == NULL) {
-               AcpiOsFree(devinfo);
+               ACPI_FREE(devinfo);
                return AE_NO_MEMORY;
        }
 
@@ -697,7 +700,7 @@
        mpacpi_npci++;
 
  out:
-       AcpiOsFree(devinfo);
+       ACPI_FREE(devinfo);
        return AE_OK;
 }
 
@@ -820,7 +823,7 @@
                mpb->mb_intrs = mpi;
        }
 
-       AcpiOsFree(mpr->mpr_buf.Pointer);
+       ACPI_FREE(mpr->mpr_buf.Pointer);
        mpr->mpr_buf.Pointer = NULL;    /* be preventive to bugs */
 
        if (mp_verbose > 1)
diff -r af484701f554 -r ac9ca7857a60 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Wed Sep 16 10:40:02 2009 +0000
+++ b/sys/dev/acpi/acpi.c       Wed Sep 16 10:47:54 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.131 2009/08/25 10:34:08 jmcneill Exp $      */
+/*     $NetBSD: acpi.c,v 1.132 2009/09/16 10:47:54 mlelstv Exp $       */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.131 2009/08/25 10:34:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.132 2009/09/16 10:47:54 mlelstv Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -94,6 +94,9 @@
 #include <dev/acpi/acpidevs_data.h>
 #endif
 
+#define _COMPONENT          ACPI_TOOLS 
+ACPI_MODULE_NAME            ("acpi")
+
 #if defined(ACPI_PCI_FIXUP)
 #error The option ACPI_PCI_FIXUP has been obsoleted by PCI_INTR_FIXUP_DISABLED.  Please adjust your kernel configuration file.
 #endif
@@ -834,7 +837,7 @@
        }
 
        (void)AcpiGetObjectInfo(handle, &newdi);
-       AcpiOsFree(*di);
+       ACPI_FREE(*di);
        *di = newdi;
 
 #ifdef ACPI_DEBUG
@@ -964,7 +967,7 @@
                            pnpstr);
 
                        buf.Pointer = NULL;
-                       buf.Length = ACPI_ALLOCATE_BUFFER;
+                       buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
                        rv = AcpiEvaluateObject(aa->aa_node->ad_handle,
                            "_STR", NULL, &buf);
                        if (ACPI_SUCCESS(rv)) {
@@ -980,7 +983,7 @@
                                        aprint_normal("type %d ",obj->Type);
                                        break;
                                }
-                               AcpiOsFree(buf.Pointer);
+                               ACPI_FREE(buf.Pointer);
                        }
 #ifdef ACPIVERBOSE
                        else {
@@ -1182,18 +1185,18 @@
                handle = ACPI_ROOT_OBJECT;
 
        buf.Pointer = NULL;
-       buf.Length = ACPI_ALLOCATE_BUFFER;
+       buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
        rv = AcpiEvaluateObjectTyped(handle, path, NULL, &buf, ACPI_TYPE_STRING);
        if (ACPI_SUCCESS(rv)) {
                ACPI_OBJECT *param = buf.Pointer;
                const char *ptr = param->String.Pointer;
                size_t len = param->String.Length;
-               if ((*stringp = AcpiOsAllocate(len)) == NULL)
+               if ((*stringp = ACPI_ALLOCATE(len)) == NULL)
                        rv = AE_NO_MEMORY;
                else
                        (void)memcpy(*stringp, ptr, len);
-               AcpiOsFree(param);
+               ACPI_FREE(param);
        }
 
        return rv;
@@ -1204,7 +1207,7 @@
  * acpi_eval_struct:
  *
  *     Evaluate a more complex structure.
- *     Caller must free buf.Pointer by AcpiOsFree().
+ *     Caller must free buf.Pointer by ACPI_FREE().
  */
 ACPI_STATUS
 acpi_eval_struct(ACPI_HANDLE handle, const char *path, ACPI_BUFFER *bufp)
@@ -1215,7 +1218,7 @@
                handle = ACPI_ROOT_OBJECT;
 
        bufp->Pointer = NULL;
-       bufp->Length = ACPI_ALLOCATE_BUFFER;
+       bufp->Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
        rv = AcpiEvaluateObject(handle, path, NULL, bufp);
 
@@ -1270,14 +1273,14 @@
  * acpi_get:
  *
  *     Fetch data info the specified (empty) ACPI buffer.
- *     Caller must free buf.Pointer by AcpiOsFree().
+ *     Caller must free buf.Pointer by ACPI_FREE().
  */
 ACPI_STATUS
 acpi_get(ACPI_HANDLE handle, ACPI_BUFFER *buf,
     ACPI_STATUS (*getit)(ACPI_HANDLE, ACPI_BUFFER *))
 {
        buf->Pointer = NULL;
-       buf->Length = ACPI_ALLOCATE_BUFFER;
+       buf->Length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
        return (*getit)(handle, buf);
 }
@@ -1342,7 +1345,7 @@
                AcpiDisableGpe(NULL, elt[0].Integer.Value, ACPI_NOT_ISR);
 
  out:
-       AcpiOsFree(buf.Pointer);
+       ACPI_FREE(buf.Pointer);
 }
 
 /*
@@ -1563,9 +1566,9 @@
 out3:
        free(bufn.Pointer, M_ACPI);
 out2:
-       AcpiOsFree(bufc.Pointer);
+       ACPI_FREE(bufc.Pointer);
 out1:
-       AcpiOsFree(bufp.Pointer);
+       ACPI_FREE(bufp.Pointer);
 out:
        return rv;
 }



Home | Main Index | Thread Index | Old Index