diff options
author | Zhang Rui <rui.zhang@intel.com> | 2007-01-28 22:02:38 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-01-28 22:33:36 -0500 |
commit | 219c3c8e268b9307eae9fae4c765a0c589b98338 (patch) | |
tree | 1cec78888ba858373ca72247bf68710827eb68e0 /drivers/acpi/debug.c | |
parent | b981c591891dc8885de36498d38fa8d8a5481069 (diff) |
ACPI: add ACPI debug attribute in sysfs
Add ACPI debug attributes in sysfs.
/proc/acpi/debug_layer && debug_level are deprecated by
/sys/module/acpi/parameters/debug_layer && debug_level.
NOTE: The operations to them are quite the same.
E.g. if you want to enable ACPI_DB_INFO, ACPI_DB_WARN,
ACPI_DB_ERROR and disable the others,
#echo 0x13 >/sys/module/acpi/parameters/debug_level is OK,
and a boot option "acpi.debug_level = 0x13" also works.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/debug.c')
-rw-r--r-- | drivers/acpi/debug.c | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 35c6af8a83cd..d48f65a8f658 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c | |||
@@ -13,14 +13,11 @@ | |||
13 | 13 | ||
14 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 14 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
15 | ACPI_MODULE_NAME("debug") | 15 | ACPI_MODULE_NAME("debug") |
16 | #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer" | 16 | |
17 | #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level" | ||
18 | #ifdef MODULE_PARAM_PREFIX | 17 | #ifdef MODULE_PARAM_PREFIX |
19 | #undef MODULE_PARAM_PREFIX | 18 | #undef MODULE_PARAM_PREFIX |
20 | #endif | 19 | #endif |
21 | #define MODULE_PARAM_PREFIX | 20 | #define MODULE_PARAM_PREFIX "acpi." |
22 | module_param(acpi_dbg_layer, uint, 0400); | ||
23 | module_param(acpi_dbg_level, uint, 0400); | ||
24 | 21 | ||
25 | struct acpi_dlayer { | 22 | struct acpi_dlayer { |
26 | const char *name; | 23 | const char *name; |
@@ -86,6 +83,60 @@ static const struct acpi_dlevel acpi_debug_levels[] = { | |||
86 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), | 83 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), |
87 | }; | 84 | }; |
88 | 85 | ||
86 | /* -------------------------------------------------------------------------- | ||
87 | FS Interface (/sys) | ||
88 | -------------------------------------------------------------------------- */ | ||
89 | static int param_get_debug_layer(char *buffer, struct kernel_param *kp) { | ||
90 | int result = 0; | ||
91 | int i; | ||
92 | |||
93 | result = sprintf(buffer, "%-25s\tHex SET\n", "Description"); | ||
94 | |||
95 | for(i = 0; i <ARRAY_SIZE(acpi_debug_layers); i++) { | ||
96 | result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n", | ||
97 | acpi_debug_layers[i].name, | ||
98 | acpi_debug_layers[i].value, | ||
99 | (acpi_dbg_layer & acpi_debug_layers[i].value) ? '*' : ' '); | ||
100 | } | ||
101 | result += sprintf(buffer+result, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS", | ||
102 | ACPI_ALL_DRIVERS, | ||
103 | (acpi_dbg_layer & ACPI_ALL_DRIVERS) == | ||
104 | ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer & | ||
105 | ACPI_ALL_DRIVERS) == 0 ? ' ' : '-'); | ||
106 | result += sprintf(buffer+result, "--\ndebug_layer = 0x%08X ( * = enabled)\n", acpi_dbg_layer); | ||
107 | |||
108 | return result; | ||
109 | } | ||
110 | |||
111 | static int param_get_debug_level(char *buffer, struct kernel_param *kp) { | ||
112 | int result = 0; | ||
113 | int i; | ||
114 | |||
115 | result = sprintf(buffer, "%-25s\tHex SET\n", "Description"); | ||
116 | |||
117 | for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) { | ||
118 | result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n", | ||
119 | acpi_debug_levels[i].name, | ||
120 | acpi_debug_levels[i].value, | ||
121 | (acpi_dbg_level & acpi_debug_levels[i]. | ||
122 | value) ? '*' : ' '); | ||
123 | } | ||
124 | result += sprintf(buffer+result, "--\ndebug_level = 0x%08X (* = enabled)\n", | ||
125 | acpi_dbg_level); | ||
126 | |||
127 | return result; | ||
128 | } | ||
129 | |||
130 | module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644); | ||
131 | module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644); | ||
132 | |||
133 | /* -------------------------------------------------------------------------- | ||
134 | FS Interface (/proc) | ||
135 | -------------------------------------------------------------------------- */ | ||
136 | #ifdef CONFIG_ACPI_PROCFS | ||
137 | #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer" | ||
138 | #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level" | ||
139 | |||
89 | static int | 140 | static int |
90 | acpi_system_read_debug(char *page, | 141 | acpi_system_read_debug(char *page, |
91 | char **start, off_t off, int count, int *eof, void *data) | 142 | char **start, off_t off, int count, int *eof, void *data) |
@@ -221,3 +272,4 @@ static int __init acpi_debug_init(void) | |||
221 | } | 272 | } |
222 | 273 | ||
223 | subsys_initcall(acpi_debug_init); | 274 | subsys_initcall(acpi_debug_init); |
275 | #endif | ||