From patchwork Tue Mar 8 10:10:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1602860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=pB1xUm2H; dkim-atps=neutral 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KCWLc2LQ5z9sGL for ; Tue, 8 Mar 2022 21:11:03 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nRWnx-0008SE-I3; Tue, 08 Mar 2022 10:10:57 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nRWnw-0008S1-Cs for fwts-devel@lists.ubuntu.com; Tue, 08 Mar 2022 10:10:56 +0000 Received: from canonical.com (unknown [106.104.73.69]) (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 9A4C83F223 for ; Tue, 8 Mar 2022 10:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646734256; bh=qPjttzDbZ3B1qBGVbCovvz8r35Q45qiK5M/lw7ikwWA=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=pB1xUm2HOLKKQYmssUI5fbNsWjmEwQbAkwCpgUNFkBXfPtdmU3SftRAUjWGa6gecK us1tUVp2W9/WYxJbHWCTVtpPg7l7FD/KfNcz9apm33XB07QmoMnaehxoDabUZP/sfo CUbiqoFPx8RvsmdpTbaexRFk4MKwV5fLF0lOtsMeTk6s8wRuaZKGnWM2AMFtYfTXnb 2WB19YvwGT+UlSv+qJtLnENamQciic6cUGEXompfTqCMih+07t1VCd+3kA9ODGVxwc /wrDAYvrX4q+qlvKwa62yOvZ27DRu6Hj5siFMyfqeBwwUPJYePsqVQ9yrtcnZQE/OC tnAQolOpHjcnw== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: sdev: add checking secure access components Date: Tue, 8 Mar 2022 18:10:42 +0800 Message-Id: <20220308101042.39987-1-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.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" BugLink: https://bugs.launchpad.net/fwts/+bug/1964061 Signed-off-by: Ivan Hu --- src/acpi/sdev/sdev.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/acpi/sdev/sdev.c b/src/acpi/sdev/sdev.c index 2bc74449..3b3cce2a 100644 --- a/src/acpi/sdev/sdev.c +++ b/src/acpi/sdev/sdev.c @@ -37,17 +37,22 @@ static void sdev_acpi_namespace_device_test( 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); + if (entry->header.flags & 1) + fwts_log_info_verbatim(fw, " Allow handoff to unsecure OS"); + if (entry->header.flags & (1 << 1)) + fwts_log_info_verbatim(fw, " Secure access components present"); 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); + if (entry->header.flags & (1 << 1)) { + 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("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( @@ -91,7 +96,13 @@ static int sdev_test1(fwts_framework *fw) 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 + acpi->secure_access_length; + acpi->vendor_length; + if (acpi->header.flags & (1 << 1)) + type_length += acpi->secure_access_length; + else { + type_length -= (sizeof(acpi->secure_access_offset) + + sizeof(acpi->secure_access_length)); + } } else if (entry->type == FWTS_SDEV_TYPE_PCIE_ENDPOINT) { fwts_acpi_table_sdev_pcie *pcie = (fwts_acpi_table_sdev_pcie *) entry;