aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/acpi/method-customizing.txt73
-rw-r--r--Documentation/firmware-guide/acpi/index.rst3
-rw-r--r--Documentation/firmware-guide/acpi/method-customizing.rst89
3 files changed, 91 insertions, 74 deletions
diff --git a/Documentation/acpi/method-customizing.txt b/Documentation/acpi/method-customizing.txt
deleted file mode 100644
index 7235da975f23..000000000000
--- a/Documentation/acpi/method-customizing.txt
+++ /dev/null
@@ -1,73 +0,0 @@
1Linux ACPI Custom Control Method How To
2=======================================
3
4Written by Zhang Rui <rui.zhang@intel.com>
5
6
7Linux supports customizing ACPI control methods at runtime.
8
9Users can use this to
101. override an existing method which may not work correctly,
11 or just for debugging purposes.
122. insert a completely new method in order to create a missing
13 method such as _OFF, _ON, _STA, _INI, etc.
14For these cases, it is far simpler to dynamically install a single
15control method rather than override the entire DSDT, because kernel
16rebuild/reboot is not needed and test result can be got in minutes.
17
18Note: Only ACPI METHOD can be overridden, any other object types like
19 "Device", "OperationRegion", are not recognized. Methods
20 declared inside scope operators are also not supported.
21Note: The same ACPI control method can be overridden for many times,
22 and it's always the latest one that used by Linux/kernel.
23Note: To get the ACPI debug object output (Store (AAAA, Debug)),
24 please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
25
261. override an existing method
27 a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
28 just run "cat /sys/firmware/acpi/tables/DSDT > /tmp/dsdt.dat"
29 b) disassemble the table by running "iasl -d dsdt.dat".
30 c) rewrite the ASL code of the method and save it in a new file,
31 d) package the new file (psr.asl) to an ACPI table format.
32 Here is an example of a customized \_SB._AC._PSR method,
33
34 DefinitionBlock ("", "SSDT", 1, "", "", 0x20080715)
35 {
36 Method (\_SB_.AC._PSR, 0, NotSerialized)
37 {
38 Store ("In AC _PSR", Debug)
39 Return (ACON)
40 }
41 }
42 Note that the full pathname of the method in ACPI namespace
43 should be used.
44 e) assemble the file to generate the AML code of the method.
45 e.g. "iasl -vw 6084 psr.asl" (psr.aml is generated as a result)
46 If parameter "-vw 6084" is not supported by your iASL compiler,
47 please try a newer version.
48 f) mount debugfs by "mount -t debugfs none /sys/kernel/debug"
49 g) override the old method via the debugfs by running
50 "cat /tmp/psr.aml > /sys/kernel/debug/acpi/custom_method"
51
522. insert a new method
53 This is easier than overriding an existing method.
54 We just need to create the ASL code of the method we want to
55 insert and then follow the step c) ~ g) in section 1.
56
573. undo your changes
58 The "undo" operation is not supported for a new inserted method
59 right now, i.e. we can not remove a method currently.
60 For an overridden method, in order to undo your changes, please
61 save a copy of the method original ASL code in step c) section 1,
62 and redo step c) ~ g) to override the method with the original one.
63
64
65Note: We can use a kernel with multiple custom ACPI method running,
66 But each individual write to debugfs can implement a SINGLE
67 method override. i.e. if we want to insert/override multiple
68 ACPI methods, we need to redo step c) ~ g) for multiple times.
69
70Note: Be aware that root can mis-use this driver to modify arbitrary
71 memory and gain additional rights, if root's privileges got
72 restricted (for example if root is not allowed to load additional
73 modules after boot).
diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
index 61d67763851b..d1d069b26bbc 100644
--- a/Documentation/firmware-guide/acpi/index.rst
+++ b/Documentation/firmware-guide/acpi/index.rst
@@ -10,5 +10,6 @@ ACPI Support
10 namespace 10 namespace
11 enumeration 11 enumeration
12 osi 12 osi
13 method-customizing
13 DSD-properties-rules 14 DSD-properties-rules
14 gpio-properties 15 gpio-properties \ No newline at end of file
diff --git a/Documentation/firmware-guide/acpi/method-customizing.rst b/Documentation/firmware-guide/acpi/method-customizing.rst
new file mode 100644
index 000000000000..de3ebcaed4cf
--- /dev/null
+++ b/Documentation/firmware-guide/acpi/method-customizing.rst
@@ -0,0 +1,89 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3=======================================
4Linux ACPI Custom Control Method How To
5=======================================
6
7:Author: Zhang Rui <rui.zhang@intel.com>
8
9
10Linux supports customizing ACPI control methods at runtime.
11
12Users can use this to:
13
141. override an existing method which may not work correctly,
15 or just for debugging purposes.
162. insert a completely new method in order to create a missing
17 method such as _OFF, _ON, _STA, _INI, etc.
18
19For these cases, it is far simpler to dynamically install a single
20control method rather than override the entire DSDT, because kernel
21rebuild/reboot is not needed and test result can be got in minutes.
22
23.. note::
24
25 - Only ACPI METHOD can be overridden, any other object types like
26 "Device", "OperationRegion", are not recognized. Methods
27 declared inside scope operators are also not supported.
28
29 - The same ACPI control method can be overridden for many times,
30 and it's always the latest one that used by Linux/kernel.
31
32 - To get the ACPI debug object output (Store (AAAA, Debug)),
33 please run::
34
35 echo 1 > /sys/module/acpi/parameters/aml_debug_output
36
37
381. override an existing method
39==============================
40a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
41 just run "cat /sys/firmware/acpi/tables/DSDT > /tmp/dsdt.dat"
42b) disassemble the table by running "iasl -d dsdt.dat".
43c) rewrite the ASL code of the method and save it in a new file,
44d) package the new file (psr.asl) to an ACPI table format.
45 Here is an example of a customized \_SB._AC._PSR method::
46
47 DefinitionBlock ("", "SSDT", 1, "", "", 0x20080715)
48 {
49 Method (\_SB_.AC._PSR, 0, NotSerialized)
50 {
51 Store ("In AC _PSR", Debug)
52 Return (ACON)
53 }
54 }
55
56 Note that the full pathname of the method in ACPI namespace
57 should be used.
58e) assemble the file to generate the AML code of the method.
59 e.g. "iasl -vw 6084 psr.asl" (psr.aml is generated as a result)
60 If parameter "-vw 6084" is not supported by your iASL compiler,
61 please try a newer version.
62f) mount debugfs by "mount -t debugfs none /sys/kernel/debug"
63g) override the old method via the debugfs by running
64 "cat /tmp/psr.aml > /sys/kernel/debug/acpi/custom_method"
65
662. insert a new method
67======================
68This is easier than overriding an existing method.
69We just need to create the ASL code of the method we want to
70insert and then follow the step c) ~ g) in section 1.
71
723. undo your changes
73====================
74The "undo" operation is not supported for a new inserted method
75right now, i.e. we can not remove a method currently.
76For an overridden method, in order to undo your changes, please
77save a copy of the method original ASL code in step c) section 1,
78and redo step c) ~ g) to override the method with the original one.
79
80
81.. note:: We can use a kernel with multiple custom ACPI method running,
82 But each individual write to debugfs can implement a SINGLE
83 method override. i.e. if we want to insert/override multiple
84 ACPI methods, we need to redo step c) ~ g) for multiple times.
85
86.. note:: Be aware that root can mis-use this driver to modify arbitrary
87 memory and gain additional rights, if root's privileges got
88 restricted (for example if root is not allowed to load additional
89 modules after boot).