From patchwork Tue Jan 8 11:18:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 210340 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 610E92C0085 for ; Tue, 8 Jan 2013 22:18:13 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TsXC7-0004kj-VM; Tue, 08 Jan 2013 11:18:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TsXC4-0004kd-S9 for fwts-devel@lists.ubuntu.com; Tue, 08 Jan 2013 11:18:08 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TsXC4-0003Ds-Op for fwts-devel@lists.ubuntu.com; Tue, 08 Jan 2013 11:18:08 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: method: format _TSS states into a table Date: Tue, 8 Jan 2013 11:18:08 +0000 Message-Id: <1357643888-9764-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King The output from _TSS is a bit messy, so re-work this to output all the valid states into a table which is more compact and easier to read. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Ivan Hu --- src/acpi/method/method.c | 57 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index f22447e..231b5fb 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -2706,6 +2706,8 @@ static void method_test_TSS_return( { uint32_t i; bool failed = false; + bool *tss_elements_ok; + bool an_element_ok = false; FWTS_UNUSED(private); @@ -2722,11 +2724,18 @@ static void method_test_TSS_return( return; } + tss_elements_ok = calloc(obj->Package.Count, sizeof(bool)); + if (tss_elements_ok == NULL) { + fwts_log_error(fw, "Cannot allocate an array. Test aborted."); + return; + } + /* Could be one or more packages */ for (i = 0; i < obj->Package.Count; i++) { ACPI_OBJECT *pkg; uint32_t j; - bool elements_ok = true; + + tss_elements_ok[i] = true; if (obj->Package.Elements[i].Type != ACPI_TYPE_PACKAGE) { fwts_failed(fw, LOG_LEVEL_MEDIUM, @@ -2734,6 +2743,7 @@ static void method_test_TSS_return( "_TSS package element %" PRIu32 " was not a package.", i); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); + tss_elements_ok[i] = false; failed = true; continue; /* Skip processing sub-package */ } @@ -2750,6 +2760,7 @@ static void method_test_TSS_return( "got %" PRIu32" elements instead.", i, pkg->Package.Count); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); + tss_elements_ok[i] = false; failed = true; continue; /* Skip processing sub-package */ } @@ -2762,14 +2773,17 @@ static void method_test_TSS_return( " element %" PRIu32 " is not " "an integer.", i, j); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); - elements_ok = false; + tss_elements_ok[i] = false; } } - if (!elements_ok) { + if (!tss_elements_ok[i]) { failed = true; continue; } + /* At least one element is OK, so remember that */ + an_element_ok = true; + /* Element 0 must be 1..100 */ if ((pkg->Package.Elements[0].Integer.Value < 1) || (pkg->Package.Elements[0].Integer.Value > 100)) { @@ -2784,23 +2798,36 @@ static void method_test_TSS_return( failed = true; } /* Skip checking elements 1..4 */ + } + + /* Summary info */ + if (an_element_ok) { + fwts_log_info_verbatum(fw, "%s values:", name); + fwts_log_info_verbatum(fw, "T-State CPU Power Latency Control Status"); + fwts_log_info_verbatum(fw, " Freq (mW) (usecs)"); + for (i = 0; i < obj->Package.Count; i++) { + if (tss_elements_ok[i]) { + ACPI_OBJECT *pkg = &obj->Package.Elements[i]; - fwts_log_info(fw, "TSS [%" PRIu32 "]:", i); - fwts_log_info_verbatum(fw, " CPU frequency: %" PRIu64 "%%", - pkg->Package.Elements[0].Integer.Value); - fwts_log_info_verbatum(fw, " Power : %" PRIu64 " (mW)", - pkg->Package.Elements[1].Integer.Value); - fwts_log_info_verbatum(fw, " Latency : %" PRIu64 " microseconds", - pkg->Package.Elements[2].Integer.Value); - fwts_log_info_verbatum(fw, " Control : 0x%" PRIx64, - pkg->Package.Elements[3].Integer.Value); - fwts_log_info_verbatum(fw, " Status : 0x%" PRIx64, - pkg->Package.Elements[4].Integer.Value); + fwts_log_info_verbatum(fw, + " %3d %3" PRIu64 "%% %7" PRIu64 " %7" PRIu64 + " %2.2" PRIx64 " %2.2" PRIx64, i, + pkg->Package.Elements[0].Integer.Value, + pkg->Package.Elements[1].Integer.Value, + pkg->Package.Elements[2].Integer.Value, + pkg->Package.Elements[3].Integer.Value, + pkg->Package.Elements[4].Integer.Value); + } else { + fwts_log_info_verbatum(fw, + " %3d ---- ----- ----- -- -- (invalid)", i); + } + } } + free(tss_elements_ok); if (!failed) fwts_passed(fw, - "_TSD correctly returned sane looking package."); + "_TSS correctly returned sane looking package."); } static int method_test_TSS(fwts_framework *fw)