diff mbox

[14/21] FADT: add compliance tests for the ACPI_ENABLE and ACPI_DISABLE fields

Message ID 1454981583-31872-15-git-send-email-al.stone@linaro.org
State Superseded
Headers show

Commit Message

Al Stone Feb. 9, 2016, 1:32 a.m. UTC
Do some checking of allowed values for ACPI_ENABLE and ACPI_DISABLE
fields, particularly if SMI_CMD is defined.

Signed-off-by: Al Stone <al.stone@linaro.org>

---
 src/acpi/fadt/fadt.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

-- 
2.5.0
diff mbox

Patch

diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
index 3da297e..a2535e8 100644
--- a/src/acpi/fadt/fadt.c
+++ b/src/acpi/fadt/fadt.c
@@ -716,6 +716,59 @@  static void acpi_table_check_fadt_smi_cmd(fwts_framework *fw)
 	}
 }
 
+static void acpi_table_check_fadt_acpi_enable(fwts_framework *fw)
+{
+	if (fadt->acpi_enable == 0)
+		if (fadt->smi_cmd == 0)
+			fwts_passed(fw, "FADT SMI ACPI enable command is zero, "
+				    "which is allowed since SMM is not "
+				    "supported, or machine is in legacy mode.");
+		else
+			fwts_failed(fw, LOG_LEVEL_MEDIUM,
+				    "SMMHasNoAcpiEnableCmd",
+				    "FADT SMI ACPI enable command is zero, "
+				    "but this is not allowed when SMM "
+				    "is supported.");
+	else
+		if (fadt->smi_cmd == 0)
+			fwts_failed(fw, LOG_LEVEL_MEDIUM,
+				    "SMMNeedsAcpiEnableCmd",
+				    "FADT SMI ACPI enable command is non-zero, "
+				    "but SMM is not supported.");
+		else
+			fwts_passed(fw, "FADT SMI ACPI enable command is "
+				    "non-zero, and SMM is supported.");
+
+	return;
+}
+
+static void acpi_table_check_fadt_acpi_disable(fwts_framework *fw)
+{
+	if (fadt->acpi_disable == 0)
+		if (fadt->smi_cmd == 0)
+			fwts_passed(fw,
+				    "FADT SMI ACPI disable command is zero, "
+				    "which is allowed since SMM is not "
+				    "supported, or machine is in legacy mode.");
+		else
+			fwts_failed(fw, LOG_LEVEL_MEDIUM,
+				    "SMMHasNoAcpiDisableCmd",
+				    "FADT SMI ACPI disable command is zero, "
+				    "but this is not allowed when SMM "
+				    "is supported.");
+	else
+		if (fadt->smi_cmd == 0)
+			fwts_failed(fw, LOG_LEVEL_MEDIUM,
+				    "SMMNeedsAcpiDisableCmd",
+				    "FADT SMI ACPI disable command is "
+				    "non-zero, but SMM is not supported.");
+		else
+			fwts_passed(fw, "FADT SMI ACPI disable command is "
+				    "non-zero, and SMM is supported.");
+
+	return;
+}
+
 static void acpi_table_check_fadt_pm_tmr(
 	fwts_framework *fw,
 	const fwts_acpi_table_fadt *fadt,
@@ -859,6 +912,8 @@  static int fadt_test1(fwts_framework *fw)
 	if (!fwts_acpi_is_reduced_hardware(fadt)) {
 		fwts_log_info(fw, "FADT SCI_INT is %" PRIu8, fadt->sci_int);
 		acpi_table_check_fadt_smi_cmd(fw);
+		acpi_table_check_fadt_acpi_enable(fw);
+		acpi_table_check_fadt_acpi_disable(fw);
 		acpi_table_check_fadt_pm_tmr(fw, fadt, &passed);
 		acpi_table_check_fadt_gpe(fw, fadt, &passed);
 		acpi_table_check_fadt_pm_addr(fw, fadt, &passed);