Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Simplify the acpiverbose module.
details: https://anonhg.NetBSD.org/src/rev/0ecb701e6b12
branches: trunk
changeset: 756880:0ecb701e6b12
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Aug 06 23:38:34 2010 +0000
description:
Simplify the acpiverbose module.
diffstat:
sys/dev/acpi/acpi.c | 112 ++++++++++++++++++++-----------------------
sys/dev/acpi/acpi_verbose.c | 65 ++++++++++++++-----------
sys/dev/acpi/acpivar.h | 7 +-
3 files changed, 89 insertions(+), 95 deletions(-)
diffs (truncated from 307 to 300 lines):
diff -r fbd70acc2feb -r 0ecb701e6b12 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Fri Aug 06 22:45:00 2010 +0000
+++ b/sys/dev/acpi/acpi.c Fri Aug 06 23:38:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.210 2010/08/06 22:45:00 jruoho Exp $ */
+/* $NetBSD: acpi.c,v 1.211 2010/08/06 23:38:34 jruoho 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.210 2010/08/06 22:45:00 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.211 2010/08/06 23:38:34 jruoho Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@@ -121,11 +121,13 @@
int acpi_active;
int acpi_force_load;
int acpi_suspended = 0;
+int acpi_verbose_loaded = 0;
-struct acpi_softc *acpi_softc;
-static uint64_t acpi_root_pointer;
-extern kmutex_t acpi_interrupt_list_mtx;
-static ACPI_HANDLE acpi_scopes[4];
+struct acpi_softc *acpi_softc;
+static uint64_t acpi_root_pointer;
+extern kmutex_t acpi_interrupt_list_mtx;
+extern struct cfdriver acpi_cd;
+static ACPI_HANDLE acpi_scopes[4];
/*
* This structure provides a context for the ACPI
@@ -197,57 +199,11 @@
static ACPI_TABLE_HEADER *acpi_map_rsdt(void);
static void acpi_unmap_rsdt(ACPI_TABLE_HEADER *);
-extern struct cfdriver acpi_cd;
-
-/*
- * Handle routine vectors and loading for acpiverbose module.
- */
-int acpi_verbose_loaded = 0;
-
-void acpi_print_devnodes_stub(struct acpi_softc *);
-void acpi_print_tree_stub(struct acpi_devnode *, uint32_t);
-void acpi_print_dev_stub(const char *);
-
-void (*acpi_print_devnodes)(struct acpi_softc *) = acpi_print_devnodes_stub;
-void (*acpi_print_tree)(struct acpi_devnode *,uint32_t) = acpi_print_tree_stub;
-void (*acpi_print_dev)(const char *) = acpi_print_dev_stub;
+void acpi_print_verbose_stub(struct acpi_softc *);
+void acpi_print_dev_stub(const char *);
-/*
- * Support for ACPIVERBOSE.
- */
-void
-acpi_load_verbose(void)
-{
- if (acpi_verbose_loaded == 0) {
- mutex_enter(&module_lock);
- module_autoload("acpiverbose", MODULE_CLASS_MISC);
- mutex_exit(&module_lock);
- }
-}
-
-void
-acpi_print_devnodes_stub(struct acpi_softc *sc)
-{
- acpi_load_verbose();
- if (acpi_verbose_loaded)
- acpi_print_devnodes(sc);
-}
-
-void
-acpi_print_tree_stub(struct acpi_devnode *ad, uint32_t level)
-{
- acpi_load_verbose();
- if (acpi_verbose_loaded)
- acpi_print_tree(ad, level);
-}
-
-void
-acpi_print_dev_stub(const char *pnpstr)
-{
- acpi_load_verbose();
- if (acpi_verbose_loaded)
- acpi_print_dev(pnpstr);
-}
+void (*acpi_print_verbose)(struct acpi_softc *) = acpi_print_verbose_stub;
+void (*acpi_print_dev)(const char *) = acpi_print_dev_stub;
CFATTACH_DECL2_NEW(acpi, sizeof(struct acpi_softc),
acpi_match, acpi_attach, acpi_detach, NULL, acpi_rescan, acpi_childdet);
@@ -533,11 +489,14 @@
acpi_debug_init();
#endif
+ /*
+ * Print debug information.
+ */
+ acpi_print_verbose(sc);
+
return;
fail:
- KASSERT(rv != AE_OK);
-
aprint_error("%s: failed to initialize ACPI: %s\n",
__func__, AcpiFormatException(rv));
}
@@ -662,9 +621,6 @@
acpi_rescan_capabilities(sc);
(void)acpi_pcidev_scan(sc->sc_root);
-
- acpi_print_devnodes(sc);
- acpi_print_tree(sc->sc_root, 0);
}
static ACPI_STATUS
@@ -1732,3 +1688,37 @@
AcpiOsUnmapMemory(rsdt, sizeof(ACPI_TABLE_HEADER));
}
+
+/*
+ * ACPIVERBOSE.
+ */
+void
+acpi_load_verbose(void)
+{
+
+ if (acpi_verbose_loaded == 0) {
+ mutex_enter(&module_lock);
+ module_autoload("acpiverbose", MODULE_CLASS_MISC);
+ mutex_exit(&module_lock);
+ }
+}
+
+void
+acpi_print_verbose_stub(struct acpi_softc *sc)
+{
+
+ acpi_load_verbose();
+
+ if (acpi_verbose_loaded != 0)
+ acpi_print_verbose(sc);
+}
+
+void
+acpi_print_dev_stub(const char *pnpstr)
+{
+
+ acpi_load_verbose();
+
+ if (acpi_verbose_loaded != 0)
+ acpi_print_dev(pnpstr);
+}
diff -r fbd70acc2feb -r 0ecb701e6b12 sys/dev/acpi/acpi_verbose.c
--- a/sys/dev/acpi/acpi_verbose.c Fri Aug 06 22:45:00 2010 +0000
+++ b/sys/dev/acpi/acpi_verbose.c Fri Aug 06 23:38:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_verbose.c,v 1.5 2010/08/06 22:45:00 jruoho Exp $ */
+/* $NetBSD: acpi_verbose.c,v 1.6 2010/08/06 23:38:34 jruoho Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.5 2010/08/06 22:45:00 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.6 2010/08/06 23:38:34 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -77,44 +77,62 @@
#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 *);
-
-extern int acpi_verbose_loaded;
+void acpi_print_verbose_real(struct acpi_softc *);
+void acpi_print_dev_real(const char *);
+static void acpi_print_devnodes(struct acpi_softc *);
+static void acpi_print_tree(struct acpi_devnode *, uint32_t);
MODULE(MODULE_CLASS_MISC, acpiverbose, NULL);
static int
acpiverbose_modcmd(modcmd_t cmd, void *arg)
{
- static void (*saved_print_devnodes)(struct acpi_softc *);
- static void (*saved_print_tree)(struct acpi_devnode *, uint32_t);
+ static void (*saved_print_verbose)(struct acpi_softc *);
static void (*saved_print_dev)(const char *);
switch (cmd) {
+
case MODULE_CMD_INIT:
- saved_print_devnodes = acpi_print_devnodes;
- saved_print_tree = acpi_print_tree;
+ saved_print_verbose = acpi_print_verbose;
saved_print_dev = acpi_print_dev;
- acpi_print_devnodes = acpi_print_devnodes_real;
- acpi_print_tree = acpi_print_tree_real;
+ acpi_print_verbose = acpi_print_verbose_real;
acpi_print_dev = acpi_print_dev_real;
acpi_verbose_loaded = 1;
return 0;
+
case MODULE_CMD_FINI:
- acpi_print_devnodes = saved_print_devnodes;
- acpi_print_tree = saved_print_tree;
+ acpi_print_verbose = saved_print_verbose;
acpi_print_dev = saved_print_dev;
acpi_verbose_loaded = 0;
return 0;
+
default:
return ENOTTY;
}
}
void
-acpi_print_devnodes_real(struct acpi_softc *sc)
+acpi_print_verbose_real(struct acpi_softc *sc)
+{
+
+ acpi_print_devnodes(sc);
+ acpi_print_tree(sc->sc_root, 0);
+}
+
+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);
+ }
+}
+
+static void
+acpi_print_devnodes(struct acpi_softc *sc)
{
struct acpi_devnode *ad;
ACPI_DEVICE_INFO *di;
@@ -147,8 +165,8 @@
aprint_normal("\n");
}
-void
-acpi_print_tree_real(struct acpi_devnode *ad, uint32_t level)
+static void
+acpi_print_tree(struct acpi_devnode *ad, uint32_t level)
{
struct acpi_devnode *child;
uint32_t i;
@@ -179,14 +197,3 @@
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);
- }
- }
-}
diff -r fbd70acc2feb -r 0ecb701e6b12 sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h Fri Aug 06 22:45:00 2010 +0000
+++ b/sys/dev/acpi/acpivar.h Fri Aug 06 23:38:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpivar.h,v 1.58 2010/08/06 22:45:00 jruoho Exp $ */
+/* $NetBSD: acpivar.h,v 1.59 2010/08/06 23:38:34 jruoho Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -325,12 +325,9 @@
/*
* 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_verbose)(struct acpi_softc *);
Home |
Main Index |
Thread Index |
Old Index