From patchwork Tue Dec 26 08:12:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1880207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SznZP3vNlz1ydb for ; Tue, 26 Dec 2023 19:12:45 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rI2YK-0001AY-UH; Tue, 26 Dec 2023 08:12:40 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rI2YF-0001AB-9O for fwts-devel@lists.ubuntu.com; Tue, 26 Dec 2023 08:12:35 +0000 Received: from canonical.com (unknown [10.101.194.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id D0B8F3F6CD for ; Tue, 26 Dec 2023 08:12:33 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: srat: fix to get device handle value and dump the reserved array Date: Tue, 26 Dec 2023 16:12:29 +0800 Message-Id: <20231226081229.115268-1-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.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" Fix getting the wrong devlce handle value for generic initiator affinity structure and dump the reseved value as array by fwts_hexdump_data_prefix_all Signed-off-by: Ivan Hu --- src/acpi/srat/srat.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/acpi/srat/srat.c b/src/acpi/srat/srat.c index 7c98bed5..55636a90 100644 --- a/src/acpi/srat/srat.c +++ b/src/acpi/srat/srat.c @@ -307,28 +307,27 @@ static void srat_check_initiator_affinity( fwts_log_info_simp_int(fw, " Reserved: ", affinity->reserved1); fwts_log_info_simp_int(fw, " Device Handle Type: ", affinity->device_handle_type); fwts_log_info_simp_int(fw, " Proximity Domain: ", affinity->proximity_domain); + + fwts_acpi_reserved_zero("SRAT", "Initiator Affinity Reserved", affinity->reserved1, passed); + fwts_acpi_reserved_bits("SRAT", "Initiator Affinity Device Handle Type", affinity->device_handle_type, 1, 7, passed); + fwts_log_info_verbatim(fw, " Device Handle:"); if (affinity->device_handle_type == 0) { - fwts_log_info_simp_int(fw, " ACPI _HID: ", (uint64_t)affinity->device_handle[0]); - fwts_log_info_simp_int(fw, " ACPI _UID: ", (uint32_t)affinity->device_handle[8]); + fwts_log_info_simp_int(fw, " ACPI _HID: ", *(uint64_t *)affinity->device_handle); + fwts_log_info_simp_int(fw, " ACPI _UID: ", *(uint32_t *)(affinity->device_handle + 8)); + h_reserved = *(uint32_t *)(affinity->device_handle + 12); + fwts_log_info_simp_int(fw, " Reserved: ", h_reserved); + fwts_acpi_reserved_zero("SRAT", "Initiator Affinity Device Handle Reserved", h_reserved, passed); } else if (affinity->device_handle_type == 1) { - fwts_log_info_simp_int(fw, " PCI Segment: ", (uint16_t)affinity->device_handle[0]); - fwts_log_info_simp_int(fw, " PCI BDF Number: ", (uint16_t)affinity->device_handle[2]); + fwts_log_info_simp_int(fw, " PCI Segment: ", *(uint16_t *)affinity->device_handle); + fwts_log_info_simp_int(fw, " PCI BDF Number: ", *(uint16_t *)(affinity->device_handle + 2)); + fwts_log_info_verbatim(fw, " Reserved:"); + fwts_hexdump_data_prefix_all(fw, affinity->device_handle + 4, " ", 12); + fwts_acpi_reserved_zero_array(fw, "SRAT", " Initiator Affinity Device Handle Reserved", affinity->device_handle + 4, 12, passed); } fwts_log_info_simp_int(fw, " Flags: ", affinity->flags); fwts_log_info_simp_int(fw, " Reserved: ", affinity->reserved2); - fwts_log_nl(fw); - fwts_acpi_reserved_zero("SRAT", "Initiator Affinity Reserved", affinity->reserved1, passed); - fwts_acpi_reserved_bits("SRAT", "Initiator Affinity Device Handle Type", affinity->device_handle_type, 1, 7, passed); - if (affinity->device_handle_type == 0) - h_reserved = affinity->device_handle[12]; - else if (affinity->device_handle_type == 1) { - uint8_t i; - for (i = 4; i < 16; i++) - h_reserved += affinity->device_handle[i]; - } - fwts_acpi_reserved_zero("SRAT", "Initiator Affinity Device Handle Reserve", h_reserved, passed); fwts_acpi_reserved_bits("SRAT", "Initiator Affinity Flags", affinity->flags, 2, 31, passed); fwts_acpi_reserved_zero("SRAT", "Initiator Affinity Reserved", affinity->reserved2, passed);