aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2010-08-14 23:55:57 -0400
committerLen Brown <len.brown@intel.com>2010-08-14 23:55:57 -0400
commitecd8ee0955a2f21914c2e2ffff82541211c5bd43 (patch)
tree3987f3d505482a00e9a1d2c44b340d0b71f66d75
parentfeb29c5175e61d0f1ec2cbcaccdfa55e588780be (diff)
parentc637e4861c7db8165d0f438db3829e7878c96059 (diff)
Merge branch 'procfs-cleanup' into release
-rw-r--r--Documentation/acpi/method-customizing.txt2
-rw-r--r--drivers/acpi/Makefile1
-rw-r--r--drivers/acpi/acpica/acglobal.h2
-rw-r--r--drivers/acpi/bus.c1
-rw-r--r--drivers/acpi/debug.c75
-rw-r--r--drivers/acpi/debugfs.c93
-rw-r--r--drivers/acpi/internal.h6
-rw-r--r--include/acpi/acpixf.h2
8 files changed, 105 insertions, 77 deletions
diff --git a/Documentation/acpi/method-customizing.txt b/Documentation/acpi/method-customizing.txt
index e628cd23ca80..3e1d25aee3fb 100644
--- a/Documentation/acpi/method-customizing.txt
+++ b/Documentation/acpi/method-customizing.txt
@@ -19,6 +19,8 @@ Note: Only ACPI METHOD can be overridden, any other object types like
19 "Device", "OperationRegion", are not recognized. 19 "Device", "OperationRegion", are not recognized.
20Note: The same ACPI control method can be overridden for many times, 20Note: The same ACPI control method can be overridden for many times,
21 and it's always the latest one that used by Linux/kernel. 21 and it's always the latest one that used by Linux/kernel.
22Note: To get the ACPI debug object output (Store (AAAA, Debug)),
23 please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
22 24
231. override an existing method 251. override an existing method
24 a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT, 26 a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 6ee33169e1dc..7891904419fc 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -39,6 +39,7 @@ acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
39acpi-y += power.o 39acpi-y += power.o
40acpi-y += system.o event.o 40acpi-y += system.o event.o
41acpi-$(CONFIG_ACPI_DEBUG) += debug.o 41acpi-$(CONFIG_ACPI_DEBUG) += debug.o
42acpi-$(CONFIG_DEBUG_FS) += debugfs.o
42acpi-$(CONFIG_ACPI_NUMA) += numa.o 43acpi-$(CONFIG_ACPI_NUMA) += numa.o
43acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o 44acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
44ifdef CONFIG_ACPI_VIDEO 45ifdef CONFIG_ACPI_VIDEO
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 899d68afc3c5..92122292ef1f 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -115,7 +115,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
115/* 115/*
116 * Optionally enable output from the AML Debug Object. 116 * Optionally enable output from the AML Debug Object.
117 */ 117 */
118u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); 118u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
119 119
120/* 120/*
121 * Optionally copy the entire DSDT to local memory (instead of simply 121 * Optionally copy the entire DSDT to local memory (instead of simply
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index c1d23cd71652..7136f24e3002 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1036,6 +1036,7 @@ static int __init acpi_init(void)
1036 acpi_power_init(); 1036 acpi_power_init();
1037 acpi_system_init(); 1037 acpi_system_init();
1038 acpi_debug_init(); 1038 acpi_debug_init();
1039 acpi_debugfs_init();
1039 acpi_sleep_proc_init(); 1040 acpi_sleep_proc_init();
1040 acpi_wakeup_device_init(); 1041 acpi_wakeup_device_init();
1041 return result; 1042 return result;
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c
index 146135e7a6a1..22476eab2b08 100644
--- a/drivers/acpi/debug.c
+++ b/drivers/acpi/debug.c
@@ -198,80 +198,6 @@ module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
198 NULL, 0644); 198 NULL, 0644);
199 199
200/* -------------------------------------------------------------------------- 200/* --------------------------------------------------------------------------
201 DebugFS Interface
202 -------------------------------------------------------------------------- */
203
204static ssize_t cm_write(struct file *file, const char __user *user_buf,
205 size_t count, loff_t *ppos)
206{
207 static char *buf;
208 static int uncopied_bytes;
209 struct acpi_table_header table;
210 acpi_status status;
211
212 if (!(*ppos)) {
213 /* parse the table header to get the table length */
214 if (count <= sizeof(struct acpi_table_header))
215 return -EINVAL;
216 if (copy_from_user(&table, user_buf,
217 sizeof(struct acpi_table_header)))
218 return -EFAULT;
219 uncopied_bytes = table.length;
220 buf = kzalloc(uncopied_bytes, GFP_KERNEL);
221 if (!buf)
222 return -ENOMEM;
223 }
224
225 if (uncopied_bytes < count) {
226 kfree(buf);
227 return -EINVAL;
228 }
229
230 if (copy_from_user(buf + (*ppos), user_buf, count)) {
231 kfree(buf);
232 return -EFAULT;
233 }
234
235 uncopied_bytes -= count;
236 *ppos += count;
237
238 if (!uncopied_bytes) {
239 status = acpi_install_method(buf);
240 kfree(buf);
241 if (ACPI_FAILURE(status))
242 return -EINVAL;
243 add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
244 }
245
246 return count;
247}
248
249static const struct file_operations cm_fops = {
250 .write = cm_write,
251};
252
253static int acpi_debugfs_init(void)
254{
255 struct dentry *acpi_dir, *cm_dentry;
256
257 acpi_dir = debugfs_create_dir("acpi", NULL);
258 if (!acpi_dir)
259 goto err;
260
261 cm_dentry = debugfs_create_file("custom_method", S_IWUGO,
262 acpi_dir, NULL, &cm_fops);
263 if (!cm_dentry)
264 goto err;
265
266 return 0;
267
268err:
269 if (acpi_dir)
270 debugfs_remove(acpi_dir);
271 return -EINVAL;
272}
273
274/* --------------------------------------------------------------------------
275 FS Interface (/proc) 201 FS Interface (/proc)
276 -------------------------------------------------------------------------- */ 202 -------------------------------------------------------------------------- */
277#ifdef CONFIG_ACPI_PROCFS 203#ifdef CONFIG_ACPI_PROCFS
@@ -400,7 +326,6 @@ int __init acpi_procfs_init(void)
400 326
401int __init acpi_debug_init(void) 327int __init acpi_debug_init(void)
402{ 328{
403 acpi_debugfs_init();
404 acpi_procfs_init(); 329 acpi_procfs_init();
405 return 0; 330 return 0;
406} 331}
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c
new file mode 100644
index 000000000000..7de27d49c4b9
--- /dev/null
+++ b/drivers/acpi/debugfs.c
@@ -0,0 +1,93 @@
1/*
2 * debugfs.c - ACPI debugfs interface to userspace.
3 */
4
5#include <linux/init.h>
6#include <linux/module.h>
7#include <linux/kernel.h>
8#include <linux/uaccess.h>
9#include <linux/debugfs.h>
10#include <acpi/acpi_drivers.h>
11
12#define _COMPONENT ACPI_SYSTEM_COMPONENT
13ACPI_MODULE_NAME("debugfs");
14
15
16/* /sys/modules/acpi/parameters/aml_debug_output */
17
18module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
19 bool, 0644);
20MODULE_PARM_DESC(aml_debug_output,
21 "To enable/disable the ACPI Debug Object output.");
22
23/* /sys/kernel/debug/acpi/custom_method */
24
25static ssize_t cm_write(struct file *file, const char __user * user_buf,
26 size_t count, loff_t *ppos)
27{
28 static char *buf;
29 static int uncopied_bytes;
30 struct acpi_table_header table;
31 acpi_status status;
32
33 if (!(*ppos)) {
34 /* parse the table header to get the table length */
35 if (count <= sizeof(struct acpi_table_header))
36 return -EINVAL;
37 if (copy_from_user(&table, user_buf,
38 sizeof(struct acpi_table_header)))
39 return -EFAULT;
40 uncopied_bytes = table.length;
41 buf = kzalloc(uncopied_bytes, GFP_KERNEL);
42 if (!buf)
43 return -ENOMEM;
44 }
45
46 if (uncopied_bytes < count) {
47 kfree(buf);
48 return -EINVAL;
49 }
50
51 if (copy_from_user(buf + (*ppos), user_buf, count)) {
52 kfree(buf);
53 return -EFAULT;
54 }
55
56 uncopied_bytes -= count;
57 *ppos += count;
58
59 if (!uncopied_bytes) {
60 status = acpi_install_method(buf);
61 kfree(buf);
62 if (ACPI_FAILURE(status))
63 return -EINVAL;
64 add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
65 }
66
67 return count;
68}
69
70static const struct file_operations cm_fops = {
71 .write = cm_write,
72};
73
74int __init acpi_debugfs_init(void)
75{
76 struct dentry *acpi_dir, *cm_dentry;
77
78 acpi_dir = debugfs_create_dir("acpi", NULL);
79 if (!acpi_dir)
80 goto err;
81
82 cm_dentry = debugfs_create_file("custom_method", S_IWUGO,
83 acpi_dir, NULL, &cm_fops);
84 if (!cm_dentry)
85 goto err;
86
87 return 0;
88
89err:
90 if (acpi_dir)
91 debugfs_remove(acpi_dir);
92 return -EINVAL;
93}
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index f8f190ec066e..0650e343867e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -30,6 +30,12 @@ int acpi_debug_init(void);
30static inline int acpi_debug_init(void) { return 0; } 30static inline int acpi_debug_init(void) { return 0; }
31#endif 31#endif
32 32
33#ifdef CONFIG_DEBUG_FS
34int acpi_debugfs_init(void);
35#else
36static inline int acpi_debugfs_init(void) { return 0; }
37#endif
38
33/* -------------------------------------------------------------------------- 39/* --------------------------------------------------------------------------
34 Power Resource 40 Power Resource
35 -------------------------------------------------------------------------- */ 41 -------------------------------------------------------------------------- */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 1371cc997393..a6ea2ac40b9c 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -67,7 +67,7 @@ extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern u8 acpi_gbl_use_default_register_widths; 67extern u8 acpi_gbl_use_default_register_widths;
68extern acpi_name acpi_gbl_trace_method_name; 68extern acpi_name acpi_gbl_trace_method_name;
69extern u32 acpi_gbl_trace_flags; 69extern u32 acpi_gbl_trace_flags;
70extern u8 acpi_gbl_enable_aml_debug_object; 70extern u32 acpi_gbl_enable_aml_debug_object;
71extern u8 acpi_gbl_copy_dsdt_locally; 71extern u8 acpi_gbl_copy_dsdt_locally;
72extern u8 acpi_gbl_truncate_io_addresses; 72extern u8 acpi_gbl_truncate_io_addresses;
73 73