From patchwork Tue Feb 9 01:32:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 61468 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1766844lbl; Mon, 8 Feb 2016 17:34:11 -0800 (PST) X-Received: by 10.182.213.7 with SMTP id no7mr27726202obc.22.1454981641454; Mon, 08 Feb 2016 17:34:01 -0800 (PST) Return-Path: Received: from mail-ob0-x22b.google.com (mail-ob0-x22b.google.com. [2607:f8b0:4003:c01::22b]) by mx.google.com with ESMTPS id j3si18751573oeq.41.2016.02.08.17.34.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Feb 2016 17:34:01 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::22b as permitted sender) client-ip=2607:f8b0:4003:c01::22b; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::22b as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-ob0-x22b.google.com with SMTP id xk3so173528277obc.2 for ; Mon, 08 Feb 2016 17:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qHUFvrYaVjPvJEqJC57im6OnDorXn8IP/acA+P05WFw=; b=PEAJWW5nCOOZy2SZ97NHCYF3Cd87piDl4e1Oyee0bL3Bg+Ew0FVGjOC9lTMdjQZckx YCjcQ/NoIqejTW0+gUeXChDyVCJWkOD4J/lUThIxM+9GV6kd5FCmk8ZQw3ta50uITBgm ft2i4CdGVFGLPqo9hUeoh/2ffAdfu9ZyVBkOI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qHUFvrYaVjPvJEqJC57im6OnDorXn8IP/acA+P05WFw=; b=fg3UvfzZ/tGXPpA3T9Y6GfXhqwA4m5oaGmtev3Y0On2q6CByUXI4EtYeTjA6jdne3V kk8Po+BxTfJIbm5mA6yoQ/4SikrZgRnyzfiaWHQ/z4K71hvGEAIsp7yRb+mf3ZWbFUKC 8oa08uW89AniO8+0S/VJ8Q/DF7hpjmixxzB7/vYohaO2UU1kgC9a6i2QC2yqUJmk27Bi CMEkpx/t0Dk1IbxzX7eo8FYgj4aeJtEZnqUNcuO8gMYlAmJe3GyrKtFQ7/IarXopC+It o8BliWeLpkUrFcLfuLoKga9UzExib8VOZsnsoDdsSfC8y3ZhoCVjL8qgnkRiR1GJT4XE w2DA== X-Gm-Message-State: AG10YORzOqXpY7u/EdjBiUOFJweVxbO7makFtUXodQ1e7qRNMOQS5p6xWLpds5PrKVKKt6n0e5s= X-Received: by 10.60.178.180 with SMTP id cz20mr27473753oec.15.1454981641182; Mon, 08 Feb 2016 17:34:01 -0800 (PST) Return-Path: Received: from fidelio.ahs3 (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by smtp.googlemail.com with ESMTPSA id qp4sm19097135obc.9.2016.02.08.17.33.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Feb 2016 17:33:59 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH 15/21] FADT: add compliance tests for S4BIOS_REQ and PSTATE_CNT fields Date: Mon, 8 Feb 2016 18:32:57 -0700 Message-Id: <1454981583-31872-16-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454981583-31872-1-git-send-email-al.stone@linaro.org> References: <1454981583-31872-1-git-send-email-al.stone@linaro.org> These are the last two field that are related to the SMI_CMD field and whether or not it is defined. Additionally, this is the first set of tests that require information from the FACS, also, so add in that table to the initialization step. Signed-off-by: Al Stone --- src/acpi/fadt/fadt.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) -- 2.5.0 diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index a2535e8..3c4cdda 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -41,6 +41,8 @@ static inline int ioperm(int a, ...) static const fwts_acpi_table_fadt *fadt; static int fadt_size; +static const fwts_acpi_table_facs *facs; + static int fadt_init(fwts_framework *fw) { fwts_acpi_table_info *table; @@ -69,6 +71,23 @@ static int fadt_init(fwts_framework *fw) } } + /* + * Some tests require data from the FACS, also, which is + * required (5.2.10) is we are not in reduced hardware + * mode + */ + if (!fwts_acpi_is_reduced_hardware(fadt)) { + if (fwts_acpi_find_table(fw, "FACS", 0, &table) != FWTS_OK) { + fwts_log_error(fw, "Cannot read ACPI table FACS."); + return FWTS_ERROR; + } + if (table == NULL) { + fwts_log_error(fw, "ACPI table FACS does not exist!"); + return FWTS_ERROR; + } + facs = (const fwts_acpi_table_facs *)table->data; + } + return FWTS_OK; } @@ -769,6 +788,102 @@ static void acpi_table_check_fadt_acpi_disable(fwts_framework *fw) return; } +static void acpi_table_check_fadt_s4bios_req(fwts_framework *fw) +{ + if (facs && facs->length >= 24) + fwts_passed(fw, + "FADT indicates we are not in reduced hardware " + "mode, and required FACS is present."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FACSMustBePresent", + "FADT indicates we are not in reduced hardware " + "mode, which requires an FACS be present, but " + "none has been found."); + + if (facs && (facs->flags & FWTS_FACS_FLAG_S4BIOS_F)) { + if (fadt->s4bios_req == 0) { + if (fadt->smi_cmd == 0) { + fwts_passed(fw, + "FADT indicates System Management " + "Mode is not supported, which " + "allows a zero S4BIOS_REQ value."); + fwts_advice(fw, + "There is an inconsistency between " + "the FADT and FACS. The FADT " + "indicates no SMM support, and " + "no S4BIOS_REQ command, but the " + "FACS indicates S4BIOS_REQ is " + "supported. One of these may " + "be incorrect."); + } else { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SMMHasNoS4BIOSReqCmd", + "FADT SMI S4BIOS_REQ command is " + "zero, but this is not allowed " + "when SMM is supported, and the " + "S4BIOS_F flag is set in the " + "FACS."); + } + } else { + if (fadt->smi_cmd == 0) { + fwts_passed(fw, + "FADT indicates System Management " + "Mode is not supported, but a " + "S4BIOS_REQ command is defined."); + fwts_advice(fw, + "There is an inconsistency between " + "the FADT and FACS. The FADT " + "indicates no SMM support, but it " + "defines an S4BIOS_REQ command, " + "and the FACS indicates " + "S4BIOS_REQ is supported. One " + "of these may be incorrect."); + } else { + fwts_passed(fw, + "FADT S4BIOS_REQ command is " + "non-zero, SMM is supported so " + "the command can be used, and " + "the FACS indicates S4BIOS_REQ " + "is supported."); + } + } + } else { + if (fadt->s4bios_req == 0) + fwts_passed(fw, "FADT S4BIOS_REQ command is not set " + "and FACS indicates it is not supported."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SMMS4BIOSCmdDefined", + "FADT S4BIOS_REQ command is defined " + "but FACS indicates it is not supported."); + } + + return; +} + +static void acpi_table_check_fadt_pstate_cnt(fwts_framework *fw) +{ + if (fadt->pstate_cnt == 0) { + if (fadt->smi_cmd == 0) + fwts_passed(fw, + "FADT SMI PSTATE_CNT command is zero, " + "which is allowed since SMM is not " + "supported."); + } else { + if (fadt->smi_cmd == 0) + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SMMHasExtraPstateCntCmd", + "FADT SMI PSTATE_CNT command is " + "non-zero, but SMM is not supported."); + else + fwts_passed(fw, "FADT SMI PSTATE_CNT 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, @@ -914,6 +1029,8 @@ static int fadt_test1(fwts_framework *fw) 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_s4bios_req(fw); + acpi_table_check_fadt_pstate_cnt(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);