public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Long, Qin" <qin.long@intel.com>
To: "Zhang, Chao B" <chao.b.zhang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [Patch] SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is allocated
Date: Mon, 21 May 2018 08:21:35 +0000	[thread overview]
Message-ID: <BF2CCE9263284D428840004653A28B6E540C6A43@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20180520144227.35132-1-chao.b.zhang@intel.com>

Reviewed-by: Long Qin <qin.long@intel.com>


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 <jiewen.yao@intel.com>; Long, Qin <qin.long@intel.com>
> Subject: [Patch] SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is
> allocated
> 
> 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 <jiewen.yao@intel.com>
> Cc: Long Qin <qin.long@intel.com>
> Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com>
> ---
>  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/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
> 
>    @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).
> 
>    @return                          patch status.
> 
>  **/
>  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) = (UINT8)(IrqBuffserSize + 19);
> 
>        //
>        // Notify _PRS to report short formed ResourceTemplate
>        //
> -      mTcgNvs->IsShortFormPkgLength = TRUE;
> +      *IsShortFormPkgLength = TRUE;
> 
>        break;
>      }
>    }
> 
> @@ -501,11 +503,11 @@ UpdatePossibleResource (
>          *(DataPtr + 2 + ((*DataPtr & (BIT7|BIT6)) >> 6)) = (UINT8)(IrqBuffserSize +
> 19);
> 
>          //
>          // Notify _PRS to report long formed ResourceTemplate
>          //
> -        mTcgNvs->IsShortFormPkgLength = FALSE;
> +        *IsShortFormPkgLength = FALSE;
>          break;
>        }
>      }
>    }
> 
> @@ -670,10 +672,13 @@ PublishAcpiTable (
>    UINTN                          TableKey;
>    EFI_ACPI_DESCRIPTION_HEADER    *Table;
>    UINTN                          TableSize;
>    UINT32                         *PossibleIrqNumBuf;
>    UINT32                         PossibleIrqNumBufSize;
> +  BOOLEAN                        IsShortFormPkgLength;
> +
> +  IsShortFormPkgLength = FALSE;
> 
>    Status = GetSectionFromFv (
>               &gEfiCallerIdGuid,
>               EFI_SECTION_RAW,
>               0,
> @@ -708,11 +713,11 @@ PublishAcpiTable (
>      //
>      PossibleIrqNumBuf     = (UINT32 *)PcdGetPtr(PcdTpm2PossibleIrqNumBuf);
>      PossibleIrqNumBufSize = (UINT32)PcdGetSize(PcdTpm2PossibleIrqNumBuf);
> 
>      if (PossibleIrqNumBufSize <= MAX_PRS_INT_BUF_SIZE &&
> (PossibleIrqNumBufSize % sizeof(UINT32)) == 0) {
> -      Status = UpdatePossibleResource(Table, PossibleIrqNumBuf,
> PossibleIrqNumBufSize);
> +      Status = 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 == SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 'b', 'l'));
>    CopyMem (Table->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (Table-
> >OemId) );
>    mTcgNvs = AssignOpRegion (Table, SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16)
> sizeof (TCG_NVS));
>    ASSERT (mTcgNvs != NULL);
>    mTcgNvs->TpmIrqNum            = PcdGet32(PcdTpm2CurrentIrqNum);
> -  mTcgNvs->IsShortFormPkgLength = FALSE;
> +  mTcgNvs->IsShortFormPkgLength = IsShortFormPkgLength;
> 
>    //
>    // Publish the TPM ACPI table. Table is re-checksumed.
>    //
>    Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)
> &AcpiTable);
> --
> 2.16.2.windows.1



      reply	other threads:[~2018-05-21  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-20 14:42 [Patch] SecurityPkg:Tcg2Smm: Update TcgNvs info after memory is allocated Zhang, Chao B
2018-05-21  8:21 ` Long, Qin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BF2CCE9263284D428840004653A28B6E540C6A43@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox