initrd_table_override.txt 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. Overriding ACPI tables via initrd
  2. =================================
  3. 1) Introduction (What is this about)
  4. 2) What is this for
  5. 3) How does it work
  6. 4) References (Where to retrieve userspace tools)
  7. 1) What is this about
  8. ---------------------
  9. If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible to
  10. override nearly any ACPI table provided by the BIOS with an instrumented,
  11. modified one.
  12. For a full list of ACPI tables that can be overridden, take a look at
  13. the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in drivers/acpi/osl.c
  14. All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
  15. be overridable, except:
  16. - ACPI_SIG_RSDP (has a signature of 6 bytes)
  17. - ACPI_SIG_FACS (does not have an ordinary ACPI table header)
  18. Both could get implemented as well.
  19. 2) What is this for
  20. -------------------
  21. Please keep in mind that this is a debug option.
  22. ACPI tables should not get overridden for productive use.
  23. If BIOS ACPI tables are overridden the kernel will get tainted with the
  24. TAINT_OVERRIDDEN_ACPI_TABLE flag.
  25. Complain to your platform/BIOS vendor if you find a bug which is so sever
  26. that a workaround is not accepted in the Linux kernel.
  27. Still, it can and should be enabled in any kernel, because:
  28. - There is no functional change with not instrumented initrds
  29. - It provides a powerful feature to easily debug and test ACPI BIOS table
  30. compatibility with the Linux kernel.
  31. 3) How does it work
  32. -------------------
  33. # Extract the machine's ACPI tables:
  34. cd /tmp
  35. acpidump >acpidump
  36. acpixtract -a acpidump
  37. # Disassemble, modify and recompile them:
  38. iasl -d *.dat
  39. # For example add this statement into a _PRT (PCI Routing Table) function
  40. # of the DSDT:
  41. Store("HELLO WORLD", debug)
  42. iasl -sa dsdt.dsl
  43. # Add the raw ACPI tables to an uncompressed cpio archive.
  44. # They must be put into a /kernel/firmware/acpi directory inside the
  45. # cpio archive.
  46. # The uncompressed cpio archive must be the first.
  47. # Other, typically compressed cpio archives, must be
  48. # concatenated on top of the uncompressed one.
  49. mkdir -p kernel/firmware/acpi
  50. cp dsdt.aml kernel/firmware/acpi
  51. # A maximum of: #define ACPI_OVERRIDE_TABLES 10
  52. # tables are currently allowed (see osl.c):
  53. iasl -sa facp.dsl
  54. iasl -sa ssdt1.dsl
  55. cp facp.aml kernel/firmware/acpi
  56. cp ssdt1.aml kernel/firmware/acpi
  57. # Create the uncompressed cpio archive and concatenate the original initrd
  58. # on top:
  59. find kernel | cpio -H newc --create > /boot/instrumented_initrd
  60. cat /boot/initrd >>/boot/instrumented_initrd
  61. # reboot with increased acpi debug level, e.g. boot params:
  62. acpi.debug_level=0x2 acpi.debug_layer=0xFFFFFFFF
  63. # and check your syslog:
  64. [ 1.268089] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
  65. [ 1.272091] [ACPI Debug] String [0x0B] "HELLO WORLD"
  66. iasl is able to disassemble and recompile quite a lot different,
  67. also static ACPI tables.
  68. 4) Where to retrieve userspace tools
  69. ------------------------------------
  70. iasl and acpixtract are part of Intel's ACPICA project:
  71. http://acpica.org/
  72. and should be packaged by distributions (for example in the acpica package
  73. on SUSE).
  74. acpidump can be found in Len Browns pmtools:
  75. ftp://kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools/acpidump
  76. This tool is also part of the acpica package on SUSE.
  77. Alternatively, used ACPI tables can be retrieved via sysfs in latest kernels:
  78. /sys/firmware/acpi/tables