From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=qin.long@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 0FC5820965DC0 for ; Mon, 21 May 2018 01:21:39 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 01:21:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="48415142" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 21 May 2018 01:21:38 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 21 May 2018 01:21:38 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 21 May 2018 01:21:37 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by shsmsx102.ccr.corp.intel.com ([169.254.2.79]) with mapi id 14.03.0319.002; Mon, 21 May 2018 16:21:35 +0800 From: "Long, Qin" To: "Zhang, Chao B" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [Patch] SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is allocated Thread-Index: AQHT8EjL7qbMrbYLBkySN9FAolZMU6Q52Lyw Date: Mon, 21 May 2018 08:21:35 +0000 Message-ID: References: <20180520144227.35132-1-chao.b.zhang@intel.com> In-Reply-To: <20180520144227.35132-1-chao.b.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzYxZGYxOTctMDQ5Yy00ZjRmLWI3ZWUtMWNiMmViMjBkMGZjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZmx1RGV0OThpMHJnWWt0a3FWcmQzdkhNcDlJTkx1V3FSRFwvXC9TVkFsakVRNWdzYXgxSVFWS3I2RmhzT2hLZUhKIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Mon, 21 May 2018 08:21:39 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Long Qin Best Regards & Thanks, LONG, Qin > -----Original Message----- > From: Zhang, Chao B > Sent: Sunday, May 20, 2018 10:42 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Long, Qin > Subject: [Patch] SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is > allocated >=20 > Update package format info in _PRS to TcgNvs after memory is allocated. >=20 > Change-Id: Icfadb350e60d3ed2df332e92c257ce13309c0018 > Contributed-under: TianoCore Contribution Agreement 1.1 > Cc: Yao Jiewen > Cc: Long Qin > Signed-off-by: Zhang, Chao B > --- > SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) >=20 > diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c > b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.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 > Package(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)(Irq= BuffserSize + > 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(PcdTpm2PossibleIrqNumB= uf); > PossibleIrqNumBufSize =3D (UINT32)PcdGetSize(PcdTpm2PossibleIrqNumBu= f); >=20 > if (PossibleIrqNumBufSize <=3D MAX_PRS_INT_BUF_SIZE && > (PossibleIrqNumBufSize % sizeof(UINT32)) =3D=3D 0) { > - Status =3D UpdatePossibleResource(Table, PossibleIrqNumBuf, > PossibleIrqNumBufSize); > + Status =3D UpdatePossibleResource(Table, PossibleIrqNumBuf, > PossibleIrqNumBufSize, &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- > >OemId) ); > mTcgNvs =3D AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), = (UINT16) > 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, (VOI= D **) > &AcpiTable); > -- > 2.16.2.windows.1