Commit 7fe19072 authored by Changbin Du's avatar Changbin Du Committed by Rafael J. Wysocki

Documentation: ACPI: move ssdt-overlays.txt to admin-guide/acpi and convert to reST

This converts the plain text documentation to reStructuredText format
and adds it to Sphinx TOC tree.

No essential content change.
Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 4887954c
...@@ -10,4 +10,5 @@ the Linux ACPI support. ...@@ -10,4 +10,5 @@ the Linux ACPI support.
initrd_table_override initrd_table_override
dsdt-override dsdt-override
ssdt-overlays
cppc_sysfs cppc_sysfs
.. SPDX-License-Identifier: GPL-2.0
=============
SSDT Overlays
=============
In order to support ACPI open-ended hardware configurations (e.g. development In order to support ACPI open-ended hardware configurations (e.g. development
boards) we need a way to augment the ACPI configuration provided by the firmware boards) we need a way to augment the ACPI configuration provided by the firmware
...@@ -15,10 +20,10 @@ user defined SSDT tables that contain the board specific information. ...@@ -15,10 +20,10 @@ user defined SSDT tables that contain the board specific information.
For example, to enumerate a Bosch BMA222E accelerometer on the I2C bus of the For example, to enumerate a Bosch BMA222E accelerometer on the I2C bus of the
Minnowboard MAX development board exposed via the LSE connector [1], the Minnowboard MAX development board exposed via the LSE connector [1], the
following ASL code can be used: following ASL code can be used::
DefinitionBlock ("minnowmax.aml", "SSDT", 1, "Vendor", "Accel", 0x00000003) DefinitionBlock ("minnowmax.aml", "SSDT", 1, "Vendor", "Accel", 0x00000003)
{ {
External (\_SB.I2C6, DeviceObj) External (\_SB.I2C6, DeviceObj)
Scope (\_SB.I2C6) Scope (\_SB.I2C6)
...@@ -45,25 +50,26 @@ DefinitionBlock ("minnowmax.aml", "SSDT", 1, "Vendor", "Accel", 0x00000003) ...@@ -45,25 +50,26 @@ DefinitionBlock ("minnowmax.aml", "SSDT", 1, "Vendor", "Accel", 0x00000003)
} }
} }
} }
} }
which can then be compiled to AML binary format: which can then be compiled to AML binary format::
$ iasl minnowmax.asl $ iasl minnowmax.asl
Intel ACPI Component Architecture Intel ACPI Component Architecture
ASL Optimizing Compiler version 20140214-64 [Mar 29 2014] ASL Optimizing Compiler version 20140214-64 [Mar 29 2014]
Copyright (c) 2000 - 2014 Intel Corporation Copyright (c) 2000 - 2014 Intel Corporation
ASL Input: minnomax.asl - 30 lines, 614 bytes, 7 keywords ASL Input: minnomax.asl - 30 lines, 614 bytes, 7 keywords
AML Output: minnowmax.aml - 165 bytes, 6 named objects, 1 executable opcodes AML Output: minnowmax.aml - 165 bytes, 6 named objects, 1 executable opcodes
[1] http://wiki.minnowboard.org/MinnowBoard_MAX#Low_Speed_Expansion_Connector_.28Top.29 [1] http://wiki.minnowboard.org/MinnowBoard_MAX#Low_Speed_Expansion_Connector_.28Top.29
The resulting AML code can then be loaded by the kernel using one of the methods The resulting AML code can then be loaded by the kernel using one of the methods
below. below.
== Loading ACPI SSDTs from initrd == Loading ACPI SSDTs from initrd
==============================
This option allows loading of user defined SSDTs from initrd and it is useful This option allows loading of user defined SSDTs from initrd and it is useful
when the system does not support EFI or when there is not enough EFI storage. when the system does not support EFI or when there is not enough EFI storage.
...@@ -74,23 +80,24 @@ aml code must be placed in the first, uncompressed, initrd under the ...@@ -74,23 +80,24 @@ aml code must be placed in the first, uncompressed, initrd under the
in loading multiple tables. Only SSDT and OEM tables are allowed. See in loading multiple tables. Only SSDT and OEM tables are allowed. See
initrd_table_override.txt for more details. initrd_table_override.txt for more details.
Here is an example: Here is an example::
# Add the raw ACPI tables to an uncompressed cpio archive. # Add the raw ACPI tables to an uncompressed cpio archive.
# They must be put into a /kernel/firmware/acpi directory inside the # They must be put into a /kernel/firmware/acpi directory inside the
# cpio archive. # cpio archive.
# The uncompressed cpio archive must be the first. # The uncompressed cpio archive must be the first.
# Other, typically compressed cpio archives, must be # Other, typically compressed cpio archives, must be
# concatenated on top of the uncompressed one. # concatenated on top of the uncompressed one.
mkdir -p kernel/firmware/acpi mkdir -p kernel/firmware/acpi
cp ssdt.aml kernel/firmware/acpi cp ssdt.aml kernel/firmware/acpi
# Create the uncompressed cpio archive and concatenate the original initrd # Create the uncompressed cpio archive and concatenate the original initrd
# on top: # on top:
find kernel | cpio -H newc --create > /boot/instrumented_initrd find kernel | cpio -H newc --create > /boot/instrumented_initrd
cat /boot/initrd >>/boot/instrumented_initrd cat /boot/initrd >>/boot/instrumented_initrd
== Loading ACPI SSDTs from EFI variables == Loading ACPI SSDTs from EFI variables
=====================================
This is the preferred method, when EFI is supported on the platform, because it This is the preferred method, when EFI is supported on the platform, because it
allows a persistent, OS independent way of storing the user defined SSDTs. There allows a persistent, OS independent way of storing the user defined SSDTs. There
...@@ -116,48 +123,49 @@ include/linux/efi.h). Writing to the file must also be done with one write ...@@ -116,48 +123,49 @@ include/linux/efi.h). Writing to the file must also be done with one write
operation. operation.
For example, you can use the following bash script to create/update an EFI For example, you can use the following bash script to create/update an EFI
variable with the content from a given file: variable with the content from a given file::
#!/bin/sh -e #!/bin/sh -e
while ! [ -z "$1" ]; do while ! [ -z "$1" ]; do
case "$1" in case "$1" in
"-f") filename="$2"; shift;; "-f") filename="$2"; shift;;
"-g") guid="$2"; shift;; "-g") guid="$2"; shift;;
*) name="$1";; *) name="$1";;
esac esac
shift shift
done done
usage() usage()
{ {
echo "Syntax: ${0##*/} -f filename [ -g guid ] name" echo "Syntax: ${0##*/} -f filename [ -g guid ] name"
exit 1 exit 1
} }
[ -n "$name" -a -f "$filename" ] || usage [ -n "$name" -a -f "$filename" ] || usage
EFIVARFS="/sys/firmware/efi/efivars" EFIVARFS="/sys/firmware/efi/efivars"
[ -d "$EFIVARFS" ] || exit 2 [ -d "$EFIVARFS" ] || exit 2
if stat -tf $EFIVARFS | grep -q -v de5e81e4; then if stat -tf $EFIVARFS | grep -q -v de5e81e4; then
mount -t efivarfs none $EFIVARFS mount -t efivarfs none $EFIVARFS
fi fi
# try to pick up an existing GUID # try to pick up an existing GUID
[ -n "$guid" ] || guid=$(find "$EFIVARFS" -name "$name-*" | head -n1 | cut -f2- -d-) [ -n "$guid" ] || guid=$(find "$EFIVARFS" -name "$name-*" | head -n1 | cut -f2- -d-)
# use a randomly generated GUID # use a randomly generated GUID
[ -n "$guid" ] || guid="$(cat /proc/sys/kernel/random/uuid)" [ -n "$guid" ] || guid="$(cat /proc/sys/kernel/random/uuid)"
# efivarfs expects all of the data in one write # efivarfs expects all of the data in one write
tmp=$(mktemp) tmp=$(mktemp)
/bin/echo -ne "\007\000\000\000" | cat - $filename > $tmp /bin/echo -ne "\007\000\000\000" | cat - $filename > $tmp
dd if=$tmp of="$EFIVARFS/$name-$guid" bs=$(stat -c %s $tmp) dd if=$tmp of="$EFIVARFS/$name-$guid" bs=$(stat -c %s $tmp)
rm $tmp rm $tmp
== Loading ACPI SSDTs from configfs == Loading ACPI SSDTs from configfs
================================
This option allows loading of user defined SSDTs from userspace via the configfs This option allows loading of user defined SSDTs from userspace via the configfs
interface. The CONFIG_ACPI_CONFIGFS option must be select and configfs must be interface. The CONFIG_ACPI_CONFIGFS option must be select and configfs must be
...@@ -165,8 +173,8 @@ mounted. In the following examples, we assume that configfs has been mounted in ...@@ -165,8 +173,8 @@ mounted. In the following examples, we assume that configfs has been mounted in
/config. /config.
New tables can be loading by creating new directories in /config/acpi/table/ and New tables can be loading by creating new directories in /config/acpi/table/ and
writing the SSDT aml code in the aml attribute: writing the SSDT aml code in the aml attribute::
cd /config/acpi/table cd /config/acpi/table
mkdir my_ssdt mkdir my_ssdt
cat ~/ssdt.aml > my_ssdt/aml cat ~/ssdt.aml > my_ssdt/aml
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment