Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 1 | Upgrading ACPI tables via initrd |
| 2 | ================================ |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 3 | |
| 4 | 1) Introduction (What is this about) |
| 5 | 2) What is this for |
| 6 | 3) How does it work |
| 7 | 4) References (Where to retrieve userspace tools) |
| 8 | |
| 9 | 1) What is this about |
| 10 | --------------------- |
| 11 | |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 12 | If the ACPI_TABLE_UPGRADE compile option is true, it is possible to |
| 13 | upgrade the ACPI execution environment that is defined by the ACPI tables |
| 14 | via upgrading the ACPI tables provided by the BIOS with an instrumented, |
| 15 | modified, more recent version one, or installing brand new ACPI tables. |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 16 | |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 17 | For a full list of ACPI tables that can be upgraded/installed, take a look |
| 18 | at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in |
| 19 | drivers/acpi/tables.c. |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 20 | All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should |
| 21 | be overridable, except: |
| 22 | - ACPI_SIG_RSDP (has a signature of 6 bytes) |
| 23 | - ACPI_SIG_FACS (does not have an ordinary ACPI table header) |
| 24 | Both could get implemented as well. |
| 25 | |
| 26 | |
| 27 | 2) What is this for |
| 28 | ------------------- |
| 29 | |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 30 | Complain to your platform/BIOS vendor if you find a bug which is so severe |
| 31 | that a workaround is not accepted in the Linux kernel. And this facility |
| 32 | allows you to upgrade the buggy tables before your platform/BIOS vendor |
| 33 | releases an upgraded BIOS binary. |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 34 | |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 35 | This facility can be used by platform/BIOS vendors to provide a Linux |
| 36 | compatible environment without modifying the underlying platform firmware. |
| 37 | |
| 38 | This facility also provides a powerful feature to easily debug and test |
| 39 | ACPI BIOS table compatibility with the Linux kernel by modifying old |
| 40 | platform provided ACPI tables or inserting new ACPI tables. |
| 41 | |
| 42 | It can and should be enabled in any kernel because there is no functional |
| 43 | change with not instrumented initrds. |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 44 | |
| 45 | |
| 46 | 3) How does it work |
| 47 | ------------------- |
| 48 | |
| 49 | # Extract the machine's ACPI tables: |
| 50 | cd /tmp |
| 51 | acpidump >acpidump |
| 52 | acpixtract -a acpidump |
| 53 | # Disassemble, modify and recompile them: |
| 54 | iasl -d *.dat |
| 55 | # For example add this statement into a _PRT (PCI Routing Table) function |
| 56 | # of the DSDT: |
| 57 | Store("HELLO WORLD", debug) |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 58 | # And increase the OEM Revision. For example, before modification: |
| 59 | DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000) |
| 60 | # After modification: |
| 61 | DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001) |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 62 | iasl -sa dsdt.dsl |
| 63 | # Add the raw ACPI tables to an uncompressed cpio archive. |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 64 | # 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 Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 71 | mkdir -p kernel/firmware/acpi |
| 72 | cp dsdt.aml kernel/firmware/acpi |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 73 | # A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed |
| 74 | # (see osl.c): |
Thomas Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 75 | iasl -sa facp.dsl |
| 76 | iasl -sa ssdt1.dsl |
| 77 | cp facp.aml kernel/firmware/acpi |
| 78 | cp ssdt1.aml kernel/firmware/acpi |
Lv Zheng | 5d88132 | 2016-04-11 10:13:33 +0800 | [diff] [blame] | 79 | # 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 Renninger | 8347bbe | 2012-10-01 00:23:57 +0200 | [diff] [blame] | 83 | find kernel | cpio -H newc --create > /boot/instrumented_initrd |
| 84 | cat /boot/initrd >>/boot/instrumented_initrd |
| 85 | # reboot with increased acpi debug level, e.g. boot params: |
| 86 | acpi.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 | |
| 91 | iasl is able to disassemble and recompile quite a lot different, |
| 92 | also static ACPI tables. |
| 93 | |
| 94 | |
| 95 | 4) Where to retrieve userspace tools |
| 96 | ------------------------------------ |
| 97 | |
| 98 | iasl and acpixtract are part of Intel's ACPICA project: |
| 99 | http://acpica.org/ |
| 100 | and should be packaged by distributions (for example in the acpica package |
| 101 | on SUSE). |
| 102 | |
| 103 | acpidump can be found in Len Browns pmtools: |
| 104 | ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump |
| 105 | This tool is also part of the acpica package on SUSE. |
| 106 | Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels: |
| 107 | /sys/firmware/acpi/tables |