<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1349332488;
        mso-list-type:hybrid;
        mso-list-template-ids:694434292 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:1985692554;
        mso-list-type:hybrid;
        mso-list-template-ids:-706175368 -325414264 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-number-format:alpha-upper;
        mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ascii-font-family:Calibri;
        mso-fareast-font-family:DengXian;
        mso-hansi-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Sorry for late response.<o:p></o:p></p>
<p class="MsoNormal">I am thinking what is the best way to address such dependency issue.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo2">If we take similar design, we need add XxxMmDependency in any StandaloneMm module with DXE communication capability, right?<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now we have different rules:<o:p></o:p></p>
<ol style="margin-top:0in" start="1" type="A">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l1 level1 lfo1">The VariableMmDependency is in StandaloneMmPkg instead of MdeModulePkg<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l1 level1 lfo1">The Tcg2MmDependency is in SecurityPkg instead of StandaloneMmPkg.<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I think we have a consistence way to add the dependency module.<o:p></o:p></p>
<p class="MsoNormal">I prefer to put it to the same package as the StandaloneMm module.<o:p></o:p></p>
<p class="MsoNormal">Can we move VariableMmDependency to MdeModulePkg ?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0in" start="2" type="1">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo2">Also, I don’t think a Library is absolutely needed.<o:p></o:p></li></ol>
<p class="MsoNormal">It could be a DXE driver with gEfiMmCommunication2ProtocolGuid in dependency section, right?<o:p></o:p></p>
<p class="MsoNormal">E.g. a Tcg2MmDependencyDxe in SecurityPkg/Tcg/Smm, and VariableMmDependencyDxe in MdeModulePkg/Universal/Variable<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you<o:p></o:p></p>
<p class="MsoNormal">Yao Jiewen<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> devel@edk2.groups.io <devel@edk2.groups.io> <b>
On Behalf Of </b>Kun Qin<br>
<b>Sent:</b> Thursday, February 25, 2021 10:26 AM<br>
<b>To:</b> devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com><br>
<b>Cc:</b> Wang, Jian J <jian.j.wang@intel.com>; Zhang, Qi1 <qi1.zhang@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com><br>
<b>Subject:</b> Re: [edk2-devel] [PATCH v2 5/6] SecurityPkg: Tcg2Smm: Added support for Standalone Mm<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Jiewen,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Do you have any feedback on this patch based on my previous reply?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">By the way, the reason I did not add this dependency library in StandaloneMmPkg was because it will make standalone package to depend on SecurityPkg, which does not seem adequate. Please let me know how you think. Thanks in advance.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Kun<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:kun.q@outlook.com">Kun Qin</a><br>
<b>Sent: </b>Tuesday, February 23, 2021 17:40<br>
<b>To: </b><a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; <a href="mailto:jiewen.yao@intel.com">
jiewen.yao@intel.com</a><br>
<b>Cc: </b><a href="mailto:jian.j.wang@intel.com">Wang, Jian J</a>; <a href="mailto:qi1.zhang@intel.com">
Zhang, Qi1</a>; <a href="mailto:rahul1.kumar@intel.com">Kumar, Rahul1</a><br>
<b>Subject: </b>Re: [edk2-devel] [PATCH v2 5/6] SecurityPkg: Tcg2Smm: Added support for Standalone Mm<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Jiewen,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This is essentially following the example of VariableStandaloneMm model here:<o:p></o:p></p>
<p class="MsoNormal"><a href="https://github.com/tianocore/edk2/commit/326598e9b7591dc4117c453b270811f645d099b7#diff-a0bf18927da79063fc4535344728f85944571ac4dccb77448fe00d79a385e494">StandaloneMmPkg/Library: Install Variable Arch Protocol · tianocore/edk2@326598e
 (github.com)</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The intended usage for this library, in the context of Standalone MM, is to link this library to the MM IPL driver (or any other drivers that has a dependency on gEfiMmCommunication2ProtocolGuid), which will make sure MM communicate is
 ready to use (and all MM drivers dispatched) before DXE core dispatch Tcg2Acpi driver. I could add an example like below in the commit message if you think that will help on the intended usage:
<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<p class="MsoNormal">  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf {<o:p></o:p></p>
<p class="MsoNormal">    <LibraryClasses><o:p></o:p></p>
<p class="MsoNormal">      NULL| SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.inf<o:p></o:p></p>
<p class="MsoNormal">  }<o:p></o:p></p>
<p class="MsoNormal">```<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Or if you have any other ideas on making sure of the loading order, please let me know as well.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Kun<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:jiewen.yao@intel.com">Yao, Jiewen</a><br>
<b>Sent: </b>Tuesday, February 23, 2021 17:26<br>
<b>To: </b><a href="mailto:kun.q@outlook.com">Kun Qin</a>; <a href="mailto:devel@edk2.groups.io">
devel@edk2.groups.io</a><br>
<b>Cc: </b><a href="mailto:jian.j.wang@intel.com">Wang, Jian J</a>; <a href="mailto:qi1.zhang@intel.com">
Zhang, Qi1</a>; <a href="mailto:rahul1.kumar@intel.com">Kumar, Rahul1</a><br>
<b>Subject: </b>Re: [edk2-devel] [PATCH v2 5/6] SecurityPkg: Tcg2Smm: Added support for Standalone Mm<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">I am not sure if Tcg2MmDependencyLib is the best solution.<br>
<br>
It seems NULL lib instance. But I am not sure how it is used. <br>
<br>
Can we have an example in SecurityPkg.dsc?<br>
<br>
<br>
<br>
> -----Original Message-----<br>
> From: Kun Qin <<a href="mailto:kun.q@outlook.com">kun.q@outlook.com</a>><br>
> Sent: Wednesday, February 10, 2021 9:25 AM<br>
> To: <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a><br>
> Cc: Yao, Jiewen <<a href="mailto:jiewen.yao@intel.com">jiewen.yao@intel.com</a>>; Wang, Jian J <<a href="mailto:jian.j.wang@intel.com">jian.j.wang@intel.com</a>>;<br>
> Zhang, Qi1 <<a href="mailto:qi1.zhang@intel.com">qi1.zhang@intel.com</a>>; Kumar, Rahul1 <<a href="mailto:rahul1.kumar@intel.com">rahul1.kumar@intel.com</a>><br>
> Subject: [PATCH v2 5/6] SecurityPkg: Tcg2Smm: Added support for Standalone<br>
> Mm<br>
> <br>
> <a href="https://bugzilla.tianocore.org/show_bug.cgi?id=3169">https://bugzilla.tianocore.org/show_bug.cgi?id=3169</a><br>
> <br>
> This change added Standalone MM instance of Tcg2. The notify function for<br>
> Standalone MM instance is left empty.<br>
> <br>
> A designated dependency library was created for DXE drivers to link as an<br>
> anonymous library.<br>
> <br>
> Lastly, the support of CI build for Tcg2 Standalone MM module is added.<br>
> <br>
> Cc: Jiewen Yao <<a href="mailto:jiewen.yao@intel.com">jiewen.yao@intel.com</a>><br>
> Cc: Jian J Wang <<a href="mailto:jian.j.wang@intel.com">jian.j.wang@intel.com</a>><br>
> Cc: Qi Zhang <<a href="mailto:qi1.zhang@intel.com">qi1.zhang@intel.com</a>><br>
> Cc: Rahul Kumar <<a href="mailto:rahul1.kumar@intel.com">rahul1.kumar@intel.com</a>><br>
> <br>
> Signed-off-by: Kun Qin <<a href="mailto:kun.q@outlook.com">kun.q@outlook.com</a>><br>
> ---<br>
> <br>
> Notes:<br>
>     v2:<br>
>     - Newly added.<br>
> <br>
>  SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.c   | 48<br>
> ++++++++++++<br>
>  SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c                      | 71<br>
> ++++++++++++++++++<br>
>  SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.inf | 39<br>
> ++++++++++<br>
>  SecurityPkg/SecurityPkg.ci.yaml                                 |  1 +<br>
>  SecurityPkg/SecurityPkg.dec                                     |  1 +<br>
>  SecurityPkg/SecurityPkg.dsc                                     | 10 +++<br>
>  SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf                    | 77<br>
> ++++++++++++++++++++<br>
>  7 files changed, 247 insertions(+)<br>
> <br>
> diff --git<br>
> a/SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.c<br>
> b/SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.c<br>
> new file mode 100644<br>
> index 000000000000..12b23813dce1<br>
> --- /dev/null<br>
> +++ b/SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.c<br>
> @@ -0,0 +1,48 @@<br>
> +/** @file<br>
> +  Runtime DXE part corresponding to StandaloneMM Tcg2 module.<br>
> +<br>
> +This module installs gTcg2MmSwSmiRegisteredGuid to notify readiness of<br>
> +StandaloneMM Tcg2 module.<br>
> +<br>
> +Copyright (c) 2019 - 2021, Arm Ltd. All rights reserved.<br>
> +Copyright (c) Microsoft Corporation.<br>
> +<br>
> +SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> +<br>
> +**/<br>
> +<br>
> +#include <PiDxe.h><br>
> +<br>
> +#include <Library/DebugLib.h><br>
> +#include <Library/UefiBootServicesTableLib.h><br>
> +<br>
> +/**<br>
> +  The constructor function installs gTcg2MmSwSmiRegisteredGuid to notify<br>
> +  readiness of StandaloneMM Tcg2 module.<br>
> +<br>
> +  @param  ImageHandle   The firmware allocated handle for the EFI image.<br>
> +  @param  SystemTable   A pointer to the Management mode System Table.<br>
> +<br>
> +  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.<br>
> +<br>
> +**/<br>
> +EFI_STATUS<br>
> +EFIAPI<br>
> +Tcg2MmDependencyLibConstructor (<br>
> +  IN EFI_HANDLE                           ImageHandle,<br>
> +  IN EFI_SYSTEM_TABLE                     *SystemTable<br>
> +  )<br>
> +{<br>
> +  EFI_STATUS            Status;<br>
> +  EFI_HANDLE            Handle;<br>
> +<br>
> +  Handle = NULL;<br>
> +  Status = gBS->InstallProtocolInterface (<br>
> +                  &Handle,<br>
> +                  &gTcg2MmSwSmiRegisteredGuid,<br>
> +                  EFI_NATIVE_INTERFACE,<br>
> +                  NULL<br>
> +                  );<br>
> +  ASSERT_EFI_ERROR (Status);<br>
> +  return EFI_SUCCESS;<br>
> +}<br>
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c<br>
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c<br>
> new file mode 100644<br>
> index 000000000000..9e0095efbc5e<br>
> --- /dev/null<br>
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c<br>
> @@ -0,0 +1,71 @@<br>
> +/** @file<br>
> +  TCG2 Standalone MM driver that updates TPM2 items in ACPI table and<br>
> registers<br>
> +  SMI2 callback functions for Tcg2 physical presence, ClearMemory, and<br>
> +  sample for dTPM StartMethod.<br>
> +<br>
> +  Caution: This module requires additional review when modified.<br>
> +  This driver will have external input - variable and ACPINvs data in SMM mode.<br>
> +  This external input must be validated carefully to avoid security issue.<br>
> +<br>
> +  PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted<br>
> input and do some check.<br>
> +<br>
> +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR><br>
> +Copyright (c) Microsoft Corporation.<br>
> +SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> +<br>
> +**/<br>
> +<br>
> +#include "Tcg2Smm.h"<br>
> +#include <Library/StandaloneMmMemLib.h><br>
> +<br>
> +/**<br>
> +  Notify the system that the SMM variable driver is ready.<br>
> +**/<br>
> +VOID<br>
> +Tcg2NotifyMmReady (<br>
> +  VOID<br>
> +  )<br>
> +{<br>
> +  // Do nothing<br>
> +}<br>
> +<br>
> +/**<br>
> +  This function is an abstraction layer for implementation specific Mm buffer<br>
> validation routine.<br>
> +<br>
> +  @param Buffer  The buffer start address to be checked.<br>
> +  @param Length  The buffer length to be checked.<br>
> +<br>
> +  @retval TRUE  This buffer is valid per processor architecture and not overlap<br>
> with SMRAM.<br>
> +  @retval FALSE This buffer is not valid per processor architecture or overlap<br>
> with SMRAM.<br>
> +**/<br>
> +BOOLEAN<br>
> +IsBufferOutsideMmValid (<br>
> +  IN EFI_PHYSICAL_ADDRESS  Buffer,<br>
> +  IN UINT64                Length<br>
> +  )<br>
> +{<br>
> +  return MmIsBufferOutsideMmValid (Buffer, Length);<br>
> +}<br>
> +<br>
> +/**<br>
> +  The driver's entry point.<br>
> +<br>
> +  It install callbacks for TPM physical presence and MemoryClear, and locate<br>
> +  SMM variable to be used in the callback function.<br>
> +<br>
> +  @param[in] ImageHandle  The firmware allocated handle for the EFI image.<br>
> +  @param[in] SystemTable  A pointer to the EFI System Table.<br>
> +<br>
> +  @retval EFI_SUCCESS     The entry point is executed successfully.<br>
> +  @retval Others          Some error occurs when executing this entry point.<br>
> +<br>
> +**/<br>
> +EFI_STATUS<br>
> +EFIAPI<br>
> +InitializeTcgStandaloneMm (<br>
> +  IN EFI_HANDLE                  ImageHandle,<br>
> +  IN EFI_MM_SYSTEM_TABLE         *SystemTable<br>
> +  )<br>
> +{<br>
> +  return InitializeTcgCommon ();<br>
> +}<br>
> diff --git<br>
> a/SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.inf<br>
> b/SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.inf<br>
> new file mode 100644<br>
> index 000000000000..5533ce2b6e6e<br>
> --- /dev/null<br>
> +++ b/SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.inf<br>
> @@ -0,0 +1,39 @@<br>
> +## @file<br>
> +#  Runtime DXE part corresponding to StandaloneMM Tcg2 module.<br>
> +#<br>
> +#  This module installs gTcg2MmSwSmiRegisteredGuid to notify readiness of<br>
> +#  StandaloneMM Tcg2 module.<br>
> +#<br>
> +# Copyright (c) Microsoft Corporation.<br>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> +#<br>
> +##<br>
> +<br>
> +[Defines]<br>
> +  INF_VERSION                    = 0x0001001A<br>
> +  BASE_NAME                      = Tcg2MmDependencyLib<br>
> +  FILE_GUID                      = 94C210EA-3113-4563-ADEB-76FE759C2F46<br>
> +  MODULE_TYPE                    = DXE_DRIVER<br>
> +  LIBRARY_CLASS                  = NULL<br>
> +  CONSTRUCTOR                    = Tcg2MmDependencyLibConstructor<br>
> +<br>
> +#<br>
> +# The following information is for reference only and not required by the build<br>
> tools.<br>
> +#<br>
> +#  VALID_ARCHITECTURES           = IA32 X64<br>
> +#<br>
> +#<br>
> +<br>
> +[Sources]<br>
> +  Tcg2MmDependencyLib.c<br>
> +<br>
> +[Packages]<br>
> +  MdePkg/MdePkg.dec<br>
> +  MdeModulePkg/MdeModulePkg.dec<br>
> +  SecurityPkg/SecurityPkg.dec<br>
> +<br>
> +[Guids]<br>
> +  gTcg2MmSwSmiRegisteredGuid         ## PRODUCES             ## GUID # Install<br>
> protocol<br>
> +<br>
> +[Depex]<br>
> +  TRUE<br>
> diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml<br>
> index 03be2e94ca97..d7b9e1f4e239 100644<br>
> --- a/SecurityPkg/SecurityPkg.ci.yaml<br>
> +++ b/SecurityPkg/SecurityPkg.ci.yaml<br>
> @@ -31,6 +31,7 @@<br>
>              "MdePkg/MdePkg.dec",<br>
>              "MdeModulePkg/MdeModulePkg.dec",<br>
>              "SecurityPkg/SecurityPkg.dec",<br>
> +            "StandaloneMmPkg/StandaloneMmPkg.dec",<br>
>              "CryptoPkg/CryptoPkg.dec"<br>
>          ],<br>
>          # For host based unit tests<br>
> diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec<br>
> index 0970cae5c75e..dfbbb0365a2b 100644<br>
> --- a/SecurityPkg/SecurityPkg.dec<br>
> +++ b/SecurityPkg/SecurityPkg.dec<br>
> @@ -383,6 +383,7 @@ [PcdsFixedAtBuild, PcdsPatchableInModule,<br>
> PcdsDynamic, PcdsDynamicEx]<br>
>    gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1|UINT8|0x0001000E<br>
> <br>
>    ## Guid name to identify TPM instance.<BR><BR><br>
> +  #  NOTE: This Pcd must be FixedAtBuild if Standalone MM is used<br>
>    #  TPM_DEVICE_INTERFACE_NONE means disable.<BR><br>
>    #  TPM_DEVICE_INTERFACE_TPM12 means TPM 1.2 DTPM.<BR><br>
>    #  TPM_DEVICE_INTERFACE_DTPM2 means TPM 2.0 DTPM.<BR><br>
> diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc<br>
> index 928bff72baa3..37242da93f3d 100644<br>
> --- a/SecurityPkg/SecurityPkg.dsc<br>
> +++ b/SecurityPkg/SecurityPkg.dsc<br>
> @@ -166,6 +166,14 @@ [LibraryClasses.common.DXE_SMM_DRIVER]<br>
> <br>
> Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/Sm<br>
> mTcg2PhysicalPresenceLib.inf<br>
>    SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf<br>
> <br>
> +[LibraryClasses.common.MM_STANDALONE]<br>
> +<br>
> StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoin<br>
> t/StandaloneMmDriverEntryPoint.inf<br>
> +<br>
> MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Standalo<br>
> neMmServicesTableLib.inf<br>
> +<br>
> Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/Sta<br>
> ndaloneMmTcg2PhysicalPresenceLib.inf<br>
> +<br>
> MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMe<br>
> mLib.inf<br>
> +<br>
> HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLi<br>
> b.inf<br>
> +<br>
> MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAlloca<br>
> tionLib/StandaloneMmMemoryAllocationLib.inf<br>
> +<br>
>  [PcdsDynamicDefault.common.DEFAULT]<br>
>    gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0xb6, 0xe5, 0x01, 0x8b,<br>
> 0x19, 0x4f, 0xe8, 0x46, 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc}<br>
>    gEfiSecurityPkgTokenSpaceGuid.PcdTpm2InitializationPolicy|1<br>
> @@ -183,6 +191,7 @@ [PcdsDynamicHii.common.DEFAULT]<br>
>  [Components]<br>
>    SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf<br>
> <br>
> SecurityPkg/Library/DxeImageAuthenticationStatusLib/DxeImageAuthentication<br>
> StatusLib.inf<br>
> +  SecurityPkg/Library/Tcg2MmDependencyLib/Tcg2MmDependencyLib.inf<br>
> <br>
>    #<br>
>    # TPM<br>
> @@ -317,6 +326,7 @@ [Components.IA32, Components.X64]<br>
>    SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLockSmm.inf<br>
>    SecurityPkg/Tcg/TcgSmm/TcgSmm.inf<br>
>    SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf<br>
> +  SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf<br>
>    SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf<br>
> <br>
> SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib<br>
> .inf<br>
> <br>
> SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalP<br>
> resenceLib.inf<br>
> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf<br>
> b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf<br>
> new file mode 100644<br>
> index 000000000000..746eda3e9fed<br>
> --- /dev/null<br>
> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf<br>
> @@ -0,0 +1,77 @@<br>
> +## @file<br>
> +#  Provides ACPI methods for TPM 2.0 support<br>
> +#<br>
> +#  Spec Compliance Info:<br>
> +#     "TCG ACPI Specification Version 1.2 Revision 8"<br>
> +#     "Physical Presence Interface Specification Version 1.30 Revision 00.52"<br>
> +#       along with<br>
> +#     "Errata Version 0.4 for TCG PC Client Platform Physical Presence Interface<br>
> Specification"<br>
> +#     "Platform Reset Attack Mitigation Specification Version 1.00"<br>
> +#    TPM2.0 ACPI device object<br>
> +#     "TCG PC Client Platform Firmware Profile Specification for TPM Family 2.0<br>
> Level 00 Revision 1.03 v51"<br>
> +#       along with<br>
> +#     "Errata for PC Client Specific Platform Firmware Profile Specification<br>
> Version 1.0 Revision 1.03"<br>
> +#<br>
> +#  This driver implements TPM 2.0 definition block in ACPI table and<br>
> +#  registers SMI callback functions for Tcg2 physical presence and<br>
> +#  MemoryClear to handle the requests from ACPI method.<br>
> +#<br>
> +#  Caution: This module requires additional review when modified.<br>
> +#  This driver will have external input - variable and ACPINvs data in SMM mode.<br>
> +#  This external input must be validated carefully to avoid security issue.<br>
> +#<br>
> +# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR><br>
> +# Copyright (c) Microsoft Corporation.<BR><br>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> +#<br>
> +##<br>
> +<br>
> +[Defines]<br>
> +  INF_VERSION                    = 0x00010005<br>
> +  BASE_NAME                      = Tcg2StandaloneMm<br>
> +  FILE_GUID                      = D40F321F-5349-4724-B667-131670587861<br>
> +  MODULE_TYPE                    = MM_STANDALONE<br>
> +  PI_SPECIFICATION_VERSION       = 0x00010032<br>
> +  VERSION_STRING                 = 1.0<br>
> +  ENTRY_POINT                    = InitializeTcgStandaloneMm<br>
> +<br>
> +[Sources]<br>
> +  Tcg2Smm.h<br>
> +  Tcg2Smm.c<br>
> +  Tcg2StandaloneMm.c<br>
> +<br>
> +[Packages]<br>
> +  MdePkg/MdePkg.dec<br>
> +  MdeModulePkg/MdeModulePkg.dec<br>
> +  SecurityPkg/SecurityPkg.dec<br>
> +  StandaloneMmPkg/StandaloneMmPkg.dec<br>
> +<br>
> +[LibraryClasses]<br>
> +  BaseLib<br>
> +  BaseMemoryLib<br>
> +  StandaloneMmDriverEntryPoint<br>
> +  MmServicesTableLib<br>
> +  DebugLib<br>
> +  Tcg2PhysicalPresenceLib<br>
> +  PcdLib<br>
> +  MemLib<br>
> +<br>
> +[Guids]<br>
> +  ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl"<br>
> +  ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl"<br>
> +  gEfiMemoryOverwriteControlDataGuid<br>
> +<br>
> +  gEfiTpmDeviceInstanceTpm20DtpmGuid                            ## PRODUCES           ##<br>
> GUID       # TPM device identifier<br>
> +  gTpmNvsMmGuid                                                 ## CONSUMES<br>
> +<br>
> +[Protocols]<br>
> +  gEfiSmmSwDispatch2ProtocolGuid                                ## CONSUMES<br>
> +  gEfiSmmVariableProtocolGuid                                   ## CONSUMES<br>
> +  gEfiMmReadyToLockProtocolGuid                                 ## CONSUMES<br>
> +<br>
> +[Pcd]<br>
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid              ## CONSUMES<br>
> +<br>
> +[Depex]<br>
> +  gEfiSmmSwDispatch2ProtocolGuid AND<br>
> +  gEfiSmmVariableProtocolGuid<br>
> --<br>
> 2.30.0.windows.1<br>
<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"></o:p></span></p>
</div>
</div>
</body>
</html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/72267">View/Reply Online (#72267)</a> |    |  <a target="_blank" href="https://groups.io/mt/80522089/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>