From patchwork Tue Jul 25 06:10:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakar Arora X-Patchwork-Id: 793206 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xGntW2XzJz9s1h; Tue, 25 Jul 2017 16:11:15 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dZt3q-0005CJ-62; Tue, 25 Jul 2017 06:11:14 +0000 Received: from foss.arm.com ([217.140.101.70]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dZt3i-0005B8-Si for fwts-devel@lists.ubuntu.com; Tue, 25 Jul 2017 06:11:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 555D92B; Mon, 24 Jul 2017 23:11:06 -0700 (PDT) Received: from u201365.usa.Arm.com (a75592.asiapac.arm.com [10.162.2.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 761CC3F577; Mon, 24 Jul 2017 23:11:04 -0700 (PDT) From: Sakar Arora To: fwts-devel@lists.ubuntu.com Subject: [PATCH 02/10] acpi: method: add SBBR compliance tests Date: Tue, 25 Jul 2017 11:40:49 +0530 Message-Id: <1500963057-4225-3-git-send-email-Sakar.Arora@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500963057-4225-1-git-send-email-Sakar.Arora@arm.com> References: <1500963057-4225-1-git-send-email-Sakar.Arora@arm.com> Cc: Prasanth.Pulla@arm.com, Mahesh.ReddyBireddy@arm.com, Rajat.Goyal@arm.com, Charles.Garcia-Tobin@arm.com 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 Server Base Boot Requirements (SBBR) specification is intended for SBSA- compliant 64-bit ARMv8 servers. It defines the base firmware requirements for out-of-box support of any ARM SBSA-compatible Operating System or hypervisor. The requirements in this specification are expected to be minimal yet complete for booting a multi-core ARMv8 server platform, while leaving plenty of room for OEM or ODM innovations and design details. For more information, download the SBBR specification here: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044b/index.html - This changes alters the acpi method tests to conform to SBBR specification. - Spelling mistakes corrected and some code cleanup. Signed-off-by: Supreeth Venkatesh Signed-off-by: Sakar Arora Acked-by: Alex Hung Acked-by: Colin Ian King --- src/acpi/method/method.c | 117 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 90 insertions(+), 27 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 75aac0a..423c96c 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -255,7 +255,7 @@ */ /* Test types */ -#define METHOD_MANDITORY 1 +#define METHOD_MANDATORY 1 #define METHOD_OPTIONAL 2 #define METHOD_MOBILE 4 #define METHOD_SILENT 8 @@ -547,8 +547,8 @@ static int method_evaluate_method(fwts_framework *fw, return FWTS_OK; } else { if (!(test_type & METHOD_SILENT)) { - /* Manditory not-found test are a failure */ - if (test_type & METHOD_MANDITORY) { + /* Mandatory not-found test are a failure */ + if (test_type & METHOD_MANDATORY) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "MethodNotExist", "Object %s did not exist.", name); } @@ -557,11 +557,11 @@ static int method_evaluate_method(fwts_framework *fw, if ((test_type & METHOD_MOBILE) && (!fadt_mobile_platform)) { fwts_skipped(fw, "Machine is not a mobile platform, skipping " - "test for non-existant mobile platform " + "test for non-existent mobile platform " "related object %s.", name); } else { fwts_skipped(fw, - "Skipping test for non-existant object %s.", + "Skipping test for non-existent object %s.", name); } } @@ -972,8 +972,12 @@ static void method_test_AEI_return( static int method_test_AEI(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, - "_AEI", NULL, 0, method_test_AEI_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + return method_evaluate_method(fw, METHOD_MANDATORY, + "_AEI", NULL, 0, method_test_AEI_return, NULL); + else + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_AEI", NULL, 0, method_test_AEI_return, NULL); } static void check_evt_event ( @@ -1057,11 +1061,15 @@ static int method_test_EVT(fwts_framework *fw) int ret; /* Only test the _EVT method with pins defined in AEI. */ - ret = method_evaluate_method(fw, METHOD_OPTIONAL | METHOD_SILENT, - "_AEI", NULL, 0, method_test_EVT_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + ret = method_evaluate_method(fw, METHOD_MANDATORY | METHOD_SILENT, + "_AEI", NULL, 0, method_test_EVT_return, NULL); + else + ret = method_evaluate_method(fw, METHOD_OPTIONAL | METHOD_SILENT, + "_AEI", NULL, 0, method_test_EVT_return, NULL); if (ret == FWTS_NOT_EXIST) - fwts_skipped(fw, "Skipping test for non-existant object _EVT."); + fwts_skipped(fw, "Skipping test for non-existent object _EVT."); return ret; } @@ -1270,8 +1278,12 @@ static void method_test_HID_return( static int method_test_HID(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, - "_HID", NULL, 0, method_test_HID_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + return method_evaluate_method(fw, METHOD_MANDATORY, + "_HID", NULL, 0, method_test_HID_return, NULL); + else + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_HID", NULL, 0, method_test_HID_return, NULL); } static void method_valid_CID_Type( @@ -1551,8 +1563,12 @@ static void method_test_UID_return( static int method_test_UID(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, - "_UID", NULL, 0, method_test_UID_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + return method_evaluate_method(fw, METHOD_MANDATORY, + "_UID", NULL, 0, method_test_UID_return, NULL); + else + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_UID", NULL, 0, method_test_UID_return, NULL); } /* @@ -2235,7 +2251,7 @@ static void method_test_CRS_return( static int method_test_CRS(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_MANDITORY, + return method_evaluate_method(fw, METHOD_MANDATORY, "_CRS", NULL, 0, method_test_CRS_return, "_CRS"); } @@ -2490,8 +2506,12 @@ static int method_test_PXM(fwts_framework *fw) /* Section 6.2.17 _CCA */ static int method_test_CCA(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, - "_CCA", NULL, 0, method_test_integer_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + return method_evaluate_method(fw, METHOD_MANDATORY, + "_CCA", NULL, 0, method_test_integer_return, NULL); + else + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_CCA", NULL, 0, method_test_integer_return, NULL); } /* @@ -2598,8 +2618,12 @@ static void method_test_STA_return( static int method_test_STA(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_STA", - NULL, 0, method_test_STA_return, "_STA"); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + return method_evaluate_method(fw, METHOD_MANDATORY, "_STA", + NULL, 0, method_test_STA_return, "_STA"); + else + return method_evaluate_method(fw, METHOD_OPTIONAL, "_STA", + NULL, 0, method_test_STA_return, "_STA"); } @@ -4398,8 +4422,12 @@ static int method_test_SST(fwts_framework *fw) arg[0].Type = ACPI_TYPE_INTEGER; for (i = 0; i <= 4; i++) { arg[0].Integer.Value = i; - ret = method_evaluate_method(fw, METHOD_OPTIONAL, - "_SST", arg, 1, method_test_NULL_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + ret = method_evaluate_method(fw, METHOD_MANDATORY, + "_SST", arg, 1, method_test_NULL_return, NULL); + else + ret = method_evaluate_method(fw, METHOD_OPTIONAL, + "_SST", arg, 1, method_test_NULL_return, NULL); if (ret != FWTS_OK) break; @@ -6428,7 +6456,23 @@ static int method_test_PTS(fwts_framework *fw) arg[0].Integer.Value = i; fwts_log_info(fw, "Test _PTS(%d).", i); - method_evaluate_method(fw, METHOD_OPTIONAL, "_PTS", arg, 1, method_test_NULL_return, NULL); + if (!(fw->flags & FWTS_FLAG_TEST_SBBR)) + method_evaluate_method(fw, METHOD_OPTIONAL, "_PTS", arg, 1, method_test_NULL_return, NULL); + else + if (method_evaluate_method(fw, METHOD_MANDATORY, "_PTS", arg, 1, + method_test_NULL_return, NULL) == FWTS_NOT_EXIST) { + fwts_advice(fw, + "Could not find _PTS. This method provides a " + "mechanism to do housekeeping functions, such " + "as write sleep state to the embedded " + "controller before entering a sleep state. If " + "the machine cannot suspend (S3), " + "hibernate (S4) or shutdown (S5) then it " + "could be because _PTS is missing. Note that " + "ACPI 1.0 wants _PTS to be executed before " + "suspending devices."); + break; + } fwts_log_nl(fw); } return FWTS_OK; @@ -6448,7 +6492,7 @@ static int method_test_TTS(fwts_framework *fw) fwts_log_info(fw, "Test _TTS(%d) Transition To State S%d.", i, i); - if (method_evaluate_method(fw, METHOD_MANDITORY, + if (method_evaluate_method(fw, METHOD_MANDATORY, "_TTS", arg, 1, method_test_NULL_return, NULL) == FWTS_NOT_EXIST) { fwts_advice(fw, @@ -6506,7 +6550,22 @@ static int method_test_WAK(fwts_framework *fw) arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = i; fwts_log_info(fw, "Test _WAK(%d) System Wake, State S%d.", i, i); - method_evaluate_method(fw, METHOD_OPTIONAL, "_WAK", arg, 1, method_test_WAK_return, &i); + if (!(fw->flags & FWTS_FLAG_TEST_SBBR)) + method_evaluate_method(fw, METHOD_OPTIONAL, "_WAK", arg, 1, method_test_WAK_return, &i); + else + if (method_evaluate_method(fw, METHOD_MANDATORY, "_WAK", arg, 1, + method_test_WAK_return, &i) == FWTS_NOT_EXIST) { + fwts_advice(fw, + "Section 7.3.7 states that a system that wakes " + "from a sleeping state will invoke the _WAK " + "control to issue device, thermal and other " + "notifications to ensure that the operating system " + "checks the states of various devices, thermal " + "zones, etc. The Linux kernel will report an " + "ACPI exception if _WAK is does not exist when " + "it returns from a sleep state."); + break; + } fwts_log_nl(fw); } return FWTS_OK; @@ -6660,8 +6719,12 @@ static int method_test_VPO(fwts_framework *fw) static int method_test_ADR(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, - "_ADR", NULL, 0, method_test_integer_return, NULL); + if (fw->flags & FWTS_FLAG_TEST_SBBR) + return method_evaluate_method(fw, METHOD_MANDATORY, + "_ADR", NULL, 0, method_test_integer_return, NULL); + else + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_ADR", NULL, 0, method_test_integer_return, NULL); } static void method_test_BCL_return( @@ -7228,6 +7291,6 @@ static fwts_framework_ops method_ops = { .minor_tests = method_tests }; -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI | FWTS_FLAG_TEST_SBBR) #endif