From patchwork Wed Dec 12 19:08:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 205625 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 95FE02C008A for ; Thu, 13 Dec 2012 06:08:28 +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 1TirfO-0006mE-UC; Wed, 12 Dec 2012 19:08:26 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TirfL-0006m8-Ql for fwts-devel@lists.ubuntu.com; Wed, 12 Dec 2012 19:08:23 +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 1TirfL-0005TA-O0 for fwts-devel@lists.ubuntu.com; Wed, 12 Dec 2012 19:08:23 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: method: dump out _PSS states in a tabular format Date: Wed, 12 Dec 2012 19:08:23 +0000 Message-Id: <1355339303-1751-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 _PSS states that were being dumped out were messy. This patch dumps out the interesting _PSS states if the elements have passed the parsing checks. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Ivan Hu --- src/acpi/method/method.c | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 52b0e18..2dcbee0 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -1715,6 +1715,8 @@ static void method_test_PSS_return( uint32_t max_freq = 0; uint32_t prev_power = 0; bool max_freq_valid = false; + bool dump_elements = false; + bool *element_ok; FWTS_UNUSED(private); @@ -1731,6 +1733,12 @@ static void method_test_PSS_return( return; } + element_ok = calloc(obj->Package.Count, sizeof(bool)); + if (element_ok == NULL) { + fwts_log_error(fw, "Cannot allocate an array. Test aborted."); + return; + } + for (i = 0; i < obj->Package.Count; i++) { ACPI_OBJECT *pstate; @@ -1772,13 +1780,11 @@ static void method_test_PSS_return( continue; } - fwts_log_info(fw, "P-State %d: CPU %" PRIu64 " Mhz, %" PRIu64 " mW, " - "latency %" PRIu64 " us, bus master latency %" PRIu64 " us.", - i, - pstate->Package.Elements[0].Integer.Value, - pstate->Package.Elements[1].Integer.Value, - pstate->Package.Elements[2].Integer.Value, - pstate->Package.Elements[3].Integer.Value); + /* + * Parses OK, so this element can be dumped out + */ + element_ok[i] = true; + dump_elements = true; /* * Collect maximum frequency. The sub-packages are sorted in @@ -1813,6 +1819,31 @@ static void method_test_PSS_return( } /* + * If we have some valid data then dump it out, it is useful to see + */ + if (dump_elements) { + fwts_log_info_verbatum(fw, "P-State Freq Power Latency Bus Master"); + fwts_log_info_verbatum(fw, " (MHz) (mW) (us) Latency (us)"); + for (i = 0; i < obj->Package.Count; i++) { + ACPI_OBJECT *pstate = &obj->Package.Elements[i]; + if (element_ok[i]) { + fwts_log_info_verbatum(fw, " %3d %7" PRIu64 " %8" PRIu64 + " %5" PRIu64 " %5" PRIu64, + i, + pstate->Package.Elements[0].Integer.Value, + pstate->Package.Elements[1].Integer.Value, + pstate->Package.Elements[2].Integer.Value, + pstate->Package.Elements[3].Integer.Value); + } else { + fwts_log_info_verbatum(fw, + " %3d ---- ----- -- -- (invalid)", i); + } + } + } + + free(element_ok); + + /* * Sanity check maximum frequency. We could also check the DMI data * for a BIOS date (but this can be wrong) or check the CPU identity * (which requires adding in new CPU identity checks) to make a decision