aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/acpi/aml-debugger.txt66
-rw-r--r--Documentation/acpi/apei/output_format.txt147
-rw-r--r--Documentation/acpi/i2c-muxes.txt58
-rw-r--r--Documentation/acpi/initrd_table_override.txt111
-rw-r--r--Documentation/acpi/method-customizing.txt73
-rw-r--r--Documentation/acpi/method-tracing.txt192
-rw-r--r--Documentation/acpi/ssdt-overlays.txt172
-rw-r--r--Documentation/admin-guide/acpi/cppc_sysfs.rst (renamed from Documentation/acpi/cppc_sysfs.txt)71
-rw-r--r--Documentation/admin-guide/acpi/dsdt-override.rst (renamed from Documentation/acpi/dsdt-override.txt)8
-rw-r--r--Documentation/admin-guide/acpi/index.rst14
-rw-r--r--Documentation/admin-guide/acpi/initrd_table_override.rst115
-rw-r--r--Documentation/admin-guide/acpi/ssdt-overlays.rst180
-rw-r--r--Documentation/admin-guide/index.rst1
-rw-r--r--Documentation/driver-api/acpi/index.rst9
-rw-r--r--Documentation/driver-api/acpi/linuxized-acpica.rst (renamed from Documentation/acpi/linuxized-acpica.txt)109
-rw-r--r--Documentation/driver-api/acpi/scan_handlers.rst (renamed from Documentation/acpi/scan_handlers.txt)24
-rw-r--r--Documentation/driver-api/index.rst1
-rw-r--r--Documentation/firmware-guide/acpi/DSD-properties-rules.rst (renamed from Documentation/acpi/DSD-properties-rules.txt)21
-rw-r--r--Documentation/firmware-guide/acpi/acpi-lid.rst (renamed from Documentation/acpi/acpi-lid.txt)40
-rw-r--r--Documentation/firmware-guide/acpi/aml-debugger.rst75
-rw-r--r--Documentation/firmware-guide/acpi/apei/einj.rst (renamed from Documentation/acpi/apei/einj.txt)94
-rw-r--r--Documentation/firmware-guide/acpi/apei/output_format.rst150
-rw-r--r--Documentation/firmware-guide/acpi/debug.rst (renamed from Documentation/acpi/debug.txt)31
-rw-r--r--Documentation/firmware-guide/acpi/dsd/data-node-references.rst (renamed from Documentation/acpi/dsd/data-node-references.txt)36
-rw-r--r--Documentation/firmware-guide/acpi/dsd/graph.rst (renamed from Documentation/acpi/dsd/graph.txt)157
-rw-r--r--Documentation/firmware-guide/acpi/enumeration.rst (renamed from Documentation/acpi/enumeration.txt)161
-rw-r--r--Documentation/firmware-guide/acpi/gpio-properties.rst (renamed from Documentation/acpi/gpio-properties.txt)78
-rw-r--r--Documentation/firmware-guide/acpi/i2c-muxes.rst61
-rw-r--r--Documentation/firmware-guide/acpi/index.rst26
-rw-r--r--Documentation/firmware-guide/acpi/lpit.rst (renamed from Documentation/acpi/lpit.txt)18
-rw-r--r--Documentation/firmware-guide/acpi/method-customizing.rst89
-rw-r--r--Documentation/firmware-guide/acpi/method-tracing.rst238
-rw-r--r--Documentation/firmware-guide/acpi/namespace.rst (renamed from Documentation/acpi/namespace.txt)294
-rw-r--r--Documentation/firmware-guide/acpi/osi.rst (renamed from Documentation/acpi/osi.txt)15
-rw-r--r--Documentation/firmware-guide/acpi/video_extension.rst (renamed from Documentation/acpi/video_extension.txt)83
-rw-r--r--Documentation/firmware-guide/index.rst13
-rw-r--r--Documentation/index.rst10
-rw-r--r--MAINTAINERS2
38 files changed, 1683 insertions, 1360 deletions
diff --git a/Documentation/acpi/aml-debugger.txt b/Documentation/acpi/aml-debugger.txt
deleted file mode 100644
index 75ebeb64ab29..000000000000
--- a/Documentation/acpi/aml-debugger.txt
+++ /dev/null
@@ -1,66 +0,0 @@
1The AML Debugger
2
3Copyright (C) 2016, Intel Corporation
4Author: Lv Zheng <lv.zheng@intel.com>
5
6
7This document describes the usage of the AML debugger embedded in the Linux
8kernel.
9
101. Build the debugger
11
12 The following kernel configuration items are required to enable the AML
13 debugger interface from the Linux kernel:
14
15 CONFIG_ACPI_DEBUGGER=y
16 CONFIG_ACPI_DEBUGGER_USER=m
17
18 The userspace utilities can be built from the kernel source tree using
19 the following commands:
20
21 $ cd tools
22 $ make acpi
23
24 The resultant userspace tool binary is then located at:
25
26 tools/power/acpi/acpidbg
27
28 It can be installed to system directories by running "make install" (as a
29 sufficiently privileged user).
30
312. Start the userspace debugger interface
32
33 After booting the kernel with the debugger built-in, the debugger can be
34 started by using the following commands:
35
36 # mount -t debugfs none /sys/kernel/debug
37 # modprobe acpi_dbg
38 # tools/power/acpi/acpidbg
39
40 That spawns the interactive AML debugger environment where you can execute
41 debugger commands.
42
43 The commands are documented in the "ACPICA Overview and Programmer Reference"
44 that can be downloaded from
45
46 https://acpica.org/documentation
47
48 The detailed debugger commands reference is located in Chapter 12 "ACPICA
49 Debugger Reference". The "help" command can be used for a quick reference.
50
513. Stop the userspace debugger interface
52
53 The interactive debugger interface can be closed by pressing Ctrl+C or using
54 the "quit" or "exit" commands. When finished, unload the module with:
55
56 # rmmod acpi_dbg
57
58 The module unloading may fail if there is an acpidbg instance running.
59
604. Run the debugger in a script
61
62 It may be useful to run the AML debugger in a test script. "acpidbg" supports
63 this in a special "batch" mode. For example, the following command outputs
64 the entire ACPI namespace:
65
66 # acpidbg -b "namespace"
diff --git a/Documentation/acpi/apei/output_format.txt b/Documentation/acpi/apei/output_format.txt
deleted file mode 100644
index 0c49c197c47a..000000000000
--- a/Documentation/acpi/apei/output_format.txt
+++ /dev/null
@@ -1,147 +0,0 @@
1 APEI output format
2 ~~~~~~~~~~~~~~~~~~
3
4APEI uses printk as hardware error reporting interface, the output
5format is as follow.
6
7<error record> :=
8APEI generic hardware error status
9severity: <integer>, <severity string>
10section: <integer>, severity: <integer>, <severity string>
11flags: <integer>
12<section flags strings>
13fru_id: <uuid string>
14fru_text: <string>
15section_type: <section type string>
16<section data>
17
18<severity string>* := recoverable | fatal | corrected | info
19
20<section flags strings># :=
21[primary][, containment warning][, reset][, threshold exceeded]\
22[, resource not accessible][, latent error]
23
24<section type string> := generic processor error | memory error | \
25PCIe error | unknown, <uuid string>
26
27<section data> :=
28<generic processor section data> | <memory section data> | \
29<pcie section data> | <null>
30
31<generic processor section data> :=
32[processor_type: <integer>, <proc type string>]
33[processor_isa: <integer>, <proc isa string>]
34[error_type: <integer>
35<proc error type strings>]
36[operation: <integer>, <proc operation string>]
37[flags: <integer>
38<proc flags strings>]
39[level: <integer>]
40[version_info: <integer>]
41[processor_id: <integer>]
42[target_address: <integer>]
43[requestor_id: <integer>]
44[responder_id: <integer>]
45[IP: <integer>]
46
47<proc type string>* := IA32/X64 | IA64
48
49<proc isa string>* := IA32 | IA64 | X64
50
51<processor error type strings># :=
52[cache error][, TLB error][, bus error][, micro-architectural error]
53
54<proc operation string>* := unknown or generic | data read | data write | \
55instruction execution
56
57<proc flags strings># :=
58[restartable][, precise IP][, overflow][, corrected]
59
60<memory section data> :=
61[error_status: <integer>]
62[physical_address: <integer>]
63[physical_address_mask: <integer>]
64[node: <integer>]
65[card: <integer>]
66[module: <integer>]
67[bank: <integer>]
68[device: <integer>]
69[row: <integer>]
70[column: <integer>]
71[bit_position: <integer>]
72[requestor_id: <integer>]
73[responder_id: <integer>]
74[target_id: <integer>]
75[error_type: <integer>, <mem error type string>]
76
77<mem error type string>* :=
78unknown | no error | single-bit ECC | multi-bit ECC | \
79single-symbol chipkill ECC | multi-symbol chipkill ECC | master abort | \
80target abort | parity error | watchdog timeout | invalid address | \
81mirror Broken | memory sparing | scrub corrected error | \
82scrub uncorrected error
83
84<pcie section data> :=
85[port_type: <integer>, <pcie port type string>]
86[version: <integer>.<integer>]
87[command: <integer>, status: <integer>]
88[device_id: <integer>:<integer>:<integer>.<integer>
89slot: <integer>
90secondary_bus: <integer>
91vendor_id: <integer>, device_id: <integer>
92class_code: <integer>]
93[serial number: <integer>, <integer>]
94[bridge: secondary_status: <integer>, control: <integer>]
95[aer_status: <integer>, aer_mask: <integer>
96<aer status string>
97[aer_uncor_severity: <integer>]
98aer_layer=<aer layer string>, aer_agent=<aer agent string>
99aer_tlp_header: <integer> <integer> <integer> <integer>]
100
101<pcie port type string>* := PCIe end point | legacy PCI end point | \
102unknown | unknown | root port | upstream switch port | \
103downstream switch port | PCIe to PCI/PCI-X bridge | \
104PCI/PCI-X to PCIe bridge | root complex integrated endpoint device | \
105root complex event collector
106
107if section severity is fatal or recoverable
108<aer status string># :=
109unknown | unknown | unknown | unknown | Data Link Protocol | \
110unknown | unknown | unknown | unknown | unknown | unknown | unknown | \
111Poisoned TLP | Flow Control Protocol | Completion Timeout | \
112Completer Abort | Unexpected Completion | Receiver Overflow | \
113Malformed TLP | ECRC | Unsupported Request
114else
115<aer status string># :=
116Receiver Error | unknown | unknown | unknown | unknown | unknown | \
117Bad TLP | Bad DLLP | RELAY_NUM Rollover | unknown | unknown | unknown | \
118Replay Timer Timeout | Advisory Non-Fatal
119fi
120
121<aer layer string> :=
122Physical Layer | Data Link Layer | Transaction Layer
123
124<aer agent string> :=
125Receiver ID | Requester ID | Completer ID | Transmitter ID
126
127Where, [] designate corresponding content is optional
128
129All <field string> description with * has the following format:
130
131field: <integer>, <field string>
132
133Where value of <integer> should be the position of "string" in <field
134string> description. Otherwise, <field string> will be "unknown".
135
136All <field strings> description with # has the following format:
137
138field: <integer>
139<field strings>
140
141Where each string in <fields strings> corresponding to one set bit of
142<integer>. The bit position is the position of "string" in <field
143strings> description.
144
145For more detailed explanation of every field, please refer to UEFI
146specification version 2.3 or later, section Appendix N: Common
147Platform Error Record.
diff --git a/Documentation/acpi/i2c-muxes.txt b/Documentation/acpi/i2c-muxes.txt
deleted file mode 100644
index 9fcc4f0b885e..000000000000
--- a/Documentation/acpi/i2c-muxes.txt
+++ /dev/null
@@ -1,58 +0,0 @@
1ACPI I2C Muxes
2--------------
3
4Describing an I2C device hierarchy that includes I2C muxes requires an ACPI
5Device () scope per mux channel.
6
7Consider this topology:
8
9+------+ +------+
10| SMB1 |-->| MUX0 |--CH00--> i2c client A (0x50)
11| | | 0x70 |--CH01--> i2c client B (0x50)
12+------+ +------+
13
14which corresponds to the following ASL:
15
16Device (SMB1)
17{
18 Name (_HID, ...)
19 Device (MUX0)
20 {
21 Name (_HID, ...)
22 Name (_CRS, ResourceTemplate () {
23 I2cSerialBus (0x70, ControllerInitiated, I2C_SPEED,
24 AddressingMode7Bit, "^SMB1", 0x00,
25 ResourceConsumer,,)
26 }
27
28 Device (CH00)
29 {
30 Name (_ADR, 0)
31
32 Device (CLIA)
33 {
34 Name (_HID, ...)
35 Name (_CRS, ResourceTemplate () {
36 I2cSerialBus (0x50, ControllerInitiated, I2C_SPEED,
37 AddressingMode7Bit, "^CH00", 0x00,
38 ResourceConsumer,,)
39 }
40 }
41 }
42
43 Device (CH01)
44 {
45 Name (_ADR, 1)
46
47 Device (CLIB)
48 {
49 Name (_HID, ...)
50 Name (_CRS, ResourceTemplate () {
51 I2cSerialBus (0x50, ControllerInitiated, I2C_SPEED,
52 AddressingMode7Bit, "^CH01", 0x00,
53 ResourceConsumer,,)
54 }
55 }
56 }
57 }
58}
diff --git a/Documentation/acpi/initrd_table_override.txt b/Documentation/acpi/initrd_table_override.txt
deleted file mode 100644
index 30437a6db373..000000000000
--- a/Documentation/acpi/initrd_table_override.txt
+++ /dev/null
@@ -1,111 +0,0 @@
1Upgrading ACPI tables via initrd
2================================
3
41) Introduction (What is this about)
52) What is this for
63) How does it work
74) References (Where to retrieve userspace tools)
8
91) What is this about
10---------------------
11
12If the ACPI_TABLE_UPGRADE compile option is true, it is possible to
13upgrade the ACPI execution environment that is defined by the ACPI tables
14via upgrading the ACPI tables provided by the BIOS with an instrumented,
15modified, more recent version one, or installing brand new ACPI tables.
16
17When building initrd with kernel in a single image, option
18ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this
19feature to work.
20
21For a full list of ACPI tables that can be upgraded/installed, take a look
22at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in
23drivers/acpi/tables.c.
24All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
25be overridable, except:
26 - ACPI_SIG_RSDP (has a signature of 6 bytes)
27 - ACPI_SIG_FACS (does not have an ordinary ACPI table header)
28Both could get implemented as well.
29
30
312) What is this for
32-------------------
33
34Complain to your platform/BIOS vendor if you find a bug which is so severe
35that a workaround is not accepted in the Linux kernel. And this facility
36allows you to upgrade the buggy tables before your platform/BIOS vendor
37releases an upgraded BIOS binary.
38
39This facility can be used by platform/BIOS vendors to provide a Linux
40compatible environment without modifying the underlying platform firmware.
41
42This facility also provides a powerful feature to easily debug and test
43ACPI BIOS table compatibility with the Linux kernel by modifying old
44platform provided ACPI tables or inserting new ACPI tables.
45
46It can and should be enabled in any kernel because there is no functional
47change with not instrumented initrds.
48
49
503) How does it work
51-------------------
52
53# Extract the machine's ACPI tables:
54cd /tmp
55acpidump >acpidump
56acpixtract -a acpidump
57# Disassemble, modify and recompile them:
58iasl -d *.dat
59# For example add this statement into a _PRT (PCI Routing Table) function
60# of the DSDT:
61Store("HELLO WORLD", debug)
62# And increase the OEM Revision. For example, before modification:
63DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
64# After modification:
65DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
66iasl -sa dsdt.dsl
67# Add the raw ACPI tables to an uncompressed cpio archive.
68# They must be put into a /kernel/firmware/acpi directory inside the cpio
69# archive. Note that if the table put here matches a platform table
70# (similar Table Signature, and similar OEMID, and similar OEM Table ID)
71# with a more recent OEM Revision, the platform table will be upgraded by
72# this table. If the table put here doesn't match a platform table
73# (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
74# ID), this table will be appended.
75mkdir -p kernel/firmware/acpi
76cp dsdt.aml kernel/firmware/acpi
77# A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
78# (see osl.c):
79iasl -sa facp.dsl
80iasl -sa ssdt1.dsl
81cp facp.aml kernel/firmware/acpi
82cp ssdt1.aml kernel/firmware/acpi
83# The uncompressed cpio archive must be the first. Other, typically
84# compressed cpio archives, must be concatenated on top of the uncompressed
85# one. Following command creates the uncompressed cpio archive and
86# concatenates the original initrd on top:
87find kernel | cpio -H newc --create > /boot/instrumented_initrd
88cat /boot/initrd >>/boot/instrumented_initrd
89# reboot with increased acpi debug level, e.g. boot params:
90acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
91# and check your syslog:
92[ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
93[ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
94
95iasl is able to disassemble and recompile quite a lot different,
96also static ACPI tables.
97
98
994) Where to retrieve userspace tools
100------------------------------------
101
102iasl and acpixtract are part of Intel's ACPICA project:
103http://acpica.org/
104and should be packaged by distributions (for example in the acpica package
105on SUSE).
106
107acpidump can be found in Len Browns pmtools:
108ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
109This tool is also part of the acpica package on SUSE.
110Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
111/sys/firmware/acpi/tables
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/acpi/method-tracing.txt b/Documentation/acpi/method-tracing.txt
deleted file mode 100644
index 0aba14c8f459..000000000000
--- a/Documentation/acpi/method-tracing.txt
+++ /dev/null
@@ -1,192 +0,0 @@
1ACPICA Trace Facility
2
3Copyright (C) 2015, Intel Corporation
4Author: Lv Zheng <lv.zheng@intel.com>
5
6
7Abstract:
8
9This document describes the functions and the interfaces of the method
10tracing facility.
11
121. Functionalities and usage examples:
13
14 ACPICA provides method tracing capability. And two functions are
15 currently implemented using this capability.
16
17 A. Log reducer
18 ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is
19 enabled. The debugging messages which are deployed via
20 ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component
21 level (known as debug layer, configured via
22 /sys/module/acpi/parameters/debug_layer) and per-type level (known as
23 debug level, configured via /sys/module/acpi/parameters/debug_level).
24
25 But when the particular layer/level is applied to the control method
26 evaluations, the quantity of the debugging outputs may still be too
27 large to be put into the kernel log buffer. The idea thus is worked out
28 to only enable the particular debug layer/level (normally more detailed)
29 logs when the control method evaluation is started, and disable the
30 detailed logging when the control method evaluation is stopped.
31
32 The following command examples illustrate the usage of the "log reducer"
33 functionality:
34 a. Filter out the debug layer/level matched logs when control methods
35 are being evaluated:
36 # cd /sys/module/acpi/parameters
37 # echo "0xXXXXXXXX" > trace_debug_layer
38 # echo "0xYYYYYYYY" > trace_debug_level
39 # echo "enable" > trace_state
40 b. Filter out the debug layer/level matched logs when the specified
41 control method is being evaluated:
42 # cd /sys/module/acpi/parameters
43 # echo "0xXXXXXXXX" > trace_debug_layer
44 # echo "0xYYYYYYYY" > trace_debug_level
45 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
46 # echo "method" > /sys/module/acpi/parameters/trace_state
47 c. Filter out the debug layer/level matched logs when the specified
48 control method is being evaluated for the first time:
49 # cd /sys/module/acpi/parameters
50 # echo "0xXXXXXXXX" > trace_debug_layer
51 # echo "0xYYYYYYYY" > trace_debug_level
52 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
53 # echo "method-once" > /sys/module/acpi/parameters/trace_state
54 Where:
55 0xXXXXXXXX/0xYYYYYYYY: Refer to Documentation/acpi/debug.txt for
56 possible debug layer/level masking values.
57 \PPPP.AAAA.TTTT.HHHH: Full path of a control method that can be found
58 in the ACPI namespace. It needn't be an entry
59 of a control method evaluation.
60
61 B. AML tracer
62
63 There are special log entries added by the method tracing facility at
64 the "trace points" the AML interpreter starts/stops to execute a control
65 method, or an AML opcode. Note that the format of the log entries are
66 subject to change:
67 [ 0.186427] exdebug-0398 ex_trace_point : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
68 [ 0.186630] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905c88:If] execution.
69 [ 0.186820] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:LEqual] execution.
70 [ 0.187010] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905a20:-NamePath-] execution.
71 [ 0.187214] exdebug-0398 ex_trace_point : Opcode End [0xf5905a20:-NamePath-] execution.
72 [ 0.187407] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
73 [ 0.187594] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
74 [ 0.187789] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:LEqual] execution.
75 [ 0.187980] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:Return] execution.
76 [ 0.188146] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
77 [ 0.188334] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
78 [ 0.188524] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:Return] execution.
79 [ 0.188712] exdebug-0398 ex_trace_point : Opcode End [0xf5905c88:If] execution.
80 [ 0.188903] exdebug-0398 ex_trace_point : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
81
82 Developers can utilize these special log entries to track the AML
83 interpretion, thus can aid issue debugging and performance tuning. Note
84 that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
85 macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
86 "AML tracer" logs.
87
88 The following command examples illustrate the usage of the "AML tracer"
89 functionality:
90 a. Filter out the method start/stop "AML tracer" logs when control
91 methods are being evaluated:
92 # cd /sys/module/acpi/parameters
93 # echo "0x80" > trace_debug_layer
94 # echo "0x10" > trace_debug_level
95 # echo "enable" > trace_state
96 b. Filter out the method start/stop "AML tracer" when the specified
97 control method is being evaluated:
98 # cd /sys/module/acpi/parameters
99 # echo "0x80" > trace_debug_layer
100 # echo "0x10" > trace_debug_level
101 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
102 # echo "method" > trace_state
103 c. Filter out the method start/stop "AML tracer" logs when the specified
104 control method is being evaluated for the first time:
105 # cd /sys/module/acpi/parameters
106 # echo "0x80" > trace_debug_layer
107 # echo "0x10" > trace_debug_level
108 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
109 # echo "method-once" > trace_state
110 d. Filter out the method/opcode start/stop "AML tracer" when the
111 specified control method is being evaluated:
112 # cd /sys/module/acpi/parameters
113 # echo "0x80" > trace_debug_layer
114 # echo "0x10" > trace_debug_level
115 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
116 # echo "opcode" > trace_state
117 e. Filter out the method/opcode start/stop "AML tracer" when the
118 specified control method is being evaluated for the first time:
119 # cd /sys/module/acpi/parameters
120 # echo "0x80" > trace_debug_layer
121 # echo "0x10" > trace_debug_level
122 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
123 # echo "opcode-opcode" > trace_state
124
125 Note that all above method tracing facility related module parameters can
126 be used as the boot parameters, for example:
127 acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \
128 acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once
129
1302. Interface descriptions:
131
132 All method tracing functions can be configured via ACPI module
133 parameters that are accessible at /sys/module/acpi/parameters/:
134
135 trace_method_name
136 The full path of the AML method that the user wants to trace.
137 Note that the full path shouldn't contain the trailing "_"s in its
138 name segments but may contain "\" to form an absolute path.
139
140 trace_debug_layer
141 The temporary debug_layer used when the tracing feature is enabled.
142 Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
143 used to match all "AML tracer" logs.
144
145 trace_debug_level
146 The temporary debug_level used when the tracing feature is enabled.
147 Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
148 debug_level used to match all "AML tracer" logs.
149
150 trace_state
151 The status of the tracing feature.
152 Users can enable/disable this debug tracing feature by executing
153 the following command:
154 # echo string > /sys/module/acpi/parameters/trace_state
155 Where "string" should be one of the following:
156 "disable"
157 Disable the method tracing feature.
158 "enable"
159 Enable the method tracing feature.
160 ACPICA debugging messages matching
161 "trace_debug_layer/trace_debug_level" during any method
162 execution will be logged.
163 "method"
164 Enable the method tracing feature.
165 ACPICA debugging messages matching
166 "trace_debug_layer/trace_debug_level" during method execution
167 of "trace_method_name" will be logged.
168 "method-once"
169 Enable the method tracing feature.
170 ACPICA debugging messages matching
171 "trace_debug_layer/trace_debug_level" during method execution
172 of "trace_method_name" will be logged only once.
173 "opcode"
174 Enable the method tracing feature.
175 ACPICA debugging messages matching
176 "trace_debug_layer/trace_debug_level" during method/opcode
177 execution of "trace_method_name" will be logged.
178 "opcode-once"
179 Enable the method tracing feature.
180 ACPICA debugging messages matching
181 "trace_debug_layer/trace_debug_level" during method/opcode
182 execution of "trace_method_name" will be logged only once.
183 Note that, the difference between the "enable" and other feature
184 enabling options are:
185 1. When "enable" is specified, since
186 "trace_debug_layer/trace_debug_level" shall apply to all control
187 method evaluations, after configuring "trace_state" to "enable",
188 "trace_method_name" will be reset to NULL.
189 2. When "method/opcode" is specified, if
190 "trace_method_name" is NULL when "trace_state" is configured to
191 these options, the "trace_debug_layer/trace_debug_level" will
192 apply to all control method evaluations.
diff --git a/Documentation/acpi/ssdt-overlays.txt b/Documentation/acpi/ssdt-overlays.txt
deleted file mode 100644
index 5ae13f161ea2..000000000000
--- a/Documentation/acpi/ssdt-overlays.txt
+++ /dev/null
@@ -1,172 +0,0 @@
1
2In order to support ACPI open-ended hardware configurations (e.g. development
3boards) we need a way to augment the ACPI configuration provided by the firmware
4image. A common example is connecting sensors on I2C / SPI buses on development
5boards.
6
7Although this can be accomplished by creating a kernel platform driver or
8recompiling the firmware image with updated ACPI tables, neither is practical:
9the former proliferates board specific kernel code while the latter requires
10access to firmware tools which are often not publicly available.
11
12Because ACPI supports external references in AML code a more practical
13way to augment firmware ACPI configuration is by dynamically loading
14user defined SSDT tables that contain the board specific information.
15
16For example, to enumerate a Bosch BMA222E accelerometer on the I2C bus of the
17Minnowboard MAX development board exposed via the LSE connector [1], the
18following ASL code can be used:
19
20DefinitionBlock ("minnowmax.aml", "SSDT", 1, "Vendor", "Accel", 0x00000003)
21{
22 External (\_SB.I2C6, DeviceObj)
23
24 Scope (\_SB.I2C6)
25 {
26 Device (STAC)
27 {
28 Name (_ADR, Zero)
29 Name (_HID, "BMA222E")
30
31 Method (_CRS, 0, Serialized)
32 {
33 Name (RBUF, ResourceTemplate ()
34 {
35 I2cSerialBus (0x0018, ControllerInitiated, 0x00061A80,
36 AddressingMode7Bit, "\\_SB.I2C6", 0x00,
37 ResourceConsumer, ,)
38 GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
39 "\\_SB.GPO2", 0x00, ResourceConsumer, , )
40 { // Pin list
41 0
42 }
43 })
44 Return (RBUF)
45 }
46 }
47 }
48}
49
50which can then be compiled to AML binary format:
51
52$ iasl minnowmax.asl
53
54Intel ACPI Component Architecture
55ASL Optimizing Compiler version 20140214-64 [Mar 29 2014]
56Copyright (c) 2000 - 2014 Intel Corporation
57
58ASL Input: minnomax.asl - 30 lines, 614 bytes, 7 keywords
59AML Output: minnowmax.aml - 165 bytes, 6 named objects, 1 executable opcodes
60
61[1] http://wiki.minnowboard.org/MinnowBoard_MAX#Low_Speed_Expansion_Connector_.28Top.29
62
63The resulting AML code can then be loaded by the kernel using one of the methods
64below.
65
66== Loading ACPI SSDTs from initrd ==
67
68This option allows loading of user defined SSDTs from initrd and it is useful
69when the system does not support EFI or when there is not enough EFI storage.
70
71It works in a similar way with initrd based ACPI tables override/upgrade: SSDT
72aml code must be placed in the first, uncompressed, initrd under the
73"kernel/firmware/acpi" path. Multiple files can be used and this will translate
74in loading multiple tables. Only SSDT and OEM tables are allowed. See
75initrd_table_override.txt for more details.
76
77Here is an example:
78
79# Add the raw ACPI tables to an uncompressed cpio archive.
80# They must be put into a /kernel/firmware/acpi directory inside the
81# cpio archive.
82# The uncompressed cpio archive must be the first.
83# Other, typically compressed cpio archives, must be
84# concatenated on top of the uncompressed one.
85mkdir -p kernel/firmware/acpi
86cp ssdt.aml kernel/firmware/acpi
87
88# Create the uncompressed cpio archive and concatenate the original initrd
89# on top:
90find kernel | cpio -H newc --create > /boot/instrumented_initrd
91cat /boot/initrd >>/boot/instrumented_initrd
92
93== Loading ACPI SSDTs from EFI variables ==
94
95This is the preferred method, when EFI is supported on the platform, because it
96allows a persistent, OS independent way of storing the user defined SSDTs. There
97is also work underway to implement EFI support for loading user defined SSDTs
98and using this method will make it easier to convert to the EFI loading
99mechanism when that will arrive.
100
101In order to load SSDTs from an EFI variable the efivar_ssdt kernel command line
102parameter can be used. The argument for the option is the variable name to
103use. If there are multiple variables with the same name but with different
104vendor GUIDs, all of them will be loaded.
105
106In order to store the AML code in an EFI variable the efivarfs filesystem can be
107used. It is enabled and mounted by default in /sys/firmware/efi/efivars in all
108recent distribution.
109
110Creating a new file in /sys/firmware/efi/efivars will automatically create a new
111EFI variable. Updating a file in /sys/firmware/efi/efivars will update the EFI
112variable. Please note that the file name needs to be specially formatted as
113"Name-GUID" and that the first 4 bytes in the file (little-endian format)
114represent the attributes of the EFI variable (see EFI_VARIABLE_MASK in
115include/linux/efi.h). Writing to the file must also be done with one write
116operation.
117
118For example, you can use the following bash script to create/update an EFI
119variable with the content from a given file:
120
121#!/bin/sh -e
122
123while ! [ -z "$1" ]; do
124 case "$1" in
125 "-f") filename="$2"; shift;;
126 "-g") guid="$2"; shift;;
127 *) name="$1";;
128 esac
129 shift
130done
131
132usage()
133{
134 echo "Syntax: ${0##*/} -f filename [ -g guid ] name"
135 exit 1
136}
137
138[ -n "$name" -a -f "$filename" ] || usage
139
140EFIVARFS="/sys/firmware/efi/efivars"
141
142[ -d "$EFIVARFS" ] || exit 2
143
144if stat -tf $EFIVARFS | grep -q -v de5e81e4; then
145 mount -t efivarfs none $EFIVARFS
146fi
147
148# try to pick up an existing GUID
149[ -n "$guid" ] || guid=$(find "$EFIVARFS" -name "$name-*" | head -n1 | cut -f2- -d-)
150
151# use a randomly generated GUID
152[ -n "$guid" ] || guid="$(cat /proc/sys/kernel/random/uuid)"
153
154# efivarfs expects all of the data in one write
155tmp=$(mktemp)
156/bin/echo -ne "\007\000\000\000" | cat - $filename > $tmp
157dd if=$tmp of="$EFIVARFS/$name-$guid" bs=$(stat -c %s $tmp)
158rm $tmp
159
160== Loading ACPI SSDTs from configfs ==
161
162This option allows loading of user defined SSDTs from userspace via the configfs
163interface. The CONFIG_ACPI_CONFIGFS option must be select and configfs must be
164mounted. In the following examples, we assume that configfs has been mounted in
165/config.
166
167New tables can be loading by creating new directories in /config/acpi/table/ and
168writing the SSDT aml code in the aml attribute:
169
170cd /config/acpi/table
171mkdir my_ssdt
172cat ~/ssdt.aml > my_ssdt/aml
diff --git a/Documentation/acpi/cppc_sysfs.txt b/Documentation/admin-guide/acpi/cppc_sysfs.rst
index f20fb445135d..a4b99afbe331 100644
--- a/Documentation/acpi/cppc_sysfs.txt
+++ b/Documentation/admin-guide/acpi/cppc_sysfs.rst
@@ -1,5 +1,11 @@
1.. SPDX-License-Identifier: GPL-2.0
1 2
2 Collaborative Processor Performance Control (CPPC) 3==================================================
4Collaborative Processor Performance Control (CPPC)
5==================================================
6
7CPPC
8====
3 9
4CPPC defined in the ACPI spec describes a mechanism for the OS to manage the 10CPPC defined in the ACPI spec describes a mechanism for the OS to manage the
5performance of a logical processor on a contigious and abstract performance 11performance of a logical processor on a contigious and abstract performance
@@ -10,31 +16,28 @@ For more details on CPPC please refer to the ACPI specification at:
10 16
11http://uefi.org/specifications 17http://uefi.org/specifications
12 18
13Some of the CPPC registers are exposed via sysfs under: 19Some of the CPPC registers are exposed via sysfs under::
14
15/sys/devices/system/cpu/cpuX/acpi_cppc/
16
17for each cpu X
18 20
19-------------------------------------------------------------------------------- 21 /sys/devices/system/cpu/cpuX/acpi_cppc/
20 22
21$ ls -lR /sys/devices/system/cpu/cpu0/acpi_cppc/ 23for each cpu X::
22/sys/devices/system/cpu/cpu0/acpi_cppc/:
23total 0
24-r--r--r-- 1 root root 65536 Mar 5 19:38 feedback_ctrs
25-r--r--r-- 1 root root 65536 Mar 5 19:38 highest_perf
26-r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_freq
27-r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_nonlinear_perf
28-r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_perf
29-r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_freq
30-r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_perf
31-r--r--r-- 1 root root 65536 Mar 5 19:38 reference_perf
32-r--r--r-- 1 root root 65536 Mar 5 19:38 wraparound_time
33 24
34-------------------------------------------------------------------------------- 25 $ ls -lR /sys/devices/system/cpu/cpu0/acpi_cppc/
26 /sys/devices/system/cpu/cpu0/acpi_cppc/:
27 total 0
28 -r--r--r-- 1 root root 65536 Mar 5 19:38 feedback_ctrs
29 -r--r--r-- 1 root root 65536 Mar 5 19:38 highest_perf
30 -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_freq
31 -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_nonlinear_perf
32 -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_perf
33 -r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_freq
34 -r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_perf
35 -r--r--r-- 1 root root 65536 Mar 5 19:38 reference_perf
36 -r--r--r-- 1 root root 65536 Mar 5 19:38 wraparound_time
35 37
36* highest_perf : Highest performance of this processor (abstract scale). 38* highest_perf : Highest performance of this processor (abstract scale).
37* nominal_perf : Highest sustained performance of this processor (abstract scale). 39* nominal_perf : Highest sustained performance of this processor
40 (abstract scale).
38* lowest_nonlinear_perf : Lowest performance of this processor with nonlinear 41* lowest_nonlinear_perf : Lowest performance of this processor with nonlinear
39 power savings (abstract scale). 42 power savings (abstract scale).
40* lowest_perf : Lowest performance of this processor (abstract scale). 43* lowest_perf : Lowest performance of this processor (abstract scale).
@@ -48,22 +51,26 @@ total 0
48* feedback_ctrs : Includes both Reference and delivered performance counter. 51* feedback_ctrs : Includes both Reference and delivered performance counter.
49 Reference counter ticks up proportional to processor's reference performance. 52 Reference counter ticks up proportional to processor's reference performance.
50 Delivered counter ticks up proportional to processor's delivered performance. 53 Delivered counter ticks up proportional to processor's delivered performance.
51* wraparound_time: Minimum time for the feedback counters to wraparound (seconds). 54* wraparound_time: Minimum time for the feedback counters to wraparound
55 (seconds).
52* reference_perf : Performance level at which reference performance counter 56* reference_perf : Performance level at which reference performance counter
53 accumulates (abstract scale). 57 accumulates (abstract scale).
54 58
55--------------------------------------------------------------------------------
56 59
57 Computing Average Delivered Performance 60Computing Average Delivered Performance
61=======================================
62
63Below describes the steps to compute the average performance delivered by
64taking two different snapshots of feedback counters at time T1 and T2.
65
66 T1: Read feedback_ctrs as fbc_t1
67 Wait or run some workload
58 68
59Below describes the steps to compute the average performance delivered by taking 69 T2: Read feedback_ctrs as fbc_t2
60two different snapshots of feedback counters at time T1 and T2.
61 70
62T1: Read feedback_ctrs as fbc_t1 71::
63 Wait or run some workload
64T2: Read feedback_ctrs as fbc_t2
65 72
66delivered_counter_delta = fbc_t2[del] - fbc_t1[del] 73 delivered_counter_delta = fbc_t2[del] - fbc_t1[del]
67reference_counter_delta = fbc_t2[ref] - fbc_t1[ref] 74 reference_counter_delta = fbc_t2[ref] - fbc_t1[ref]
68 75
69delivered_perf = (refernce_perf x delivered_counter_delta) / reference_counter_delta 76 delivered_perf = (refernce_perf x delivered_counter_delta) / reference_counter_delta
diff --git a/Documentation/acpi/dsdt-override.txt b/Documentation/admin-guide/acpi/dsdt-override.rst
index 784841caa6e6..50bd7f194bf4 100644
--- a/Documentation/acpi/dsdt-override.txt
+++ b/Documentation/admin-guide/acpi/dsdt-override.rst
@@ -1,6 +1,12 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3===============
4Overriding DSDT
5===============
6
1Linux supports a method of overriding the BIOS DSDT: 7Linux supports a method of overriding the BIOS DSDT:
2 8
3CONFIG_ACPI_CUSTOM_DSDT builds the image into the kernel. 9CONFIG_ACPI_CUSTOM_DSDT - builds the image into the kernel.
4 10
5When to use this method is described in detail on the 11When to use this method is described in detail on the
6Linux/ACPI home page: 12Linux/ACPI home page:
diff --git a/Documentation/admin-guide/acpi/index.rst b/Documentation/admin-guide/acpi/index.rst
new file mode 100644
index 000000000000..4d13eeea1eca
--- /dev/null
+++ b/Documentation/admin-guide/acpi/index.rst
@@ -0,0 +1,14 @@
1============
2ACPI Support
3============
4
5Here we document in detail how to interact with various mechanisms in
6the Linux ACPI support.
7
8.. toctree::
9 :maxdepth: 1
10
11 initrd_table_override
12 dsdt-override
13 ssdt-overlays
14 cppc_sysfs
diff --git a/Documentation/admin-guide/acpi/initrd_table_override.rst b/Documentation/admin-guide/acpi/initrd_table_override.rst
new file mode 100644
index 000000000000..cbd768207631
--- /dev/null
+++ b/Documentation/admin-guide/acpi/initrd_table_override.rst
@@ -0,0 +1,115 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3================================
4Upgrading ACPI tables via initrd
5================================
6
7What is this about
8==================
9
10If the ACPI_TABLE_UPGRADE compile option is true, it is possible to
11upgrade the ACPI execution environment that is defined by the ACPI tables
12via upgrading the ACPI tables provided by the BIOS with an instrumented,
13modified, more recent version one, or installing brand new ACPI tables.
14
15When building initrd with kernel in a single image, option
16ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD should also be true for this
17feature to work.
18
19For a full list of ACPI tables that can be upgraded/installed, take a look
20at the char `*table_sigs[MAX_ACPI_SIGNATURE];` definition in
21drivers/acpi/tables.c.
22
23All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
24be overridable, except:
25
26 - ACPI_SIG_RSDP (has a signature of 6 bytes)
27 - ACPI_SIG_FACS (does not have an ordinary ACPI table header)
28
29Both could get implemented as well.
30
31
32What is this for
33================
34
35Complain to your platform/BIOS vendor if you find a bug which is so severe
36that a workaround is not accepted in the Linux kernel. And this facility
37allows you to upgrade the buggy tables before your platform/BIOS vendor
38releases an upgraded BIOS binary.
39
40This facility can be used by platform/BIOS vendors to provide a Linux
41compatible environment without modifying the underlying platform firmware.
42
43This facility also provides a powerful feature to easily debug and test
44ACPI BIOS table compatibility with the Linux kernel by modifying old
45platform provided ACPI tables or inserting new ACPI tables.
46
47It can and should be enabled in any kernel because there is no functional
48change with not instrumented initrds.
49
50
51How does it work
52================
53::
54
55 # Extract the machine's ACPI tables:
56 cd /tmp
57 acpidump >acpidump
58 acpixtract -a acpidump
59 # Disassemble, modify and recompile them:
60 iasl -d *.dat
61 # For example add this statement into a _PRT (PCI Routing Table) function
62 # of the DSDT:
63 Store("HELLO WORLD", debug)
64 # And increase the OEM Revision. For example, before modification:
65 DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
66 # After modification:
67 DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
68 iasl -sa dsdt.dsl
69 # Add the raw ACPI tables to an uncompressed cpio archive.
70 # They must be put into a /kernel/firmware/acpi directory inside the cpio
71 # archive. Note that if the table put here matches a platform table
72 # (similar Table Signature, and similar OEMID, and similar OEM Table ID)
73 # with a more recent OEM Revision, the platform table will be upgraded by
74 # this table. If the table put here doesn't match a platform table
75 # (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
76 # ID), this table will be appended.
77 mkdir -p kernel/firmware/acpi
78 cp dsdt.aml kernel/firmware/acpi
79 # A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
80 # (see osl.c):
81 iasl -sa facp.dsl
82 iasl -sa ssdt1.dsl
83 cp facp.aml kernel/firmware/acpi
84 cp ssdt1.aml kernel/firmware/acpi
85 # The uncompressed cpio archive must be the first. Other, typically
86 # compressed cpio archives, must be concatenated on top of the uncompressed
87 # one. Following command creates the uncompressed cpio archive and
88 # concatenates the original initrd on top:
89 find kernel | cpio -H newc --create > /boot/instrumented_initrd
90 cat /boot/initrd >>/boot/instrumented_initrd
91 # reboot with increased acpi debug level, e.g. boot params:
92 acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
93 # and check your syslog:
94 [ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
95 [ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
96
97iasl is able to disassemble and recompile quite a lot different,
98also static ACPI tables.
99
100
101Where to retrieve userspace tools
102=================================
103
104iasl and acpixtract are part of Intel's ACPICA project:
105http://acpica.org/
106
107and should be packaged by distributions (for example in the acpica package
108on SUSE).
109
110acpidump can be found in Len Browns pmtools:
111ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
112
113This tool is also part of the acpica package on SUSE.
114Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
115/sys/firmware/acpi/tables
diff --git a/Documentation/admin-guide/acpi/ssdt-overlays.rst b/Documentation/admin-guide/acpi/ssdt-overlays.rst
new file mode 100644
index 000000000000..da37455f96c9
--- /dev/null
+++ b/Documentation/admin-guide/acpi/ssdt-overlays.rst
@@ -0,0 +1,180 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3=============
4SSDT Overlays
5=============
6
7In order to support ACPI open-ended hardware configurations (e.g. development
8boards) we need a way to augment the ACPI configuration provided by the firmware
9image. A common example is connecting sensors on I2C / SPI buses on development
10boards.
11
12Although this can be accomplished by creating a kernel platform driver or
13recompiling the firmware image with updated ACPI tables, neither is practical:
14the former proliferates board specific kernel code while the latter requires
15access to firmware tools which are often not publicly available.
16
17Because ACPI supports external references in AML code a more practical
18way to augment firmware ACPI configuration is by dynamically loading
19user defined SSDT tables that contain the board specific information.
20
21For example, to enumerate a Bosch BMA222E accelerometer on the I2C bus of the
22Minnowboard MAX development board exposed via the LSE connector [1], the
23following ASL code can be used::
24
25 DefinitionBlock ("minnowmax.aml", "SSDT", 1, "Vendor", "Accel", 0x00000003)
26 {
27 External (\_SB.I2C6, DeviceObj)
28
29 Scope (\_SB.I2C6)
30 {
31 Device (STAC)
32 {
33 Name (_ADR, Zero)
34 Name (_HID, "BMA222E")
35
36 Method (_CRS, 0, Serialized)
37 {
38 Name (RBUF, ResourceTemplate ()
39 {
40 I2cSerialBus (0x0018, ControllerInitiated, 0x00061A80,
41 AddressingMode7Bit, "\\_SB.I2C6", 0x00,
42 ResourceConsumer, ,)
43 GpioInt (Edge, ActiveHigh, Exclusive, PullDown, 0x0000,
44 "\\_SB.GPO2", 0x00, ResourceConsumer, , )
45 { // Pin list
46 0
47 }
48 })
49 Return (RBUF)
50 }
51 }
52 }
53 }
54
55which can then be compiled to AML binary format::
56
57 $ iasl minnowmax.asl
58
59 Intel ACPI Component Architecture
60 ASL Optimizing Compiler version 20140214-64 [Mar 29 2014]
61 Copyright (c) 2000 - 2014 Intel Corporation
62
63 ASL Input: minnomax.asl - 30 lines, 614 bytes, 7 keywords
64 AML Output: minnowmax.aml - 165 bytes, 6 named objects, 1 executable opcodes
65
66[1] http://wiki.minnowboard.org/MinnowBoard_MAX#Low_Speed_Expansion_Connector_.28Top.29
67
68The resulting AML code can then be loaded by the kernel using one of the methods
69below.
70
71Loading ACPI SSDTs from initrd
72==============================
73
74This option allows loading of user defined SSDTs from initrd and it is useful
75when the system does not support EFI or when there is not enough EFI storage.
76
77It works in a similar way with initrd based ACPI tables override/upgrade: SSDT
78aml code must be placed in the first, uncompressed, initrd under the
79"kernel/firmware/acpi" path. Multiple files can be used and this will translate
80in loading multiple tables. Only SSDT and OEM tables are allowed. See
81initrd_table_override.txt for more details.
82
83Here is an example::
84
85 # Add the raw ACPI tables to an uncompressed cpio archive.
86 # They must be put into a /kernel/firmware/acpi directory inside the
87 # cpio archive.
88 # The uncompressed cpio archive must be the first.
89 # Other, typically compressed cpio archives, must be
90 # concatenated on top of the uncompressed one.
91 mkdir -p kernel/firmware/acpi
92 cp ssdt.aml kernel/firmware/acpi
93
94 # Create the uncompressed cpio archive and concatenate the original initrd
95 # on top:
96 find kernel | cpio -H newc --create > /boot/instrumented_initrd
97 cat /boot/initrd >>/boot/instrumented_initrd
98
99Loading ACPI SSDTs from EFI variables
100=====================================
101
102This is the preferred method, when EFI is supported on the platform, because it
103allows a persistent, OS independent way of storing the user defined SSDTs. There
104is also work underway to implement EFI support for loading user defined SSDTs
105and using this method will make it easier to convert to the EFI loading
106mechanism when that will arrive.
107
108In order to load SSDTs from an EFI variable the efivar_ssdt kernel command line
109parameter can be used. The argument for the option is the variable name to
110use. If there are multiple variables with the same name but with different
111vendor GUIDs, all of them will be loaded.
112
113In order to store the AML code in an EFI variable the efivarfs filesystem can be
114used. It is enabled and mounted by default in /sys/firmware/efi/efivars in all
115recent distribution.
116
117Creating a new file in /sys/firmware/efi/efivars will automatically create a new
118EFI variable. Updating a file in /sys/firmware/efi/efivars will update the EFI
119variable. Please note that the file name needs to be specially formatted as
120"Name-GUID" and that the first 4 bytes in the file (little-endian format)
121represent the attributes of the EFI variable (see EFI_VARIABLE_MASK in
122include/linux/efi.h). Writing to the file must also be done with one write
123operation.
124
125For example, you can use the following bash script to create/update an EFI
126variable with the content from a given file::
127
128 #!/bin/sh -e
129
130 while ! [ -z "$1" ]; do
131 case "$1" in
132 "-f") filename="$2"; shift;;
133 "-g") guid="$2"; shift;;
134 *) name="$1";;
135 esac
136 shift
137 done
138
139 usage()
140 {
141 echo "Syntax: ${0##*/} -f filename [ -g guid ] name"
142 exit 1
143 }
144
145 [ -n "$name" -a -f "$filename" ] || usage
146
147 EFIVARFS="/sys/firmware/efi/efivars"
148
149 [ -d "$EFIVARFS" ] || exit 2
150
151 if stat -tf $EFIVARFS | grep -q -v de5e81e4; then
152 mount -t efivarfs none $EFIVARFS
153 fi
154
155 # try to pick up an existing GUID
156 [ -n "$guid" ] || guid=$(find "$EFIVARFS" -name "$name-*" | head -n1 | cut -f2- -d-)
157
158 # use a randomly generated GUID
159 [ -n "$guid" ] || guid="$(cat /proc/sys/kernel/random/uuid)"
160
161 # efivarfs expects all of the data in one write
162 tmp=$(mktemp)
163 /bin/echo -ne "\007\000\000\000" | cat - $filename > $tmp
164 dd if=$tmp of="$EFIVARFS/$name-$guid" bs=$(stat -c %s $tmp)
165 rm $tmp
166
167Loading ACPI SSDTs from configfs
168================================
169
170This option allows loading of user defined SSDTs from userspace via the configfs
171interface. The CONFIG_ACPI_CONFIGFS option must be select and configfs must be
172mounted. In the following examples, we assume that configfs has been mounted in
173/config.
174
175New tables can be loading by creating new directories in /config/acpi/table/ and
176writing the SSDT aml code in the aml attribute::
177
178 cd /config/acpi/table
179 mkdir my_ssdt
180 cat ~/ssdt.aml > my_ssdt/aml
diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst
index 0a491676685e..5b8286fdd91b 100644
--- a/Documentation/admin-guide/index.rst
+++ b/Documentation/admin-guide/index.rst
@@ -77,6 +77,7 @@ configure specific aspects of kernel behavior to your liking.
77 LSM/index 77 LSM/index
78 mm/index 78 mm/index
79 perf-security 79 perf-security
80 acpi/index
80 81
81.. only:: subproject and html 82.. only:: subproject and html
82 83
diff --git a/Documentation/driver-api/acpi/index.rst b/Documentation/driver-api/acpi/index.rst
new file mode 100644
index 000000000000..ace0008e54c2
--- /dev/null
+++ b/Documentation/driver-api/acpi/index.rst
@@ -0,0 +1,9 @@
1============
2ACPI Support
3============
4
5.. toctree::
6 :maxdepth: 2
7
8 linuxized-acpica
9 scan_handlers
diff --git a/Documentation/acpi/linuxized-acpica.txt b/Documentation/driver-api/acpi/linuxized-acpica.rst
index 3ad7b0dfb083..0ca8f1538519 100644
--- a/Documentation/acpi/linuxized-acpica.txt
+++ b/Documentation/driver-api/acpi/linuxized-acpica.rst
@@ -1,31 +1,37 @@
1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
3
4============================================================
1Linuxized ACPICA - Introduction to ACPICA Release Automation 5Linuxized ACPICA - Introduction to ACPICA Release Automation
6============================================================
2 7
3Copyright (C) 2013-2016, Intel Corporation 8:Copyright: |copy| 2013-2016, Intel Corporation
4Author: Lv Zheng <lv.zheng@intel.com>
5 9
10:Author: Lv Zheng <lv.zheng@intel.com>
6 11
7Abstract:
8 12
13Abstract
14========
9This document describes the ACPICA project and the relationship between 15This document describes the ACPICA project and the relationship between
10ACPICA and Linux. It also describes how ACPICA code in drivers/acpi/acpica, 16ACPICA and Linux. It also describes how ACPICA code in drivers/acpi/acpica,
11include/acpi and tools/power/acpi is automatically updated to follow the 17include/acpi and tools/power/acpi is automatically updated to follow the
12upstream. 18upstream.
13 19
20ACPICA Project
21==============
14 22
151. ACPICA Project 23The ACPI Component Architecture (ACPICA) project provides an operating
16 24system (OS)-independent reference implementation of the Advanced
17 The ACPI Component Architecture (ACPICA) project provides an operating 25Configuration and Power Interface Specification (ACPI). It has been
18 system (OS)-independent reference implementation of the Advanced 26adapted by various host OSes. By directly integrating ACPICA, Linux can
19 Configuration and Power Interface Specification (ACPI). It has been 27also benefit from the application experiences of ACPICA from other host
20 adapted by various host OSes. By directly integrating ACPICA, Linux can 28OSes.
21 also benefit from the application experiences of ACPICA from other host
22 OSes.
23 29
24 The homepage of ACPICA project is: www.acpica.org, it is maintained and 30The homepage of ACPICA project is: www.acpica.org, it is maintained and
25 supported by Intel Corporation. 31supported by Intel Corporation.
26 32
27 The following figure depicts the Linux ACPI subsystem where the ACPICA 33The following figure depicts the Linux ACPI subsystem where the ACPICA
28 adaptation is included: 34adaptation is included::
29 35
30 +---------------------------------------------------------+ 36 +---------------------------------------------------------+
31 | | 37 | |
@@ -71,21 +77,27 @@ upstream.
71 77
72 Figure 1. Linux ACPI Software Components 78 Figure 1. Linux ACPI Software Components
73 79
74 NOTE: 80.. note::
75 A. OS Service Layer - Provided by Linux to offer OS dependent 81 A. OS Service Layer - Provided by Linux to offer OS dependent
76 implementation of the predefined ACPICA interfaces (acpi_os_*). 82 implementation of the predefined ACPICA interfaces (acpi_os_*).
83 ::
84
77 include/acpi/acpiosxf.h 85 include/acpi/acpiosxf.h
78 drivers/acpi/osl.c 86 drivers/acpi/osl.c
79 include/acpi/platform 87 include/acpi/platform
80 include/asm/acenv.h 88 include/asm/acenv.h
81 B. ACPICA Functionality - Released from ACPICA code base to offer 89 B. ACPICA Functionality - Released from ACPICA code base to offer
82 OS independent implementation of the ACPICA interfaces (acpi_*). 90 OS independent implementation of the ACPICA interfaces (acpi_*).
91 ::
92
83 drivers/acpi/acpica 93 drivers/acpi/acpica
84 include/acpi/ac*.h 94 include/acpi/ac*.h
85 tools/power/acpi 95 tools/power/acpi
86 C. Linux/ACPI Functionality - Providing Linux specific ACPI 96 C. Linux/ACPI Functionality - Providing Linux specific ACPI
87 functionality to the other Linux kernel subsystems and user space 97 functionality to the other Linux kernel subsystems and user space
88 programs. 98 programs.
99 ::
100
89 drivers/acpi 101 drivers/acpi
90 include/linux/acpi.h 102 include/linux/acpi.h
91 include/linux/acpi*.h 103 include/linux/acpi*.h
@@ -95,24 +107,27 @@ upstream.
95 ACPI subsystem to offer architecture specific implementation of the 107 ACPI subsystem to offer architecture specific implementation of the
96 ACPI interfaces. They are Linux specific components and are out of 108 ACPI interfaces. They are Linux specific components and are out of
97 the scope of this document. 109 the scope of this document.
110 ::
111
98 include/asm/acpi.h 112 include/asm/acpi.h
99 include/asm/acpi*.h 113 include/asm/acpi*.h
100 arch/*/acpi 114 arch/*/acpi
101 115
1022. ACPICA Release 116ACPICA Release
117==============
103 118
104 The ACPICA project maintains its code base at the following repository URL: 119The ACPICA project maintains its code base at the following repository URL:
105 https://github.com/acpica/acpica.git. As a rule, a release is made every 120https://github.com/acpica/acpica.git. As a rule, a release is made every
106 month. 121month.
107 122
108 As the coding style adopted by the ACPICA project is not acceptable by 123As the coding style adopted by the ACPICA project is not acceptable by
109 Linux, there is a release process to convert the ACPICA git commits into 124Linux, there is a release process to convert the ACPICA git commits into
110 Linux patches. The patches generated by this process are referred to as 125Linux patches. The patches generated by this process are referred to as
111 "linuxized ACPICA patches". The release process is carried out on a local 126"linuxized ACPICA patches". The release process is carried out on a local
112 copy the ACPICA git repository. Each commit in the monthly release is 127copy the ACPICA git repository. Each commit in the monthly release is
113 converted into a linuxized ACPICA patch. Together, they form the monthly 128converted into a linuxized ACPICA patch. Together, they form the monthly
114 ACPICA release patchset for the Linux ACPI community. This process is 129ACPICA release patchset for the Linux ACPI community. This process is
115 illustrated in the following figure: 130illustrated in the following figure::
116 131
117 +-----------------------------+ 132 +-----------------------------+
118 | acpica / master (-) commits | 133 | acpica / master (-) commits |
@@ -153,7 +168,7 @@ upstream.
153 168
154 Figure 2. ACPICA -> Linux Upstream Process 169 Figure 2. ACPICA -> Linux Upstream Process
155 170
156 NOTE: 171.. note::
157 A. Linuxize Utilities - Provided by the ACPICA repository, including a 172 A. Linuxize Utilities - Provided by the ACPICA repository, including a
158 utility located in source/tools/acpisrc folder and a number of 173 utility located in source/tools/acpisrc folder and a number of
159 scripts located in generate/linux folder. 174 scripts located in generate/linux folder.
@@ -170,19 +185,20 @@ upstream.
170 following kernel configuration options: 185 following kernel configuration options:
171 CONFIG_ACPI/CONFIG_ACPI_DEBUG/CONFIG_ACPI_DEBUGGER 186 CONFIG_ACPI/CONFIG_ACPI_DEBUG/CONFIG_ACPI_DEBUGGER
172 187
1733. ACPICA Divergences 188ACPICA Divergences
189==================
174 190
175 Ideally, all of the ACPICA commits should be converted into Linux patches 191Ideally, all of the ACPICA commits should be converted into Linux patches
176 automatically without manual modifications, the "linux / master" tree should 192automatically without manual modifications, the "linux / master" tree should
177 contain the ACPICA code that exactly corresponds to the ACPICA code 193contain the ACPICA code that exactly corresponds to the ACPICA code
178 contained in "new linuxized acpica" tree and it should be possible to run 194contained in "new linuxized acpica" tree and it should be possible to run
179 the release process fully automatically. 195the release process fully automatically.
180 196
181 As a matter of fact, however, there are source code differences between 197As a matter of fact, however, there are source code differences between
182 the ACPICA code in Linux and the upstream ACPICA code, referred to as 198the ACPICA code in Linux and the upstream ACPICA code, referred to as
183 "ACPICA Divergences". 199"ACPICA Divergences".
184 200
185 The various sources of ACPICA divergences include: 201The various sources of ACPICA divergences include:
186 1. Legacy divergences - Before the current ACPICA release process was 202 1. Legacy divergences - Before the current ACPICA release process was
187 established, there already had been divergences between Linux and 203 established, there already had been divergences between Linux and
188 ACPICA. Over the past several years those divergences have been greatly 204 ACPICA. Over the past several years those divergences have been greatly
@@ -213,11 +229,12 @@ upstream.
213 rebased on the ACPICA side in order to offer better solutions, new ACPICA 229 rebased on the ACPICA side in order to offer better solutions, new ACPICA
214 divergences are generated. 230 divergences are generated.
215 231
2164. ACPICA Development 232ACPICA Development
233==================
217 234
218 This paragraph guides Linux developers to use the ACPICA upstream release 235This paragraph guides Linux developers to use the ACPICA upstream release
219 utilities to obtain Linux patches corresponding to upstream ACPICA commits 236utilities to obtain Linux patches corresponding to upstream ACPICA commits
220 before they become available from the ACPICA release process. 237before they become available from the ACPICA release process.
221 238
222 1. Cherry-pick an ACPICA commit 239 1. Cherry-pick an ACPICA commit
223 240
@@ -225,7 +242,7 @@ upstream.
225 you want to cherry pick must be committed into the local repository. 242 you want to cherry pick must be committed into the local repository.
226 243
227 Then the gen-patch.sh command can help to cherry-pick an ACPICA commit 244 Then the gen-patch.sh command can help to cherry-pick an ACPICA commit
228 from the ACPICA local repository: 245 from the ACPICA local repository::
229 246
230 $ git clone https://github.com/acpica/acpica 247 $ git clone https://github.com/acpica/acpica
231 $ cd acpica 248 $ cd acpica
@@ -240,7 +257,7 @@ upstream.
240 changes that haven't been applied to Linux yet. 257 changes that haven't been applied to Linux yet.
241 258
242 You can generate the ACPICA release series yourself and rebase your code on 259 You can generate the ACPICA release series yourself and rebase your code on
243 top of the generated ACPICA release patches: 260 top of the generated ACPICA release patches::
244 261
245 $ git clone https://github.com/acpica/acpica 262 $ git clone https://github.com/acpica/acpica
246 $ cd acpica 263 $ cd acpica
@@ -254,7 +271,7 @@ upstream.
254 3. Inspect the current divergences 271 3. Inspect the current divergences
255 272
256 If you have local copies of both Linux and upstream ACPICA, you can generate 273 If you have local copies of both Linux and upstream ACPICA, you can generate
257 a diff file indicating the state of the current divergences: 274 a diff file indicating the state of the current divergences::
258 275
259 # git clone https://github.com/acpica/acpica 276 # git clone https://github.com/acpica/acpica
260 # git clone http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 277 # git clone http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/Documentation/acpi/scan_handlers.txt b/Documentation/driver-api/acpi/scan_handlers.rst
index 3246ccf15992..7a197b3a33fc 100644
--- a/Documentation/acpi/scan_handlers.txt
+++ b/Documentation/driver-api/acpi/scan_handlers.rst
@@ -1,7 +1,13 @@
1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
3
4==================
1ACPI Scan Handlers 5ACPI Scan Handlers
6==================
7
8:Copyright: |copy| 2012, Intel Corporation
2 9
3Copyright (C) 2012, Intel Corporation 10:Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
4Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
5 11
6During system initialization and ACPI-based device hot-add, the ACPI namespace 12During system initialization and ACPI-based device hot-add, the ACPI namespace
7is scanned in search of device objects that generally represent various pieces 13is scanned in search of device objects that generally represent various pieces
@@ -30,14 +36,14 @@ to configure that link so that the kernel can use it.
30Those additional configuration tasks usually depend on the type of the hardware 36Those additional configuration tasks usually depend on the type of the hardware
31component represented by the given device node which can be determined on the 37component represented by the given device node which can be determined on the
32basis of the device node's hardware ID (HID). They are performed by objects 38basis of the device node's hardware ID (HID). They are performed by objects
33called ACPI scan handlers represented by the following structure: 39called ACPI scan handlers represented by the following structure::
34 40
35struct acpi_scan_handler { 41 struct acpi_scan_handler {
36 const struct acpi_device_id *ids; 42 const struct acpi_device_id *ids;
37 struct list_head list_node; 43 struct list_head list_node;
38 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); 44 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
39 void (*detach)(struct acpi_device *dev); 45 void (*detach)(struct acpi_device *dev);
40}; 46 };
41 47
42where ids is the list of IDs of device nodes the given handler is supposed to 48where ids is the list of IDs of device nodes the given handler is supposed to
43take care of, list_node is the hook to the global list of ACPI scan handlers 49take care of, list_node is the hook to the global list of ACPI scan handlers
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
index c0b600ed9961..aa87075c7846 100644
--- a/Documentation/driver-api/index.rst
+++ b/Documentation/driver-api/index.rst
@@ -56,6 +56,7 @@ available subsections can be seen below.
56 slimbus 56 slimbus
57 soundwire/index 57 soundwire/index
58 fpga/index 58 fpga/index
59 acpi/index
59 60
60.. only:: subproject and html 61.. only:: subproject and html
61 62
diff --git a/Documentation/acpi/DSD-properties-rules.txt b/Documentation/firmware-guide/acpi/DSD-properties-rules.rst
index 3e4862bdad98..4306f29b6103 100644
--- a/Documentation/acpi/DSD-properties-rules.txt
+++ b/Documentation/firmware-guide/acpi/DSD-properties-rules.rst
@@ -1,8 +1,11 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3==================================
1_DSD Device Properties Usage Rules 4_DSD Device Properties Usage Rules
2---------------------------------- 5==================================
3 6
4Properties, Property Sets and Property Subsets 7Properties, Property Sets and Property Subsets
5---------------------------------------------- 8==============================================
6 9
7The _DSD (Device Specific Data) configuration object, introduced in ACPI 5.1, 10The _DSD (Device Specific Data) configuration object, introduced in ACPI 5.1,
8allows any type of device configuration data to be provided via the ACPI 11allows any type of device configuration data to be provided via the ACPI
@@ -18,7 +21,7 @@ specific type) associated with it.
18 21
19In the ACPI _DSD context it is an element of the sub-package following the 22In the ACPI _DSD context it is an element of the sub-package following the
20generic Device Properties UUID in the _DSD return package as specified in the 23generic Device Properties UUID in the _DSD return package as specified in the
21Device Properties UUID definition document [1]. 24Device Properties UUID definition document [1]_.
22 25
23It also may be regarded as the definition of a key and the associated data type 26It also may be regarded as the definition of a key and the associated data type
24that can be returned by _DSD in the Device Properties UUID sub-package for a 27that can be returned by _DSD in the Device Properties UUID sub-package for a
@@ -33,14 +36,14 @@ Property subsets are nested collections of properties. Each of them is
33associated with an additional key (name) allowing the subset to be referred 36associated with an additional key (name) allowing the subset to be referred
34to as a whole (and to be treated as a separate entity). The canonical 37to as a whole (and to be treated as a separate entity). The canonical
35representation of property subsets is via the mechanism specified in the 38representation of property subsets is via the mechanism specified in the
36Hierarchical Properties Extension UUID definition document [2]. 39Hierarchical Properties Extension UUID definition document [2]_.
37 40
38Property sets may be hierarchical. That is, a property set may contain 41Property sets may be hierarchical. That is, a property set may contain
39multiple property subsets that each may contain property subsets of its 42multiple property subsets that each may contain property subsets of its
40own and so on. 43own and so on.
41 44
42General Validity Rule for Property Sets 45General Validity Rule for Property Sets
43--------------------------------------- 46=======================================
44 47
45Valid property sets must follow the guidance given by the Device Properties UUID 48Valid property sets must follow the guidance given by the Device Properties UUID
46definition document [1]. 49definition document [1].
@@ -73,7 +76,7 @@ suitable for the ACPI environment and consequently they cannot belong to a valid
73property set. 76property set.
74 77
75Property Sets and Device Tree Bindings 78Property Sets and Device Tree Bindings
76-------------------------------------- 79======================================
77 80
78It often is useful to make _DSD return property sets that follow Device Tree 81It often is useful to make _DSD return property sets that follow Device Tree
79bindings. 82bindings.
@@ -91,7 +94,7 @@ expected to automatically work in the ACPI environment regardless of their
91contents. 94contents.
92 95
93References 96References
94---------- 97==========
95 98
96[1] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf 99.. [1] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
97[2] http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf 100.. [2] http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf
diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/firmware-guide/acpi/acpi-lid.rst
index effe7af3a5af..874ce0ed340d 100644
--- a/Documentation/acpi/acpi-lid.txt
+++ b/Documentation/firmware-guide/acpi/acpi-lid.rst
@@ -1,13 +1,18 @@
1Special Usage Model of the ACPI Control Method Lid Device 1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
2 3
3Copyright (C) 2016, Intel Corporation 4=========================================================
4Author: Lv Zheng <lv.zheng@intel.com> 5Special Usage Model of the ACPI Control Method Lid Device
6=========================================================
5 7
8:Copyright: |copy| 2016, Intel Corporation
6 9
7Abstract: 10:Author: Lv Zheng <lv.zheng@intel.com>
8 11
9Platforms containing lids convey lid state (open/close) to OSPMs using a 12Abstract
10control method lid device. To implement this, the AML tables issue 13========
14Platforms containing lids convey lid state (open/close) to OSPMs
15using a control method lid device. To implement this, the AML tables issue
11Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has 16Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has
12changed. The _LID control method for the lid device must be implemented to 17changed. The _LID control method for the lid device must be implemented to
13report the "current" state of the lid as either "opened" or "closed". 18report the "current" state of the lid as either "opened" or "closed".
@@ -19,7 +24,8 @@ taken into account. This document describes the restrictions and the
19expections of the Linux ACPI lid device driver. 24expections of the Linux ACPI lid device driver.
20 25
21 26
221. Restrictions of the returning value of the _LID control method 27Restrictions of the returning value of the _LID control method
28==============================================================
23 29
24The _LID control method is described to return the "current" lid state. 30The _LID control method is described to return the "current" lid state.
25However the word of "current" has ambiguity, some buggy AML tables return 31However the word of "current" has ambiguity, some buggy AML tables return
@@ -30,7 +36,8 @@ initial returning value. When the AML tables implement this control method
30with cached value, the initial returning value is likely not reliable. 36with cached value, the initial returning value is likely not reliable.
31There are platforms always retun "closed" as initial lid state. 37There are platforms always retun "closed" as initial lid state.
32 38
332. Restrictions of the lid state change notifications 39Restrictions of the lid state change notifications
40==================================================
34 41
35There are buggy AML tables never notifying when the lid device state is 42There are buggy AML tables never notifying when the lid device state is
36changed to "opened". Thus the "opened" notification is not guaranteed. But 43changed to "opened". Thus the "opened" notification is not guaranteed. But
@@ -39,18 +46,22 @@ state is changed to "closed". The "closed" notification is normally used to
39trigger some system power saving operations on Windows. Since it is fully 46trigger some system power saving operations on Windows. Since it is fully
40tested, it is reliable from all AML tables. 47tested, it is reliable from all AML tables.
41 48
423. Expections for the userspace users of the ACPI lid device driver 49Expections for the userspace users of the ACPI lid device driver
50================================================================
43 51
44The ACPI button driver exports the lid state to the userspace via the 52The ACPI button driver exports the lid state to the userspace via the
45following file: 53following file::
54
46 /proc/acpi/button/lid/LID0/state 55 /proc/acpi/button/lid/LID0/state
56
47This file actually calls the _LID control method described above. And given 57This file actually calls the _LID control method described above. And given
48the previous explanation, it is not reliable enough on some platforms. So 58the previous explanation, it is not reliable enough on some platforms. So
49it is advised for the userspace program to not to solely rely on this file 59it is advised for the userspace program to not to solely rely on this file
50to determine the actual lid state. 60to determine the actual lid state.
51 61
52The ACPI button driver emits the following input event to the userspace: 62The ACPI button driver emits the following input event to the userspace:
53 SW_LID 63 * SW_LID
64
54The ACPI lid device driver is implemented to try to deliver the platform 65The ACPI lid device driver is implemented to try to deliver the platform
55triggered events to the userspace. However, given the fact that the buggy 66triggered events to the userspace. However, given the fact that the buggy
56firmware cannot make sure "opened"/"closed" events are paired, the ACPI 67firmware cannot make sure "opened"/"closed" events are paired, the ACPI
@@ -59,20 +70,25 @@ button driver uses the following 3 modes in order not to trigger issues.
59If the userspace hasn't been prepared to ignore the unreliable "opened" 70If the userspace hasn't been prepared to ignore the unreliable "opened"
60events and the unreliable initial state notification, Linux users can use 71events and the unreliable initial state notification, Linux users can use
61the following kernel parameters to handle the possible issues: 72the following kernel parameters to handle the possible issues:
73
62A. button.lid_init_state=method: 74A. button.lid_init_state=method:
63 When this option is specified, the ACPI button driver reports the 75 When this option is specified, the ACPI button driver reports the
64 initial lid state using the returning value of the _LID control method 76 initial lid state using the returning value of the _LID control method
65 and whether the "opened"/"closed" events are paired fully relies on the 77 and whether the "opened"/"closed" events are paired fully relies on the
66 firmware implementation. 78 firmware implementation.
79
67 This option can be used to fix some platforms where the returning value 80 This option can be used to fix some platforms where the returning value
68 of the _LID control method is reliable but the initial lid state 81 of the _LID control method is reliable but the initial lid state
69 notification is missing. 82 notification is missing.
83
70 This option is the default behavior during the period the userspace 84 This option is the default behavior during the period the userspace
71 isn't ready to handle the buggy AML tables. 85 isn't ready to handle the buggy AML tables.
86
72B. button.lid_init_state=open: 87B. button.lid_init_state=open:
73 When this option is specified, the ACPI button driver always reports the 88 When this option is specified, the ACPI button driver always reports the
74 initial lid state as "opened" and whether the "opened"/"closed" events 89 initial lid state as "opened" and whether the "opened"/"closed" events
75 are paired fully relies on the firmware implementation. 90 are paired fully relies on the firmware implementation.
91
76 This may fix some platforms where the returning value of the _LID 92 This may fix some platforms where the returning value of the _LID
77 control method is not reliable and the initial lid state notification is 93 control method is not reliable and the initial lid state notification is
78 missing. 94 missing.
@@ -80,6 +96,7 @@ B. button.lid_init_state=open:
80If the userspace has been prepared to ignore the unreliable "opened" events 96If the userspace has been prepared to ignore the unreliable "opened" events
81and the unreliable initial state notification, Linux users should always 97and the unreliable initial state notification, Linux users should always
82use the following kernel parameter: 98use the following kernel parameter:
99
83C. button.lid_init_state=ignore: 100C. button.lid_init_state=ignore:
84 When this option is specified, the ACPI button driver never reports the 101 When this option is specified, the ACPI button driver never reports the
85 initial lid state and there is a compensation mechanism implemented to 102 initial lid state and there is a compensation mechanism implemented to
@@ -89,6 +106,7 @@ C. button.lid_init_state=ignore:
89 notifications can be delivered to the userspace when the lid is actually 106 notifications can be delivered to the userspace when the lid is actually
90 opens given that some AML tables do not send "opened" notifications 107 opens given that some AML tables do not send "opened" notifications
91 reliably. 108 reliably.
109
92 In this mode, if everything is correctly implemented by the platform 110 In this mode, if everything is correctly implemented by the platform
93 firmware, the old userspace programs should still work. Otherwise, the 111 firmware, the old userspace programs should still work. Otherwise, the
94 new userspace programs are required to work with the ACPI button driver. 112 new userspace programs are required to work with the ACPI button driver.
diff --git a/Documentation/firmware-guide/acpi/aml-debugger.rst b/Documentation/firmware-guide/acpi/aml-debugger.rst
new file mode 100644
index 000000000000..a889d43bc6c5
--- /dev/null
+++ b/Documentation/firmware-guide/acpi/aml-debugger.rst
@@ -0,0 +1,75 @@
1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
3
4================
5The AML Debugger
6================
7
8:Copyright: |copy| 2016, Intel Corporation
9:Author: Lv Zheng <lv.zheng@intel.com>
10
11
12This document describes the usage of the AML debugger embedded in the Linux
13kernel.
14
151. Build the debugger
16=====================
17
18The following kernel configuration items are required to enable the AML
19debugger interface from the Linux kernel::
20
21 CONFIG_ACPI_DEBUGGER=y
22 CONFIG_ACPI_DEBUGGER_USER=m
23
24The userspace utilities can be built from the kernel source tree using
25the following commands::
26
27 $ cd tools
28 $ make acpi
29
30The resultant userspace tool binary is then located at::
31
32 tools/power/acpi/acpidbg
33
34It can be installed to system directories by running "make install" (as a
35sufficiently privileged user).
36
372. Start the userspace debugger interface
38=========================================
39
40After booting the kernel with the debugger built-in, the debugger can be
41started by using the following commands::
42
43 # mount -t debugfs none /sys/kernel/debug
44 # modprobe acpi_dbg
45 # tools/power/acpi/acpidbg
46
47That spawns the interactive AML debugger environment where you can execute
48debugger commands.
49
50The commands are documented in the "ACPICA Overview and Programmer Reference"
51that can be downloaded from
52
53https://acpica.org/documentation
54
55The detailed debugger commands reference is located in Chapter 12 "ACPICA
56Debugger Reference". The "help" command can be used for a quick reference.
57
583. Stop the userspace debugger interface
59========================================
60
61The interactive debugger interface can be closed by pressing Ctrl+C or using
62the "quit" or "exit" commands. When finished, unload the module with::
63
64 # rmmod acpi_dbg
65
66The module unloading may fail if there is an acpidbg instance running.
67
684. Run the debugger in a script
69===============================
70
71It may be useful to run the AML debugger in a test script. "acpidbg" supports
72this in a special "batch" mode. For example, the following command outputs
73the entire ACPI namespace::
74
75 # acpidbg -b "namespace"
diff --git a/Documentation/acpi/apei/einj.txt b/Documentation/firmware-guide/acpi/apei/einj.rst
index e550c8b98139..e588bccf5158 100644
--- a/Documentation/acpi/apei/einj.txt
+++ b/Documentation/firmware-guide/acpi/apei/einj.rst
@@ -1,13 +1,16 @@
1 APEI Error INJection 1.. SPDX-License-Identifier: GPL-2.0
2 ~~~~~~~~~~~~~~~~~~~~ 2
3====================
4APEI Error INJection
5====================
3 6
4EINJ provides a hardware error injection mechanism. It is very useful 7EINJ provides a hardware error injection mechanism. It is very useful
5for debugging and testing APEI and RAS features in general. 8for debugging and testing APEI and RAS features in general.
6 9
7You need to check whether your BIOS supports EINJ first. For that, look 10You need to check whether your BIOS supports EINJ first. For that, look
8for early boot messages similar to this one: 11for early boot messages similar to this one::
9 12
10ACPI: EINJ 0x000000007370A000 000150 (v01 INTEL 00000001 INTL 00000001) 13 ACPI: EINJ 0x000000007370A000 000150 (v01 INTEL 00000001 INTL 00000001)
11 14
12which shows that the BIOS is exposing an EINJ table - it is the 15which shows that the BIOS is exposing an EINJ table - it is the
13mechanism through which the injection is done. 16mechanism through which the injection is done.
@@ -23,11 +26,11 @@ order to see the APEI,EINJ,... functionality supported and exposed by
23the BIOS menu. 26the BIOS menu.
24 27
25To use EINJ, make sure the following are options enabled in your kernel 28To use EINJ, make sure the following are options enabled in your kernel
26configuration: 29configuration::
27 30
28CONFIG_DEBUG_FS 31 CONFIG_DEBUG_FS
29CONFIG_ACPI_APEI 32 CONFIG_ACPI_APEI
30CONFIG_ACPI_APEI_EINJ 33 CONFIG_ACPI_APEI_EINJ
31 34
32The EINJ user interface is in <debugfs mount point>/apei/einj. 35The EINJ user interface is in <debugfs mount point>/apei/einj.
33 36
@@ -37,20 +40,22 @@ The following files belong to it:
37 40
38 This file shows which error types are supported: 41 This file shows which error types are supported:
39 42
43 ================ ===================================
40 Error Type Value Error Description 44 Error Type Value Error Description
41 ================ ================= 45 ================ ===================================
42 0x00000001 Processor Correctable 46 0x00000001 Processor Correctable
43 0x00000002 Processor Uncorrectable non-fatal 47 0x00000002 Processor Uncorrectable non-fatal
44 0x00000004 Processor Uncorrectable fatal 48 0x00000004 Processor Uncorrectable fatal
45 0x00000008 Memory Correctable 49 0x00000008 Memory Correctable
46 0x00000010 Memory Uncorrectable non-fatal 50 0x00000010 Memory Uncorrectable non-fatal
47 0x00000020 Memory Uncorrectable fatal 51 0x00000020 Memory Uncorrectable fatal
48 0x00000040 PCI Express Correctable 52 0x00000040 PCI Express Correctable
49 0x00000080 PCI Express Uncorrectable fatal 53 0x00000080 PCI Express Uncorrectable fatal
50 0x00000100 PCI Express Uncorrectable non-fatal 54 0x00000100 PCI Express Uncorrectable non-fatal
51 0x00000200 Platform Correctable 55 0x00000200 Platform Correctable
52 0x00000400 Platform Uncorrectable non-fatal 56 0x00000400 Platform Uncorrectable non-fatal
53 0x00000800 Platform Uncorrectable fatal 57 0x00000800 Platform Uncorrectable fatal
58 ================ ===================================
54 59
55 The format of the file contents are as above, except present are only 60 The format of the file contents are as above, except present are only
56 the available error types. 61 the available error types.
@@ -73,9 +78,12 @@ The following files belong to it:
73 injection. Value is a bitmask as specified in ACPI5.0 spec for the 78 injection. Value is a bitmask as specified in ACPI5.0 spec for the
74 SET_ERROR_TYPE_WITH_ADDRESS data structure: 79 SET_ERROR_TYPE_WITH_ADDRESS data structure:
75 80
76 Bit 0 - Processor APIC field valid (see param3 below). 81 Bit 0
77 Bit 1 - Memory address and mask valid (param1 and param2). 82 Processor APIC field valid (see param3 below).
78 Bit 2 - PCIe (seg,bus,dev,fn) valid (see param4 below). 83 Bit 1
84 Memory address and mask valid (param1 and param2).
85 Bit 2
86 PCIe (seg,bus,dev,fn) valid (see param4 below).
79 87
80 If set to zero, legacy behavior is mimicked where the type of 88 If set to zero, legacy behavior is mimicked where the type of
81 injection specifies just one bit set, and param1 is multiplexed. 89 injection specifies just one bit set, and param1 is multiplexed.
@@ -121,7 +129,7 @@ BIOS versions based on the ACPI 5.0 specification have more control over
121the target of the injection. For processor-related errors (type 0x1, 0x2 129the target of the injection. For processor-related errors (type 0x1, 0x2
122and 0x4), you can set flags to 0x3 (param3 for bit 0, and param1 and 130and 0x4), you can set flags to 0x3 (param3 for bit 0, and param1 and
123param2 for bit 1) so that you have more information added to the error 131param2 for bit 1) so that you have more information added to the error
124signature being injected. The actual data passed is this: 132signature being injected. The actual data passed is this::
125 133
126 memory_address = param1; 134 memory_address = param1;
127 memory_address_range = param2; 135 memory_address_range = param2;
@@ -131,7 +139,7 @@ signature being injected. The actual data passed is this:
131For memory errors (type 0x8, 0x10 and 0x20) the address is set using 139For memory errors (type 0x8, 0x10 and 0x20) the address is set using
132param1 with a mask in param2 (0x0 is equivalent to all ones). For PCI 140param1 with a mask in param2 (0x0 is equivalent to all ones). For PCI
133express errors (type 0x40, 0x80 and 0x100) the segment, bus, device and 141express errors (type 0x40, 0x80 and 0x100) the segment, bus, device and
134function are specified using param1: 142function are specified using param1::
135 143
136 31 24 23 16 15 11 10 8 7 0 144 31 24 23 16 15 11 10 8 7 0
137 +-------------------------------------------------+ 145 +-------------------------------------------------+
@@ -152,26 +160,26 @@ documentation for details (and expect changes to this API if vendors
152creativity in using this feature expands beyond our expectations). 160creativity in using this feature expands beyond our expectations).
153 161
154 162
155An error injection example: 163An error injection example::
156 164
157# cd /sys/kernel/debug/apei/einj 165 # cd /sys/kernel/debug/apei/einj
158# cat available_error_type # See which errors can be injected 166 # cat available_error_type # See which errors can be injected
1590x00000002 Processor Uncorrectable non-fatal 167 0x00000002 Processor Uncorrectable non-fatal
1600x00000008 Memory Correctable 168 0x00000008 Memory Correctable
1610x00000010 Memory Uncorrectable non-fatal 169 0x00000010 Memory Uncorrectable non-fatal
162# echo 0x12345000 > param1 # Set memory address for injection 170 # echo 0x12345000 > param1 # Set memory address for injection
163# echo $((-1 << 12)) > param2 # Mask 0xfffffffffffff000 - anywhere in this page 171 # echo $((-1 << 12)) > param2 # Mask 0xfffffffffffff000 - anywhere in this page
164# echo 0x8 > error_type # Choose correctable memory error 172 # echo 0x8 > error_type # Choose correctable memory error
165# echo 1 > error_inject # Inject now 173 # echo 1 > error_inject # Inject now
166 174
167You should see something like this in dmesg: 175You should see something like this in dmesg::
168 176
169[22715.830801] EDAC sbridge MC3: HANDLING MCE MEMORY ERROR 177 [22715.830801] EDAC sbridge MC3: HANDLING MCE MEMORY ERROR
170[22715.834759] EDAC sbridge MC3: CPU 0: Machine Check Event: 0 Bank 7: 8c00004000010090 178 [22715.834759] EDAC sbridge MC3: CPU 0: Machine Check Event: 0 Bank 7: 8c00004000010090
171[22715.834759] EDAC sbridge MC3: TSC 0 179 [22715.834759] EDAC sbridge MC3: TSC 0
172[22715.834759] EDAC sbridge MC3: ADDR 12345000 EDAC sbridge MC3: MISC 144780c86 180 [22715.834759] EDAC sbridge MC3: ADDR 12345000 EDAC sbridge MC3: MISC 144780c86
173[22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0 181 [22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0
174[22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0) 182 [22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0)
175 183
176For more information about EINJ, please refer to ACPI specification 184For more information about EINJ, please refer to ACPI specification
177version 4.0, section 17.5 and ACPI 5.0, section 18.6. 185version 4.0, section 17.5 and ACPI 5.0, section 18.6.
diff --git a/Documentation/firmware-guide/acpi/apei/output_format.rst b/Documentation/firmware-guide/acpi/apei/output_format.rst
new file mode 100644
index 000000000000..c2e7ebddb529
--- /dev/null
+++ b/Documentation/firmware-guide/acpi/apei/output_format.rst
@@ -0,0 +1,150 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3==================
4APEI output format
5==================
6
7APEI uses printk as hardware error reporting interface, the output
8format is as follow::
9
10 <error record> :=
11 APEI generic hardware error status
12 severity: <integer>, <severity string>
13 section: <integer>, severity: <integer>, <severity string>
14 flags: <integer>
15 <section flags strings>
16 fru_id: <uuid string>
17 fru_text: <string>
18 section_type: <section type string>
19 <section data>
20
21 <severity string>* := recoverable | fatal | corrected | info
22
23 <section flags strings># :=
24 [primary][, containment warning][, reset][, threshold exceeded]\
25 [, resource not accessible][, latent error]
26
27 <section type string> := generic processor error | memory error | \
28 PCIe error | unknown, <uuid string>
29
30 <section data> :=
31 <generic processor section data> | <memory section data> | \
32 <pcie section data> | <null>
33
34 <generic processor section data> :=
35 [processor_type: <integer>, <proc type string>]
36 [processor_isa: <integer>, <proc isa string>]
37 [error_type: <integer>
38 <proc error type strings>]
39 [operation: <integer>, <proc operation string>]
40 [flags: <integer>
41 <proc flags strings>]
42 [level: <integer>]
43 [version_info: <integer>]
44 [processor_id: <integer>]
45 [target_address: <integer>]
46 [requestor_id: <integer>]
47 [responder_id: <integer>]
48 [IP: <integer>]
49
50 <proc type string>* := IA32/X64 | IA64
51
52 <proc isa string>* := IA32 | IA64 | X64
53
54 <processor error type strings># :=
55 [cache error][, TLB error][, bus error][, micro-architectural error]
56
57 <proc operation string>* := unknown or generic | data read | data write | \
58 instruction execution
59
60 <proc flags strings># :=
61 [restartable][, precise IP][, overflow][, corrected]
62
63 <memory section data> :=
64 [error_status: <integer>]
65 [physical_address: <integer>]
66 [physical_address_mask: <integer>]
67 [node: <integer>]
68 [card: <integer>]
69 [module: <integer>]
70 [bank: <integer>]
71 [device: <integer>]
72 [row: <integer>]
73 [column: <integer>]
74 [bit_position: <integer>]
75 [requestor_id: <integer>]
76 [responder_id: <integer>]
77 [target_id: <integer>]
78 [error_type: <integer>, <mem error type string>]
79
80 <mem error type string>* :=
81 unknown | no error | single-bit ECC | multi-bit ECC | \
82 single-symbol chipkill ECC | multi-symbol chipkill ECC | master abort | \
83 target abort | parity error | watchdog timeout | invalid address | \
84 mirror Broken | memory sparing | scrub corrected error | \
85 scrub uncorrected error
86
87 <pcie section data> :=
88 [port_type: <integer>, <pcie port type string>]
89 [version: <integer>.<integer>]
90 [command: <integer>, status: <integer>]
91 [device_id: <integer>:<integer>:<integer>.<integer>
92 slot: <integer>
93 secondary_bus: <integer>
94 vendor_id: <integer>, device_id: <integer>
95 class_code: <integer>]
96 [serial number: <integer>, <integer>]
97 [bridge: secondary_status: <integer>, control: <integer>]
98 [aer_status: <integer>, aer_mask: <integer>
99 <aer status string>
100 [aer_uncor_severity: <integer>]
101 aer_layer=<aer layer string>, aer_agent=<aer agent string>
102 aer_tlp_header: <integer> <integer> <integer> <integer>]
103
104 <pcie port type string>* := PCIe end point | legacy PCI end point | \
105 unknown | unknown | root port | upstream switch port | \
106 downstream switch port | PCIe to PCI/PCI-X bridge | \
107 PCI/PCI-X to PCIe bridge | root complex integrated endpoint device | \
108 root complex event collector
109
110 if section severity is fatal or recoverable
111 <aer status string># :=
112 unknown | unknown | unknown | unknown | Data Link Protocol | \
113 unknown | unknown | unknown | unknown | unknown | unknown | unknown | \
114 Poisoned TLP | Flow Control Protocol | Completion Timeout | \
115 Completer Abort | Unexpected Completion | Receiver Overflow | \
116 Malformed TLP | ECRC | Unsupported Request
117 else
118 <aer status string># :=
119 Receiver Error | unknown | unknown | unknown | unknown | unknown | \
120 Bad TLP | Bad DLLP | RELAY_NUM Rollover | unknown | unknown | unknown | \
121 Replay Timer Timeout | Advisory Non-Fatal
122 fi
123
124 <aer layer string> :=
125 Physical Layer | Data Link Layer | Transaction Layer
126
127 <aer agent string> :=
128 Receiver ID | Requester ID | Completer ID | Transmitter ID
129
130Where, [] designate corresponding content is optional
131
132All <field string> description with * has the following format::
133
134 field: <integer>, <field string>
135
136Where value of <integer> should be the position of "string" in <field
137string> description. Otherwise, <field string> will be "unknown".
138
139All <field strings> description with # has the following format::
140
141 field: <integer>
142 <field strings>
143
144Where each string in <fields strings> corresponding to one set bit of
145<integer>. The bit position is the position of "string" in <field
146strings> description.
147
148For more detailed explanation of every field, please refer to UEFI
149specification version 2.3 or later, section Appendix N: Common
150Platform Error Record.
diff --git a/Documentation/acpi/debug.txt b/Documentation/firmware-guide/acpi/debug.rst
index 65bf47c46b6d..1a152dd1d765 100644
--- a/Documentation/acpi/debug.txt
+++ b/Documentation/firmware-guide/acpi/debug.rst
@@ -1,18 +1,21 @@
1 ACPI Debug Output 1.. SPDX-License-Identifier: GPL-2.0
2 2
3=================
4ACPI Debug Output
5=================
3 6
4The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug 7The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug
5output. This document describes how to use this facility. 8output. This document describes how to use this facility.
6 9
7Compile-time configuration 10Compile-time configuration
8-------------------------- 11==========================
9 12
10ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config 13ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config
11option is turned off, the debug messages are not even built into the 14option is turned off, the debug messages are not even built into the
12kernel. 15kernel.
13 16
14Boot- and run-time configuration 17Boot- and run-time configuration
15-------------------------------- 18================================
16 19
17When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages 20When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages
18you're interested in. At boot-time, use the acpi.debug_layer and 21you're interested in. At boot-time, use the acpi.debug_layer and
@@ -21,7 +24,7 @@ debug_layer and debug_level files in /sys/module/acpi/parameters/ to control
21the debug messages. 24the debug messages.
22 25
23debug_layer (component) 26debug_layer (component)
24----------------------- 27=======================
25 28
26The "debug_layer" is a mask that selects components of interest, e.g., a 29The "debug_layer" is a mask that selects components of interest, e.g., a
27specific driver or part of the ACPI interpreter. To build the debug_layer 30specific driver or part of the ACPI interpreter. To build the debug_layer
@@ -33,7 +36,7 @@ to /sys/module/acpi/parameters/debug_layer.
33 36
34The possible components are defined in include/acpi/acoutput.h and 37The possible components are defined in include/acpi/acoutput.h and
35include/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer 38include/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer
36shows the supported mask values, currently these: 39shows the supported mask values, currently these::
37 40
38 ACPI_UTILITIES 0x00000001 41 ACPI_UTILITIES 0x00000001
39 ACPI_HARDWARE 0x00000002 42 ACPI_HARDWARE 0x00000002
@@ -65,7 +68,7 @@ shows the supported mask values, currently these:
65 ACPI_PROCESSOR_COMPONENT 0x20000000 68 ACPI_PROCESSOR_COMPONENT 0x20000000
66 69
67debug_level 70debug_level
68----------- 71===========
69 72
70The "debug_level" is a mask that selects different types of messages, e.g., 73The "debug_level" is a mask that selects different types of messages, e.g.,
71those related to initialization, method execution, informational messages, etc. 74those related to initialization, method execution, informational messages, etc.
@@ -81,7 +84,7 @@ to /sys/module/acpi/parameters/debug_level.
81 84
82The possible levels are defined in include/acpi/acoutput.h. Reading 85The possible levels are defined in include/acpi/acoutput.h. Reading
83/sys/module/acpi/parameters/debug_level shows the supported mask values, 86/sys/module/acpi/parameters/debug_level shows the supported mask values,
84currently these: 87currently these::
85 88
86 ACPI_LV_INIT 0x00000001 89 ACPI_LV_INIT 0x00000001
87 ACPI_LV_DEBUG_OBJECT 0x00000002 90 ACPI_LV_DEBUG_OBJECT 0x00000002
@@ -113,9 +116,9 @@ currently these:
113 ACPI_LV_EVENTS 0x80000000 116 ACPI_LV_EVENTS 0x80000000
114 117
115Examples 118Examples
116-------- 119========
117 120
118For example, drivers/acpi/bus.c contains this: 121For example, drivers/acpi/bus.c contains this::
119 122
120 #define _COMPONENT ACPI_BUS_COMPONENT 123 #define _COMPONENT ACPI_BUS_COMPONENT
121 ... 124 ...
@@ -127,22 +130,22 @@ statement uses ACPI_DB_INFO, which is macro based on the ACPI_LV_INFO
127definition.) 130definition.)
128 131
129Enable all AML "Debug" output (stores to the Debug object while interpreting 132Enable all AML "Debug" output (stores to the Debug object while interpreting
130AML) during boot: 133AML) during boot::
131 134
132 acpi.debug_layer=0xffffffff acpi.debug_level=0x2 135 acpi.debug_layer=0xffffffff acpi.debug_level=0x2
133 136
134Enable PCI and PCI interrupt routing debug messages: 137Enable PCI and PCI interrupt routing debug messages::
135 138
136 acpi.debug_layer=0x400000 acpi.debug_level=0x4 139 acpi.debug_layer=0x400000 acpi.debug_level=0x4
137 140
138Enable all ACPI hardware-related messages: 141Enable all ACPI hardware-related messages::
139 142
140 acpi.debug_layer=0x2 acpi.debug_level=0xffffffff 143 acpi.debug_layer=0x2 acpi.debug_level=0xffffffff
141 144
142Enable all ACPI_DB_INFO messages after boot: 145Enable all ACPI_DB_INFO messages after boot::
143 146
144 # echo 0x4 > /sys/module/acpi/parameters/debug_level 147 # echo 0x4 > /sys/module/acpi/parameters/debug_level
145 148
146Show all valid component values: 149Show all valid component values::
147 150
148 # cat /sys/module/acpi/parameters/debug_layer 151 # cat /sys/module/acpi/parameters/debug_layer
diff --git a/Documentation/acpi/dsd/data-node-references.txt b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst
index c3871565c8cf..1351984e767c 100644
--- a/Documentation/acpi/dsd/data-node-references.txt
+++ b/Documentation/firmware-guide/acpi/dsd/data-node-references.rst
@@ -1,9 +1,12 @@
1Copyright (C) 2018 Intel Corporation 1.. SPDX-License-Identifier: GPL-2.0
2Author: Sakari Ailus <sakari.ailus@linux.intel.com> 2.. include:: <isonum.txt>
3
4 3
4===================================
5Referencing hierarchical data nodes 5Referencing hierarchical data nodes
6----------------------------------- 6===================================
7
8:Copyright: |copy| 2018 Intel Corporation
9:Author: Sakari Ailus <sakari.ailus@linux.intel.com>
7 10
8ACPI in general allows referring to device objects in the tree only. 11ACPI in general allows referring to device objects in the tree only.
9Hierarchical data extension nodes may not be referred to directly, hence this 12Hierarchical data extension nodes may not be referred to directly, hence this
@@ -28,13 +31,14 @@ extension key.
28 31
29 32
30Example 33Example
31------- 34=======
32 35
33 In the ASL snippet below, the "reference" _DSD property [2] contains a 36In the ASL snippet below, the "reference" _DSD property [2] contains a
34 device object reference to DEV0 and under that device object, a 37device object reference to DEV0 and under that device object, a
35 hierarchical data extension key "node@1" referring to the NOD1 object 38hierarchical data extension key "node@1" referring to the NOD1 object
36 and lastly, a hierarchical data extension key "anothernode" referring to 39and lastly, a hierarchical data extension key "anothernode" referring to
37 the ANOD object which is also the final target node of the reference. 40the ANOD object which is also the final target node of the reference.
41::
38 42
39 Device (DEV0) 43 Device (DEV0)
40 { 44 {
@@ -75,15 +79,15 @@ Example
75 }) 79 })
76 } 80 }
77 81
78Please also see a graph example in graph.txt . 82Please also see a graph example in :doc:`graph`.
79 83
80References 84References
81---------- 85==========
82 86
83[1] Hierarchical Data Extension UUID For _DSD. 87[1] Hierarchical Data Extension UUID For _DSD.
84 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 88<http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
85 referenced 2018-07-17. 89referenced 2018-07-17.
86 90
87[2] Device Properties UUID For _DSD. 91[2] Device Properties UUID For _DSD.
88 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 92<http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
89 referenced 2016-10-04. 93referenced 2016-10-04.
diff --git a/Documentation/acpi/dsd/graph.txt b/Documentation/firmware-guide/acpi/dsd/graph.rst
index b9ce910781dc..e0baed35b037 100644
--- a/Documentation/acpi/dsd/graph.txt
+++ b/Documentation/firmware-guide/acpi/dsd/graph.rst
@@ -1,8 +1,11 @@
1Graphs 1.. SPDX-License-Identifier: GPL-2.0
2 2
3======
4Graphs
5======
3 6
4_DSD 7_DSD
5---- 8====
6 9
7_DSD (Device Specific Data) [7] is a predefined ACPI device 10_DSD (Device Specific Data) [7] is a predefined ACPI device
8configuration object that can be used to convey information on 11configuration object that can be used to convey information on
@@ -30,7 +33,7 @@ hierarchical data extension array on each depth.
30 33
31 34
32Ports and endpoints 35Ports and endpoints
33------------------- 36===================
34 37
35The port and endpoint concepts are very similar to those in Devicetree 38The port and endpoint concepts are very similar to those in Devicetree
36[3]. A port represents an interface in a device, and an endpoint 39[3]. A port represents an interface in a device, and an endpoint
@@ -38,9 +41,9 @@ represents a connection to that interface.
38 41
39All port nodes are located under the device's "_DSD" node in the hierarchical 42All port nodes are located under the device's "_DSD" node in the hierarchical
40data extension tree. The data extension related to each port node must begin 43data extension tree. The data extension related to each port node must begin
41with "port" and must be followed by the "@" character and the number of the port 44with "port" and must be followed by the "@" character and the number of the
42as its key. The target object it refers to should be called "PRTX", where "X" is 45port as its key. The target object it refers to should be called "PRTX", where
43the number of the port. An example of such a package would be: 46"X" is the number of the port. An example of such a package would be::
44 47
45 Package() { "port@4", PRT4 } 48 Package() { "port@4", PRT4 }
46 49
@@ -49,7 +52,7 @@ data extension key of the endpoint nodes must begin with
49"endpoint" and must be followed by the "@" character and the number of the 52"endpoint" and must be followed by the "@" character and the number of the
50endpoint. The object it refers to should be called "EPXY", where "X" is the 53endpoint. The object it refers to should be called "EPXY", where "X" is the
51number of the port and "Y" is the number of the endpoint. An example of such a 54number of the port and "Y" is the number of the endpoint. An example of such a
52package would be: 55package would be::
53 56
54 Package() { "endpoint@0", EP40 } 57 Package() { "endpoint@0", EP40 }
55 58
@@ -62,85 +65,85 @@ of that port shall be zero. Similarly, if a port may only have a single
62endpoint, the number of that endpoint shall be zero. 65endpoint, the number of that endpoint shall be zero.
63 66
64The endpoint reference uses property extension with "remote-endpoint" property 67The endpoint reference uses property extension with "remote-endpoint" property
65name followed by a reference in the same package. Such references consist of the 68name followed by a reference in the same package. Such references consist of
66the remote device reference, the first package entry of the port data extension 69the remote device reference, the first package entry of the port data extension
67reference under the device and finally the first package entry of the endpoint 70reference under the device and finally the first package entry of the endpoint
68data extension reference under the port. Individual references thus appear as: 71data extension reference under the port. Individual references thus appear as::
69 72
70 Package() { device, "port@X", "endpoint@Y" } 73 Package() { device, "port@X", "endpoint@Y" }
71 74
72In the above example, "X" is the number of the port and "Y" is the number of the 75In the above example, "X" is the number of the port and "Y" is the number of
73endpoint. 76the endpoint.
74 77
75The references to endpoints must be always done both ways, to the 78The references to endpoints must be always done both ways, to the
76remote endpoint and back from the referred remote endpoint node. 79remote endpoint and back from the referred remote endpoint node.
77 80
78A simple example of this is show below: 81A simple example of this is show below::
79 82
80 Scope (\_SB.PCI0.I2C2) 83 Scope (\_SB.PCI0.I2C2)
81 { 84 {
82 Device (CAM0) 85 Device (CAM0)
83 { 86 {
84 Name (_DSD, Package () { 87 Name (_DSD, Package () {
85 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 88 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
86 Package () { 89 Package () {
87 Package () { "compatible", Package () { "nokia,smia" } }, 90 Package () { "compatible", Package () { "nokia,smia" } },
88 }, 91 },
89 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 92 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
90 Package () { 93 Package () {
91 Package () { "port@0", PRT0 }, 94 Package () { "port@0", PRT0 },
92 } 95 }
93 }) 96 })
94 Name (PRT0, Package() { 97 Name (PRT0, Package() {
95 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 98 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
96 Package () { 99 Package () {
97 Package () { "reg", 0 }, 100 Package () { "reg", 0 },
98 }, 101 },
99 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 102 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
100 Package () { 103 Package () {
101 Package () { "endpoint@0", EP00 }, 104 Package () { "endpoint@0", EP00 },
102 } 105 }
103 }) 106 })
104 Name (EP00, Package() { 107 Name (EP00, Package() {
105 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 108 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
106 Package () { 109 Package () {
107 Package () { "reg", 0 }, 110 Package () { "reg", 0 },
108 Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } }, 111 Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } },
109 } 112 }
110 }) 113 })
111 } 114 }
112 } 115 }
113 116
114 Scope (\_SB.PCI0) 117 Scope (\_SB.PCI0)
115 { 118 {
116 Device (ISP) 119 Device (ISP)
117 { 120 {
118 Name (_DSD, Package () { 121 Name (_DSD, Package () {
119 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 122 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
120 Package () { 123 Package () {
121 Package () { "port@4", PRT4 }, 124 Package () { "port@4", PRT4 },
122 } 125 }
123 }) 126 })
124 127
125 Name (PRT4, Package() { 128 Name (PRT4, Package() {
126 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 129 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
127 Package () { 130 Package () {
128 Package () { "reg", 4 }, /* CSI-2 port number */ 131 Package () { "reg", 4 }, /* CSI-2 port number */
129 }, 132 },
130 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 133 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
131 Package () { 134 Package () {
132 Package () { "endpoint@0", EP40 }, 135 Package () { "endpoint@0", EP40 },
133 } 136 }
134 }) 137 })
135 138
136 Name (EP40, Package() { 139 Name (EP40, Package() {
137 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 140 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
138 Package () { 141 Package () {
139 Package () { "reg", 0 }, 142 Package () { "reg", 0 },
140 Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } }, 143 Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } },
141 } 144 }
142 }) 145 })
143 } 146 }
144 } 147 }
145 148
146Here, the port 0 of the "CAM0" device is connected to the port 4 of 149Here, the port 0 of the "CAM0" device is connected to the port 4 of
@@ -148,27 +151,27 @@ the "ISP" device and vice versa.
148 151
149 152
150References 153References
151---------- 154==========
152 155
153[1] _DSD (Device Specific Data) Implementation Guide. 156[1] _DSD (Device Specific Data) Implementation Guide.
154 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm>, 157 http://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm,
155 referenced 2016-10-03. 158 referenced 2016-10-03.
156 159
157[2] Devicetree. <URL:http://www.devicetree.org>, referenced 2016-10-03. 160[2] Devicetree. http://www.devicetree.org, referenced 2016-10-03.
158 161
159[3] Documentation/devicetree/bindings/graph.txt 162[3] Documentation/devicetree/bindings/graph.txt
160 163
161[4] Device Properties UUID For _DSD. 164[4] Device Properties UUID For _DSD.
162 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 165 http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf,
163 referenced 2016-10-04. 166 referenced 2016-10-04.
164 167
165[5] Hierarchical Data Extension UUID For _DSD. 168[5] Hierarchical Data Extension UUID For _DSD.
166 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 169 http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf,
167 referenced 2016-10-04. 170 referenced 2016-10-04.
168 171
169[6] Advanced Configuration and Power Interface Specification. 172[6] Advanced Configuration and Power Interface Specification.
170 <URL:http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf>, 173 http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf,
171 referenced 2016-10-04. 174 referenced 2016-10-04.
172 175
173[7] _DSD Device Properties Usage Rules. 176[7] _DSD Device Properties Usage Rules.
174 Documentation/acpi/DSD-properties-rules.txt 177 :doc:`../DSD-properties-rules`
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/firmware-guide/acpi/enumeration.rst
index 7bcf9c3d9fbe..6b32b7be8c85 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/firmware-guide/acpi/enumeration.rst
@@ -1,5 +1,9 @@
1ACPI based device enumeration 1.. SPDX-License-Identifier: GPL-2.0
2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2
3=============================
4ACPI Based Device Enumeration
5=============================
6
3ACPI 5 introduced a set of new resources (UartTSerialBus, I2cSerialBus, 7ACPI 5 introduced a set of new resources (UartTSerialBus, I2cSerialBus,
4SpiSerialBus, GpioIo and GpioInt) which can be used in enumerating slave 8SpiSerialBus, GpioIo and GpioInt) which can be used in enumerating slave
5devices behind serial bus controllers. 9devices behind serial bus controllers.
@@ -11,12 +15,12 @@ that are accessed through memory-mapped registers.
11In order to support this and re-use the existing drivers as much as 15In order to support this and re-use the existing drivers as much as
12possible we decided to do following: 16possible we decided to do following:
13 17
14 o Devices that have no bus connector resource are represented as 18 - Devices that have no bus connector resource are represented as
15 platform devices. 19 platform devices.
16 20
17 o Devices behind real busses where there is a connector resource 21 - Devices behind real busses where there is a connector resource
18 are represented as struct spi_device or struct i2c_device 22 are represented as struct spi_device or struct i2c_device
19 (standard UARTs are not busses so there is no struct uart_device). 23 (standard UARTs are not busses so there is no struct uart_device).
20 24
21As both ACPI and Device Tree represent a tree of devices (and their 25As both ACPI and Device Tree represent a tree of devices (and their
22resources) this implementation follows the Device Tree way as much as 26resources) this implementation follows the Device Tree way as much as
@@ -31,7 +35,8 @@ enumerated from ACPI namespace. This handle can be used to extract other
31device-specific configuration. There is an example of this below. 35device-specific configuration. There is an example of this below.
32 36
33Platform bus support 37Platform bus support
34~~~~~~~~~~~~~~~~~~~~ 38====================
39
35Since we are using platform devices to represent devices that are not 40Since we are using platform devices to represent devices that are not
36connected to any physical bus we only need to implement a platform driver 41connected to any physical bus we only need to implement a platform driver
37for the device and add supported ACPI IDs. If this same IP-block is used on 42for the device and add supported ACPI IDs. If this same IP-block is used on
@@ -39,7 +44,7 @@ some other non-ACPI platform, the driver might work out of the box or needs
39some minor changes. 44some minor changes.
40 45
41Adding ACPI support for an existing driver should be pretty 46Adding ACPI support for an existing driver should be pretty
42straightforward. Here is the simplest example: 47straightforward. Here is the simplest example::
43 48
44 #ifdef CONFIG_ACPI 49 #ifdef CONFIG_ACPI
45 static const struct acpi_device_id mydrv_acpi_match[] = { 50 static const struct acpi_device_id mydrv_acpi_match[] = {
@@ -61,12 +66,13 @@ configuring GPIOs it can get its ACPI handle and extract this information
61from ACPI tables. 66from ACPI tables.
62 67
63DMA support 68DMA support
64~~~~~~~~~~~ 69===========
70
65DMA controllers enumerated via ACPI should be registered in the system to 71DMA controllers enumerated via ACPI should be registered in the system to
66provide generic access to their resources. For example, a driver that would 72provide generic access to their resources. For example, a driver that would
67like to be accessible to slave devices via generic API call 73like to be accessible to slave devices via generic API call
68dma_request_slave_channel() must register itself at the end of the probe 74dma_request_slave_channel() must register itself at the end of the probe
69function like this: 75function like this::
70 76
71 err = devm_acpi_dma_controller_register(dev, xlate_func, dw); 77 err = devm_acpi_dma_controller_register(dev, xlate_func, dw);
72 /* Handle the error if it's not a case of !CONFIG_ACPI */ 78 /* Handle the error if it's not a case of !CONFIG_ACPI */
@@ -74,7 +80,7 @@ function like this:
74and implement custom xlate function if needed (usually acpi_dma_simple_xlate() 80and implement custom xlate function if needed (usually acpi_dma_simple_xlate()
75is enough) which converts the FixedDMA resource provided by struct 81is enough) which converts the FixedDMA resource provided by struct
76acpi_dma_spec into the corresponding DMA channel. A piece of code for that case 82acpi_dma_spec into the corresponding DMA channel. A piece of code for that case
77could look like: 83could look like::
78 84
79 #ifdef CONFIG_ACPI 85 #ifdef CONFIG_ACPI
80 struct filter_args { 86 struct filter_args {
@@ -114,7 +120,7 @@ provided by struct acpi_dma.
114Clients must call dma_request_slave_channel() with the string parameter that 120Clients must call dma_request_slave_channel() with the string parameter that
115corresponds to a specific FixedDMA resource. By default "tx" means the first 121corresponds to a specific FixedDMA resource. By default "tx" means the first
116entry of the FixedDMA resource array, "rx" means the second entry. The table 122entry of the FixedDMA resource array, "rx" means the second entry. The table
117below shows a layout: 123below shows a layout::
118 124
119 Device (I2C0) 125 Device (I2C0)
120 { 126 {
@@ -138,12 +144,13 @@ acpi_dma_request_slave_chan_by_index() directly and therefore choose the
138specific FixedDMA resource by its index. 144specific FixedDMA resource by its index.
139 145
140SPI serial bus support 146SPI serial bus support
141~~~~~~~~~~~~~~~~~~~~~~ 147======================
148
142Slave devices behind SPI bus have SpiSerialBus resource attached to them. 149Slave devices behind SPI bus have SpiSerialBus resource attached to them.
143This is extracted automatically by the SPI core and the slave devices are 150This is extracted automatically by the SPI core and the slave devices are
144enumerated once spi_register_master() is called by the bus driver. 151enumerated once spi_register_master() is called by the bus driver.
145 152
146Here is what the ACPI namespace for a SPI slave might look like: 153Here is what the ACPI namespace for a SPI slave might look like::
147 154
148 Device (EEP0) 155 Device (EEP0)
149 { 156 {
@@ -163,7 +170,7 @@ Here is what the ACPI namespace for a SPI slave might look like:
163 170
164The SPI device drivers only need to add ACPI IDs in a similar way than with 171The SPI device drivers only need to add ACPI IDs in a similar way than with
165the platform device drivers. Below is an example where we add ACPI support 172the platform device drivers. Below is an example where we add ACPI support
166to at25 SPI eeprom driver (this is meant for the above ACPI snippet): 173to at25 SPI eeprom driver (this is meant for the above ACPI snippet)::
167 174
168 #ifdef CONFIG_ACPI 175 #ifdef CONFIG_ACPI
169 static const struct acpi_device_id at25_acpi_match[] = { 176 static const struct acpi_device_id at25_acpi_match[] = {
@@ -182,7 +189,7 @@ to at25 SPI eeprom driver (this is meant for the above ACPI snippet):
182 189
183Note that this driver actually needs more information like page size of the 190Note that this driver actually needs more information like page size of the
184eeprom etc. but at the time writing this there is no standard way of 191eeprom etc. but at the time writing this there is no standard way of
185passing those. One idea is to return this in _DSM method like: 192passing those. One idea is to return this in _DSM method like::
186 193
187 Device (EEP0) 194 Device (EEP0)
188 { 195 {
@@ -202,7 +209,7 @@ passing those. One idea is to return this in _DSM method like:
202 } 209 }
203 210
204Then the at25 SPI driver can get this configuration by calling _DSM on its 211Then the at25 SPI driver can get this configuration by calling _DSM on its
205ACPI handle like: 212ACPI handle like::
206 213
207 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 214 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
208 struct acpi_object_list input; 215 struct acpi_object_list input;
@@ -220,14 +227,15 @@ ACPI handle like:
220 kfree(output.pointer); 227 kfree(output.pointer);
221 228
222I2C serial bus support 229I2C serial bus support
223~~~~~~~~~~~~~~~~~~~~~~ 230======================
231
224The slaves behind I2C bus controller only need to add the ACPI IDs like 232The slaves behind I2C bus controller only need to add the ACPI IDs like
225with the platform and SPI drivers. The I2C core automatically enumerates 233with the platform and SPI drivers. The I2C core automatically enumerates
226any slave devices behind the controller device once the adapter is 234any slave devices behind the controller device once the adapter is
227registered. 235registered.
228 236
229Below is an example of how to add ACPI support to the existing mpu3050 237Below is an example of how to add ACPI support to the existing mpu3050
230input driver: 238input driver::
231 239
232 #ifdef CONFIG_ACPI 240 #ifdef CONFIG_ACPI
233 static const struct acpi_device_id mpu3050_acpi_match[] = { 241 static const struct acpi_device_id mpu3050_acpi_match[] = {
@@ -251,56 +259,57 @@ input driver:
251 }; 259 };
252 260
253GPIO support 261GPIO support
254~~~~~~~~~~~~ 262============
263
255ACPI 5 introduced two new resources to describe GPIO connections: GpioIo 264ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
256and GpioInt. These resources can be used to pass GPIO numbers used by 265and GpioInt. These resources can be used to pass GPIO numbers used by
257the device to the driver. ACPI 5.1 extended this with _DSD (Device 266the device to the driver. ACPI 5.1 extended this with _DSD (Device
258Specific Data) which made it possible to name the GPIOs among other things. 267Specific Data) which made it possible to name the GPIOs among other things.
259 268
260For example: 269For example::
261 270
262Device (DEV) 271 Device (DEV)
263{
264 Method (_CRS, 0, NotSerialized)
265 { 272 {
266 Name (SBUF, ResourceTemplate() 273 Method (_CRS, 0, NotSerialized)
267 { 274 {
268 ... 275 Name (SBUF, ResourceTemplate()
269 // Used to power on/off the device
270 GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
271 IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
272 0x00, ResourceConsumer,,)
273 { 276 {
274 // Pin List 277 ...
275 0x0055 278 // Used to power on/off the device
276 } 279 GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
280 IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
281 0x00, ResourceConsumer,,)
282 {
283 // Pin List
284 0x0055
285 }
286
287 // Interrupt for the device
288 GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
289 0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
290 {
291 // Pin list
292 0x0058
293 }
294
295 ...
277 296
278 // Interrupt for the device
279 GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
280 0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
281 {
282 // Pin list
283 0x0058
284 } 297 }
285 298
286 ... 299 Return (SBUF)
287
288 } 300 }
289 301
290 Return (SBUF) 302 // ACPI 5.1 _DSD used for naming the GPIOs
291 } 303 Name (_DSD, Package ()
292
293 // ACPI 5.1 _DSD used for naming the GPIOs
294 Name (_DSD, Package ()
295 {
296 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
297 Package ()
298 { 304 {
299 Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }}, 305 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
300 Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }}, 306 Package ()
301 } 307 {
302 }) 308 Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }},
303 ... 309 Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }},
310 }
311 })
312 ...
304 313
305These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0" 314These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
306specifies the path to the controller. In order to use these GPIOs in Linux 315specifies the path to the controller. In order to use these GPIOs in Linux
@@ -310,7 +319,7 @@ There is a standard GPIO API for that and is documented in
310Documentation/gpio/. 319Documentation/gpio/.
311 320
312In the above example we can get the corresponding two GPIO descriptors with 321In the above example we can get the corresponding two GPIO descriptors with
313a code like this: 322a code like this::
314 323
315 #include <linux/gpio/consumer.h> 324 #include <linux/gpio/consumer.h>
316 ... 325 ...
@@ -334,21 +343,22 @@ See Documentation/acpi/gpio-properties.txt for more information about the
334_DSD binding related to GPIOs. 343_DSD binding related to GPIOs.
335 344
336MFD devices 345MFD devices
337~~~~~~~~~~~ 346===========
347
338The MFD devices register their children as platform devices. For the child 348The MFD devices register their children as platform devices. For the child
339devices there needs to be an ACPI handle that they can use to reference 349devices there needs to be an ACPI handle that they can use to reference
340parts of the ACPI namespace that relate to them. In the Linux MFD subsystem 350parts of the ACPI namespace that relate to them. In the Linux MFD subsystem
341we provide two ways: 351we provide two ways:
342 352
343 o The children share the parent ACPI handle. 353 - The children share the parent ACPI handle.
344 o The MFD cell can specify the ACPI id of the device. 354 - The MFD cell can specify the ACPI id of the device.
345 355
346For the first case, the MFD drivers do not need to do anything. The 356For the first case, the MFD drivers do not need to do anything. The
347resulting child platform device will have its ACPI_COMPANION() set to point 357resulting child platform device will have its ACPI_COMPANION() set to point
348to the parent device. 358to the parent device.
349 359
350If the ACPI namespace has a device that we can match using an ACPI id or ACPI 360If the ACPI namespace has a device that we can match using an ACPI id or ACPI
351adr, the cell should be set like: 361adr, the cell should be set like::
352 362
353 static struct mfd_cell_acpi_match my_subdevice_cell_acpi_match = { 363 static struct mfd_cell_acpi_match my_subdevice_cell_acpi_match = {
354 .pnpid = "XYZ0001", 364 .pnpid = "XYZ0001",
@@ -366,7 +376,8 @@ the MFD device and if found, that ACPI companion device is bound to the
366resulting child platform device. 376resulting child platform device.
367 377
368Device Tree namespace link device ID 378Device Tree namespace link device ID
369~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 379====================================
380
370The Device Tree protocol uses device identification based on the "compatible" 381The Device Tree protocol uses device identification based on the "compatible"
371property whose value is a string or an array of strings recognized as device 382property whose value is a string or an array of strings recognized as device
372identifiers by drivers and the driver core. The set of all those strings may be 383identifiers by drivers and the driver core. The set of all those strings may be
@@ -410,6 +421,32 @@ Specifically, the device IDs returned by _HID and preceding PRP0001 in the _CID
410return package will be checked first. Also in that case the bus type the device 421return package will be checked first. Also in that case the bus type the device
411will be enumerated to depends on the device ID returned by _HID. 422will be enumerated to depends on the device ID returned by _HID.
412 423
424For example, the following ACPI sample might be used to enumerate an lm75-type
425I2C temperature sensor and match it to the driver using the Device Tree
426namespace link:
427
428 Device (TMP0)
429 {
430 Name (_HID, "PRP0001")
431 Name (_DSD, Package() {
432 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
433 Package () {
434 Package (2) { "compatible", "ti,tmp75" },
435 }
436 })
437 Method (_CRS, 0, Serialized)
438 {
439 Name (SBUF, ResourceTemplate ()
440 {
441 I2cSerialBusV2 (0x48, ControllerInitiated,
442 400000, AddressingMode7Bit,
443 "\\_SB.PCI0.I2C1", 0x00,
444 ResourceConsumer, , Exclusive,)
445 })
446 Return (SBUF)
447 }
448 }
449
413It is valid to define device objects with a _HID returning PRP0001 and without 450It is valid to define device objects with a _HID returning PRP0001 and without
414the "compatible" property in the _DSD or a _CID as long as one of their 451the "compatible" property in the _DSD or a _CID as long as one of their
415ancestors provides a _DSD with a valid "compatible" property. Such device 452ancestors provides a _DSD with a valid "compatible" property. Such device
@@ -423,4 +460,4 @@ the _DSD of the device object itself or the _DSD of its ancestor in the
423Otherwise, the _DSD itself is regarded as invalid and therefore the "compatible" 460Otherwise, the _DSD itself is regarded as invalid and therefore the "compatible"
424property returned by it is meaningless. 461property returned by it is meaningless.
425 462
426Refer to DSD-properties-rules.txt for more information. 463Refer to :doc:`DSD-properties-rules` for more information.
diff --git a/Documentation/acpi/gpio-properties.txt b/Documentation/firmware-guide/acpi/gpio-properties.rst
index 88c65cb5bf0a..bb6d74f23ee0 100644
--- a/Documentation/acpi/gpio-properties.txt
+++ b/Documentation/firmware-guide/acpi/gpio-properties.rst
@@ -1,5 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3======================================
1_DSD Device Properties Related to GPIO 4_DSD Device Properties Related to GPIO
2-------------------------------------- 5======================================
3 6
4With the release of ACPI 5.1, the _DSD configuration object finally 7With the release of ACPI 5.1, the _DSD configuration object finally
5allows names to be given to GPIOs (and other things as well) returned 8allows names to be given to GPIOs (and other things as well) returned
@@ -8,7 +11,7 @@ the corresponding GPIO, which is pretty error prone (it depends on
8the _CRS output ordering, for example). 11the _CRS output ordering, for example).
9 12
10With _DSD we can now query GPIOs using a name instead of an integer 13With _DSD we can now query GPIOs using a name instead of an integer
11index, like the ASL example below shows: 14index, like the ASL example below shows::
12 15
13 // Bluetooth device with reset and shutdown GPIOs 16 // Bluetooth device with reset and shutdown GPIOs
14 Device (BTH) 17 Device (BTH)
@@ -34,15 +37,19 @@ index, like the ASL example below shows:
34 }) 37 })
35 } 38 }
36 39
37The format of the supported GPIO property is: 40The format of the supported GPIO property is::
38 41
39 Package () { "name", Package () { ref, index, pin, active_low }} 42 Package () { "name", Package () { ref, index, pin, active_low }}
40 43
41 ref - The device that has _CRS containing GpioIo()/GpioInt() resources, 44ref
42 typically this is the device itself (BTH in our case). 45 The device that has _CRS containing GpioIo()/GpioInt() resources,
43 index - Index of the GpioIo()/GpioInt() resource in _CRS starting from zero. 46 typically this is the device itself (BTH in our case).
44 pin - Pin in the GpioIo()/GpioInt() resource. Typically this is zero. 47index
45 active_low - If 1 the GPIO is marked as active_low. 48 Index of the GpioIo()/GpioInt() resource in _CRS starting from zero.
49pin
50 Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
51active_low
52 If 1 the GPIO is marked as active_low.
46 53
47Since ACPI GpioIo() resource does not have a field saying whether it is 54Since ACPI GpioIo() resource does not have a field saying whether it is
48active low or high, the "active_low" argument can be used here. Setting 55active low or high, the "active_low" argument can be used here. Setting
@@ -55,7 +62,7 @@ It is possible to leave holes in the array of GPIOs. This is useful in
55cases like with SPI host controllers where some chip selects may be 62cases like with SPI host controllers where some chip selects may be
56implemented as GPIOs and some as native signals. For example a SPI host 63implemented as GPIOs and some as native signals. For example a SPI host
57controller can have chip selects 0 and 2 implemented as GPIOs and 1 as 64controller can have chip selects 0 and 2 implemented as GPIOs and 1 as
58native: 65native::
59 66
60 Package () { 67 Package () {
61 "cs-gpios", 68 "cs-gpios",
@@ -67,7 +74,7 @@ native:
67 } 74 }
68 75
69Other supported properties 76Other supported properties
70-------------------------- 77==========================
71 78
72Following Device Tree compatible device properties are also supported by 79Following Device Tree compatible device properties are also supported by
73_DSD device properties for GPIO controllers: 80_DSD device properties for GPIO controllers:
@@ -78,7 +85,7 @@ _DSD device properties for GPIO controllers:
78- input 85- input
79- line-name 86- line-name
80 87
81Example: 88Example::
82 89
83 Name (_DSD, Package () { 90 Name (_DSD, Package () {
84 // _DSD Hierarchical Properties Extension UUID 91 // _DSD Hierarchical Properties Extension UUID
@@ -100,7 +107,7 @@ Example:
100 107
101- gpio-line-names 108- gpio-line-names
102 109
103Example: 110Example::
104 111
105 Package () { 112 Package () {
106 "gpio-line-names", 113 "gpio-line-names",
@@ -114,7 +121,7 @@ See Documentation/devicetree/bindings/gpio/gpio.txt for more information
114about these properties. 121about these properties.
115 122
116ACPI GPIO Mappings Provided by Drivers 123ACPI GPIO Mappings Provided by Drivers
117-------------------------------------- 124======================================
118 125
119There are systems in which the ACPI tables do not contain _DSD but provide _CRS 126There are systems in which the ACPI tables do not contain _DSD but provide _CRS
120with GpioIo()/GpioInt() resources and device drivers still need to work with 127with GpioIo()/GpioInt() resources and device drivers still need to work with
@@ -139,16 +146,16 @@ line in that resource starting from zero, and the active-low flag for that line,
139respectively, in analogy with the _DSD GPIO property format specified above. 146respectively, in analogy with the _DSD GPIO property format specified above.
140 147
141For the example Bluetooth device discussed previously the data structures in 148For the example Bluetooth device discussed previously the data structures in
142question would look like this: 149question would look like this::
143 150
144static const struct acpi_gpio_params reset_gpio = { 1, 1, false }; 151 static const struct acpi_gpio_params reset_gpio = { 1, 1, false };
145static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false }; 152 static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false };
146 153
147static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = { 154 static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
148 { "reset-gpios", &reset_gpio, 1 }, 155 { "reset-gpios", &reset_gpio, 1 },
149 { "shutdown-gpios", &shutdown_gpio, 1 }, 156 { "shutdown-gpios", &shutdown_gpio, 1 },
150 { }, 157 { },
151}; 158 };
152 159
153Next, the mapping table needs to be passed as the second argument to 160Next, the mapping table needs to be passed as the second argument to
154acpi_dev_add_driver_gpios() that will register it with the ACPI device object 161acpi_dev_add_driver_gpios() that will register it with the ACPI device object
@@ -158,12 +165,12 @@ calling acpi_dev_remove_driver_gpios() on the ACPI device object where that
158table was previously registered. 165table was previously registered.
159 166
160Using the _CRS fallback 167Using the _CRS fallback
161----------------------- 168=======================
162 169
163If a device does not have _DSD or the driver does not create ACPI GPIO 170If a device does not have _DSD or the driver does not create ACPI GPIO
164mapping, the Linux GPIO framework refuses to return any GPIOs. This is 171mapping, the Linux GPIO framework refuses to return any GPIOs. This is
165because the driver does not know what it actually gets. For example if we 172because the driver does not know what it actually gets. For example if we
166have a device like below: 173have a device like below::
167 174
168 Device (BTH) 175 Device (BTH)
169 { 176 {
@@ -177,7 +184,7 @@ have a device like below:
177 }) 184 })
178 } 185 }
179 186
180The driver might expect to get the right GPIO when it does: 187The driver might expect to get the right GPIO when it does::
181 188
182 desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW); 189 desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW);
183 190
@@ -193,22 +200,25 @@ the ACPI GPIO mapping tables are hardly linked to ACPI ID and certain
193objects, as listed in the above chapter, of the device in question. 200objects, as listed in the above chapter, of the device in question.
194 201
195Getting GPIO descriptor 202Getting GPIO descriptor
196----------------------- 203=======================
204
205There are two main approaches to get GPIO resource from ACPI::
197 206
198There are two main approaches to get GPIO resource from ACPI: 207 desc = gpiod_get(dev, connection_id, flags);
199 desc = gpiod_get(dev, connection_id, flags); 208 desc = gpiod_get_index(dev, connection_id, index, flags);
200 desc = gpiod_get_index(dev, connection_id, index, flags);
201 209
202We may consider two different cases here, i.e. when connection ID is 210We may consider two different cases here, i.e. when connection ID is
203provided and otherwise. 211provided and otherwise.
204 212
205Case 1: 213Case 1::
206 desc = gpiod_get(dev, "non-null-connection-id", flags); 214
207 desc = gpiod_get_index(dev, "non-null-connection-id", index, flags); 215 desc = gpiod_get(dev, "non-null-connection-id", flags);
216 desc = gpiod_get_index(dev, "non-null-connection-id", index, flags);
217
218Case 2::
208 219
209Case 2: 220 desc = gpiod_get(dev, NULL, flags);
210 desc = gpiod_get(dev, NULL, flags); 221 desc = gpiod_get_index(dev, NULL, index, flags);
211 desc = gpiod_get_index(dev, NULL, index, flags);
212 222
213Case 1 assumes that corresponding ACPI device description must have 223Case 1 assumes that corresponding ACPI device description must have
214defined device properties and will prevent to getting any GPIO resources 224defined device properties and will prevent to getting any GPIO resources
diff --git a/Documentation/firmware-guide/acpi/i2c-muxes.rst b/Documentation/firmware-guide/acpi/i2c-muxes.rst
new file mode 100644
index 000000000000..3a8997ccd7c4
--- /dev/null
+++ b/Documentation/firmware-guide/acpi/i2c-muxes.rst
@@ -0,0 +1,61 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3==============
4ACPI I2C Muxes
5==============
6
7Describing an I2C device hierarchy that includes I2C muxes requires an ACPI
8Device () scope per mux channel.
9
10Consider this topology::
11
12 +------+ +------+
13 | SMB1 |-->| MUX0 |--CH00--> i2c client A (0x50)
14 | | | 0x70 |--CH01--> i2c client B (0x50)
15 +------+ +------+
16
17which corresponds to the following ASL::
18
19 Device (SMB1)
20 {
21 Name (_HID, ...)
22 Device (MUX0)
23 {
24 Name (_HID, ...)
25 Name (_CRS, ResourceTemplate () {
26 I2cSerialBus (0x70, ControllerInitiated, I2C_SPEED,
27 AddressingMode7Bit, "^SMB1", 0x00,
28 ResourceConsumer,,)
29 }
30
31 Device (CH00)
32 {
33 Name (_ADR, 0)
34
35 Device (CLIA)
36 {
37 Name (_HID, ...)
38 Name (_CRS, ResourceTemplate () {
39 I2cSerialBus (0x50, ControllerInitiated, I2C_SPEED,
40 AddressingMode7Bit, "^CH00", 0x00,
41 ResourceConsumer,,)
42 }
43 }
44 }
45
46 Device (CH01)
47 {
48 Name (_ADR, 1)
49
50 Device (CLIB)
51 {
52 Name (_HID, ...)
53 Name (_CRS, ResourceTemplate () {
54 I2cSerialBus (0x50, ControllerInitiated, I2C_SPEED,
55 AddressingMode7Bit, "^CH01", 0x00,
56 ResourceConsumer,,)
57 }
58 }
59 }
60 }
61 }
diff --git a/Documentation/firmware-guide/acpi/index.rst b/Documentation/firmware-guide/acpi/index.rst
new file mode 100644
index 000000000000..ae609eec4679
--- /dev/null
+++ b/Documentation/firmware-guide/acpi/index.rst
@@ -0,0 +1,26 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3============
4ACPI Support
5============
6
7.. toctree::
8 :maxdepth: 1
9
10 namespace
11 dsd/graph
12 dsd/data-node-references
13 enumeration
14 osi
15 method-customizing
16 method-tracing
17 DSD-properties-rules
18 debug
19 aml-debugger
20 apei/output_format
21 apei/einj
22 gpio-properties
23 i2c-muxes
24 acpi-lid
25 lpit
26 video_extension
diff --git a/Documentation/acpi/lpit.txt b/Documentation/firmware-guide/acpi/lpit.rst
index b426398d2e97..aca928fab027 100644
--- a/Documentation/acpi/lpit.txt
+++ b/Documentation/firmware-guide/acpi/lpit.rst
@@ -1,3 +1,9 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3===========================
4Low Power Idle Table (LPIT)
5===========================
6
1To enumerate platform Low Power Idle states, Intel platforms are using 7To enumerate platform Low Power Idle states, Intel platforms are using
2“Low Power Idle Table” (LPIT). More details about this table can be 8“Low Power Idle Table” (LPIT). More details about this table can be
3downloaded from: 9downloaded from:
@@ -8,13 +14,15 @@ Residencies for each low power state can be read via FFH
8 14
9On platforms supporting S0ix sleep states, there can be two types of 15On platforms supporting S0ix sleep states, there can be two types of
10residencies: 16residencies:
11- CPU PKG C10 (Read via FFH interface) 17
12- Platform Controller Hub (PCH) SLP_S0 (Read via memory mapped interface) 18 - CPU PKG C10 (Read via FFH interface)
19 - Platform Controller Hub (PCH) SLP_S0 (Read via memory mapped interface)
13 20
14The following attributes are added dynamically to the cpuidle 21The following attributes are added dynamically to the cpuidle
15sysfs attribute group: 22sysfs attribute group::
16 /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us 23
17 /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us 24 /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
25 /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
18 26
19The "low_power_idle_cpu_residency_us" attribute shows time spent 27The "low_power_idle_cpu_residency_us" attribute shows time spent
20by the CPU package in PKG C10 28by the CPU package in PKG C10
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).
diff --git a/Documentation/firmware-guide/acpi/method-tracing.rst b/Documentation/firmware-guide/acpi/method-tracing.rst
new file mode 100644
index 000000000000..d0b077b73f5f
--- /dev/null
+++ b/Documentation/firmware-guide/acpi/method-tracing.rst
@@ -0,0 +1,238 @@
1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
3
4=====================
5ACPICA Trace Facility
6=====================
7
8:Copyright: |copy| 2015, Intel Corporation
9:Author: Lv Zheng <lv.zheng@intel.com>
10
11
12Abstract
13========
14This document describes the functions and the interfaces of the
15method tracing facility.
16
17Functionalities and usage examples
18==================================
19
20ACPICA provides method tracing capability. And two functions are
21currently implemented using this capability.
22
23Log reducer
24-----------
25
26ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is
27enabled. The debugging messages which are deployed via
28ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component
29level (known as debug layer, configured via
30/sys/module/acpi/parameters/debug_layer) and per-type level (known as
31debug level, configured via /sys/module/acpi/parameters/debug_level).
32
33But when the particular layer/level is applied to the control method
34evaluations, the quantity of the debugging outputs may still be too
35large to be put into the kernel log buffer. The idea thus is worked out
36to only enable the particular debug layer/level (normally more detailed)
37logs when the control method evaluation is started, and disable the
38detailed logging when the control method evaluation is stopped.
39
40The following command examples illustrate the usage of the "log reducer"
41functionality:
42
43a. Filter out the debug layer/level matched logs when control methods
44 are being evaluated::
45
46 # cd /sys/module/acpi/parameters
47 # echo "0xXXXXXXXX" > trace_debug_layer
48 # echo "0xYYYYYYYY" > trace_debug_level
49 # echo "enable" > trace_state
50
51b. Filter out the debug layer/level matched logs when the specified
52 control method is being evaluated::
53
54 # cd /sys/module/acpi/parameters
55 # echo "0xXXXXXXXX" > trace_debug_layer
56 # echo "0xYYYYYYYY" > trace_debug_level
57 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
58 # echo "method" > /sys/module/acpi/parameters/trace_state
59
60c. Filter out the debug layer/level matched logs when the specified
61 control method is being evaluated for the first time::
62
63 # cd /sys/module/acpi/parameters
64 # echo "0xXXXXXXXX" > trace_debug_layer
65 # echo "0xYYYYYYYY" > trace_debug_level
66 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
67 # echo "method-once" > /sys/module/acpi/parameters/trace_state
68
69Where:
70 0xXXXXXXXX/0xYYYYYYYY
71 Refer to Documentation/acpi/debug.txt for possible debug layer/level
72 masking values.
73 \PPPP.AAAA.TTTT.HHHH
74 Full path of a control method that can be found in the ACPI namespace.
75 It needn't be an entry of a control method evaluation.
76
77AML tracer
78----------
79
80There are special log entries added by the method tracing facility at
81the "trace points" the AML interpreter starts/stops to execute a control
82method, or an AML opcode. Note that the format of the log entries are
83subject to change::
84
85 [ 0.186427] exdebug-0398 ex_trace_point : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
86 [ 0.186630] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905c88:If] execution.
87 [ 0.186820] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:LEqual] execution.
88 [ 0.187010] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905a20:-NamePath-] execution.
89 [ 0.187214] exdebug-0398 ex_trace_point : Opcode End [0xf5905a20:-NamePath-] execution.
90 [ 0.187407] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
91 [ 0.187594] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
92 [ 0.187789] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:LEqual] execution.
93 [ 0.187980] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:Return] execution.
94 [ 0.188146] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
95 [ 0.188334] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
96 [ 0.188524] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:Return] execution.
97 [ 0.188712] exdebug-0398 ex_trace_point : Opcode End [0xf5905c88:If] execution.
98 [ 0.188903] exdebug-0398 ex_trace_point : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
99
100Developers can utilize these special log entries to track the AML
101interpretion, thus can aid issue debugging and performance tuning. Note
102that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
103macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
104"AML tracer" logs.
105
106The following command examples illustrate the usage of the "AML tracer"
107functionality:
108
109a. Filter out the method start/stop "AML tracer" logs when control
110 methods are being evaluated::
111
112 # cd /sys/module/acpi/parameters
113 # echo "0x80" > trace_debug_layer
114 # echo "0x10" > trace_debug_level
115 # echo "enable" > trace_state
116
117b. Filter out the method start/stop "AML tracer" when the specified
118 control method is being evaluated::
119
120 # cd /sys/module/acpi/parameters
121 # echo "0x80" > trace_debug_layer
122 # echo "0x10" > trace_debug_level
123 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
124 # echo "method" > trace_state
125
126c. Filter out the method start/stop "AML tracer" logs when the specified
127 control method is being evaluated for the first time::
128
129 # cd /sys/module/acpi/parameters
130 # echo "0x80" > trace_debug_layer
131 # echo "0x10" > trace_debug_level
132 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
133 # echo "method-once" > trace_state
134
135d. Filter out the method/opcode start/stop "AML tracer" when the
136 specified control method is being evaluated::
137
138 # cd /sys/module/acpi/parameters
139 # echo "0x80" > trace_debug_layer
140 # echo "0x10" > trace_debug_level
141 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
142 # echo "opcode" > trace_state
143
144e. Filter out the method/opcode start/stop "AML tracer" when the
145 specified control method is being evaluated for the first time::
146
147 # cd /sys/module/acpi/parameters
148 # echo "0x80" > trace_debug_layer
149 # echo "0x10" > trace_debug_level
150 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
151 # echo "opcode-opcode" > trace_state
152
153Note that all above method tracing facility related module parameters can
154be used as the boot parameters, for example::
155
156 acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \
157 acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once
158
159
160Interface descriptions
161======================
162
163All method tracing functions can be configured via ACPI module
164parameters that are accessible at /sys/module/acpi/parameters/:
165
166trace_method_name
167 The full path of the AML method that the user wants to trace.
168
169 Note that the full path shouldn't contain the trailing "_"s in its
170 name segments but may contain "\" to form an absolute path.
171
172trace_debug_layer
173 The temporary debug_layer used when the tracing feature is enabled.
174
175 Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
176 used to match all "AML tracer" logs.
177
178trace_debug_level
179 The temporary debug_level used when the tracing feature is enabled.
180
181 Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
182 debug_level used to match all "AML tracer" logs.
183
184trace_state
185 The status of the tracing feature.
186
187 Users can enable/disable this debug tracing feature by executing
188 the following command::
189
190 # echo string > /sys/module/acpi/parameters/trace_state
191
192Where "string" should be one of the following:
193
194"disable"
195 Disable the method tracing feature.
196
197"enable"
198 Enable the method tracing feature.
199
200 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
201 during any method execution will be logged.
202
203"method"
204 Enable the method tracing feature.
205
206 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
207 during method execution of "trace_method_name" will be logged.
208
209"method-once"
210 Enable the method tracing feature.
211
212 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
213 during method execution of "trace_method_name" will be logged only once.
214
215"opcode"
216 Enable the method tracing feature.
217
218 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
219 during method/opcode execution of "trace_method_name" will be logged.
220
221"opcode-once"
222 Enable the method tracing feature.
223
224 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
225 during method/opcode execution of "trace_method_name" will be logged only
226 once.
227
228Note that, the difference between the "enable" and other feature
229enabling options are:
230
2311. When "enable" is specified, since
232 "trace_debug_layer/trace_debug_level" shall apply to all control
233 method evaluations, after configuring "trace_state" to "enable",
234 "trace_method_name" will be reset to NULL.
2352. When "method/opcode" is specified, if
236 "trace_method_name" is NULL when "trace_state" is configured to
237 these options, the "trace_debug_layer/trace_debug_level" will
238 apply to all control method evaluations.
diff --git a/Documentation/acpi/namespace.txt b/Documentation/firmware-guide/acpi/namespace.rst
index 1860cb3865c6..835521baeb89 100644
--- a/Documentation/acpi/namespace.txt
+++ b/Documentation/firmware-guide/acpi/namespace.rst
@@ -1,85 +1,90 @@
1.. SPDX-License-Identifier: GPL-2.0
2.. include:: <isonum.txt>
3
4===================================================
1ACPI Device Tree - Representation of ACPI Namespace 5ACPI Device Tree - Representation of ACPI Namespace
6===================================================
2 7
3Copyright (C) 2013, Intel Corporation 8:Copyright: |copy| 2013, Intel Corporation
4Author: Lv Zheng <lv.zheng@intel.com>
5 9
10:Author: Lv Zheng <lv.zheng@intel.com>
6 11
7Abstract: 12:Credit: Thanks for the help from Zhang Rui <rui.zhang@intel.com> and
13 Rafael J.Wysocki <rafael.j.wysocki@intel.com>.
8 14
15Abstract
16========
9The Linux ACPI subsystem converts ACPI namespace objects into a Linux 17The Linux ACPI subsystem converts ACPI namespace objects into a Linux
10device tree under the /sys/devices/LNXSYSTEM:00 and updates it upon 18device tree under the /sys/devices/LNXSYSTEM:00 and updates it upon
11receiving ACPI hotplug notification events. For each device object in this 19receiving ACPI hotplug notification events. For each device object
12hierarchy there is a corresponding symbolic link in the 20in this hierarchy there is a corresponding symbolic link in the
13/sys/bus/acpi/devices. 21/sys/bus/acpi/devices.
22
14This document illustrates the structure of the ACPI device tree. 23This document illustrates the structure of the ACPI device tree.
15 24
25ACPI Definition Blocks
26======================
27
28The ACPI firmware sets up RSDP (Root System Description Pointer) in the
29system memory address space pointing to the XSDT (Extended System
30Description Table). The XSDT always points to the FADT (Fixed ACPI
31Description Table) using its first entry, the data within the FADT
32includes various fixed-length entries that describe fixed ACPI features
33of the hardware. The FADT contains a pointer to the DSDT
34(Differentiated System Descripition Table). The XSDT also contains
35entries pointing to possibly multiple SSDTs (Secondary System
36Description Table).
37
38The DSDT and SSDT data is organized in data structures called definition
39blocks that contain definitions of various objects, including ACPI
40control methods, encoded in AML (ACPI Machine Language). The data block
41of the DSDT along with the contents of SSDTs represents a hierarchical
42data structure called the ACPI namespace whose topology reflects the
43structure of the underlying hardware platform.
44
45The relationships between ACPI System Definition Tables described above
46are illustrated in the following diagram::
47
48 +---------+ +-------+ +--------+ +------------------------+
49 | RSDP | +->| XSDT | +->| FADT | | +-------------------+ |
50 +---------+ | +-------+ | +--------+ +-|->| DSDT | |
51 | Pointer | | | Entry |-+ | ...... | | | +-------------------+ |
52 +---------+ | +-------+ | X_DSDT |--+ | | Definition Blocks | |
53 | Pointer |-+ | ..... | | ...... | | +-------------------+ |
54 +---------+ +-------+ +--------+ | +-------------------+ |
55 | Entry |------------------|->| SSDT | |
56 +- - - -+ | +-------------------| |
57 | Entry | - - - - - - - -+ | | Definition Blocks | |
58 +- - - -+ | | +-------------------+ |
59 | | +- - - - - - - - - -+ |
60 +-|->| SSDT | |
61 | +-------------------+ |
62 | | Definition Blocks | |
63 | +- - - - - - - - - -+ |
64 +------------------------+
65 |
66 OSPM Loading |
67 \|/
68 +----------------+
69 | ACPI Namespace |
70 +----------------+
71
72 Figure 1. ACPI Definition Blocks
73
74.. note:: RSDP can also contain a pointer to the RSDT (Root System
75 Description Table). Platforms provide RSDT to enable
76 compatibility with ACPI 1.0 operating systems. The OS is expected
77 to use XSDT, if present.
78
79
80Example ACPI Namespace
81======================
82
83All definition blocks are loaded into a single namespace. The namespace
84is a hierarchy of objects identified by names and paths.
85The following naming conventions apply to object names in the ACPI
86namespace:
16 87
17Credit:
18
19Thanks for the help from Zhang Rui <rui.zhang@intel.com> and Rafael J.
20Wysocki <rafael.j.wysocki@intel.com>.
21
22
231. ACPI Definition Blocks
24
25 The ACPI firmware sets up RSDP (Root System Description Pointer) in the
26 system memory address space pointing to the XSDT (Extended System
27 Description Table). The XSDT always points to the FADT (Fixed ACPI
28 Description Table) using its first entry, the data within the FADT
29 includes various fixed-length entries that describe fixed ACPI features
30 of the hardware. The FADT contains a pointer to the DSDT
31 (Differentiated System Descripition Table). The XSDT also contains
32 entries pointing to possibly multiple SSDTs (Secondary System
33 Description Table).
34
35 The DSDT and SSDT data is organized in data structures called definition
36 blocks that contain definitions of various objects, including ACPI
37 control methods, encoded in AML (ACPI Machine Language). The data block
38 of the DSDT along with the contents of SSDTs represents a hierarchical
39 data structure called the ACPI namespace whose topology reflects the
40 structure of the underlying hardware platform.
41
42 The relationships between ACPI System Definition Tables described above
43 are illustrated in the following diagram.
44
45 +---------+ +-------+ +--------+ +------------------------+
46 | RSDP | +->| XSDT | +->| FADT | | +-------------------+ |
47 +---------+ | +-------+ | +--------+ +-|->| DSDT | |
48 | Pointer | | | Entry |-+ | ...... | | | +-------------------+ |
49 +---------+ | +-------+ | X_DSDT |--+ | | Definition Blocks | |
50 | Pointer |-+ | ..... | | ...... | | +-------------------+ |
51 +---------+ +-------+ +--------+ | +-------------------+ |
52 | Entry |------------------|->| SSDT | |
53 +- - - -+ | +-------------------| |
54 | Entry | - - - - - - - -+ | | Definition Blocks | |
55 +- - - -+ | | +-------------------+ |
56 | | +- - - - - - - - - -+ |
57 +-|->| SSDT | |
58 | +-------------------+ |
59 | | Definition Blocks | |
60 | +- - - - - - - - - -+ |
61 +------------------------+
62 |
63 OSPM Loading |
64 \|/
65 +----------------+
66 | ACPI Namespace |
67 +----------------+
68
69 Figure 1. ACPI Definition Blocks
70
71 NOTE: RSDP can also contain a pointer to the RSDT (Root System
72 Description Table). Platforms provide RSDT to enable
73 compatibility with ACPI 1.0 operating systems. The OS is expected
74 to use XSDT, if present.
75
76
772. Example ACPI Namespace
78
79 All definition blocks are loaded into a single namespace. The namespace
80 is a hierarchy of objects identified by names and paths.
81 The following naming conventions apply to object names in the ACPI
82 namespace:
83 1. All names are 32 bits long. 88 1. All names are 32 bits long.
84 2. The first byte of a name must be one of 'A' - 'Z', '_'. 89 2. The first byte of a name must be one of 'A' - 'Z', '_'.
85 3. Each of the remaining bytes of a name must be one of 'A' - 'Z', '0' 90 3. Each of the remaining bytes of a name must be one of 'A' - 'Z', '0'
@@ -91,7 +96,7 @@ Wysocki <rafael.j.wysocki@intel.com>.
91 (i.e. names prepended with '^' are relative to the parent of the 96 (i.e. names prepended with '^' are relative to the parent of the
92 current namespace node). 97 current namespace node).
93 98
94 The figure below shows an example ACPI namespace. 99The figure below shows an example ACPI namespace::
95 100
96 +------+ 101 +------+
97 | \ | Root 102 | \ | Root
@@ -184,19 +189,20 @@ Wysocki <rafael.j.wysocki@intel.com>.
184 Figure 2. Example ACPI Namespace 189 Figure 2. Example ACPI Namespace
185 190
186 191
1873. Linux ACPI Device Objects 192Linux ACPI Device Objects
193=========================
188 194
189 The Linux kernel's core ACPI subsystem creates struct acpi_device 195The Linux kernel's core ACPI subsystem creates struct acpi_device
190 objects for ACPI namespace objects representing devices, power resources 196objects for ACPI namespace objects representing devices, power resources
191 processors, thermal zones. Those objects are exported to user space via 197processors, thermal zones. Those objects are exported to user space via
192 sysfs as directories in the subtree under /sys/devices/LNXSYSTM:00. The 198sysfs as directories in the subtree under /sys/devices/LNXSYSTM:00. The
193 format of their names is <bus_id:instance>, where 'bus_id' refers to the 199format of their names is <bus_id:instance>, where 'bus_id' refers to the
194 ACPI namespace representation of the given object and 'instance' is used 200ACPI namespace representation of the given object and 'instance' is used
195 for distinguishing different object of the same 'bus_id' (it is 201for distinguishing different object of the same 'bus_id' (it is
196 two-digit decimal representation of an unsigned integer). 202two-digit decimal representation of an unsigned integer).
197 203
198 The value of 'bus_id' depends on the type of the object whose name it is 204The value of 'bus_id' depends on the type of the object whose name it is
199 part of as listed in the table below. 205part of as listed in the table below::
200 206
201 +---+-----------------+-------+----------+ 207 +---+-----------------+-------+----------+
202 | | Object/Feature | Table | bus_id | 208 | | Object/Feature | Table | bus_id |
@@ -226,10 +232,11 @@ Wysocki <rafael.j.wysocki@intel.com>.
226 232
227 Table 1. ACPI Namespace Objects Mapping 233 Table 1. ACPI Namespace Objects Mapping
228 234
229 The following rules apply when creating struct acpi_device objects on 235The following rules apply when creating struct acpi_device objects on
230 the basis of the contents of ACPI System Description Tables (as 236the basis of the contents of ACPI System Description Tables (as
231 indicated by the letter in the first column and the notation in the 237indicated by the letter in the first column and the notation in the
232 second column of the table above): 238second column of the table above):
239
233 N: 240 N:
234 The object's source is an ACPI namespace node (as indicated by the 241 The object's source is an ACPI namespace node (as indicated by the
235 named object's type in the second column). In that case the object's 242 named object's type in the second column). In that case the object's
@@ -249,13 +256,14 @@ Wysocki <rafael.j.wysocki@intel.com>.
249 struct acpi_device object with LNXVIDEO 'bus_id' will be created for 256 struct acpi_device object with LNXVIDEO 'bus_id' will be created for
250 it. 257 it.
251 258
252 The third column of the above table indicates which ACPI System 259The third column of the above table indicates which ACPI System
253 Description Tables contain information used for the creation of the 260Description Tables contain information used for the creation of the
254 struct acpi_device objects represented by the given row (xSDT means DSDT 261struct acpi_device objects represented by the given row (xSDT means DSDT
255 or SSDT). 262or SSDT).
263
264The forth column of the above table indicates the 'bus_id' generation
265rule of the struct acpi_device object:
256 266
257 The forth column of the above table indicates the 'bus_id' generation
258 rule of the struct acpi_device object:
259 _HID: 267 _HID:
260 _HID in the last column of the table means that the object's bus_id 268 _HID in the last column of the table means that the object's bus_id
261 is derived from the _HID/_CID identification objects present under 269 is derived from the _HID/_CID identification objects present under
@@ -275,45 +283,47 @@ Wysocki <rafael.j.wysocki@intel.com>.
275 object's bus_id. 283 object's bus_id.
276 284
277 285
2784. Linux ACPI Physical Device Glue 286Linux ACPI Physical Device Glue
279 287===============================
280 ACPI device (i.e. struct acpi_device) objects may be linked to other 288
281 objects in the Linux' device hierarchy that represent "physical" devices 289ACPI device (i.e. struct acpi_device) objects may be linked to other
282 (for example, devices on the PCI bus). If that happens, it means that 290objects in the Linux' device hierarchy that represent "physical" devices
283 the ACPI device object is a "companion" of a device otherwise 291(for example, devices on the PCI bus). If that happens, it means that
284 represented in a different way and is used (1) to provide configuration 292the ACPI device object is a "companion" of a device otherwise
285 information on that device which cannot be obtained by other means and 293represented in a different way and is used (1) to provide configuration
286 (2) to do specific things to the device with the help of its ACPI 294information on that device which cannot be obtained by other means and
287 control methods. One ACPI device object may be linked this way to 295(2) to do specific things to the device with the help of its ACPI
288 multiple "physical" devices. 296control methods. One ACPI device object may be linked this way to
289 297multiple "physical" devices.
290 If an ACPI device object is linked to a "physical" device, its sysfs 298
291 directory contains the "physical_node" symbolic link to the sysfs 299If an ACPI device object is linked to a "physical" device, its sysfs
292 directory of the target device object. In turn, the target device's 300directory contains the "physical_node" symbolic link to the sysfs
293 sysfs directory will then contain the "firmware_node" symbolic link to 301directory of the target device object. In turn, the target device's
294 the sysfs directory of the companion ACPI device object. 302sysfs directory will then contain the "firmware_node" symbolic link to
295 The linking mechanism relies on device identification provided by the 303the sysfs directory of the companion ACPI device object.
296 ACPI namespace. For example, if there's an ACPI namespace object 304The linking mechanism relies on device identification provided by the
297 representing a PCI device (i.e. a device object under an ACPI namespace 305ACPI namespace. For example, if there's an ACPI namespace object
298 object representing a PCI bridge) whose _ADR returns 0x00020000 and the 306representing a PCI device (i.e. a device object under an ACPI namespace
299 bus number of the parent PCI bridge is 0, the sysfs directory 307object representing a PCI bridge) whose _ADR returns 0x00020000 and the
300 representing the struct acpi_device object created for that ACPI 308bus number of the parent PCI bridge is 0, the sysfs directory
301 namespace object will contain the 'physical_node' symbolic link to the 309representing the struct acpi_device object created for that ACPI
302 /sys/devices/pci0000:00/0000:00:02:0/ sysfs directory of the 310namespace object will contain the 'physical_node' symbolic link to the
303 corresponding PCI device. 311/sys/devices/pci0000:00/0000:00:02:0/ sysfs directory of the
304 312corresponding PCI device.
305 The linking mechanism is generally bus-specific. The core of its 313
306 implementation is located in the drivers/acpi/glue.c file, but there are 314The linking mechanism is generally bus-specific. The core of its
307 complementary parts depending on the bus types in question located 315implementation is located in the drivers/acpi/glue.c file, but there are
308 elsewhere. For example, the PCI-specific part of it is located in 316complementary parts depending on the bus types in question located
309 drivers/pci/pci-acpi.c. 317elsewhere. For example, the PCI-specific part of it is located in
310 318drivers/pci/pci-acpi.c.
311 319
3125. Example Linux ACPI Device Tree 320
313 321Example Linux ACPI Device Tree
314 The sysfs hierarchy of struct acpi_device objects corresponding to the 322=================================
315 example ACPI namespace illustrated in Figure 2 with the addition of 323
316 fixed PWR_BUTTON/SLP_BUTTON devices is shown below. 324The sysfs hierarchy of struct acpi_device objects corresponding to the
325example ACPI namespace illustrated in Figure 2 with the addition of
326fixed PWR_BUTTON/SLP_BUTTON devices is shown below::
317 327
318 +--------------+---+-----------------+ 328 +--------------+---+-----------------+
319 | LNXSYSTEM:00 | \ | acpi:LNXSYSTEM: | 329 | LNXSYSTEM:00 | \ | acpi:LNXSYSTEM: |
@@ -377,12 +387,14 @@ Wysocki <rafael.j.wysocki@intel.com>.
377 387
378 Figure 3. Example Linux ACPI Device Tree 388 Figure 3. Example Linux ACPI Device Tree
379 389
380 NOTE: Each node is represented as "object/path/modalias", where: 390.. note:: Each node is represented as "object/path/modalias", where:
381 1. 'object' is the name of the object's directory in sysfs. 391
382 2. 'path' is the ACPI namespace path of the corresponding 392 1. 'object' is the name of the object's directory in sysfs.
383 ACPI namespace object, as returned by the object's 'path' 393 2. 'path' is the ACPI namespace path of the corresponding
384 sysfs attribute. 394 ACPI namespace object, as returned by the object's 'path'
385 3. 'modalias' is the value of the object's 'modalias' sysfs 395 sysfs attribute.
386 attribute (as described earlier in this document). 396 3. 'modalias' is the value of the object's 'modalias' sysfs
387 NOTE: N/A indicates the device object does not have the 'path' or the 397 attribute (as described earlier in this document).
388 'modalias' attribute. 398
399.. note:: N/A indicates the device object does not have the 'path' or the
400 'modalias' attribute.
diff --git a/Documentation/acpi/osi.txt b/Documentation/firmware-guide/acpi/osi.rst
index 50cde0ceb9b0..29e9ef79ebc0 100644
--- a/Documentation/acpi/osi.txt
+++ b/Documentation/firmware-guide/acpi/osi.rst
@@ -1,5 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3==========================
1ACPI _OSI and _REV methods 4ACPI _OSI and _REV methods
2-------------------------- 5==========================
3 6
4An ACPI BIOS can use the "Operating System Interfaces" method (_OSI) 7An ACPI BIOS can use the "Operating System Interfaces" method (_OSI)
5to find out what the operating system supports. Eg. If BIOS 8to find out what the operating system supports. Eg. If BIOS
@@ -14,7 +17,7 @@ This document explains how and why the BIOS and Linux should use these methods.
14It also explains how and why they are widely misused. 17It also explains how and why they are widely misused.
15 18
16How to use _OSI 19How to use _OSI
17--------------- 20===============
18 21
19Linux runs on two groups of machines -- those that are tested by the OEM 22Linux runs on two groups of machines -- those that are tested by the OEM
20to be compatible with Linux, and those that were never tested with Linux, 23to be compatible with Linux, and those that were never tested with Linux,
@@ -62,7 +65,7 @@ the string when that support is added to the kernel.
62That was easy. Read on, to find out how to do it wrong. 65That was easy. Read on, to find out how to do it wrong.
63 66
64Before _OSI, there was _OS 67Before _OSI, there was _OS
65-------------------------- 68==========================
66 69
67ACPI 1.0 specified "_OS" as an 70ACPI 1.0 specified "_OS" as an
68"object that evaluates to a string that identifies the operating system." 71"object that evaluates to a string that identifies the operating system."
@@ -96,7 +99,7 @@ That is the *only* viable strategy, as that is what modern Windows does,
96and so doing otherwise could steer the BIOS down an untested path. 99and so doing otherwise could steer the BIOS down an untested path.
97 100
98_OSI is born, and immediately misused 101_OSI is born, and immediately misused
99-------------------------------------- 102=====================================
100 103
101With _OSI, the *BIOS* provides the string describing an interface, 104With _OSI, the *BIOS* provides the string describing an interface,
102and asks the OS: "YES/NO, are you compatible with this interface?" 105and asks the OS: "YES/NO, are you compatible with this interface?"
@@ -144,7 +147,7 @@ catastrophic failure resulting from the BIOS taking paths that
144were never validated under *any* OS. 147were never validated under *any* OS.
145 148
146Do not use _REV 149Do not use _REV
147--------------- 150===============
148 151
149Since _OSI("Linux") went away, some BIOS writers used _REV 152Since _OSI("Linux") went away, some BIOS writers used _REV
150to support Linux and Windows differences in the same BIOS. 153to support Linux and Windows differences in the same BIOS.
@@ -164,7 +167,7 @@ from mid-2015 onward. The ACPI specification will also be updated
164to reflect that _REV is deprecated, and always returns 2. 167to reflect that _REV is deprecated, and always returns 2.
165 168
166Apple Mac and _OSI("Darwin") 169Apple Mac and _OSI("Darwin")
167---------------------------- 170============================
168 171
169On Apple's Mac platforms, the ACPI BIOS invokes _OSI("Darwin") 172On Apple's Mac platforms, the ACPI BIOS invokes _OSI("Darwin")
170to determine if the machine is running Apple OSX. 173to determine if the machine is running Apple OSX.
diff --git a/Documentation/acpi/video_extension.txt b/Documentation/firmware-guide/acpi/video_extension.rst
index 79bf6a4921be..099b8607e07b 100644
--- a/Documentation/acpi/video_extension.txt
+++ b/Documentation/firmware-guide/acpi/video_extension.rst
@@ -1,5 +1,8 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3=====================
1ACPI video extensions 4ACPI video extensions
2~~~~~~~~~~~~~~~~~~~~~ 5=====================
3 6
4This driver implement the ACPI Extensions For Display Adapters for 7This driver implement the ACPI Extensions For Display Adapters for
5integrated graphics devices on motherboard, as specified in ACPI 2.0 8integrated graphics devices on motherboard, as specified in ACPI 2.0
@@ -8,9 +11,10 @@ defining the video POST device, retrieving EDID information or to
8setup a video output, etc. Note that this is an ref. implementation 11setup a video output, etc. Note that this is an ref. implementation
9only. It may or may not work for your integrated video device. 12only. It may or may not work for your integrated video device.
10 13
11The ACPI video driver does 3 things regarding backlight control: 14The ACPI video driver does 3 things regarding backlight control.
12 15
131 Export a sysfs interface for user space to control backlight level 16Export a sysfs interface for user space to control backlight level
17==================================================================
14 18
15If the ACPI table has a video device, and acpi_backlight=vendor kernel 19If the ACPI table has a video device, and acpi_backlight=vendor kernel
16command line is not present, the driver will register a backlight device 20command line is not present, the driver will register a backlight device
@@ -22,36 +26,41 @@ The backlight sysfs interface has a standard definition here:
22Documentation/ABI/stable/sysfs-class-backlight. 26Documentation/ABI/stable/sysfs-class-backlight.
23 27
24And what ACPI video driver does is: 28And what ACPI video driver does is:
25actual_brightness: on read, control method _BQC will be evaluated to 29
26get the brightness level the firmware thinks it is at; 30actual_brightness:
27bl_power: not implemented, will set the current brightness instead; 31 on read, control method _BQC will be evaluated to
28brightness: on write, control method _BCM will run to set the requested 32 get the brightness level the firmware thinks it is at;
29brightness level; 33bl_power:
30max_brightness: Derived from the _BCL package(see below); 34 not implemented, will set the current brightness instead;
31type: firmware 35brightness:
36 on write, control method _BCM will run to set the requested brightness level;
37max_brightness:
38 Derived from the _BCL package(see below);
39type:
40 firmware
32 41
33Note that ACPI video backlight driver will always use index for 42Note that ACPI video backlight driver will always use index for
34brightness, actual_brightness and max_brightness. So if we have 43brightness, actual_brightness and max_brightness. So if we have
35the following _BCL package: 44the following _BCL package::
36 45
37Method (_BCL, 0, NotSerialized) 46 Method (_BCL, 0, NotSerialized)
38{
39 Return (Package (0x0C)
40 { 47 {
41 0x64, 48 Return (Package (0x0C)
42 0x32, 49 {
43 0x0A, 50 0x64,
44 0x14, 51 0x32,
45 0x1E, 52 0x0A,
46 0x28, 53 0x14,
47 0x32, 54 0x1E,
48 0x3C, 55 0x28,
49 0x46, 56 0x32,
50 0x50, 57 0x3C,
51 0x5A, 58 0x46,
52 0x64 59 0x50,
53 }) 60 0x5A,
54} 61 0x64
62 })
63 }
55 64
56The first two levels are for when laptop are on AC or on battery and are 65The first two levels are for when laptop are on AC or on battery and are
57not used by Linux currently. The remaining 10 levels are supported levels 66not used by Linux currently. The remaining 10 levels are supported levels
@@ -62,13 +71,15 @@ as a "brightness level" indicator. Thus from the user space perspective
62the range of available brightness levels is from 0 to 9 (max_brightness) 71the range of available brightness levels is from 0 to 9 (max_brightness)
63inclusive. 72inclusive.
64 73
652 Notify user space about hotkey event 74Notify user space about hotkey event
75====================================
66 76
67There are generally two cases for hotkey event reporting: 77There are generally two cases for hotkey event reporting:
78
68i) For some laptops, when user presses the hotkey, a scancode will be 79i) For some laptops, when user presses the hotkey, a scancode will be
69 generated and sent to user space through the input device created by 80 generated and sent to user space through the input device created by
70 the keyboard driver as a key type input event, with proper remap, the 81 the keyboard driver as a key type input event, with proper remap, the
71 following key code will appear to user space: 82 following key code will appear to user space::
72 83
73 EV_KEY, KEY_BRIGHTNESSUP 84 EV_KEY, KEY_BRIGHTNESSUP
74 EV_KEY, KEY_BRIGHTNESSDOWN 85 EV_KEY, KEY_BRIGHTNESSDOWN
@@ -84,23 +95,27 @@ ii) For some laptops, the press of the hotkey will not generate the
84 notify value it received and send the event to user space through the 95 notify value it received and send the event to user space through the
85 input device it created: 96 input device it created:
86 97
98 ===== ==================
87 event keycode 99 event keycode
100 ===== ==================
88 0x86 KEY_BRIGHTNESSUP 101 0x86 KEY_BRIGHTNESSUP
89 0x87 KEY_BRIGHTNESSDOWN 102 0x87 KEY_BRIGHTNESSDOWN
90 etc. 103 etc.
104 ===== ==================
91 105
92so this would lead to the same effect as case i) now. 106so this would lead to the same effect as case i) now.
93 107
94Once user space tool receives this event, it can modify the backlight 108Once user space tool receives this event, it can modify the backlight
95level through the sysfs interface. 109level through the sysfs interface.
96 110
973 Change backlight level in the kernel 111Change backlight level in the kernel
112====================================
98 113
99This works for machines covered by case ii) in Section 2. Once the driver 114This works for machines covered by case ii) in Section 2. Once the driver
100received a notification, it will set the backlight level accordingly. This does 115received a notification, it will set the backlight level accordingly. This does
101not affect the sending of event to user space, they are always sent to user 116not affect the sending of event to user space, they are always sent to user
102space regardless of whether or not the video module controls the backlight level 117space regardless of whether or not the video module controls the backlight level
103directly. This behaviour can be controlled through the brightness_switch_enabled 118directly. This behaviour can be controlled through the brightness_switch_enabled
104module parameter as documented in admin-guide/kernel-parameters.rst. It is recommended to 119module parameter as documented in admin-guide/kernel-parameters.rst. It is
105disable this behaviour once a GUI environment starts up and wants to have full 120recommended to disable this behaviour once a GUI environment starts up and
106control of the backlight level. 121wants to have full control of the backlight level.
diff --git a/Documentation/firmware-guide/index.rst b/Documentation/firmware-guide/index.rst
new file mode 100644
index 000000000000..5355784ca0a2
--- /dev/null
+++ b/Documentation/firmware-guide/index.rst
@@ -0,0 +1,13 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3===============================
4The Linux kernel firmware guide
5===============================
6
7This section describes the ACPI subsystem in Linux from firmware perspective.
8
9.. toctree::
10 :maxdepth: 1
11
12 acpi/index
13
diff --git a/Documentation/index.rst b/Documentation/index.rst
index 80a421cb935e..fdfa85c56a50 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -35,6 +35,16 @@ trying to get it to work optimally on a given system.
35 35
36 admin-guide/index 36 admin-guide/index
37 37
38Firmware-related documentation
39------------------------------
40The following holds information on the kernel's expectations regarding the
41platform firmwares.
42
43.. toctree::
44 :maxdepth: 2
45
46 firmware-guide/index
47
38Application-developer documentation 48Application-developer documentation
39----------------------------------- 49-----------------------------------
40 50
diff --git a/MAINTAINERS b/MAINTAINERS
index 5c38f21aee78..bfe9ab4b75a5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6594,7 +6594,7 @@ M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
6594L: linux-gpio@vger.kernel.org 6594L: linux-gpio@vger.kernel.org
6595L: linux-acpi@vger.kernel.org 6595L: linux-acpi@vger.kernel.org
6596S: Maintained 6596S: Maintained
6597F: Documentation/acpi/gpio-properties.txt 6597F: Documentation/firmware-guide/acpi/gpio-properties.rst
6598F: drivers/gpio/gpiolib-acpi.c 6598F: drivers/gpio/gpiolib-acpi.c
6599 6599
6600GPIO IR Transmitter 6600GPIO IR Transmitter