blob: eb651a6aa28505769a38f68fa253e2a56be3ddef [file] [log] [blame]
Lv Zheng5d881322016-04-11 10:13:33 +08001Upgrading ACPI tables via initrd
2================================
Thomas Renninger8347bbe2012-10-01 00:23:57 +02003
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
Lv Zheng5d881322016-04-11 10:13:33 +080012If 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.
Thomas Renninger8347bbe2012-10-01 00:23:57 +020016
Lv Zheng5d881322016-04-11 10:13:33 +080017For a full list of ACPI tables that can be upgraded/installed, take a look
18at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in
19drivers/acpi/tables.c.
Thomas Renninger8347bbe2012-10-01 00:23:57 +020020All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
21be overridable, except:
22 - ACPI_SIG_RSDP (has a signature of 6 bytes)
23 - ACPI_SIG_FACS (does not have an ordinary ACPI table header)
24Both could get implemented as well.
25
26
272) What is this for
28-------------------
29
Lv Zheng5d881322016-04-11 10:13:33 +080030Complain to your platform/BIOS vendor if you find a bug which is so severe
31that a workaround is not accepted in the Linux kernel. And this facility
32allows you to upgrade the buggy tables before your platform/BIOS vendor
33releases an upgraded BIOS binary.
Thomas Renninger8347bbe2012-10-01 00:23:57 +020034
Lv Zheng5d881322016-04-11 10:13:33 +080035This facility can be used by platform/BIOS vendors to provide a Linux
36compatible environment without modifying the underlying platform firmware.
37
38This facility also provides a powerful feature to easily debug and test
39ACPI BIOS table compatibility with the Linux kernel by modifying old
40platform provided ACPI tables or inserting new ACPI tables.
41
42It can and should be enabled in any kernel because there is no functional
43change with not instrumented initrds.
Thomas Renninger8347bbe2012-10-01 00:23:57 +020044
45
463) How does it work
47-------------------
48
49# Extract the machine's ACPI tables:
50cd /tmp
51acpidump >acpidump
52acpixtract -a acpidump
53# Disassemble, modify and recompile them:
54iasl -d *.dat
55# For example add this statement into a _PRT (PCI Routing Table) function
56# of the DSDT:
57Store("HELLO WORLD", debug)
Lv Zheng5d881322016-04-11 10:13:33 +080058# And increase the OEM Revision. For example, before modification:
59DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
60# After modification:
61DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
Thomas Renninger8347bbe2012-10-01 00:23:57 +020062iasl -sa dsdt.dsl
63# Add the raw ACPI tables to an uncompressed cpio archive.
Lv Zheng5d881322016-04-11 10:13:33 +080064# They must be put into a /kernel/firmware/acpi directory inside the cpio
65# archive. Note that if the table put here matches a platform table
66# (similar Table Signature, and similar OEMID, and similar OEM Table ID)
67# with a more recent OEM Revision, the platform table will be upgraded by
68# this table. If the table put here doesn't match a platform table
69# (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
70# ID), this table will be appended.
Thomas Renninger8347bbe2012-10-01 00:23:57 +020071mkdir -p kernel/firmware/acpi
72cp dsdt.aml kernel/firmware/acpi
Lv Zheng5d881322016-04-11 10:13:33 +080073# A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
74# (see osl.c):
Thomas Renninger8347bbe2012-10-01 00:23:57 +020075iasl -sa facp.dsl
76iasl -sa ssdt1.dsl
77cp facp.aml kernel/firmware/acpi
78cp ssdt1.aml kernel/firmware/acpi
Lv Zheng5d881322016-04-11 10:13:33 +080079# The uncompressed cpio archive must be the first. Other, typically
80# compressed cpio archives, must be concatenated on top of the uncompressed
81# one. Following command creates the uncompressed cpio archive and
82# concatenates the original initrd on top:
Thomas Renninger8347bbe2012-10-01 00:23:57 +020083find kernel | cpio -H newc --create > /boot/instrumented_initrd
84cat /boot/initrd >>/boot/instrumented_initrd
85# reboot with increased acpi debug level, e.g. boot params:
86acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
87# and check your syslog:
88[ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
89[ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
90
91iasl is able to disassemble and recompile quite a lot different,
92also static ACPI tables.
93
94
954) Where to retrieve userspace tools
96------------------------------------
97
98iasl and acpixtract are part of Intel's ACPICA project:
99http://acpica.org/
100and should be packaged by distributions (for example in the acpica package
101on SUSE).
102
103acpidump can be found in Len Browns pmtools:
104ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
105This tool is also part of the acpica package on SUSE.
106Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
107/sys/firmware/acpi/tables