From patchwork Mon Apr 5 23:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1462551 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 4FDnMD1jG1z9sSC for ; Tue, 6 Apr 2021 09:44:55 +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 1lTYto-0005Zz-2a; Mon, 05 Apr 2021 23:44:52 +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 1lTYtm-0005Zt-7D for fwts-devel@lists.ubuntu.com; Mon, 05 Apr 2021 23:44:50 +0000 Received: from [104.157.111.226] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lTYtl-0006K8-K9; Mon, 05 Apr 2021 23:44:50 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: sdev: update type 1 in ACPI 6.4 (mantis 2111) Date: Mon, 5 Apr 2021 17:44:43 -0600 Message-Id: <20210405234444.847385-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" Note: acpica (iasl) seems to miss secure access component type 1 and therefore tests for components need to be implemented later. Signed-off-by: Alex Hung Acked-by: Ivan Hu Acked-by: Colin Ian King --- src/acpi/sdev/sdev.c | 44 +++++++++++++++++++++---------------- src/lib/include/fwts_acpi.h | 35 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/src/acpi/sdev/sdev.c b/src/acpi/sdev/sdev.c index 8e1e142b..f03566e8 100644 --- a/src/acpi/sdev/sdev.c +++ b/src/acpi/sdev/sdev.c @@ -32,29 +32,33 @@ acpi_table_init(SDEV, &table) static void sdev_acpi_namespace_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_acpi *entry, bool *passed) { fwts_log_info_verbatim(fw, " ACPI Integrated Device (Type 0):"); - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); - fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); - fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); - - fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); + fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); + fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); + fwts_log_info_simp_int(fw, " Secure Access Components Offset: ", entry->secure_access_offset); + fwts_log_info_simp_int(fw, " Secure Access Components Length: ", entry->secure_access_length); + + fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 2, 15, passed); + + /* TODO - check Secure Access Components - acpica (iasl) supports aren't complete */ } static void sdev_pcie_endpoint_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_pcie *entry, bool *passed) { fwts_log_info_verbatim(fw, " PCIe Endpoint Device (Type 1):"); - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); - fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); - fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); - fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); - fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); + fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); + fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); + fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); + fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); } @@ -83,7 +87,9 @@ static int sdev_test1(fwts_framework *fw) if (entry->type == FWTS_ACPI_SDEV_TYPE_ACPI_NAMESPACE) { fwts_acpi_table_sdev_acpi *acpi = (fwts_acpi_table_sdev_acpi *) entry; sdev_acpi_namespace_device_test(fw, acpi, &passed); - type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + acpi->vendor_length; + type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + + acpi->vendor_length + acpi->secure_access_length; + } else if (entry->type == FWTS_ACPI_SDEV_TYPE_PCIE_ENDPOINT) { fwts_acpi_table_sdev_pcie *pcie = (fwts_acpi_table_sdev_pcie *) entry; sdev_pcie_endpoint_device_test(fw, pcie, &passed); diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index 614fd881..90f178be 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -1345,6 +1345,8 @@ typedef struct { uint16_t device_id_length; uint16_t vendor_offset; uint16_t vendor_length; + uint16_t secure_access_offset; + uint16_t secure_access_length; } fwts_acpi_table_sdev_acpi; typedef struct { @@ -1357,6 +1359,39 @@ typedef struct { uint16_t vendor_length; } fwts_acpi_table_sdev_pcie; +typedef enum { + FWTS_ACPI_SDEV_ID_BASE_SECURE_ACCESS = 0, + FWTS_ACPI_SDEV_MEM_BASE_SECURE_ACCESS = 1, + FWTS_ACPI_SDEV_RESERVED_SECURE_ACCESS = 2, +} fwts_acpi_sdev_acpi_type; + +typedef struct { + uint8_t type; + uint8_t flags; + uint16_t length; +} __attribute__ ((packed)) fwts_acpi_table_sdev_acpi_header; + +typedef struct { + fwts_acpi_table_sdev_acpi_header header; + uint16_t hw_id_offset; + uint16_t hw_id_length; + uint16_t subsys_id_offset; + uint16_t subsys_id_length; + uint16_t hw_revision; + uint8_t hw_revision_present; + uint8_t class_code_present; + uint8_t pci_comp_class; + uint8_t pci_comp_subclass; + uint8_t pci_comp_interface; +} fwts_acpi_table_sdev_acpi_id; + +typedef struct { + fwts_acpi_table_sdev_acpi_header header; + uint32_t reserved; + uint64_t base_addr; + uint64_t mem_length; +} fwts_acpi_table_sdev_acpi_memory; + /* * ACPI HMAT (Heterogeneous Memory Attribute Table), 5.2.27 */ From patchwork Mon Apr 5 23:44:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1462552 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 4FDnMG5fkKz9sSC for ; Tue, 6 Apr 2021 09:44:58 +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 1lTYts-0005ad-4m; Mon, 05 Apr 2021 23:44:56 +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 1lTYtq-0005aJ-5Y for fwts-devel@lists.ubuntu.com; Mon, 05 Apr 2021 23:44:54 +0000 Received: from [104.157.111.226] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lTYtp-0006KH-Lq; Mon, 05 Apr 2021 23:44:54 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] fwts-test: sync up with sdev changes Date: Mon, 5 Apr 2021 17:44:44 -0600 Message-Id: <20210405234444.847385-2-alex.hung@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405234444.847385-1-alex.hung@canonical.com> References: <20210405234444.847385-1-alex.hung@canonical.com> 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" --- fwts-test/sdev-0001/acpidump-0001.log | 17 ++++++------ fwts-test/sdev-0001/acpidump-0002.log | 17 ++++++------ fwts-test/sdev-0001/sdev-0001.log | 34 +++++++++++++----------- fwts-test/sdev-0001/sdev-0002.log | 38 ++++++++++++++------------- 4 files changed, 56 insertions(+), 50 deletions(-) Acked-by: Ivan Hu Acked-by: Colin Ian King diff --git a/fwts-test/sdev-0001/acpidump-0001.log b/fwts-test/sdev-0001/acpidump-0001.log index 2bca356b..dbd9eaeb 100644 --- a/fwts-test/sdev-0001/acpidump-0001.log +++ b/fwts-test/sdev-0001/acpidump-0001.log @@ -24,12 +24,13 @@ FACP @ 0x00000000 00f0: 00 00 00 00 .... SDEV @ 0x0000000000000000 - 0000: 53 44 45 56 72 00 00 00 01 36 49 4e 54 45 4c 20 SDEVr....6INTEL - 0010: 54 65 6d 70 6c 61 74 65 01 00 00 00 49 4e 54 4c Template....INTL - 0020: 29 09 17 20 00 01 2a 00 0c 00 16 00 22 00 08 00 ).. ..*....."... - 0030: 5c 5c 5f 53 42 5f 2e 50 43 49 30 2e 55 53 42 31 \\_SB_.PCI0.USB1 - 0040: 2e 53 55 42 31 00 00 11 22 33 44 55 66 77 01 01 .SUB1..."3DUfw.. - 0050: 24 00 10 00 20 00 10 00 04 00 14 00 10 00 11 22 $... .........." - 0060: 33 44 ee dd cc bb aa 55 66 77 88 99 aa bb cc dd 3D.....Ufw...... - 0070: ee ff .. + 0000: 53 44 45 56 89 00 00 00 01 40 49 4E 54 45 4C 20 SDEV.....@INTEL + 0010: 54 65 6D 70 6C 61 74 65 01 00 00 00 49 4E 54 4C Template....INTL + 0020: 31 03 21 20 00 03 41 00 23 00 16 00 39 00 08 00 1.! ..A.#...9... + 0030: 10 00 13 00 00 00 00 00 01 00 03 02 05 04 07 06 ................ + 0040: 09 08 0A 0B 0C 0D 0E 5C 5C 5F 53 42 5F 2E 50 43 .......\\_SB_.PC + 0050: 49 30 2E 55 53 42 31 2E 53 55 42 31 00 00 11 22 I0.USB1.SUB1..." + 0060: 33 44 55 66 77 01 01 24 00 10 00 20 00 10 00 04 3DUfw..$... .... + 0070: 00 14 00 10 00 11 22 33 44 EE DD CC BB AA 55 66 ......"3D.....Uf + 0080: 77 88 99 AA BB CC DD EE FF w........ diff --git a/fwts-test/sdev-0001/acpidump-0002.log b/fwts-test/sdev-0001/acpidump-0002.log index 10628c5c..3e54c42a 100644 --- a/fwts-test/sdev-0001/acpidump-0002.log +++ b/fwts-test/sdev-0001/acpidump-0002.log @@ -24,12 +24,13 @@ FACP @ 0x00000000 00f0: 00 00 00 00 .... SDEV @ 0x0000000000000000 - 0000: 53 44 45 56 72 00 00 00 01 36 49 4e 54 45 4c 20 SDEVr....6INTEL - 0010: 54 65 6d 70 6c 61 74 65 01 00 00 00 49 4e 54 4c Template....INTL - 0020: 29 09 17 20 00 03 2a 00 0c 00 16 00 22 00 08 00 ).. ..*....."... - 0030: 5c 5c 5f 53 42 5f 2e 50 43 49 30 2e 55 53 42 31 \\_SB_.PCI0.USB1 - 0040: 2e 53 55 42 31 00 00 11 22 33 44 55 66 77 01 05 .SUB1..."3DUfw.. - 0050: 24 00 10 00 20 00 10 00 04 00 14 00 10 00 11 22 $... .........." - 0060: 33 44 ee dd cc bb aa 55 66 77 88 99 aa bb cc dd 3D.....Ufw...... - 0070: ee ff .. + 0000: 53 44 45 56 89 00 00 00 01 40 49 4E 54 45 4C 20 SDEV.....@INTEL + 0010: 54 65 6D 70 6C 61 74 65 01 00 00 00 49 4E 54 4C Template....INTL + 0020: 31 03 21 20 00 05 41 00 23 00 16 00 39 00 08 00 1.! ..A.#...9... + 0030: 10 00 13 00 00 00 00 00 01 00 03 02 05 04 07 06 ................ + 0040: 09 08 0A 0B 0C 0D 0E 5C 5C 5F 53 42 5F 2E 50 43 .......\\_SB_.PC + 0050: 49 30 2E 55 53 42 31 2E 53 55 42 31 00 00 11 22 I0.USB1.SUB1..." + 0060: 33 44 55 66 77 01 03 24 00 10 00 20 00 10 00 04 3DUfw..$... .... + 0070: 00 14 00 10 00 11 22 33 44 EE DD CC BB AA 55 66 ......"3D.....Uf + 0080: 77 88 99 AA BB CC DD EE FF w........ diff --git a/fwts-test/sdev-0001/sdev-0001.log b/fwts-test/sdev-0001/sdev-0001.log index 8e5dce59..459fbd32 100644 --- a/fwts-test/sdev-0001/sdev-0001.log +++ b/fwts-test/sdev-0001/sdev-0001.log @@ -3,24 +3,26 @@ sdev ---------------------------------------------------------- sdev Test 1 of 1: Validate SDEV table. sdev SDEV Secure Devices Table: sdev ACPI Integrated Device (Type 0): -sdev Type: 0x00 -sdev Flags: 0x01 -sdev Length: 0x002a -sdev Device Id Offset: 0x000c -sdev Device Id Length: 0x0016 -sdev Vendor Specific Data Offset: 0x0022 -sdev Vendor Specific Data Length: 0x0008 +sdev Type: 0x00 +sdev Flags: 0x03 +sdev Length: 0x0041 +sdev Device Id Offset: 0x0023 +sdev Device Id Length: 0x0016 +sdev Vendor Specific Data Offset: 0x0039 +sdev Vendor Specific Data Length: 0x0008 +sdev Secure Access Components Offset: 0x0010 +sdev Secure Access Components Length: 0x0013 sdev sdev PCIe Endpoint Device (Type 1): -sdev Type: 0x01 -sdev Flags: 0x01 -sdev Length: 0x0024 -sdev PCI Segment Number: 0x0010 -sdev Start Bus Number: 0x0020 -sdev PCI Path Offset: 0x0010 -sdev PCI Path Length: 0x0004 -sdev Vendor Specific Data Offset: 0x0014 -sdev Vendor Specific Data Length: 0x0010 +sdev Type: 0x01 +sdev Flags: 0x01 +sdev Length: 0x0024 +sdev PCI Segment Number: 0x0010 +sdev Start Bus Number: 0x0020 +sdev PCI Path Offset: 0x0010 +sdev PCI Path Length: 0x0004 +sdev Vendor Specific Data Offset: 0x0014 +sdev Vendor Specific Data Length: 0x0010 sdev sdev sdev PASSED: Test 1, No issues found in SDEV table. diff --git a/fwts-test/sdev-0001/sdev-0002.log b/fwts-test/sdev-0001/sdev-0002.log index ff83c69c..00b85bfb 100644 --- a/fwts-test/sdev-0001/sdev-0002.log +++ b/fwts-test/sdev-0001/sdev-0002.log @@ -3,28 +3,30 @@ sdev ---------------------------------------------------------- sdev Test 1 of 1: Validate SDEV table. sdev SDEV Secure Devices Table: sdev ACPI Integrated Device (Type 0): -sdev Type: 0x00 -sdev Flags: 0x03 -sdev Length: 0x002a -sdev Device Id Offset: 0x000c -sdev Device Id Length: 0x0016 -sdev Vendor Specific Data Offset: 0x0022 -sdev Vendor Specific Data Length: 0x0008 +sdev Type: 0x00 +sdev Flags: 0x05 +sdev Length: 0x0041 +sdev Device Id Offset: 0x0023 +sdev Device Id Length: 0x0016 +sdev Vendor Specific Data Offset: 0x0039 +sdev Vendor Specific Data Length: 0x0008 +sdev Secure Access Components Offset: 0x0010 +sdev Secure Access Components Length: 0x0013 sdev FAILED [HIGH] SDEVReservedBitsNonZero: Test 1, SDEV Flags -sdev Bits [15..1] must be zero, got 0x03 instead +sdev Bits [15..2] must be zero, got 0x05 instead sdev sdev PCIe Endpoint Device (Type 1): -sdev Type: 0x01 -sdev Flags: 0x05 -sdev Length: 0x0024 -sdev PCI Segment Number: 0x0010 -sdev Start Bus Number: 0x0020 -sdev PCI Path Offset: 0x0010 -sdev PCI Path Length: 0x0004 -sdev Vendor Specific Data Offset: 0x0014 -sdev Vendor Specific Data Length: 0x0010 +sdev Type: 0x01 +sdev Flags: 0x03 +sdev Length: 0x0024 +sdev PCI Segment Number: 0x0010 +sdev Start Bus Number: 0x0020 +sdev PCI Path Offset: 0x0010 +sdev PCI Path Length: 0x0004 +sdev Vendor Specific Data Offset: 0x0014 +sdev Vendor Specific Data Length: 0x0010 sdev FAILED [HIGH] SDEVReservedBitsNonZero: Test 1, SDEV Flags -sdev Bits [15..1] must be zero, got 0x05 instead +sdev Bits [15..1] must be zero, got 0x03 instead sdev sdev sdev