While other ACPI tables include fixed fields and lengths, it doesn't mean their contents cannot go wrong. In fact, many systems in the field have many incorrect ACPI tables in their firmware. This can happen when systems are developed by integrating code from various parties without modified for customized hardware.
A test suite is a good solution to catch errors without involving too many engineering resources as it can identifying errors automatically or semi-automatically. In particular, Firmware Test Suite (FWTS) is one of the best test suite (did I also mention it is freely available too?) and it is the recommended ACPI test suite by UEFI forum, who is the owner of ACPI specification.
What is Firmware Test Suite (FWTS) ?Firmware Test Suite (FWTS) is a test suite that performs sanity checks on firmware. It is intended to identify BIOS, UEFI, ACPI and many other errors and if appropriate it will try to explain the errors and give advice to help workaround or fix firmware bugs.
More information about FWTS can be found at its official website or in a previous blog.
FWTS be can installed easily with package managers on many Linux distros. It is developed on Ubuntu Linux and can be installed as follows:
- Add stable PPA for latest FWTS (optional) - sudo add-apt-repository ppa:firmware-testing-team/ppa-fwts-stable
- Install FWTS - sudo apt install fwts
Using FWTS for ACPI Errors
FWTS is a command-line tool and its usage is "fwts cmds" (root access is usually required). The following are examples of fwts checks ACPI tables
- Check FADT - fwts facp
- Check MCFG - fwts mcfg
- Check table checksums- fwts checksum
- Check table signatures and IDs - fwts acpitables
Below is an example of how fwts was executed.
More details of FWTS's ACPI tests can be found on its references website or by the command fwts --show-tests.
Running Multiple Tests
FWTS can also run multiple tests by appending tests one after another as below:
Running All ACPI TestsFWTS also provides a way to execute all tests in a category. For example, sudo fwts --acpitests run all ACPI tests all together. A similar command is sudo fwts --uefitests (which will not be discussed in details here).
Let's See Some Examples...FWTS is used for real projects. Here are some examples of tests we have run.
Running sudo fwts fadt executes 6 tests that checks whether system firmware/BIOS implement FACP table correctly.
Especially, the sizes of FACP table grow with ACPI specs, but some firmware/BIOS updates the FACP major and minor versions without adding the new fields in later ACPI spec. This can be caught by FWTS with ease. An example is Test 3 in results.log shown below.
Checking Table Checksum
Another common error in system firmware/BIOS is ACPI table checksums. When built by AML compiler, ex. iasl, table checksums are updated accordingly; however, it is a common practice that system firmware/BIOS modifies tables for hardware customization during boot time and this can corrupt tables if firmware/BIOS does not update checksum fields accordingly.
Below is an example of running sudo fwts checksum to verify the checksum fields of all ACPI tables.