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: 585489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id D5EFD1402D8; Sat, 20 Feb 2016 10:41:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=R5Ed2wgV; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1aWufm-0005Ra-OD; Fri, 19 Feb 2016 23:41:18 +0000 Received: from mail-oi0-f53.google.com ([209.85.218.53]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.76) (envelope-from ) id 1aWufb-0005Mk-TF for fwts-devel@lists.ubuntu.com; Fri, 19 Feb 2016 23:41:08 +0000 Received: by mail-oi0-f53.google.com with SMTP id j125so23004384oih.0 for ; Fri, 19 Feb 2016 15:41:07 -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=RqS2bwVYQciDoj5Xrsu+Et4Hs69hXfBXR34hUuL1d592knVSQKzlekBSJ/K9ZqeoRP tveI9CRORipOjziuKqp8r9+uiLQ0IqT0pTyQni+FJUiSBAz1ZxXIla4oc7O39WitYzx2 xs/cptDJ9uWLloL1QY6r6lwwgcG91pK+mn19CzBIe0w+5t+oZ5XkPD+BkwjkocvKt8g8 KbT7aHjCPtai9x9rErefZXfbwTg7I6ZveXS2vwm78uSHLZi0CU6Syy5+slhzjQH1JFP7 OX/ncWW4i0xO0MFjQ0J+kfV6Fb8y7unBw52MT5fdGObeqkB5fNTGLpmAHI9eXpNXwzhw auMA== X-Gm-Message-State: AG10YORfHKsxPAIZ/1WJ4acnowKI9u8P4vwy7Ktd8NN/mIUPsHl1YUwfy6AztKlGycsI1H0c X-Received: by 10.202.235.85 with SMTP id j82mr13523824oih.38.1455925266841; Fri, 19 Feb 2016 15:41:06 -0800 (PST) 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 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> Cc: patches@linaro.org, linaro-acpi@lists.linaro.org X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com 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(+) 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);