From patchwork Fri Feb 19 23:39:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 62436 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp78748lbl; Fri, 19 Feb 2016 15:41:21 -0800 (PST) X-Received: by 10.60.79.102 with SMTP id i6mr13816602oex.4.1455925281298; Fri, 19 Feb 2016 15:41:21 -0800 (PST) Return-Path: Received: from mail-ob0-x233.google.com (mail-ob0-x233.google.com. [2607:f8b0:4003:c01::233]) by mx.google.com with ESMTPS id j7si2323344oeo.36.2016.02.19.15.41.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Feb 2016 15:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::233 as permitted sender) client-ip=2607:f8b0:4003:c01::233; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::233 as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-ob0-x233.google.com with SMTP id jq7so122511974obb.0 for ; Fri, 19 Feb 2016 15:41:21 -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=7uRZvb4V8XSY1apF+/6oGVkxKzQK007gh6rnW+fdRRo=; b=h91BBS7aPpBOKzdDJpbK7NVKsC9YildtD5RFIbKDveMZdxqUvYmPhJTL/dWrh0QGHs uQDzEHLKqrQ99EHaxPP8BCMiq2NBg8ajLl1u27WyqPhQaNd6fC4kowZxd8tEM8jptPa9 bG6ybnV7WnQszVllrIFFhCCuk0FuZ/AXvwG4k= 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=7uRZvb4V8XSY1apF+/6oGVkxKzQK007gh6rnW+fdRRo=; b=bMDvqnTpswVW3jzKCv9o/dEbAcYSsJw/QqbM7vAbVYsx+R8YL38f6QhsdlqFSbYpL9 ud2C00pfOuJbONJA+EAQPu4u9x90bL2jrkj6EKMQmPbSTAN5ikTIboBxtH5Vlb5MQTET I/NFyyzr0q1kB81JH0gngrLudCF86RCEAiClVXC/J9Iy1y/Y4QeIJ/JKtazCF7Zixxjf IzOitYfpnly1wIfw1hz4oxCNJOJBpWBCdSAtBLz5EB67zzmef3Ww4lLGPy0p9F0YS9FD b5X4y54uEoYpW8TmzNx+ZY7Mm9ujuL5NKW9y5cwtMhgpss24ZrLMOhB1TrroTOmmEqPJ vCeg== X-Gm-Message-State: AG10YORYBPFcCuBb8tEtN4K39aGi3Fji6eBufgwBOjXOX+cwfAul3eLRWIRvX2YtP7FX2D0Xdxg= X-Received: by 10.60.60.65 with SMTP id f1mr10629140oer.28.1455925280992; Fri, 19 Feb 2016 15:41:20 -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.19 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Feb 2016 15:41:19 -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 20/23] FADT: add in SLEEP_CONTROL_REG and SLEEP_STATUS_REG compliance tests Date: Fri, 19 Feb 2016 16:39:56 -0700 Message-Id: <1455925199-8587-21-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> 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 simply null and not used at all. Signed-off-by: Al Stone Acked-by: Colin Ian King Acked-by: Alex Hung --- 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 34978e5..70b6c8a 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -1475,6 +1475,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; @@ -1541,6 +1601,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