Module Name: src
Committed By: pgoyette
Date: Mon May 31 20:32:29 UTC 2010
Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/dev/acpi: acpi.c acpivar.h files.acpi
src/sys/dev/acpi/wmi: files.wmi wmi_acpi.c wmi_acpivar.h
src/sys/modules: Makefile
Added Files:
src/distrib/sets/lists/modules: md.ia64
src/sys/dev/acpi: acpi_verbose.c
src/sys/dev/acpi/wmi: wmi_dump.c
src/sys/modules/acpiverbose: Makefile
Log Message:
Extract ACPIVERBOSE into a kernel module. The module can be builtin
by defining 'options ACPIVERBOSE' in the kernel config file (no change
from current behavior), or it can be loaded at boot time on those
architectures that support the boot loader's "load" command.
ACPIVERBOSE also includes code to dump acpi/wmi data.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/modules/md.ia64
cvs rdiff -u -r1.196 -r1.197 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_verbose.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/acpi/acpivar.h
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/acpi/files.acpi
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/wmi/files.wmi
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/wmi/wmi_acpi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/wmi/wmi_acpivar.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/wmi/wmi_dump.c
cvs rdiff -u -r1.45 -r1.46 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/acpiverbose/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.2 src/distrib/sets/lists/modules/md.amd64:1.3
--- src/distrib/sets/lists/modules/md.amd64:1.2 Fri Apr 9 13:49:12 2010
+++ src/distrib/sets/lists/modules/md.amd64 Mon May 31 20:32:28 2010
@@ -1,4 +1,6 @@
-# $NetBSD: md.amd64,v 1.2 2010/04/09 13:49:12 ahoka Exp $
+# $NetBSD: md.amd64,v 1.3 2010/05/31 20:32:28 pgoyette Exp $
+./@MODULEDIR@/acpiverbose base-kernel-modules kmod
+./@MODULEDIR@/acpiverbose/acpiverbose.kmod base-kernel-modules kmod
./@MODULEDIR@/azalia base-kernel-modules kmod
./@MODULEDIR@/azalia/azalia.kmod base-kernel-modules kmod
./@MODULEDIR@/compat_linux base-kernel-modules kmod
Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.3 src/distrib/sets/lists/modules/md.i386:1.4
--- src/distrib/sets/lists/modules/md.i386:1.3 Fri Apr 9 13:49:12 2010
+++ src/distrib/sets/lists/modules/md.i386 Mon May 31 20:32:28 2010
@@ -1,4 +1,6 @@
-# $NetBSD: md.i386,v 1.3 2010/04/09 13:49:12 ahoka Exp $
+# $NetBSD: md.i386,v 1.4 2010/05/31 20:32:28 pgoyette Exp $
+./@MODULEDIR@/acpiverbose base-kernel-modules kmod
+./@MODULEDIR@/acpiverbose/acpiverbose.kmod base-kernel-modules kmod
./@MODULEDIR@/azalia base-kernel-modules kmod
./@MODULEDIR@/azalia/azalia.kmod base-kernel-modules kmod
./@MODULEDIR@/compat_freebsd base-kernel-modules kmod
Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.196 src/sys/dev/acpi/acpi.c:1.197
--- src/sys/dev/acpi/acpi.c:1.196 Sun May 23 22:05:54 2010
+++ src/sys/dev/acpi/acpi.c Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.196 2010/05/23 22:05:54 christos Exp $ */
+/* $NetBSD: acpi.c,v 1.197 2010/05/31 20:32:29 pgoyette Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.196 2010/05/23 22:05:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.197 2010/05/31 20:32:29 pgoyette Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@@ -74,6 +74,7 @@
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -86,10 +87,6 @@
#include <dev/acpi/acpi_timer.h>
#include <dev/acpi/acpi_wakedev.h>
-#ifdef ACPIVERBOSE
-#include <dev/acpi/acpidevs_data.h>
-#endif
-
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME ("acpi")
@@ -186,11 +183,6 @@
static void acpi_rescan_capabilities(struct acpi_softc *);
static int acpi_print(void *aux, const char *);
-#ifdef ACPIVERBOSE
-static void acpi_print_devnodes(struct acpi_softc *);
-static void acpi_print_tree(struct acpi_devnode *, uint32_t);
-#endif
-
static void acpi_notify_handler(ACPI_HANDLE, uint32_t, void *);
static void acpi_register_fixed_button(struct acpi_softc *, int);
@@ -210,6 +202,41 @@
extern struct cfdriver acpi_cd;
+/* Handle routine vectors and loading for acpiverbose module */
+void acpi_verbose_ctl(bool load);
+void acpi_null(void);
+
+void (*acpi_print_devnodes)(struct acpi_softc *) = (void *)acpi_null;
+void (*acpi_print_tree)(struct acpi_devnode *, uint32_t) = (void *)acpi_null;
+void (*acpi_print_dev)(const char *) = (void *)acpi_null;
+void (*acpi_wmidump)(void *) = (void *)acpi_null;
+
+/* acpiverbose support */
+void
+acpi_null(void)
+{
+ /* Nothing to do */
+}
+
+void
+acpi_verbose_ctl(bool load)
+{
+ static int loaded = 0;
+
+ if (load) {
+ if (loaded++ == 0)
+ if (module_load("acpiverbose", MODCTL_LOAD_FORCE,
+ NULL, MODULE_CLASS_MISC) != 0)
+ loaded = 0;
+ return;
+ }
+ if (loaded == 0)
+ return;
+ if (--loaded == 0)
+ module_unload("acpiverbose");
+}
+
+
CFATTACH_DECL2_NEW(acpi, sizeof(struct acpi_softc),
acpi_match, acpi_attach, acpi_detach, NULL, acpi_rescan, acpi_childdet);
@@ -374,6 +401,8 @@
if (acpi_softc != NULL)
panic("%s: already attached", __func__);
+ acpi_verbose_ctl(true);
+
rsdt = acpi_map_rsdt();
if (rsdt == NULL)
@@ -538,6 +567,8 @@
acpi_softc = NULL;
+ acpi_verbose_ctl(false);
+
return 0;
}
@@ -623,11 +654,8 @@
(void)acpi_pcidev_scan(sc->sc_root);
-#ifdef ACPIVERBOSE
acpi_print_devnodes(sc);
- aprint_normal("\n");
acpi_print_tree(sc->sc_root, 0);
-#endif
}
static ACPI_STATUS
@@ -1049,21 +1077,9 @@
}
ACPI_FREE(buf.Pointer);
}
-#ifdef ACPIVERBOSE
- else {
- int i;
+ else
+ acpi_print_dev(pnpstr);
- for (i = 0; i < __arraycount(acpi_knowndevs);
- i++) {
- if (strcmp(acpi_knowndevs[i].pnp,
- pnpstr) == 0) {
- aprint_normal("[%s] ",
- acpi_knowndevs[i].str);
- }
- }
- }
-
-#endif
aprint_normal("at %s", pnp);
} else if (aa->aa_node->ad_devinfo->Type != ACPI_TYPE_DEVICE) {
aprint_normal("%s (ACPI Object Type '%s' "
@@ -1092,74 +1108,6 @@
return UNCONF;
}
-#ifdef ACPIVERBOSE
-static void
-acpi_print_devnodes(struct acpi_softc *sc)
-{
- struct acpi_devnode *ad;
- ACPI_DEVICE_INFO *di;
-
- SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
-
- di = ad->ad_devinfo;
- aprint_normal_dev(sc->sc_dev, "%-5s ", ad->ad_name);
-
- aprint_normal("HID %-10s ",
- ((di->Valid & ACPI_VALID_HID) != 0) ?
- di->HardwareId.String: "-");
-
- aprint_normal("UID %-4s ",
- ((di->Valid & ACPI_VALID_UID) != 0) ?
- di->UniqueId.String : "-");
-
- if ((di->Valid & ACPI_VALID_STA) != 0)
- aprint_normal("STA 0x%08X ", di->CurrentStatus);
- else
- aprint_normal("STA %10s ", "-");
-
- if ((di->Valid & ACPI_VALID_ADR) != 0)
- aprint_normal("ADR 0x%016" PRIX64"", di->Address);
- else
- aprint_normal("ADR -");
-
- aprint_normal("\n");
- }
-}
-
-static void
-acpi_print_tree(struct acpi_devnode *ad, uint32_t level)
-{
- struct acpi_devnode *child;
- uint32_t i;
-
- for (i = 0; i < level; i++)
- aprint_normal(" ");
-
- aprint_normal("%-5s [%02u] [%c%c] ", ad->ad_name, ad->ad_type,
- ((ad->ad_flags & ACPI_DEVICE_POWER) != 0) ? 'P' : ' ',
- ((ad->ad_flags & ACPI_DEVICE_WAKEUP) != 0) ? 'W' : ' ');
-
- if (ad->ad_pciinfo != NULL) {
-
- aprint_normal("(PCI) @ 0x%02X:0x%02X:0x%02X:0x%02X ",
- ad->ad_pciinfo->ap_segment, ad->ad_pciinfo->ap_bus,
- ad->ad_pciinfo->ap_device, ad->ad_pciinfo->ap_function);
-
- if ((ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0)
- aprint_normal("[R] ");
-
- if (ad->ad_pciinfo->ap_bridge != false)
- aprint_normal("[B] -> 0x%02X",
- ad->ad_pciinfo->ap_downbus);
- }
-
- aprint_normal("\n");
-
- SIMPLEQ_FOREACH(child, &ad->ad_child_head, ad_child_list)
- acpi_print_tree(child, level + 1);
-}
-#endif
-
/*
* Notify.
*/
Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.53 src/sys/dev/acpi/acpivar.h:1.54
--- src/sys/dev/acpi/acpivar.h:1.53 Tue Apr 27 08:37:07 2010
+++ src/sys/dev/acpi/acpivar.h Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpivar.h,v 1.53 2010/04/27 08:37:07 jruoho Exp $ */
+/* $NetBSD: acpivar.h,v 1.54 2010/05/31 20:32:29 pgoyette Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -319,4 +319,14 @@
void acpi_debug_init(void);
#endif
+/* Misc routines with vectors updated by acpiverbose module */
+extern void (*acpi_print_devnodes)(struct acpi_softc *);
+extern void (*acpi_print_tree)(struct acpi_devnode *, uint32_t);
+extern void (*acpi_print_dev)(const char *);
+extern void (*acpi_wmidump)(void *);
+
+void acpi_wmidump_real(void *);
+
+void acpi_null(void);
+
#endif /* !_SYS_DEV_ACPI_ACPIVAR_H */
Index: src/sys/dev/acpi/files.acpi
diff -u src/sys/dev/acpi/files.acpi:1.74 src/sys/dev/acpi/files.acpi:1.75
--- src/sys/dev/acpi/files.acpi:1.74 Thu Apr 22 18:40:09 2010
+++ src/sys/dev/acpi/files.acpi Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-# $NetBSD: files.acpi,v 1.74 2010/04/22 18:40:09 jruoho Exp $
+# $NetBSD: files.acpi,v 1.75 2010/05/31 20:32:29 pgoyette Exp $
include "dev/acpi/acpica/files.acpica"
@@ -25,6 +25,7 @@
file dev/acpi/acpi_timer.c acpi
file dev/acpi/acpi_util.c acpi
file dev/acpi/acpi_wakedev.c acpi
+file dev/acpi/acpi_verbose.c acpi & acpiverbose
# ACPI/apm emulation.
attach apm at acpiapmbus with acpiapm: sysmon_envsys
Index: src/sys/dev/acpi/wmi/files.wmi
diff -u src/sys/dev/acpi/wmi/files.wmi:1.3 src/sys/dev/acpi/wmi/files.wmi:1.4
--- src/sys/dev/acpi/wmi/files.wmi:1.3 Thu Apr 8 17:32:30 2010
+++ src/sys/dev/acpi/wmi/files.wmi Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-# $NetBSD: files.wmi,v 1.3 2010/04/08 17:32:30 jruoho Exp $
+# $NetBSD: files.wmi,v 1.4 2010/05/31 20:32:29 pgoyette Exp $
define acpiwmibus { }
@@ -6,6 +6,7 @@
device acpiwmi: acpiwmibus
attach acpiwmi at acpinodebus
file dev/acpi/wmi/wmi_acpi.c acpiwmi
+file dev/acpi/wmi/wmi_dump.c acpwmi & acpiverbose
# Dell WMI mappings
device wmidell: sysmon_power
Index: src/sys/dev/acpi/wmi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi/wmi_acpi.c:1.4 src/sys/dev/acpi/wmi/wmi_acpi.c:1.5
--- src/sys/dev/acpi/wmi/wmi_acpi.c:1.4 Thu Apr 15 07:02:24 2010
+++ src/sys/dev/acpi/wmi/wmi_acpi.c Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_acpi.c,v 1.4 2010/04/15 07:02:24 jruoho Exp $ */
+/* $NetBSD: wmi_acpi.c,v 1.5 2010/05/31 20:32:29 pgoyette Exp $ */
/*-
* Copyright (c) 2009, 2010 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.4 2010/04/15 07:02:24 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.5 2010/05/31 20:32:29 pgoyette Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -50,70 +50,6 @@
*
* (Obtained on Thu Feb 12 18:21:44 EET 2009.)
*/
-struct guid_t {
-
- /*
- * The GUID itself. The used format is the usual 32-16-16-64-bit
- * representation. All except the fourth field are in native byte
- * order. A 32-16-16-16-48-bit hexadecimal notation with hyphens
- * is used for human-readable GUIDs.
- */
- struct {
- uint32_t data1;
- uint16_t data2;
- uint16_t data3;
- uint8_t data4[8];
- } __packed;
-
- union {
- char oid[2]; /* ACPI object ID. */
-
- struct {
- uint8_t nid; /* Notification value. */
- uint8_t res; /* Reserved. */
- } __packed;
- } __packed;
-
- uint8_t count; /* Number of instances. */
- uint8_t flags; /* Additional flags. */
-
-} __packed;
-
-struct wmi_t {
- struct guid_t guid;
- bool eevent;
-
- SIMPLEQ_ENTRY(wmi_t) wmi_link;
-};
-
-struct acpi_wmi_softc {
- device_t sc_dev;
- device_t sc_child;
- ACPI_NOTIFY_HANDLER sc_handler;
- struct acpi_devnode *sc_node;
-
- SIMPLEQ_HEAD(, wmi_t) wmi_head;
-};
-
-#define ACPI_WMI_FLAG_EXPENSIVE 0x01
-#define ACPI_WMI_FLAG_METHOD 0x02
-#define ACPI_WMI_FLAG_STRING 0x04
-#define ACPI_WMI_FLAG_EVENT 0x08
-#define ACPI_WMI_FLAG_DATA (ACPI_WMI_FLAG_EXPENSIVE | \
- ACPI_WMI_FLAG_STRING)
-
-#define UGET16(x) (*(uint16_t *)(x))
-#define UGET64(x) (*(uint64_t *)(x))
-
-#define HEXCHAR(x) (((x) >= '0' && (x) <= '9') || \
- ((x) >= 'a' && (x) <= 'f') || \
- ((x) >= 'A' && (x) <= 'F'))
-
-#define GUIDCMP(a, b) \
- ((a)->data1 == (b)->data1 && \
- (a)->data2 == (b)->data2 && \
- (a)->data3 == (b)->data3 && \
- UGET64((a)->data4) == UGET64((b)->data4))
static int acpi_wmi_match(device_t, cfdata_t, void *);
static void acpi_wmi_attach(device_t, device_t, void *);
@@ -123,10 +59,6 @@
static bool acpi_wmi_add(struct acpi_wmi_softc *, ACPI_OBJECT *);
static void acpi_wmi_del(struct acpi_wmi_softc *);
-#ifdef ACPIVERBOSE
-static void acpi_wmi_dump(struct acpi_wmi_softc *);
-#endif
-
static ACPI_STATUS acpi_wmi_guid_get(struct acpi_wmi_softc *,
const char *, struct wmi_t **);
static void acpi_wmi_event_add(struct acpi_wmi_softc *);
@@ -174,9 +106,7 @@
if (acpi_wmi_init(sc) != true)
return;
-#ifdef ACPIVERBOSE
- acpi_wmi_dump(sc);
-#endif
+ acpi_wmidump(sc);
acpi_wmi_event_add(sc);
@@ -313,31 +243,6 @@
}
}
-#ifdef ACPIVERBOSE
-static void
-acpi_wmi_dump(struct acpi_wmi_softc *sc)
-{
- struct wmi_t *wmi;
-
- KASSERT(SIMPLEQ_EMPTY(&sc->wmi_head) == 0);
-
- SIMPLEQ_FOREACH(wmi, &sc->wmi_head, wmi_link) {
-
- aprint_normal_dev(sc->sc_dev, "{%08X-%04X-%04X-",
- wmi->guid.data1, wmi->guid.data2, wmi->guid.data3);
-
- aprint_normal("%02X%02X-%02X%02X%02X%02X%02X%02X} ",
- wmi->guid.data4[0], wmi->guid.data4[1],
- wmi->guid.data4[2], wmi->guid.data4[3],
- wmi->guid.data4[4], wmi->guid.data4[5],
- wmi->guid.data4[6], wmi->guid.data4[7]);
-
- aprint_normal("oid %04X count %02X flags %02X\n",
- UGET16(wmi->guid.oid), wmi->guid.count, wmi->guid.flags);
- }
-}
-#endif
-
static ACPI_STATUS
acpi_wmi_guid_get(struct acpi_wmi_softc *sc,
const char *src, struct wmi_t **out)
Index: src/sys/dev/acpi/wmi/wmi_acpivar.h
diff -u src/sys/dev/acpi/wmi/wmi_acpivar.h:1.2 src/sys/dev/acpi/wmi/wmi_acpivar.h:1.3
--- src/sys/dev/acpi/wmi/wmi_acpivar.h:1.2 Thu Apr 8 12:36:21 2010
+++ src/sys/dev/acpi/wmi/wmi_acpivar.h Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_acpivar.h,v 1.2 2010/04/08 12:36:21 jruoho Exp $ */
+/* $NetBSD: wmi_acpivar.h,v 1.3 2010/05/31 20:32:29 pgoyette Exp $ */
/*-
* Copyright (c) 2009, 2010 Jukka Ruohonen <[email protected]>
@@ -31,7 +31,7 @@
#define _SYS_DEV_ACPI_WMI_WMI_ACPIVAR_H
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpivar.h,v 1.2 2010/04/08 12:36:21 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpivar.h,v 1.3 2010/05/31 20:32:29 pgoyette Exp $");
ACPI_STATUS acpi_wmi_event_register(device_t, ACPI_NOTIFY_HANDLER);
ACPI_STATUS acpi_wmi_event_deregister(device_t);
@@ -47,4 +47,69 @@
ACPI_STATUS acpi_wmi_method(device_t, const char *, uint8_t,
uint32_t, ACPI_BUFFER *, ACPI_BUFFER *);
+struct guid_t {
+
+ /*
+ * The GUID itself. The used format is the usual 32-16-16-64-bit
+ * representation. All except the fourth field are in native byte
+ * order. A 32-16-16-16-48-bit hexadecimal notation with hyphens
+ * is used for human-readable GUIDs.
+ */
+ struct {
+ uint32_t data1;
+ uint16_t data2;
+ uint16_t data3;
+ uint8_t data4[8];
+ } __packed;
+
+ union {
+ char oid[2]; /* ACPI object ID. */
+
+ struct {
+ uint8_t nid; /* Notification value. */
+ uint8_t res; /* Reserved. */
+ } __packed;
+ } __packed;
+
+ uint8_t count; /* Number of instances. */
+ uint8_t flags; /* Additional flags. */
+
+} __packed;
+
+#define ACPI_WMI_FLAG_EXPENSIVE 0x01
+#define ACPI_WMI_FLAG_METHOD 0x02
+#define ACPI_WMI_FLAG_STRING 0x04
+#define ACPI_WMI_FLAG_EVENT 0x08
+#define ACPI_WMI_FLAG_DATA (ACPI_WMI_FLAG_EXPENSIVE | \
+ ACPI_WMI_FLAG_STRING)
+
+struct wmi_t {
+ struct guid_t guid;
+ bool eevent;
+
+ SIMPLEQ_ENTRY(wmi_t) wmi_link;
+};
+
+struct acpi_wmi_softc {
+ device_t sc_dev;
+ device_t sc_child;
+ ACPI_NOTIFY_HANDLER sc_handler;
+ struct acpi_devnode *sc_node;
+
+ SIMPLEQ_HEAD(, wmi_t) wmi_head;
+};
+
+#define UGET16(x) (*(uint16_t *)(x))
+#define UGET64(x) (*(uint64_t *)(x))
+
+#define HEXCHAR(x) (((x) >= '0' && (x) <= '9') || \
+ ((x) >= 'a' && (x) <= 'f') || \
+ ((x) >= 'A' && (x) <= 'F'))
+
+#define GUIDCMP(a, b) \
+ ((a)->data1 == (b)->data1 && \
+ (a)->data2 == (b)->data2 && \
+ (a)->data3 == (b)->data3 && \
+ UGET64((a)->data4) == UGET64((b)->data4))
+
#endif /* !_SYS_DEV_ACPI_WMI_WMI_ACPIVAR_H */
Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.45 src/sys/modules/Makefile:1.46
--- src/sys/modules/Makefile:1.45 Sun May 30 17:44:07 2010
+++ src/sys/modules/Makefile Mon May 31 20:32:29 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.45 2010/05/30 17:44:07 pgoyette Exp $
+# $NetBSD: Makefile,v 1.46 2010/05/31 20:32:29 pgoyette Exp $
.include <bsd.own.mk>
@@ -83,6 +83,12 @@
SUBDIR+= tprof_pmi
.endif
+.if ${MACHINE_ARCH} == "i386" || \
+ ${MACHINE_ARCH} == "ia64" || \
+ ${MACHINE_ARCH} == "x86_64"
+SUBDIR+= acpiverbose
+.endif
+
.if ${MACHINE_ARCH} == "x86_64"
SUBDIR+= azalia
SUBDIR+= compat_linux
Added files:
Index: src/distrib/sets/lists/modules/md.ia64
diff -u /dev/null src/distrib/sets/lists/modules/md.ia64:1.1
--- /dev/null Mon May 31 20:32:29 2010
+++ src/distrib/sets/lists/modules/md.ia64 Mon May 31 20:32:28 2010
@@ -0,0 +1,3 @@
+# $NetBSD: md.ia64,v 1.1 2010/05/31 20:32:28 pgoyette Exp $
+./@MODULEDIR@/acpiverbose base-kernel-modules kmod
+./@MODULEDIR@/acpiverbose/acpiverbose.kmod base-kernel-modules kmod
Index: src/sys/dev/acpi/acpi_verbose.c
diff -u /dev/null src/sys/dev/acpi/acpi_verbose.c:1.1
--- /dev/null Mon May 31 20:32:29 2010
+++ src/sys/dev/acpi/acpi_verbose.c Mon May 31 20:32:29 2010
@@ -0,0 +1,185 @@
+/* $NetBSD: acpi_verbose.c,v 1.1 2010/05/31 20:32:29 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum of By Noon Software, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright 2001, 2003 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.1 2010/05/31 20:32:29 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpidevs_data.h>
+
+void acpi_print_devnodes_real(struct acpi_softc *);
+void acpi_print_tree_real(struct acpi_devnode *, uint32_t);
+void acpi_print_dev_real(const char *);
+
+MODULE(MODULE_CLASS_MISC, acpiverbose, NULL);
+
+__weak_alias(acpi_wmidump_real, acpi_null);
+
+static int
+acpiverbose_modcmd(modcmd_t cmd, void *arg)
+{
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ acpi_print_devnodes = acpi_print_devnodes_real;
+ acpi_print_tree = acpi_print_tree_real;
+ acpi_print_dev = acpi_print_dev_real;
+ acpi_wmidump = acpi_wmidump_real;
+ return 0;
+ case MODULE_CMD_FINI:
+ acpi_print_devnodes = (void *)acpi_null;
+ acpi_print_tree = (void *)acpi_null;
+ acpi_print_dev = (void *)acpi_null;
+ acpi_wmidump = (void *)acpi_null;
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
+
+void
+acpi_print_devnodes_real(struct acpi_softc *sc)
+{
+ struct acpi_devnode *ad;
+ ACPI_DEVICE_INFO *di;
+
+ SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
+
+ di = ad->ad_devinfo;
+ aprint_normal_dev(sc->sc_dev, "%-5s ", ad->ad_name);
+
+ aprint_normal("HID %-10s ",
+ ((di->Valid & ACPI_VALID_HID) != 0) ?
+ di->HardwareId.String: "-");
+
+ aprint_normal("UID %-4s ",
+ ((di->Valid & ACPI_VALID_UID) != 0) ?
+ di->UniqueId.String : "-");
+
+ if ((di->Valid & ACPI_VALID_STA) != 0)
+ aprint_normal("STA 0x%08X ", di->CurrentStatus);
+ else
+ aprint_normal("STA %10s ", "-");
+
+ if ((di->Valid & ACPI_VALID_ADR) != 0)
+ aprint_normal("ADR 0x%016" PRIX64"", di->Address);
+ else
+ aprint_normal("ADR -");
+
+ aprint_normal("\n");
+ }
+ aprint_normal("\n");
+}
+
+void
+acpi_print_tree_real(struct acpi_devnode *ad, uint32_t level)
+{
+ struct acpi_devnode *child;
+ uint32_t i;
+
+ for (i = 0; i < level; i++)
+ aprint_normal(" ");
+
+ aprint_normal("%-5s [%02u] [%c%c] ", ad->ad_name, ad->ad_type,
+ ((ad->ad_flags & ACPI_DEVICE_POWER) != 0) ? 'P' : ' ',
+ ((ad->ad_flags & ACPI_DEVICE_WAKEUP) != 0) ? 'W' : ' ');
+
+ if (ad->ad_pciinfo != NULL) {
+
+ aprint_normal("(PCI) @ 0x%02X:0x%02X:0x%02X:0x%02X ",
+ ad->ad_pciinfo->ap_segment, ad->ad_pciinfo->ap_bus,
+ ad->ad_pciinfo->ap_device, ad->ad_pciinfo->ap_function);
+
+ if ((ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0)
+ aprint_normal("[R] ");
+
+ if (ad->ad_pciinfo->ap_bridge != false)
+ aprint_normal("[B] -> 0x%02X",
+ ad->ad_pciinfo->ap_downbus);
+ }
+
+ aprint_normal("\n");
+
+ SIMPLEQ_FOREACH(child, &ad->ad_child_head, ad_child_list)
+ acpi_print_tree(child, level + 1);
+}
+
+void acpi_print_dev_real(const char *pnpstr)
+{
+ int i;
+
+ for (i = 0; i < __arraycount(acpi_knowndevs); i++) {
+ if (strcmp(acpi_knowndevs[i].pnp, pnpstr) == 0) {
+ aprint_normal("[%s] ", acpi_knowndevs[i].str);
+ }
+ }
+}
Index: src/sys/dev/acpi/wmi/wmi_dump.c
diff -u /dev/null src/sys/dev/acpi/wmi/wmi_dump.c:1.1
--- /dev/null Mon May 31 20:32:29 2010
+++ src/sys/dev/acpi/wmi/wmi_dump.c Mon May 31 20:32:29 2010
@@ -0,0 +1,64 @@
+/* $NetBSD: wmi_dump.c,v 1.1 2010/05/31 20:32:29 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2009, 2010 Jukka Ruohonen <[email protected]>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: wmi_dump.c,v 1.1 2010/05/31 20:32:29 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/endian.h>
+#include <sys/kmem.h>
+#include <sys/systm.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/wmi/wmi_acpivar.h>
+
+void
+acpi_wmidump_real(void *arg)
+{
+ struct wmi_t *wmi;
+ struct acpi_wmi_softc *sc = (struct acpi_wmi_softc *)arg;
+
+ KASSERT(SIMPLEQ_EMPTY(&sc->wmi_head) == 0);
+
+ SIMPLEQ_FOREACH(wmi, &sc->wmi_head, wmi_link) {
+
+ aprint_normal_dev(sc->sc_dev, "{%08X-%04X-%04X-",
+ wmi->guid.data1, wmi->guid.data2, wmi->guid.data3);
+
+ aprint_normal("%02X%02X-%02X%02X%02X%02X%02X%02X} ",
+ wmi->guid.data4[0], wmi->guid.data4[1],
+ wmi->guid.data4[2], wmi->guid.data4[3],
+ wmi->guid.data4[4], wmi->guid.data4[5],
+ wmi->guid.data4[6], wmi->guid.data4[7]);
+
+ aprint_normal("oid %04X count %02X flags %02X\n",
+ UGET16(wmi->guid.oid), wmi->guid.count, wmi->guid.flags);
+ }
+}
Index: src/sys/modules/acpiverbose/Makefile
diff -u /dev/null src/sys/modules/acpiverbose/Makefile:1.1
--- /dev/null Mon May 31 20:32:29 2010
+++ src/sys/modules/acpiverbose/Makefile Mon May 31 20:32:29 2010
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2010/05/31 20:32:29 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+KMOD= acpiverbose
+
+.PATH: ${S}/dev/acpi
+SRCS= acpi_verbose.c
+
+.PATH: ${S}/dev/acpi/wmi
+SRCS+= wmi_dump.c
+
+.include <bsd.kmodule.mk>