When in reduced hardware mode, these fields may or may not be used. If they are, there are rules to check to make the values are reasonable. It is also possible that these fields are simply null and not used at all.
Signed-off-by: Al Stone al.stone@linaro.org Acked-by: Colin Ian King colin.king@canonical.com Acked-by: Alex Hung alex.hung@canonical.com --- src/acpi/fadt/fadt.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index 34978e5..70b6c8a 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -1475,6 +1475,66 @@ static void acpi_table_check_fadt_p_lvl3_lat(fwts_framework *fw, uint64_t pblk) return; }
+static void acpi_table_check_fadt_sleep_control_reg(fwts_framework *fw) +{ + if (fwts_acpi_is_reduced_hardware(fadt)) { + if (fadt->sleep_control_reg.address == 0) + fwts_passed(fw, "FADT SLEEP_CONTROL_REG not in use."); + else { + if (fadt->sleep_control_reg.register_bit_width == 8 && + fadt->sleep_control_reg.register_bit_offset == 0) + fwts_passed(fw, "FADT SLEEP_CONTROL_REG is " + "in use and well-defined."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SleepControlRegHasBadGAS", + "FADT SLEEP_CONTROL_REG is " + "in use but register width or " + "offset is incorrect."); + } + } else { + if (fadt->sleep_control_reg.address == 0) + fwts_passed(fw, "FADT SLEEP_CONTROL_REG is null and " + "not available when not in reduced " + "hardware mode."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SleepControlRegNotAllowed", + "FADT SLEEP_CONTROL_REG is defined but " + "will be ignored reduced hardware mode."); + } +} + +static void acpi_table_check_fadt_sleep_status_reg(fwts_framework *fw) +{ + if (fwts_acpi_is_reduced_hardware(fadt)) { + if (fadt->sleep_status_reg.address == 0) + fwts_passed(fw, "FADT SLEEP_STATUS_REG not in use."); + else { + if (fadt->sleep_status_reg.register_bit_width == 8 && + fadt->sleep_status_reg.register_bit_offset == 0) + fwts_passed(fw, "FADT SLEEP_STATUS_REG is " + "in use and well-defined."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SleepStatusRegHasBadGAS", + "FADT SLEEP_STATUS_REG is " + "in use but register width or " + "offset is incorrect."); + } + } else { + if (fadt->sleep_status_reg.address == 0) + fwts_passed(fw, "FADT SLEEP_STATUS_REG is null and " + "not available when not in reduced " + "hardware mode."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SleepStatusRegNotAllowed", + "FADT SLEEP_STATUS_REG is defined but " + "will be ignored reduced hardware mode."); + } +} + static int fadt_test1(fwts_framework *fw) { bool passed = true; @@ -1541,6 +1601,9 @@ static int fadt_test1(fwts_framework *fw) fwts_log_info(fw, "FADT CENTURY is %" PRIu8, fadt->century); }
+ acpi_table_check_fadt_sleep_control_reg(fw); + acpi_table_check_fadt_sleep_status_reg(fw); + /* * Cannot really test the Hypervisor Vendor Identity since * the value is provided by the hypervisor to the OS (as a