From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.5593.1608774812042711041 for ; Wed, 23 Dec 2020 17:53:34 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 24 Dec 2020 09:53:26 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , , "'Yao, Jiewen'" Cc: "'Wang, Jian J'" , "'Bi, Dandan'" References: <20201218185011.1366-1-kun.q@outlook.com> , In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDA2LzE1XSBNZGVNb2R1bGVQa2c6IFNtbVJlcG9ydFN0YXR1c0NvZGVMaWI6IFJlcG9ydFN0YXR1c0NvZGVMaWIgaW4gU3RhbmRhbG9uZU1t?= Date: Thu, 24 Dec 2020 09:53:29 +0800 Message-ID: <00f701d6d997$93d1af10$bb750d30$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFg3yxaHQ8fwUPni7u8T6g29nhsgQGclWVHAhrFEiYBzp27fwGJIek/qrj3j3A= Content-Type: multipart/alternative; boundary="----=_NextPart_000_00F8_01D6D9DA.A1F78720" Content-Language: zh-cn ------=_NextPart_000_00F8_01D6D9DA.A1F78720 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Kun: I am OK for this solution. Have you plan to update StatusCodeHandlerSmm? =20 Thanks Liming =B7=A2=BC=FE=C8=CB: bounce+27952+69397+4905953+8761045@groups.io =B4=FA=B1=ED Wu, Hao A =B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA12=D4=C223=C8=D5 14:10 =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; kun.q@outlook.com; Liming Gao ; Yao, Jiewen =B3=AD=CB=CD: Wang, Jian J ; Bi, Dandan =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm =20 Hello Kun, =20 Got it, thanks for the explanation. My preference is the same with your current proposal in the patch. =20 =20 Hello Liming and Jiewen, =20 Do you have comments for this case? Thanks in advance. =20 Best Regards, Hao Wu =20 From: devel@edk2.groups.io > On Behalf Of Kun Qin Sent: Wednesday, December 23, 2020 3:15 AM To: devel@edk2.groups.io ; Wu, Hao A > Cc: Wang, Jian J >; Bi, Dandan >; Liming Gao >; Yao, Jiewen > Subject: Re: [edk2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm =20 Hi Hao, =20 That was my original plan, but doing it might require a MmServiceTableLib instance for SMM_CORE type if PiSmmCore links in RSC lib (similar to PiSmmCoreSmmServicesTableLib). We can create such an instance just like PiSmmCoreSmmServicesTableLib, but the implementation will pull in gSmmCoreSmst as an external variable and cast it from `EFI_SMM_SYSTEM_TABLE2` to `EFI_MM_SYSTEM_TABLE`, which does not look clea= n. Thus I just abstract the routine to avoid it. =20 Please let me know if you have better ideas, I can add the change for next patch series. =20 Thanks, Kun =20 From: Wu, Hao A =20 Sent: Tuesday, December 22, 2020 00:35 To: devel@edk2.groups.io ; kun.q@outlook.com =20 Cc: Wang, Jian J ; Bi, Dandan ; Liming Gao ; Yao, Jiewen =20 Subject: Re: [edk2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm =20 > -----Original Message----- > From: devel@edk2.groups.io > On Behalf Of Kun Qin > Sent: Saturday, December 19, 2020 2:50 AM > To: devel@edk2.groups.io =20 > Cc: Wang, Jian J >= ; Wu, Hao A >; > Bi, Dandan >; Liming G= ao > > Subject: [edk2-devel] [PATCH v1 06/15] MdeModulePkg: > SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm >=20 > This change added support of StandaloneMm for ReportStatusCodeLib. It > adds a new instance of ReportStatusCodeLib for MM_STANDALONE type, > and abstracts the references of gMmst and gSmst functionalities into > separate files in order to link in proper Service Table for SMM core/drivers. Sorry for a question. Do you think it is feasible to use: gMmst->MmLocateProtocol to locate gEfiMmStatusCodeProtocolGuid and avoid introducing 2 separate implementations for internal function InternalLocateProtocol()? Since I found that the definitions for gEfiMmStatusCodeProtocolGuid an gEfiSmmStatusCodeProtocolGuid are identical. Best Regards, Hao Wu >=20 > Cc: Jian J Wang > > Cc: Hao A Wu > > Cc: Dandan Bi > > Cc: Liming Gao > >=20 > Signed-off-by: Kun Qin > > --- > MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c > | 16 ++++---- >=20 > MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibSta > ndaloneMm.c | 39 ++++++++++++++++++++ >=20 > MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibTra > ditional.c | 39 ++++++++++++++++++++ > MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.h > | 37 +++++++++++++++++++ >=20 > MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLi > b.inf | 4 +- >=20 > MdeModulePkg/Library/SmmReportStatusCodeLib/{SmmReportStatusCode > Lib.inf =3D> StandaloneMmReportStatusCodeLib.inf} | 17 +++++---- > MdeModulePkg/MdeModulePkg.dsc > | 1 + > 7 files changed, 137 insertions(+), 16 deletions(-) >=20 > diff --git > a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib. > c > index 3a1772538cdf..fb1769db9223 100644 > --- > a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c > +++ > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib. > c > @@ -1,5 +1,5 @@ > /** @file > - Report Status Code Library for SMM Phase. > + Report Status Code Library for MM Phase. >=20 > Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. > SPDX-License-Identifier: BSD-2-Clause-Patent @@ -8,7 +8,7 @@ >=20 > #include #include = - > #include > +#include > #include > #include > #include > @@ -16,10 +16,12 @@ >=20 > #include > #include -#include > > +#include >=20 > -EFI_SMM_REPORT_STATUS_CODE mReportStatusCode =3D NULL; > -EFI_SMM_STATUS_CODE_PROTOCOL *mStatusCodeProtocol =3D NULL; > +#include "ReportStatusCodeLib.h" > + > +EFI_MM_REPORT_STATUS_CODE mReportStatusCode =3D NULL; > +EFI_MM_STATUS_CODE_PROTOCOL *mStatusCodeProtocol =3D NULL; >=20 >=20 > /** > @@ -29,14 +31,14 @@ EFI_SMM_STATUS_CODE_PROTOCOL > *mStatusCodeProtocol =3D NULL; > NULL is returned if no status code service is available. >=20 > **/ > -EFI_SMM_REPORT_STATUS_CODE > +EFI_MM_REPORT_STATUS_CODE > InternalGetReportStatusCode ( > VOID > ) > { > EFI_STATUS Status; >=20 > - Status =3D gSmst->SmmLocateProtocol (&gEfiSmmStatusCodeProtocolGuid, > NULL, (VOID**)&mStatusCodeProtocol); > + Status =3D InternalLocateProtocol (&gEfiMmStatusCodeProtocolGuid, NUL= L, > + (VOID**)&mStatusCodeProtocol); > if (!EFI_ERROR (Status) && mStatusCodeProtocol !=3D NULL) { > return mStatusCodeProtocol->ReportStatusCode; > } > diff --git > a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibS > tandaloneMm.c > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibS > tandaloneMm.c > new file mode 100644 > index 000000000000..fc47dffe9ffb > --- /dev/null > +++ > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibS > ta > +++ ndaloneMm.c > @@ -0,0 +1,39 @@ > +/** @file > + Abstraction layer for MM service table used by MM ReportStatusCodeLib= . > + > + Copyright (c) Microsoft Corporation. > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > + > +/** > + Returns the first protocol instance that matches the given protocol. > + > + @param[in] Protocol Provides the protocol to search for. > + @param[in] Registration Optional registration key returned from > + RegisterProtocolNotify(). > + @param[out] Interface On return, a pointer to the first interface that > matches Protocol and > + Registration. > + > + @retval EFI_SUCCESS A protocol instance matching Protocol w= as > found and returned in > + Interface. > + @retval EFI_NOT_FOUND No protocol instances were found that > match Protocol and > + Registration. > + @retval EFI_INVALID_PARAMETER Interface is NULL. > + Protocol is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +InternalLocateProtocol ( > + IN EFI_GUID *Protocol, > + IN VOID *Registration, OPTIONAL > + OUT VOID **Interface > + ) > +{ > + return gMmst->MmLocateProtocol (Protocol, Registration, Interface); } > diff --git > a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibT > raditional.c > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibT > raditional.c > new file mode 100644 > index 000000000000..6b3a7c6051c5 > --- /dev/null > +++ > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibT > ra > +++ ditional.c > @@ -0,0 +1,39 @@ > +/** @file > + Abstraction layer for SMM service table used by SMM > ReportStatusCodeLib. > + > + Copyright (c) Microsoft Corporation. > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > + > +/** > + Returns the first protocol instance that matches the given protocol. > + > + @param[in] Protocol Provides the protocol to search for. > + @param[in] Registration Optional registration key returned from > + RegisterProtocolNotify(). > + @param[out] Interface On return, a pointer to the first interface that > matches Protocol and > + Registration. > + > + @retval EFI_SUCCESS A protocol instance matching Protocol w= as > found and returned in > + Interface. > + @retval EFI_NOT_FOUND No protocol instances were found that > match Protocol and > + Registration. > + @retval EFI_INVALID_PARAMETER Interface is NULL. > + Protocol is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +InternalLocateProtocol ( > + IN EFI_GUID *Protocol, > + IN VOID *Registration, OPTIONAL > + OUT VOID **Interface > + ) > +{ > + return gSmst->SmmLocateProtocol (Protocol, Registration, Interface); > +} > diff --git > a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib. > h > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib. > h > new file mode 100644 > index 000000000000..9a16741e64f6 > --- /dev/null > +++ > b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib. > h > @@ -0,0 +1,37 @@ > +/** @file > + Report Status Code Library for MM Phase. > + > + Copyright (c) 2009 - 2018, Intel Corporation. All rights > + reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _MM_RSC_LIB_H_ > +#define _MM_RSC_LIB_H_ > + > +/** > + Returns the first protocol instance that matches the given protocol. > + > + @param[in] Protocol Provides the protocol to search for. > + @param[in] Registration Optional registration key returned from > + RegisterProtocolNotify(). > + @param[out] Interface On return, a pointer to the first interface that > matches Protocol and > + Registration. > + > + @retval EFI_SUCCESS A protocol instance matching Protocol w= as > found and returned in > + Interface. > + @retval EFI_NOT_FOUND No protocol instances were found that > match Protocol and > + Registration. > + @retval EFI_INVALID_PARAMETER Interface is NULL. > + Protocol is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +InternalLocateProtocol ( > + IN EFI_GUID *Protocol, > + IN VOID *Registration, OPTIONAL > + OUT VOID **Interface > + ); > + > +#endif // _MM_RSC_LIB_H_ > diff --git > a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod > eLib.inf > b/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod > eLib.inf > index 72496bfababd..02dce09a199d 100644 > --- > a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod > eLib.inf > +++ > b/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod > eLib > +++ .inf > @@ -28,6 +28,8 @@ [Defines] >=20 > [Sources] > ReportStatusCodeLib.c > + ReportStatusCodeLib.h > + ReportStatusCodeLibTraditional.c >=20 > [Packages] > MdePkg/MdePkg.dec > @@ -45,7 +47,7 @@ [Guids] > gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES > ## UNDEFINED >=20 > [Protocols] > - gEfiSmmStatusCodeProtocolGuid ## CONSUMES > + gEfiMmStatusCodeProtocolGuid ## CONSUMES >=20 > [Pcd] > gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask ## > CONSUMES diff --git > a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod > eLib.inf > b/MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReport > StatusCodeLib.inf > similarity index 64% > copy from > MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLi > b.inf > copy to > MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportSt > atusCodeLib.inf > index 72496bfababd..11ecc67fc4fa 100644 > --- > a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod > eLib.inf > +++ > b/MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReport > Stat > +++ usCodeLib.inf > @@ -12,13 +12,12 @@ >=20 > [Defines] > INF_VERSION =3D 0x00010005 > - BASE_NAME =3D SmmReportStatusCodeLib > - MODULE_UNI_FILE =3D SmmReportStatusCodeLib.uni > - FILE_GUID =3D 67089D19-B3D6-4d9e-A0EB-FEDC1F83A1= EE > - MODULE_TYPE =3D DXE_SMM_DRIVER > + BASE_NAME =3D StandaloneMmReportStatusCodeLib > + FILE_GUID =3D 17C7FC8C-8C5D-497E-9C0E-C21255B30E= 04 > + MODULE_TYPE =3D MM_STANDALONE > VERSION_STRING =3D 1.0 > - PI_SPECIFICATION_VERSION =3D 0x0001000A > - LIBRARY_CLASS =3D ReportStatusCodeLib|DXE_SMM_DRIVER > SMM_CORE > + PI_SPECIFICATION_VERSION =3D 0x00010032 > + LIBRARY_CLASS =3D ReportStatusCodeLib|MM_STANDALONE >=20 > # > # The following information is for reference only and not required by t= he > build tools. > @@ -28,6 +27,8 @@ [Defines] >=20 > [Sources] > ReportStatusCodeLib.c > + ReportStatusCodeLib.h > + ReportStatusCodeLibStandaloneMm.c >=20 > [Packages] > MdePkg/MdePkg.dec > @@ -36,7 +37,7 @@ [Packages] > [LibraryClasses] > PcdLib > BaseMemoryLib > - SmmServicesTableLib > + MmServicesTableLib > DebugLib > MemoryAllocationLib >=20 > @@ -45,7 +46,7 @@ [Guids] > gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES > ## UNDEFINED >=20 > [Protocols] > - gEfiSmmStatusCodeProtocolGuid ## CONSUMES > + gEfiMmStatusCodeProtocolGuid ## CONSUMES >=20 > [Pcd] > gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask ## > CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dsc > b/MdeModulePkg/MdeModulePkg.dsc index cd91a70b4fdd..05bf5fe08094 > 100644 > --- a/MdeModulePkg/MdeModulePkg.dsc > +++ b/MdeModulePkg/MdeModulePkg.dsc > @@ -473,6 +473,7 @@ [Components.IA32, Components.X64] > } >=20 > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.i > nf >=20 > MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLi > b.inf > + > + > MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportSt > atusCo > + deLib.inf >=20 > MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSm > m.inf >=20 > MdeModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCod > eRouterSmm.inf > MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf > -- > 2.28.0.windows.1 >=20 >=20 >=20 >=20 >=20 =20 ------=_NextPart_000_00F8_01D6D9DA.A1F78720 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
Kun:

 I am OK for this s= olution. Have you plan to update StatusCodeHandlerSmm?

 

Thanks=

Liming

=B7=A2=BC=FE=C8=CB: bounce+27952+69397+4905953+8761045@groups.io <bounce+27952+69= 397+4905953+8761045@groups.io> =B4=FA=B1=ED Wu, Hao A
=B7=A2=CB= =CD=CA=B1=BC=E4: 2020=C4=EA12=D4=C223=C8= =D5 14:10
=CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; kun.q@outlook.co= m; Liming Gao <gaoliming@byosoft.com.cn>; Yao, Jiewen <jiewen.yao@= intel.com>
=B3=AD=CB=CD: Wang, Jian J <jian.j.wang@intel.com>; Bi, Dandan <d= andan.bi@intel.com>
=D6=F7=CC=E2:= Re: [edk2-devel] [PATCH v1 06/15] MdeModulePkg: Smm= ReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm<= /span>

 

Hello Kun,

 

Got it, thanks for the explana= tion. My preference is the same with your current proposal in the patch.

 

 

Hello Liming and Jiewen,<= /o:p>

 

Do you have comments for t= his case? Thanks in advance.

 

Best Regards,

Hao Wu

 

= From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kun QinSent: Wednesday, December 23, 2020 3:15 AM
To: devel@edk2.groups.io; Wu, Hao A <<= a href=3D"mailto:hao.a.wu@intel.com">hao.a.wu@intel.com>
Cc: Wang, Jian J <jian.j.wang@in= tel.com>; Bi, Dandan <dand= an.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: Re:= [edk2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: Report= StatusCodeLib in StandaloneMm

 

Hi Hao,

 

That was my original plan, but doing it might require a MmService= TableLib instance for SMM_CORE type if PiSmmCore links in RSC lib (similar = to PiSmmCoreSmmServicesTableLib). We can create such an instance just like = PiSmmCoreSmmServicesTableLib, but the implementation will pull in gSmmCoreS= mst as an external variable and cast it from `EFI_SMM_SYSTEM_TABLE2` to `EF= I_MM_SYSTEM_TABLE`, which does not look clean. Thus I just abstract the rou= tine to avoid it.

 

Ple= ase let me know if you have better ideas, I can add the change for next pat= ch series.

 

Thanks,

Kun

 

From: Wu, Hao A
Se= nt: Tuesday, December 22, 2020 00:35
To: devel@edk2.groups.io; kun.q@outlook.com
Cc: Wang, Jian J; Bi, Dand= an; Liming Gao; Yao, Jiewen
Subject: Re: [e= dk2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportSta= tusCodeLib in StandaloneMm

=  

> -----Original Message---= --
> From: devel@edk2.groups.= io <devel@edk2.groups.io= > On Behalf Of Kun Qin
> Sent: Saturday, December 19, 2020 2:50 AM=
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <
ji= an.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Bi, Dandan <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
> = Subject: [edk2-devel] [PATCH v1 06/15] MdeModulePkg:
> SmmReportStatu= sCodeLib: ReportStatusCodeLib in StandaloneMm
>
> This change = added support of StandaloneMm for ReportStatusCodeLib. It
> adds a ne= w instance of ReportStatusCodeLib for MM_STANDALONE type,
> and abstr= acts the references of gMmst and gSmst functionalities into
> separat= e files in order to link in proper Service Table for SMM core/drivers.
<= br>
Sorry for a question.

Do you think it is feasible to use:
= gMmst->MmLocateProtocol to locate gEfiMmStatusCodeProtocolGuid
and av= oid introducing 2 separate implementations for internal function InternalLo= cateProtocol()?

Since I found that the definitions for gEfiMmStatusC= odeProtocolGuid an gEfiSmmStatusCodeProtocolGuid are identical.

Best= Regards,
Hao Wu


>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Ha= o A Wu <hao.a.wu@intel.com>=
> Cc: Dandan Bi <dandan.bi= @intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>
> Signed-off= -by: Kun Qin <kun.q@outlook.com= >
> ---
>  MdeModulePkg/Library/SmmReportStatusCodeLib/= ReportStatusCodeLib.c
> | 16 ++++----
>
> MdeModulePkg/L= ibrary/SmmReportStatusCodeLib/ReportStatusCodeLibSta
> ndaloneMm.c&nb= sp;            =             &nb= sp;         | 39 ++++++++++++++++++= ++
>
> MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatu= sCodeLibTra
> ditional.c       &nb= sp;            =             &nb= sp;   | 39 ++++++++++++++++++++
>  MdeModulePkg/Librar= y/SmmReportStatusCodeLib/ReportStatusCodeLib.h
> | 37 +++++++++++++++= ++++
>
> MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReport= StatusCodeLi
> b.inf        &= nbsp;           &nbs= p;            &= nbsp;        |  4 +-
>
&g= t; MdeModulePkg/Library/SmmReportStatusCodeLib/{SmmReportStatusCode
>= Lib.inf =3D> StandaloneMmReportStatusCodeLib.inf} | 17 +++++----
>= ;  MdeModulePkg/MdeModulePkg.dsc
> |  1 +
>  7 f= iles changed, 137 insertions(+), 16 deletions(-)
>
> diff --gi= t
> a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib= .c
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLi= b.
> c
> index 3a1772538cdf..fb1769db9223 100644
> ---> a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c> +++
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStat= usCodeLib.
> c
> @@ -1,5 +1,5 @@
>  /** @file
>= ; -  Report Status Code Library for SMM Phase.
> +  Report = Status Code Library for MM Phase.
>
>    Copyri= ght (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
&= gt;    SPDX-License-Identifier: BSD-2-Clause-Patent @@ -8,7 = +8,7 @@
>
>  #include <Library/ReportStatusCodeLib.h&g= t;  #include <Library/DebugLib.h> -
> #include <Library= /SmmServicesTableLib.h>
> +#include <Library/MmServicesTableLib= .h>
>  #include <Library/BaseLib.h>
>  #incl= ude <Library/BaseMemoryLib.h>
>  #include <Library/PcdL= ib.h>
> @@ -16,10 +16,12 @@
>
>  #include <Gu= id/StatusCodeDataTypeId.h>
>  #include <Guid/StatusCodeDat= aTypeDebug.h> -#include
> <Protocol/SmmStatusCode.h>
>= +#include <Protocol/MmStatusCode.h>
>
> -EFI_SMM_REPORT= _STATUS_CODE     mReportStatusCode =3D NULL;
> -E= FI_SMM_STATUS_CODE_PROTOCOL   *mStatusCodeProtocol =3D NULL;
&= gt; +#include "ReportStatusCodeLib.h"
> +
> +EFI_MM_R= EPORT_STATUS_CODE     mReportStatusCode =3D NULL;
&g= t; +EFI_MM_STATUS_CODE_PROTOCOL   *mStatusCodeProtocol =3D NULL;<= br>>
>
>  /**
> @@ -29,14 +31,14 @@ EFI_SMM_STA= TUS_CODE_PROTOCOL
> *mStatusCodeProtocol =3D NULL;
>  = ;            NULL is= returned if no status code service is available.
>
>  **= /
> -EFI_SMM_REPORT_STATUS_CODE
> +EFI_MM_REPORT_STATUS_CODE>  InternalGetReportStatusCode (
>    VOID>    )
>  {
>    EFI_STA= TUS            =         Status;
>
> - = Status =3D gSmst->SmmLocateProtocol (&gEfiSmmStatusCodeProtocolGuid= ,
> NULL, (VOID**)&mStatusCodeProtocol);
> +  Status = =3D InternalLocateProtocol (&gEfiMmStatusCodeProtocolGuid, NULL,
&g= t; + (VOID**)&mStatusCodeProtocol);
>    if (!EFI_= ERROR (Status) && mStatusCodeProtocol !=3D NULL) {
> &nb= sp;    return mStatusCodeProtocol->ReportStatusCode;
&= gt;    }
> diff --git
> a/MdeModulePkg/Library/S= mmReportStatusCodeLib/ReportStatusCodeLibS
> tandaloneMm.c
> b/= MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibS
> ta= ndaloneMm.c
> new file mode 100644
> index 000000000000..fc47df= fe9ffb
> --- /dev/null
> +++
> b/MdeModulePkg/Library/Smm= ReportStatusCodeLib/ReportStatusCodeLibS
> ta
> +++ ndaloneMm.c=
> @@ -0,0 +1,39 @@
> +/** @file
> +  Abstraction la= yer for MM service table used by MM ReportStatusCodeLib.
> +
> = +  Copyright (c) Microsoft Corporation.
> +  SPDX-License-I= dentifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#i= nclude <PiMm.h>
> +
> +#include <Library/MmServicesTab= leLib.h>
> +
> +/**
> +  Returns the first protoc= ol instance that matches the given protocol.
> +
> +  @par= am[in]  Protocol         = Provides the protocol to search for.
> +  @param[in]  Regi= stration      Optional registration key returned f= rom
> +          &n= bsp;            = ;         RegisterProtocolNotify().=
> +  @param[out]  Interface     &= nbsp;  On return, a pointer to the first interface that
> matche= s Protocol and
> +        &nb= sp;            =            Registration.<= br>> +
> +  @retval EFI_SUCCESS     =       A protocol instance matching Protocol was> found and returned in
> +      &n= bsp;            = ;             I= nterface.
> +  @retval EFI_NOT_FOUND    &nbs= p;    No protocol instances were found that
> match Pr= otocol and
> +         &= nbsp;           &nbs= p;          Registration.
&= gt; +  @retval EFI_INVALID_PARAMETER Interface is NULL.
> + = ;            &n= bsp;            = ;      Protocol is NULL.
> +
> +**/> +EFI_STATUS
> +EFIAPI
> +InternalLocateProtocol (
>= +  IN  EFI_GUID  *Protocol,
> +  IN  VOID&n= bsp;     *Registration, OPTIONAL
> +  OUT VO= ID      **Interface
> +  )
> +{> +  return gMmst->MmLocateProtocol (Protocol, Registration, I= nterface); }
> diff --git
> a/MdeModulePkg/Library/SmmReportSta= tusCodeLib/ReportStatusCodeLibT
> raditional.c
> b/MdeModulePkg= /Library/SmmReportStatusCodeLib/ReportStatusCodeLibT
> raditional.c> new file mode 100644
> index 000000000000..6b3a7c6051c5
>= ; --- /dev/null
> +++
> b/MdeModulePkg/Library/SmmReportStatusC= odeLib/ReportStatusCodeLibT
> ra
> +++ ditional.c
> @@ -0= ,0 +1,39 @@
> +/** @file
> +  Abstraction layer for SMM se= rvice table used by SMM
> ReportStatusCodeLib.
> +
> +&nb= sp; Copyright (c) Microsoft Corporation.
> +  SPDX-License-Ident= ifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#inclu= de <PiMm.h>
> +
> +#include <Library/SmmServicesTableL= ib.h>
> +
> +/**
> +  Returns the first protocol = instance that matches the given protocol.
> +
> +  @param[= in]  Protocol          Pr= ovides the protocol to search for.
> +  @param[in]  Registr= ation      Optional registration key returned from=
> +           = ;            &n= bsp;        RegisterProtocolNotify().> +  @param[out]  Interface     &nbs= p;  On return, a pointer to the first interface that
> matches P= rotocol and
> +         =             &nb= sp;          Registration.
= > +
> +  @retval EFI_SUCCESS     &nb= sp;     A protocol instance matching Protocol was
&g= t; found and returned in
> +       = ;            &n= bsp;            Inte= rface.
> +  @retval EFI_NOT_FOUND     &= nbsp;   No protocol instances were found that
> match Proto= col and
> +         &nbs= p;            &= nbsp;         Registration.
>= +  @retval EFI_INVALID_PARAMETER Interface is NULL.
> + &n= bsp;            = ;            &n= bsp;     Protocol is NULL.
> +
> +**/
&g= t; +EFI_STATUS
> +EFIAPI
> +InternalLocateProtocol (
> +&= nbsp; IN  EFI_GUID  *Protocol,
> +  IN  VOID = ;     *Registration, OPTIONAL
> +  OUT VOID&= nbsp;     **Interface
> +  )
> +{
&= gt; +  return gSmst->SmmLocateProtocol (Protocol, Registration, Int= erface);
> +}
> diff --git
> a/MdeModulePkg/Library/SmmRe= portStatusCodeLib/ReportStatusCodeLib.
> h
> b/MdeModulePkg/Lib= rary/SmmReportStatusCodeLib/ReportStatusCodeLib.
> h
> new file= mode 100644
> index 000000000000..9a16741e64f6
> --- /dev/null=
> +++
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportSt= atusCodeLib.
> h
> @@ -0,0 +1,37 @@
> +/** @file
> = +  Report Status Code Library for MM Phase.
> +
> +  = Copyright (c) 2009 - 2018, Intel Corporation. All rights
> + reserved= .<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent> +
> +**/
> +
> +#ifndef _MM_RSC_LIB_H_
> +#de= fine _MM_RSC_LIB_H_
> +
> +/**
> +  Returns the firs= t protocol instance that matches the given protocol.
> +
> +&nb= sp; @param[in]  Protocol       &nbs= p;  Provides the protocol to search for.
> +  @param[in]&nb= sp; Registration      Optional registration key re= turned from
> +         =             &nb= sp;          RegisterProtocolN= otify().
> +  @param[out]  Interface    = ;    On return, a pointer to the first interface that
>= ; matches Protocol and
> +       &= nbsp;           &nbs= p;            Regist= ration.
> +
> +  @retval EFI_SUCCESS   &nbs= p;       A protocol instance matching Protoco= l was
> found and returned in
> +     =             &nb= sp;            =   Interface.
> +  @retval EFI_NOT_FOUND   &n= bsp;     No protocol instances were found that
> = match Protocol and
> +        = ;            &n= bsp;           Registrati= on.
> +  @retval EFI_INVALID_PARAMETER Interface is NULL.
>= ; +            =             &nb= sp;       Protocol is NULL.
> +
>= +**/
> +EFI_STATUS
> +EFIAPI
> +InternalLocateProtocol (=
> +  IN  EFI_GUID  *Protocol,
> +  IN = ; VOID      *Registration, OPTIONAL
> + = ; OUT VOID      **Interface
> +  );
= > +
> +#endif // _MM_RSC_LIB_H_
> diff --git
> a/MdeMo= dulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod
> eLib.inf<= br>> b/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod> eLib.inf
> index 72496bfababd..02dce09a199d 100644
> ---<= br>> a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod> eLib.inf
> +++
> b/MdeModulePkg/Library/SmmReportStatusCo= deLib/SmmReportStatusCod
> eLib
> +++ .inf
> @@ -28,6 +28= ,8 @@ [Defines]
>
>  [Sources]
>    = ReportStatusCodeLib.c
> +  ReportStatusCodeLib.h
> + = ReportStatusCodeLibTraditional.c
>
>  [Packages]
>=     MdePkg/MdePkg.dec
> @@ -45,7 +47,7 @@ [Guids]
&= gt;    gEfiStatusCodeDataTypeDebugGuid   &nbs= p;           ## SOMETIMES= _CONSUMES
> ## UNDEFINED
>
>  [Protocols]
> -=   gEfiSmmStatusCodeProtocolGuid      &nb= sp;          ## CONSUMES
&g= t; +  gEfiMmStatusCodeProtocolGuid      =             ## CONSU= MES
>
>  [Pcd]
>    gEfiMdePkgTokenS= paceGuid.PcdReportStatusCodePropertyMask  ##
> CONSUMES diff --g= it
> a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod=
> eLib.inf
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/Sta= ndaloneMmReport
> StatusCodeLib.inf
> similarity index 64%
&= gt; copy from
> MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReport= StatusCodeLi
> b.inf
> copy to
> MdeModulePkg/Library/Smm= ReportStatusCodeLib/StandaloneMmReportSt
> atusCodeLib.inf
> in= dex 72496bfababd..11ecc67fc4fa 100644
> ---
> a/MdeModulePkg/Li= brary/SmmReportStatusCodeLib/SmmReportStatusCod
> eLib.inf
> ++= +
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReport<= br>> Stat
> +++ usCodeLib.inf
> @@ -12,13 +12,12 @@
> =
>  [Defines]
>    INF_VERSION  &= nbsp;           &nbs= p;     =3D 0x00010005
> -  BASE_NAME &n= bsp;            = ;        =3D SmmReportStatusCodeLib
&= gt; -  MODULE_UNI_FILE        =         =3D SmmReportStatusCodeLib.uni> -  FILE_GUID        &nb= sp;            = =3D 67089D19-B3D6-4d9e-A0EB-FEDC1F83A1EE
> -  MODULE_TYPE =             &nb= sp;      =3D DXE_SMM_DRIVER
> +  BASE_N= AME            =           =3D StandaloneMmRepo= rtStatusCodeLib
> +  FILE_GUID     &nbs= p;            &= nbsp;   =3D 17C7FC8C-8C5D-497E-9C0E-C21255B30E04
> +  = MODULE_TYPE          &nbs= p;         =3D MM_STANDALONE
>= ;    VERSION_STRING       = ;          =3D 1.0
> -&n= bsp; PI_SPECIFICATION_VERSION       =3D 0x000= 1000A
> -  LIBRARY_CLASS      &nbs= p;           =3D ReportSt= atusCodeLib|DXE_SMM_DRIVER
> SMM_CORE
> +  PI_SPECIFICATIO= N_VERSION       =3D 0x00010032
> + = ; LIBRARY_CLASS          =         =3D ReportStatusCodeLib|MM_STAND= ALONE
>
>  #
>  # The following information is= for reference only and not required by the
> build tools.
> @@= -28,6 +27,8 @@ [Defines]
>
>  [Sources]
> &nb= sp;  ReportStatusCodeLib.c
> +  ReportStatusCodeLib.h
&g= t; +  ReportStatusCodeLibStandaloneMm.c
>
>  [Packag= es]
>    MdePkg/MdePkg.dec
> @@ -36,7 +37,7 @@ [= Packages]
>  [LibraryClasses]
>    PcdLib>    BaseMemoryLib
> -  SmmServicesTableLib<= br>> +  MmServicesTableLib
>    DebugLib
&g= t;    MemoryAllocationLib
>
> @@ -45,7 +46,7 @@= [Guids]
>    gEfiStatusCodeDataTypeDebugGuid &nb= sp;            = ## SOMETIMES_CONSUMES
> ## UNDEFINED
>
>  [Protoco= ls]
> -  gEfiSmmStatusCodeProtocolGuid    &n= bsp;            ## C= ONSUMES
> +  gEfiMmStatusCodeProtocolGuid    = ;            &n= bsp; ## CONSUMES
>
>  [Pcd]
>    gEf= iMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask  ##
> CONS= UMES diff --git a/MdeModulePkg/MdeModulePkg.dsc
> b/MdeModulePkg/MdeM= odulePkg.dsc index cd91a70b4fdd..05bf5fe08094
> 100644
> --- a/= MdeModulePkg/MdeModulePkg.dsc
> +++ b/MdeModulePkg/MdeModulePkg.dsc> @@ -473,6 +473,7 @@ [Components.IA32, Components.X64]
> &= nbsp;  }
>
> MdeModulePkg/Universal/Variable/RuntimeDxe/V= ariableSmmRuntimeDxe.i
> nf
>
> MdeModulePkg/Library/Smm= ReportStatusCodeLib/SmmReportStatusCodeLi
> b.inf
> +
> +=
> MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportSt> atusCo
> + deLib.inf
>
> MdeModulePkg/Universal/S= tatusCodeHandler/Smm/StatusCodeHandlerSm
> m.inf
>
> Mde= ModulePkg/Universal/ReportStatusCodeRouter/Smm/ReportStatusCod
> eRou= terSmm.inf
>    MdeModulePkg/Universal/LockBox/SmmLock= Box/SmmLockBox.inf
> --
> 2.28.0.windows.1
>
> >
>
>



 

------=_NextPart_000_00F8_01D6D9DA.A1F78720--