6 #include <linux/kernel.h>
10 #define _COMPONENT ACPI_SYSTEM_COMPONENT
13 #define PREFIX "ACPI: "
15 #ifdef CONFIG_ACPI_DEBUG
34 #define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
36 static const struct acpi_dlayer acpi_debug_layers[] = {
68 static const struct acpi_dlevel acpi_debug_levels[] = {
108 result =
sprintf(buffer,
"%-25s\tHex SET\n",
"Description");
110 for (i = 0; i <
ARRAY_SIZE(acpi_debug_layers); i++) {
111 result +=
sprintf(buffer + result,
"%-25s\t0x%08lX [%c]\n",
112 acpi_debug_layers[i].
name,
113 acpi_debug_layers[i].
value,
118 sprintf(buffer + result,
"%-25s\t0x%08X [%c]\n",
"ACPI_ALL_DRIVERS",
125 "--\ndebug_layer = 0x%08X ( * = enabled)\n",
131 static int param_get_debug_level(
char *buffer,
const struct kernel_param *kp)
136 result =
sprintf(buffer,
"%-25s\tHex SET\n",
"Description");
138 for (i = 0; i <
ARRAY_SIZE(acpi_debug_levels); i++) {
139 result +=
sprintf(buffer + result,
"%-25s\t0x%08lX [%c]\n",
140 acpi_debug_levels[i].
name,
141 acpi_debug_levels[i].
value,
146 sprintf(buffer + result,
"--\ndebug_level = 0x%08X (* = enabled)\n",
154 .get = param_get_debug_layer,
159 .get = param_get_debug_level,
165 static char trace_method_name[6];
167 static unsigned int trace_debug_layer;
169 static unsigned int trace_debug_level;
172 static int param_set_trace_state(
const char *
val,
struct kernel_param *kp)
176 if (!
strncmp(val,
"enable",
sizeof(
"enable") - 1)) {
178 trace_debug_layer, 0);
184 if (!
strncmp(val,
"disable",
sizeof(
"disable") - 1)) {
187 trace_debug_layer, 0);
195 trace_debug_layer, 1);
206 static int param_get_trace_state(
char *buffer,
struct kernel_param *kp)
208 if (!acpi_gbl_trace_method_name)
209 return sprintf(buffer,
"disable");
211 if (acpi_gbl_trace_flags & 1)
214 return sprintf(buffer,
"enable");
229 "To enable/disable the ACPI Debug Object output.");
232 static int param_get_acpica_version(
char *buffer,
struct kernel_param *kp)
250 static struct kobject *tables_kobj;
251 static struct kobject *dynamic_tables_kobj;
273 memcpy(name,
"\0\0\0\0", 4);
280 table_header, table_header->
length);
309 table_attr->
attr.size = 0;
310 table_attr->
attr.read = acpi_table_show;
311 table_attr->
attr.attr.name = table_attr->
name;
312 table_attr->
attr.attr.mode = 0400;
329 acpi_table_attr_init(table_attr, table);
331 &table_attr->
attr)) {
350 static int acpi_tables_sysfs_init(
void)
362 if (!dynamic_tables_kobj)
363 goto err_dynamic_tables;
375 acpi_table_attr_init(table_attr, table_header);
384 &acpi_table_attr_list);
408 #define COUNT_SCI_NOT 2
409 #define COUNT_ERROR 3
410 #define NUM_COUNTERS_EXTRA 4
419 static u32 num_counters;
424 .name =
"interrupts",
429 static void delete_gpe_attr_array(
void)
439 for (i = 0; i < num_gpes; i++)
442 kfree(counter_attrs);
456 if (gpe_number < num_gpes)
465 static void fixed_event_count(
u32 event_number)
471 all_counters[num_gpes + event_number].
count++;
480 u32 event_number,
void *context)
483 gpe_count(event_number);
486 fixed_event_count(event_number);
497 if (index < num_gpes) {
501 "Invalid GPE 0x%x\n", index));
515 int index = attr - counter_attrs;
527 size =
sprintf(buf,
"%8d", all_counters[index].count);
538 size +=
sprintf(buf + size,
" invalid");
540 size +=
sprintf(buf + size,
" enabled");
542 size +=
sprintf(buf + size,
" wake_enabled");
544 size +=
sprintf(buf + size,
" disabled");
547 size +=
sprintf(buf + size,
"\n");
548 return result ? result :
size;
560 int index = attr - counter_attrs;
567 for (i = 0; i < num_counters; ++
i)
568 all_counters[i].count = 0;
570 acpi_irq_handled = 0;
571 acpi_irq_not_handled = 0;
580 if (!(status & ACPI_EVENT_FLAG_HANDLE)) {
582 "Can not change Invalid GPE/Fixed Event status\n");
586 if (index < num_gpes) {
587 if (!
strcmp(buf,
"disable\n") &&
588 (status & ACPI_EVENT_FLAG_ENABLED))
590 else if (!
strcmp(buf,
"enable\n") &&
591 !(status & ACPI_EVENT_FLAG_ENABLED))
593 else if (!
strcmp(buf,
"clear\n") &&
599 int event = index - num_gpes;
600 if (!
strcmp(buf,
"disable\n") &&
601 (status & ACPI_EVENT_FLAG_ENABLED))
603 else if (!
strcmp(buf,
"enable\n") &&
604 !(status & ACPI_EVENT_FLAG_ENABLED))
606 else if (!
strcmp(buf,
"clear\n") &&
617 return result ? result :
size;
631 all_attrs = kzalloc(
sizeof(
struct attribute *) * (num_counters + 1),
633 if (all_attrs ==
NULL)
636 all_counters = kzalloc(
sizeof(
struct event_counter) * (num_counters),
638 if (all_counters ==
NULL)
645 counter_attrs = kzalloc(
sizeof(
struct kobj_attribute) * (num_counters),
647 if (counter_attrs ==
NULL)
650 for (i = 0; i < num_counters; ++
i) {
659 sprintf(buffer,
"ff_gbl_lock");
683 counter_attrs[
i].attr.name =
name;
684 counter_attrs[
i].attr.mode = 0644;
685 counter_attrs[
i].show = counter_show;
686 counter_attrs[
i].store = counter_set;
688 all_attrs[
i] = &counter_attrs[
i].attr;
691 interrupt_stats_attr_group.
attrs = all_attrs;
696 delete_gpe_attr_array();
700 static void __exit interrupt_stats_exit(
void)
704 delete_gpe_attr_array();
723 result = acpi_tables_sysfs_init();