From patchwork Sat May 29 00:57:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1485330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FsNT9378Mz9sVm for ; Sat, 29 May 2021 10:58:05 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lmnIg-0004Vs-7f; Sat, 29 May 2021 00:58:02 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lmnId-0004VB-VB for fwts-devel@lists.ubuntu.com; Sat, 29 May 2021 00:57:59 +0000 Received: from d75-158-101-9.abhsia.telus.net ([75.158.101.9] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lmnId-00055U-Bn; Sat, 29 May 2021 00:57:59 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: wdat: enable printing fields Date: Fri, 28 May 2021 18:57:56 -0600 Message-Id: <20210529005757.1800860-1-alex.hung@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Also checks reserved fields by fwts_acpi_reserved_zero Signed-off-by: Alex Hung Acked-by: Ivan Hu Acked-by: Colin Ian King --- src/acpi/wdat/wdat.c | 74 +++++++++++++++++-------------------- src/lib/include/fwts_acpi.h | 2 +- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/src/acpi/wdat/wdat.c b/src/acpi/wdat/wdat.c index 92357bad..57dba6cb 100644 --- a/src/acpi/wdat/wdat.c +++ b/src/acpi/wdat/wdat.c @@ -28,8 +28,6 @@ #include "fwts_acpi_object_eval.h" -#define ACPI_DUMP (0) /* WDAT entries are long, so don't dump, too verbose */ - static fwts_acpi_table_info *table; acpi_table_init(WDAT, &table) @@ -41,6 +39,7 @@ static int wdat_test1(fwts_framework *fw) { const fwts_acpi_table_wdat *wdat = (const fwts_acpi_table_wdat *)table->data; + uint32_t reserved1, reserved2; bool passed = true; bool entries_passed = true; size_t total_length; @@ -58,33 +57,28 @@ static int wdat_test1(fwts_framework *fw) goto done; } + reserved1 = (uint32_t) wdat->reserved1[0] + ((uint32_t) wdat->reserved1[1] << 8) + + ((uint32_t) wdat->reserved1[2] << 16); + + reserved2 = (uint32_t) wdat->reserved2[0] + ((uint32_t) wdat->reserved2[1] << 8) + + ((uint32_t) wdat->reserved2[2] << 16); + /* Now we have got some sane data, dump the WDAT */ -#if ACPI_DUMP fwts_log_info_verbatim(fw, "WDAT Microsoft Watchdog Action Table:"); - fwts_log_info_verbatim(fw, " Watchdog Header Length: 0x%8.8" PRIx32, wdat->watchdog_header_length); - fwts_log_info_verbatim(fw, " PCI Segment: 0x%4.4" PRIx16, wdat->pci_segment); - fwts_log_info_verbatim(fw, " PCI Bus Number: 0x%2.2" PRIx8, wdat->pci_bus_number); - fwts_log_info_verbatim(fw, " PCI Device Number: 0x%2.2" PRIx8, wdat->pci_device_number); - fwts_log_info_verbatim(fw, " PCI Function Number: 0x%2.2" PRIx8, wdat->pci_function_number); - fwts_log_info_verbatim(fw, " Reserved: 0x%2.2" PRIx8 " 0x%2.2" PRIx8 " 0x%2.2" PRIx8, - wdat->reserved1[0], wdat->reserved1[1], wdat->reserved1[2]); - fwts_log_info_verbatim(fw, " Timer Period: 0x%4.4" PRIx32, wdat->timer_period); - fwts_log_info_verbatim(fw, " Maximum Count: 0x%4.4" PRIx32, wdat->maximum_count); - fwts_log_info_verbatim(fw, " Minimum Count: 0x%4.4" PRIx32, wdat->minimum_count); - fwts_log_info_verbatim(fw, " Watchdog Flags: 0x%4.4" PRIx32, wdat->watchdog_flags); - fwts_log_info_verbatim(fw, " Reserved: 0x%2.2" PRIx8 " 0x%2.2" PRIx8 " 0x%2.2" PRIx8, - wdat->reserved2[0], wdat->reserved2[1], wdat->reserved2[2]); - fwts_log_info_verbatim(fw, " Watchdog Entries 0x%4.4" PRIx32, wdat->number_of_entries); -#endif - - if (wdat->reserved1[0] | wdat->reserved1[1] | wdat->reserved1[2] | - wdat->reserved2[0] | wdat->reserved2[1] | wdat->reserved2[2]) { - passed = false; - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "WDATReservedFieldsNonZero", - "WDAT Reserved Fields contain a non-zero value, these " - "all should be zero."); - } + fwts_log_info_simp_int(fw, " Watchdog Header Length: ", wdat->watchdog_header_length); + fwts_log_info_simp_int(fw, " PCI Segment: ", wdat->pci_segment); + fwts_log_info_simp_int(fw, " PCI Bus Number: ", wdat->pci_bus_number); + fwts_log_info_simp_int(fw, " PCI Device Number: ", wdat->pci_device_number); + fwts_log_info_simp_int(fw, " PCI Function Number: ", wdat->pci_function_number); + fwts_log_info_simp_int(fw, " Reserved: ", reserved1); + fwts_acpi_reserved_zero("WDAT", "Reserved1", reserved1, &passed); + fwts_log_info_simp_int(fw, " Timer Period: ", wdat->timer_period); + fwts_log_info_simp_int(fw, " Maximum Count: ", wdat->maximum_count); + fwts_log_info_simp_int(fw, " Minimum Count: ", wdat->minimum_count); + fwts_log_info_simp_int(fw, " Watchdog Flags: ", wdat->watchdog_flags); + fwts_log_info_simp_int(fw, " Reserved: ", reserved2); + fwts_acpi_reserved_zero("WDAT", "Reserved2", reserved2, &passed); + fwts_log_info_simp_int(fw, " Watchdog Entries ", wdat->number_of_entries); if (wdat->minimum_count > wdat->maximum_count) { passed = false; @@ -120,21 +114,19 @@ static int wdat_test1(fwts_framework *fw) } for (i = 0; i < wdat->number_of_entries; i++) { const fwts_acpi_table_wdat_instr_entries *entry = &wdat->entries[i]; -#if ACPI_DUMP + fwts_log_info_verbatim(fw, "Watchdog Instruction Entry %" PRIu32, i + 1); - fwts_log_info_verbatim(fw, " Watchdog Action: 0x%2.2" PRIx8, entry->watchdog_action); - fwts_log_info_verbatim(fw, " Instruction Flags: 0x%2.2" PRIx8, entry->instruction_flags); - fwts_log_info_verbatim(fw, " Reserved: 0x%2.2" PRIx8 " 0x%2.2" PRIx8, - entry->reserved[0], entry->reserved[1]); - - fwts_log_info_verbatim(fw, " Address Space ID: 0x%2.2" PRIx8, entry->register_region.address_space_id); - fwts_log_info_verbatim(fw, " Register Bit Width 0x%2.2" PRIx8, entry->register_region.register_bit_width); - fwts_log_info_verbatim(fw, " Register Bit Offset 0x%2.2" PRIx8, entry->register_region.register_bit_offset); - fwts_log_info_verbatim(fw, " Access Size 0x%2.2" PRIx8, entry->register_region.access_width); - fwts_log_info_verbatim(fw, " Address 0x%16.16" PRIx64, entry->register_region.address); - fwts_log_info_verbatim(fw, " Value: 0x%8.8" PRIx32, entry->value); - fwts_log_info_verbatim(fw, " Mask: 0x%8.8" PRIx32, entry->mask); -#endif + fwts_log_info_simp_int(fw, " Watchdog Action: ", entry->watchdog_action); + fwts_log_info_simp_int(fw, " Instruction Flags: ", entry->instruction_flags); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved); + fwts_acpi_reserved_zero("WDAT", "Watchdog Entry Reserved", entry->reserved, &passed); + fwts_log_info_simp_int(fw, " Address Space ID: ", entry->register_region.address_space_id); + fwts_log_info_simp_int(fw, " Register Bit Width ", entry->register_region.register_bit_width); + fwts_log_info_simp_int(fw, " Register Bit Offset ", entry->register_region.register_bit_offset); + fwts_log_info_simp_int(fw, " Access Size ", entry->register_region.access_width); + fwts_log_info_simp_int(fw, " Address ", entry->register_region.address); + fwts_log_info_simp_int(fw, " Value: ", entry->value); + fwts_log_info_simp_int(fw, " Mask: ", entry->mask); switch (entry->watchdog_action) { case 0x01: /* RESET */ diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index ff95324b..0781f08a 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -2154,7 +2154,7 @@ typedef struct { typedef struct { uint8_t watchdog_action; uint8_t instruction_flags; - uint8_t reserved[2]; + uint16_t reserved; fwts_acpi_gas register_region; uint32_t value; uint32_t mask;