From nobody Sat May 4 17:52:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152682735736092.20609553836857; Sun, 20 May 2018 07:42:37 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 14D1320985990; Sun, 20 May 2018 07:42:36 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2DA362097DD3F for ; Sun, 20 May 2018 07:42:34 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 May 2018 07:42:34 -0700 Received: from shwde9099.ccr.corp.intel.com ([10.239.9.146]) by orsmga005.jf.intel.com with ESMTP; 20 May 2018 07:42:32 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=chao.b.zhang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,423,1520924400"; d="scan'208";a="225742668" From: "Zhang, Chao B" To: edk2-devel@lists.01.org Date: Sun, 20 May 2018 22:42:27 +0800 Message-Id: <20180520144227.35132-1-chao.b.zhang@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Subject: [edk2] [Patch] SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is allocated X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yao Jiewen , Long Qin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Update package format info in _PRS to TcgNvs after memory is allocated. Change-Id: Icfadb350e60d3ed2df332e92c257ce13309c0018 Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yao Jiewen Cc: Long Qin Signed-off-by: Zhang, Chao B Reviewed-by: Long Qin --- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tc= g2Smm.c index c3cee834ae..3e0a68999a 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -308,19 +308,21 @@ UpdatePPVersion ( interrupt buffer size. BufferSize, PkgLength and interrupt descirptor in= ByteList need to be patched =20 @param[in, out] Table The TPM item in ACPI table. @param[in] IrqBuffer Input new IRQ buffer. @param[in] IrqBuffserSize Input new IRQ buffer size. + @param[out] IsShortFormPkgLength If _PRS returns Short length Pack= age(ACPI spec 20.2.4). =20 @return patch status. =20 **/ EFI_STATUS UpdatePossibleResource ( - EFI_ACPI_DESCRIPTION_HEADER *Table, - UINT32 *IrqBuffer, - UINT32 IrqBuffserSize + IN EFI_ACPI_DESCRIPTION_HEADER *Table, + IN UINT32 *IrqBuffer, + IN UINT32 IrqBuffserSize, + OUT BOOLEAN *IsShortFormPkgLength ) { UINT8 *DataPtr; UINT8 *DataEndPtr; UINT32 NewPkgLength; @@ -429,11 +431,11 @@ UpdatePossibleResource ( *(DataPtr + 2) =3D (UINT8)(IrqBuffserSize + 19); =20 // // Notify _PRS to report short formed ResourceTemplate // - mTcgNvs->IsShortFormPkgLength =3D TRUE; + *IsShortFormPkgLength =3D TRUE; =20 break; } } =20 @@ -501,11 +503,11 @@ UpdatePossibleResource ( *(DataPtr + 2 + ((*DataPtr & (BIT7|BIT6)) >> 6)) =3D (UINT8)(IrqBu= ffserSize + 19); =20 // // Notify _PRS to report long formed ResourceTemplate // - mTcgNvs->IsShortFormPkgLength =3D FALSE; + *IsShortFormPkgLength =3D FALSE; break; } } } =20 @@ -670,10 +672,13 @@ PublishAcpiTable ( UINTN TableKey; EFI_ACPI_DESCRIPTION_HEADER *Table; UINTN TableSize; UINT32 *PossibleIrqNumBuf; UINT32 PossibleIrqNumBufSize; + BOOLEAN IsShortFormPkgLength; + + IsShortFormPkgLength =3D FALSE; =20 Status =3D GetSectionFromFv ( &gEfiCallerIdGuid, EFI_SECTION_RAW, 0, @@ -708,11 +713,11 @@ PublishAcpiTable ( // PossibleIrqNumBuf =3D (UINT32 *)PcdGetPtr(PcdTpm2PossibleIrqNumBuf= ); PossibleIrqNumBufSize =3D (UINT32)PcdGetSize(PcdTpm2PossibleIrqNumBuf); =20 if (PossibleIrqNumBufSize <=3D MAX_PRS_INT_BUF_SIZE && (PossibleIrqNum= BufSize % sizeof(UINT32)) =3D=3D 0) { - Status =3D UpdatePossibleResource(Table, PossibleIrqNumBuf, Possible= IrqNumBufSize); + Status =3D UpdatePossibleResource(Table, PossibleIrqNumBuf, Possible= IrqNumBufSize, &IsShortFormPkgLength); DEBUG (( DEBUG_INFO, "UpdatePossibleResource status - %x. TPM2 service may not ready in= OS.\n", Status )); @@ -741,11 +746,11 @@ PublishAcpiTable ( ASSERT (Table->OemTableId =3D=3D SIGNATURE_64 ('T', 'p', 'm', '2', 'T', = 'a', 'b', 'l')); CopyMem (Table->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (Table->O= emId) ); mTcgNvs =3D AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (U= INT16) sizeof (TCG_NVS)); ASSERT (mTcgNvs !=3D NULL); mTcgNvs->TpmIrqNum =3D PcdGet32(PcdTpm2CurrentIrqNum); - mTcgNvs->IsShortFormPkgLength =3D FALSE; + mTcgNvs->IsShortFormPkgLength =3D IsShortFormPkgLength; =20 // // Publish the TPM ACPI table. Table is re-checksumed. // Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **) &AcpiTable); --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel