Port-i386 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: ACPI runtime debugging
On Sat, Jan 30, 2010 at 08:47:23AM +0100, Bernd Ernesti wrote:
> > On Thu, Jan 28, 2010 at 06:20:38PM +0100, Bernd Ernesti wrote:
>
> * the manpage update is missing for the new sysctl nodes.
See below.
> * would there be a way to have a kernel variable so you can boot
> into ddb and set a variable to debug something while booting
> a kernel?
ACPICA's own debugger is already hooked into ddb(4). Just drop into DDB and
call acpi_osd_debugger(). Also this requires a kernel with ACPI_DEBUG
option.
There is also something called "acpiexec" (included in sysutils/acpica-utils).
It can be used to load tables, execute control methods, and generally
simulate the ACPI execution process from user space.
But as I argued, the printf-debugging is often more useful.
Index: acpi.4
===================================================================
RCS file: /cvsroot/src/share/man/man4/acpi.4,v
retrieving revision 1.34
diff -u -p -r1.34 acpi.4
--- acpi.4 25 Jan 2010 17:21:32 -0000 1.34
+++ acpi.4 28 Jan 2010 11:06:07 -0000
@@ -248,6 +248,133 @@ Sony programmable I/O controller.
.It vald
Toshiba Libretto device.
.El
+.Sh DEBUGGING
+The
+.Tn ACPICA
+reference implementation provides a rich
+facility of different debugging methods.
+To ease the use of these,
+.Nx
+provides two
+.Xr sysctl 7
+variables that control the debug output at runtime.
+These are only available if the running kernel has been compiled with the
+.Tn ACPI_DEBUG
+option.
+.Pp
+The
+.Ic hw.acpi.debug_component
+limits the output to a specific
+.Tn ACPI
+component and the
+.Ic hw.acpi.debug_level
+controls the debug level.
+Both
+.Xr sysctl 7
+variables are string literals.
+The possible values are:
+.Bl -column -offset indent \
+"ACPI_ALL_NETBSD_COMPONENTS * " "ACPI_ALL_NETBSD_COMPONENTS * "
+.It Sy COMPONENT Ta Sy LEVEL
+.It Li ACPI_DEBUG_NONE Ta ACPI_DEBUG_NONE
+.It Li Ta
+.It Li ACPI_UTILITIES Ta ACPI_LV_INIT
+.It Li ACPI_HARDWARE Ta ACPI_LV_DEBUG_OBJECT
+.It Li ACPI_EVENTS Ta ACPI_LV_INFO
+.It Li ACPI_TABLES Ta ACPI_LV_ALL_EXCEPTIONS *
+.It Li ACPI_NAMESPACE Ta
+.It Li ACPI_PARSER Ta ACPI_LV_INIT_NAMES
+.It Li ACPI_DISPATCHER Ta ACPI_LV_PARSE
+.It Li ACPI_EXECUTER Ta ACPI_LV_LOAD
+.It Li ACPI_RESOURCES Ta ACPI_LV_DISPATCH
+.It Li ACPI_CA_DEBUGGER Ta ACPI_LV_EXEC
+.It Li ACPI_OS_SERVICES Ta ACPI_LV_NAMES
+.It Li ACPI_CA_DISASSEMBLER Ta ACPI_LV_OPREGION
+.It Li ACPI_COMPILER Ta ACPI_LV_BFIELD
+.It Li ACPI_TOOLS Ta ACPI_LV_TABLES
+.It Li ACPI_EXAMPLE Ta ACPI_LV_VALUES
+.It Li ACPI_DRIVER Ta ACPI_LV_OBJECTS
+.It Li ACPI_ALL_COMPONENTS * Ta ACPI_LV_RESOURCES
+.It Li Ta ACPI_LV_USER_REQUESTS
+.It Li ACPI_BUS_COMPONENT Ta ACPI_LV_PACKAGE
+.It Li ACPI_ACAD_COMPONENT Ta ACPI_LV_VERBOSITY1 *
+.It Li ACPI_BAT_COMPONENT Ta
+.It Li ACPI_BUTTON_COMPONENT Ta ACPI_LV_ALLOCATIONS
+.It Li APCI_EC_COMPONENT Ta ACPI_LV_FUNCTIONS
+.It Li ACPI_LID_COMPONENT Ta ACPI_LV_OPTIMIZATIONS
+.It Li ACPI_RESOURCE_COMPONENT Ta ACPI_LV_VERBOSITY2 *
+.It Li ACPI_TZ_COMPONENT Ta
+.It Li ACPI_ALL_NETBSD_COMPONENTS * Ta ACPI_LV_MUTEX
+.It Li Ta ACPI_LV_THREADS
+.It Li Ta ACPI_LV_IO
+.It Li Ta ACPI_LV_AML_INTERRUPTS
+.It Li "* This is a compound" Ta ACPI_LV_VERBOSITY3 *
+.It Li " constant, including" Ta
+.It Li " all previous elements." Ta ACPI_LV_AML_DISASSEMBLE
+.It Li Ta ACPI_LV_VERBOSE_INFO
+.It Li Ta ACPI_LV_FULL_TABLES
+.It Li Ta ACPI_LV_EVENTS
+.It Li Ta ACPI_LV_VERBOSE *
+.El
+.Pp
+In addition, there is
+.Dv ACPI_DEBUG_DEFAULT
+that is used by
+.Tn ACPICA
+as the default debug level.
+.Pp
+The debug components form two groups: the first one is specific to the
+.Tn ACPICA
+interpreter and the second one contains the internal
+.Tn ACPI
+components of
+.Nx .
+The
+.Tn ACPICA
+interpreter uses several debug levels internally,
+but the
+.Nx
+specific parts are typically limited to
+.Dv ACPI_LV_DEBUG_OBJECT
+and
+.Dv ACPI_LV_DEBUG_INFO .
+The debug output can be stopped by setting
+.Ic hw.acpi.debug_level
+to
+.Dv ACPI_DEBUG_NONE .
+.Ss EXAMPLE
+.Pp
+As an example, a driver may have defined the component it belongs to and
+the name of the module:
+.Bd -literal -offset indent
+#define _COMPONENT ACPI_BUS_COMPONENT
+ACPI_MODULE_NAME ("acpi_example")
+.Ed
+.Pp
+The driver may also utilize the debug facility:
+.Bd -literal -offset indent
+ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Failed to evaluate _STA\\n"));
+.Ed
+.Pp
+With these options the debug message from
+.Dv ACPI_DEBUG_PRINT
+is only visible when
+.Ic hw.acpi.debug_component
+is either
+.Dv ACPI_BUS_COMPONENT
+or a compound constant including it, and
+.Ic hw.acpi.debug_level
+is
+.Dv ACPI_LV_INFO
+or some constant that includes it.
+Finally, it can be noted that the
+.Tn ACPI
+implementation uses the prefix
+.Dv ACPI_DB ,
+whereas the debug level
+.Xr sysctl 7
+variable is always specified with the prefix
+.Dv ACPI_LV.
.Sh SEE ALSO
.Xr acpiacad 4 ,
.Xr acpibat 4 ,
Index: acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.147
diff -u -p -r1.147 acpi.c
--- acpi.c 18 Jan 2010 18:49:27 -0000 1.147
+++ acpi.c 28 Jan 2010 11:07:47 -0000
@@ -546,6 +546,10 @@ acpi_attach(device_t parent, device_t se
if (acpi_dbgr & ACPI_DBGR_RUNNING)
acpi_osd_debugger();
#endif
+
+#ifdef ACPI_DEBUG
+ acpi_debug_init();
+#endif
}
static int
Index: acpivar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpivar.h,v
retrieving revision 1.39
diff -u -p -r1.39 acpivar.h
--- acpivar.h 18 Jan 2010 18:06:31 -0000 1.39
+++ acpivar.h 28 Jan 2010 11:08:11 -0000
@@ -307,6 +307,11 @@ struct acpi_drq *acpi_res_drq(struct ac
*/
ACPI_STATUS acpi_enter_sleep_state(struct acpi_softc *, int);
+
+#ifdef ACPI_DEBUG
+void acpi_debug_init(void);
+#endif
+
/*
* quirk handling
*/
Index: acpireg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpireg.h,v
retrieving revision 1.6
diff -u -p -r1.6 acpireg.h
--- acpireg.h 16 Sep 2009 10:47:54 -0000 1.6
+++ acpireg.h 28 Jan 2010 11:09:18 -0000
@@ -312,11 +312,12 @@
* ACPI driver components
*/
-#define ACPI_BUS_COMPONENT 0x00010000
-#define ACPI_ACAD_COMPONENT 0x00020000
-#define ACPI_BAT_COMPONENT 0x00040000
-#define ACPI_BUTTON_COMPONENT 0x00080000
-#define ACPI_EC_COMPONENT 0x00100000
-#define ACPI_LID_COMPONENT 0x00200000
-#define ACPI_RESOURCE_COMPONENT 0x00400000
-#define ACPI_TZ_COMPONENT 0x00800000
+#define ACPI_BUS_COMPONENT 0x00010000
+#define ACPI_ACAD_COMPONENT 0x00020000
+#define ACPI_BAT_COMPONENT 0x00040000
+#define ACPI_BUTTON_COMPONENT 0x00080000
+#define ACPI_EC_COMPONENT 0x00100000
+#define ACPI_LID_COMPONENT 0x00200000
+#define ACPI_RESOURCE_COMPONENT 0x00400000
+#define ACPI_TZ_COMPONENT 0x00800000
+#define ACPI_ALL_NETBSD_COMPONENTS 0xFFFF0000
Home |
Main Index |
Thread Index |
Old Index