Commit 75281999 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] debugging enhancements (Yi Zhu)

new cmdline options: "acpi_dbg_layer=",  "acpi_dbg_level="
and /proc/acpi/debug_layer, debug_level now describe levels

http://bugzilla.kernel.org/show_bug.cgi?id=2398
parent af1c93ae
...@@ -138,6 +138,20 @@ running once the system is up. ...@@ -138,6 +138,20 @@ running once the system is up.
Recognize and ignore IRQ0/pin2 Interrupt Override. Recognize and ignore IRQ0/pin2 Interrupt Override.
For broken nForce2 BIOS resulting in XT-PIC timer. For broken nForce2 BIOS resulting in XT-PIC timer.
acpi_dbg_layer= [HW,ACPI]
Format: <int>
Each bit of the <int> indicates an acpi debug layer,
1: enable, 0: disable. It is useful for boot time
debugging. After system has booted up, it can be set
via /proc/acpi/debug_layer.
acpi_dbg_level= [HW,ACPI]
Format: <int>
Each bit of the <int> indicates an acpi debug level,
1: enable, 0: disable. It is useful for boot time
debugging. After system has booted up, it can be set
via /proc/acpi/debug_level.
ad1816= [HW,OSS] ad1816= [HW,OSS]
Format: <io>,<irq>,<dma>,<dma2> Format: <io>,<irq>,<dma>,<dma2>
See also Documentation/sound/oss/AD1816. See also Documentation/sound/oss/AD1816.
......
...@@ -738,9 +738,6 @@ static int __init acpi_init (void) ...@@ -738,9 +738,6 @@ static int __init acpi_init (void)
printk(KERN_INFO PREFIX "Subsystem revision %08x\n", printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
ACPI_CA_VERSION); ACPI_CA_VERSION);
/* Initial core debug level excludes drivers, so include them now */
acpi_set_debug(ACPI_DEBUG_LOW);
if (acpi_disabled) { if (acpi_disabled) {
printk(KERN_INFO PREFIX "Interpreter disabled.\n"); printk(KERN_INFO PREFIX "Interpreter disabled.\n");
return -ENODEV; return -ENODEV;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/moduleparam.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
...@@ -13,6 +14,81 @@ ACPI_MODULE_NAME ("debug") ...@@ -13,6 +14,81 @@ ACPI_MODULE_NAME ("debug")
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer" #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level" #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
#ifdef MODULE_PARAM_PREFIX
#undef MODULE_PARAM_PREFIX
#endif
#define MODULE_PARAM_PREFIX
module_param(acpi_dbg_layer, uint, 0400);
module_param(acpi_dbg_level, uint, 0400);
struct acpi_dlayer {
const char *name;
unsigned long value;
};
struct acpi_dlevel {
const char *name;
unsigned long value;
};
#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
const struct acpi_dlayer acpi_debug_layers[] =
{
ACPI_DEBUG_INIT(ACPI_UTILITIES),
ACPI_DEBUG_INIT(ACPI_HARDWARE),
ACPI_DEBUG_INIT(ACPI_EVENTS),
ACPI_DEBUG_INIT(ACPI_TABLES),
ACPI_DEBUG_INIT(ACPI_NAMESPACE),
ACPI_DEBUG_INIT(ACPI_PARSER),
ACPI_DEBUG_INIT(ACPI_DISPATCHER),
ACPI_DEBUG_INIT(ACPI_EXECUTER),
ACPI_DEBUG_INIT(ACPI_RESOURCES),
ACPI_DEBUG_INIT(ACPI_CA_DEBUGGER),
ACPI_DEBUG_INIT(ACPI_OS_SERVICES),
ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER),
ACPI_DEBUG_INIT(ACPI_COMPILER),
ACPI_DEBUG_INIT(ACPI_TOOLS),
};
const struct acpi_dlevel acpi_debug_levels[] =
{
ACPI_DEBUG_INIT(ACPI_LV_ERROR),
ACPI_DEBUG_INIT(ACPI_LV_WARN),
ACPI_DEBUG_INIT(ACPI_LV_INIT),
ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT),
ACPI_DEBUG_INIT(ACPI_LV_INFO),
ACPI_DEBUG_INIT(ACPI_LV_INIT_NAMES),
ACPI_DEBUG_INIT(ACPI_LV_PARSE),
ACPI_DEBUG_INIT(ACPI_LV_LOAD),
ACPI_DEBUG_INIT(ACPI_LV_DISPATCH),
ACPI_DEBUG_INIT(ACPI_LV_EXEC),
ACPI_DEBUG_INIT(ACPI_LV_NAMES),
ACPI_DEBUG_INIT(ACPI_LV_OPREGION),
ACPI_DEBUG_INIT(ACPI_LV_BFIELD),
ACPI_DEBUG_INIT(ACPI_LV_TABLES),
ACPI_DEBUG_INIT(ACPI_LV_VALUES),
ACPI_DEBUG_INIT(ACPI_LV_OBJECTS),
ACPI_DEBUG_INIT(ACPI_LV_RESOURCES),
ACPI_DEBUG_INIT(ACPI_LV_USER_REQUESTS),
ACPI_DEBUG_INIT(ACPI_LV_PACKAGE),
ACPI_DEBUG_INIT(ACPI_LV_ALLOCATIONS),
ACPI_DEBUG_INIT(ACPI_LV_FUNCTIONS),
ACPI_DEBUG_INIT(ACPI_LV_OPTIMIZATIONS),
ACPI_DEBUG_INIT(ACPI_LV_MUTEX),
ACPI_DEBUG_INIT(ACPI_LV_THREADS),
ACPI_DEBUG_INIT(ACPI_LV_IO),
ACPI_DEBUG_INIT(ACPI_LV_INTERRUPTS),
ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
};
#define NUM_OF(v) ( sizeof(v)/sizeof(v[0]) )
static int static int
acpi_system_read_debug ( acpi_system_read_debug (
char *page, char *page,
...@@ -24,16 +100,41 @@ acpi_system_read_debug ( ...@@ -24,16 +100,41 @@ acpi_system_read_debug (
{ {
char *p = page; char *p = page;
int size = 0; int size = 0;
int i;
if (off != 0) if (off != 0)
goto end; goto end;
p += sprintf(p, "%-25s\tHex SET\n", "Description");
switch ((unsigned long) data) { switch ((unsigned long) data) {
case 0: case 0:
p += sprintf(p, "0x%08x\n", acpi_dbg_layer); for (i = 0; i < NUM_OF(acpi_debug_layers); i++) {
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_layers[i].name,
acpi_debug_layers[i].value,
(acpi_dbg_layer & acpi_debug_layers[i].value) ?
'*' : ' ');
}
p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
ACPI_ALL_DRIVERS,
(acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
'*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
' ' : '-');
p += sprintf(p,
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
acpi_dbg_layer);
break; break;
case 1: case 1:
p += sprintf(p, "0x%08x\n", acpi_dbg_level); for (i = 0; i < NUM_OF(acpi_debug_levels); i++) {
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_levels[i].name,
acpi_debug_levels[i].value,
(acpi_dbg_level & acpi_debug_levels[i].value) ?
'*' : ' ');
}
p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
acpi_dbg_level);
break; break;
default: default:
p += sprintf(p, "Invalid debug option\n"); p += sprintf(p, "Invalid debug option\n");
......
...@@ -142,16 +142,11 @@ acpi_format_exception ( ...@@ -142,16 +142,11 @@ acpi_format_exception (
*/ */
/* Debug switch - level and trace mask */ /* Debug switch - level and trace mask */
u32 acpi_dbg_level = 0;
#ifdef ACPI_DEBUG_OUTPUT
u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
#else
u32 acpi_dbg_level = ACPI_NORMAL_DEFAULT;
#endif
/* Debug switch - layer (component) mask */ /* Debug switch - layer (component) mask */
u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT; u32 acpi_dbg_layer = 0;
u32 acpi_gbl_nesting_level = 0; u32 acpi_gbl_nesting_level = 0;
......
...@@ -106,59 +106,4 @@ int acpi_ec_ecdt_probe (void); ...@@ -106,59 +106,4 @@ int acpi_ec_ecdt_probe (void);
int acpi_processor_set_thermal_limit(acpi_handle handle, int type); int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
/* --------------------------------------------------------------------------
Debug Support
-------------------------------------------------------------------------- */
#define ACPI_DEBUG_RESTORE 0
#define ACPI_DEBUG_LOW 1
#define ACPI_DEBUG_MEDIUM 2
#define ACPI_DEBUG_HIGH 3
#define ACPI_DEBUG_DRIVERS 4
extern u32 acpi_dbg_level;
extern u32 acpi_dbg_layer;
static inline void
acpi_set_debug (
u32 flag)
{
static u32 layer_save;
static u32 level_save;
switch (flag) {
case ACPI_DEBUG_RESTORE:
acpi_dbg_layer = layer_save;
acpi_dbg_level = level_save;
break;
case ACPI_DEBUG_LOW:
case ACPI_DEBUG_MEDIUM:
case ACPI_DEBUG_HIGH:
case ACPI_DEBUG_DRIVERS:
layer_save = acpi_dbg_layer;
level_save = acpi_dbg_level;
break;
}
switch (flag) {
case ACPI_DEBUG_LOW:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
acpi_dbg_level = ACPI_DEBUG_DEFAULT;
break;
case ACPI_DEBUG_MEDIUM:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
acpi_dbg_level = ACPI_LV_FUNCTIONS | ACPI_LV_ALL_EXCEPTIONS;
break;
case ACPI_DEBUG_HIGH:
acpi_dbg_layer = 0xFFFFFFFF;
acpi_dbg_level = 0xFFFFFFFF;
break;
case ACPI_DEBUG_DRIVERS:
acpi_dbg_layer = ACPI_ALL_DRIVERS;
acpi_dbg_level = 0xFFFFFFFF;
break;
}
}
#endif /*__ACPI_DRIVERS_H__*/ #endif /*__ACPI_DRIVERS_H__*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment