From patchwork Tue Feb 9 01:33:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 61473 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1766923lbl; Mon, 8 Feb 2016 17:34:26 -0800 (PST) X-Received: by 10.60.142.170 with SMTP id rx10mr27337763oeb.37.1454981655959; Mon, 08 Feb 2016 17:34:15 -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 o132si1083349oib.59.2016.02.08.17.34.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Feb 2016 17:34:15 -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 ba1so173683536obb.3 for ; Mon, 08 Feb 2016 17:34:15 -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=EdU/18mYPXrtyaLgh0vU/0yuox64zMzz2PgHjCBn1yE=; b=TSKHKT8MglfTYIfTjlG4FvRb00ernfYJc2u32XjCjmEc/nj4NaPpEqPUcqKZs3x7rD cOuwcXLMKROnra8KXfs3ruicd9OdvgOxOPplBnl26QPc7DUbPbkK6qRfFuH1EPF2FoaE CQHb9EyxYCBcq8wQmf7YyqiWBnYh/ujTEdDQY= 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=EdU/18mYPXrtyaLgh0vU/0yuox64zMzz2PgHjCBn1yE=; b=XrL0b+abJIDWigocozNFX24wDUvSiTM4ELw5HNQFgKbt2OL1htr1qHjY5q+HfN/nJz Dn976oF/IfEBav6WOkOIW0a/mGUCxiayNVe/P5srZ33UcFEB3JId9p0LiQicGPUC4C2Y 0zRFDz9lx8akpt8Zu/Q2c9V2E+RKUuf0kOoVGeUWmy8xqyEg8gJun8hWoZr0He4qXoBJ OdtmOTaMXjeu79MXw/HIiBB58tVa2p2Hh9Wskwdg9C8ihubKYW41be6i9q6U4+g6hLqJ RkZRHrY6gDE1YRdC7jHMaRrzhAqDMww3I+aj9rkhROoLvPcc+jwsMPgP2TfQX65TLcnN hv6g== X-Gm-Message-State: AG10YORtCLSNxuH9Nc6W7FDWiCqQGaK9qBiOSwQvezLvvYNh4CuEjokonEsbGrJSlargf05FbHY= X-Received: by 10.60.135.10 with SMTP id po10mr29023484oeb.56.1454981655621; Mon, 08 Feb 2016 17:34:15 -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.34.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Feb 2016 17:34:14 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH 20/21] FADT: add in SLEEP_CONTROL_REG and SLEEP_STATUS_REG compliance tests Date: Mon, 8 Feb 2016 18:33:02 -0700 Message-Id: <1454981583-31872-21-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> 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 simple null and not used at all. Signed-off-by: Al Stone --- src/acpi/fadt/fadt.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) -- 2.5.0 diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index a2ed70c..05205cb 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -1452,6 +1452,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; @@ -1518,6 +1578,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