From patchwork Fri Feb 19 23:39:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 62431 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp78671lbl; Fri, 19 Feb 2016 15:41:07 -0800 (PST) X-Received: by 10.202.49.138 with SMTP id x132mr13563826oix.106.1455925267189; Fri, 19 Feb 2016 15:41:07 -0800 (PST) Return-Path: Received: from mail-oi0-x22b.google.com (mail-oi0-x22b.google.com. [2607:f8b0:4003:c06::22b]) by mx.google.com with ESMTPS id di4si8535117oeb.17.2016.02.19.15.41.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Feb 2016 15:41:07 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c06::22b as permitted sender) client-ip=2607:f8b0:4003:c06::22b; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c06::22b as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-oi0-x22b.google.com with SMTP id m82so22787880oif.1 for ; Fri, 19 Feb 2016 15:41:06 -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=7yNs67qlZShcjydvuCxSz5gOBqEuKmo5eaIc04JUUrg=; b=R5Ed2wgVtQjBVXyiHcAIl/CkD2/YmR7ksQvd/vI224wfvWibQ0UOxQ3/I7etHAzFF/ tyYwmwFcsjsRMeUJ1tsg4f8mFmZD47So92Vgpk1BYwmGczz/gtLbp1sGcVawLBVUw/tx o4qOTYBqebvckSHY3qx7PgCuQcm0OG4bk5kYk= 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=7yNs67qlZShcjydvuCxSz5gOBqEuKmo5eaIc04JUUrg=; b=hhxs8EM6BhwADvlW709FY16zEJ99yb8FRtV6hC2/dMmRMw9Y777EjyHJ5MZAgF03yp gAt83zLC7ecd2YV8YsH9bB6uS0O0lYEBMvpuCBJ8xRRUkRmw9ZslhP052AHQxRYIhzP6 t8v9CJCzNq7382aYs+cNqI6jSY3DStfNRABx3uswBJns/iBB6L9fWKZpXemlL7pWx8+O O0fbJsnVLTCaLnEFp/l16XnVtfL8pSestp4bQu6MYw31K3LIb0KbVSdjiFt8Ocjmw8tv 0QGkszCHM/4Jo8RN36QXFCRGcXRLN0bEDD09ZY6clZiz0YQX25Gg62Tli19HCIZ6pvh1 +tRg== X-Gm-Message-State: AG10YOTthOozoMeoPZdCPaYyHLWp+luBg+fySTzv5I92i42R+2XoKFva0ZeCWJTskl8LSxD2Gdo= X-Received: by 10.202.235.85 with SMTP id j82mr13523824oih.38.1455925266841; Fri, 19 Feb 2016 15:41:06 -0800 (PST) Return-Path: Received: from fidelio.ahs3.com (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by smtp.googlemail.com with ESMTPSA id kg7sm8655217obb.27.2016.02.19.15.41.04 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Feb 2016 15:41:05 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH v2 15/23] FADT: add compliance tests for S4BIOS_REQ and PSTATE_CNT fields Date: Fri, 19 Feb 2016 16:39:51 -0700 Message-Id: <1455925199-8587-16-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455925199-8587-1-git-send-email-al.stone@linaro.org> References: <1455925199-8587-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 Acked-by: Colin Ian King Acked-by: Alex Hung --- 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 2c56eba..94a166c 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; } @@ -793,6 +812,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, @@ -938,6 +1053,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);