From patchwork Sat Jan 16 05:30:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 568963 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 2956C140B9A; Sat, 16 Jan 2016 16:31:06 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1aKJRt-0005du-C7; Sat, 16 Jan 2016 05:30:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1aKJRn-0005dk-OA for fwts-devel@lists.ubuntu.com; Sat, 16 Jan 2016 05:30:47 +0000 Received: from 123-204-69-1.adsl.dynamic.seed.net.tw ([123.204.69.1] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1aKJRm-0005c2-TB; Sat, 16 Jan 2016 05:30:47 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/3][v2] acpi: method: add _RDI test Date: Sat, 16 Jan 2016 13:30:42 +0800 Message-Id: <1452922243-28742-1-git-send-email-alex.hung@canonical.com> X-Mailer: git-send-email 2.5.0 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 Signed-off-by: Alex Hung Acked-by: Colin Ian King Acked-by: Ivan Hu --- src/acpi/method/method.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 1fb0728..5004c82 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -183,7 +183,7 @@ * _PUR 8.5.11 Y * _PXM 6.2.13 Y * _Qxx 5.6.4.1 n/a - * _RDI 8.5 N + * _RDI 8.5 Y * _REG 6.5.4 n/a * _REV 5.7.4 n/a * _RMV 6.3.6 Y @@ -4120,6 +4120,69 @@ static int method_test_TSS(fwts_framework *fw) } /* + * Section 8.4.4 Lower Power Idle States +*/ + +static void method_test_RDI_return( + fwts_framework *fw, + char *name, + ACPI_BUFFER *buf, + ACPI_OBJECT *obj, + void *private) +{ + uint32_t i, j; + bool failed = false; + + FWTS_UNUSED(private); + + if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK) + return; + + /* First element is Revision */ + if (obj->Package.Elements[0].Integer.Value != 0) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "Method_RDIBadID", + "%s: Expected Revision to be 0, " + "got 0x%4.4" PRIx64 ".", name, + (uint64_t)obj->Package.Elements[0].Integer.Value); + failed = true; + } + + /* The rest of elements are packages with references */ + for (i = 1; i < obj->Package.Count; i++) { + ACPI_OBJECT *pkg; + pkg = &obj->Package.Elements[i]; + + if (pkg->Type != ACPI_TYPE_PACKAGE) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "Method_RDIBadElementType", + "%s element %" PRIu32 " is not a package.", name, i); + failed = true; + continue; + } + + for (j = 0; j < pkg->Package.Count; j++) { + if (pkg->Package.Elements[j].Type != ACPI_TYPE_LOCAL_REFERENCE) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "Method_RDIBadESublementType", + "%s sub-package %" PRIu32 " element %" PRIu32 " is not " + "a Reference.", name, i, j); + failed = true; + } + } + } + + if (!failed) + method_passed_sane(fw, name, "package"); +} + +static int method_test_RDI(fwts_framework *fw) +{ + return method_evaluate_method(fw, METHOD_OPTIONAL, + "_RDI", NULL, 0, method_test_RDI_return, NULL); +} + +/* * Section 8.5 Processor Aggregator Device */ @@ -6834,6 +6897,9 @@ static fwts_framework_minor_test method_tests[] = { { method_test_TSD, "Test _TSD (Throttling State Dependencies)." }, { method_test_TSS, "Test _TSS (Throttling Supported States)." }, + /* Section 8.4.4 Lower Power Idle States */ + { method_test_RDI, "Test _RDI (Resource Dependencies for Idle)." }, + /* Section 8.5 Processor Aggregator Device */ { method_test_PUR, "Test _PUR (Processor Utilization Request)." },