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.6300.1609205042508932199 for ; Mon, 28 Dec 2020 17:24:04 -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 ; Tue, 29 Dec 2020 09:23:58 +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> , ,<00f701d6d997$93d1af10$bb750d30$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDA2LzE1XSBNZGVNb2R1bGVQa2c6IFNtbVJlcG9ydFN0YXR1c0NvZGVMaWI6IFJlcG9ydFN0YXR1c0NvZGVMaWIgaW4gU3RhbmRhbG9uZU1t?= Date: Tue, 29 Dec 2020 09:23:58 +0800 Message-ID: <000e01d6dd81$48bca2d0$da35e870$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFg3yxaHQ8fwUPni7u8T6g29nhsgQGclWVHAhrFEiYBzp27fwGJIek/AVK2K18CFCWVwaqlkfEg Content-Type: multipart/alternative; boundary="----=_NextPart_000_000F_01D6DDC4.56E38C50" Content-language: zh-cn ------=_NextPart_000_000F_01D6DDC4.56E38C50 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Kun: I prefer to include StatusCodeHandlerSmm with the basic check. If so, the complete statuscode solution can be provided.=20 =20 Thanks Liming =B7=A2=BC=FE=C8=CB: bounce+27952+69443+4905953+8761045@groups.io =B4=FA=B1=ED Kun Qin =B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA12=D4=C224=C8=D5 17:12 =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; gaoliming@byosoft.com.cn; hao.a.= wu@intel.com; '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 Liming, =20 I have not had a plan for StatusCodeHandlerSmm because our platforms are n= ot using it currently (we used a MU version instead). So it would be difficul= t to fully validate the functionality after updates. Please let me know if y= ou prefer to have this driver updated in this patch series, I can try to upda= te it locally with some fundamental sanity checks. =20 Regards, Kun =20 From: gaoliming =20 Sent: Wednesday, December 23, 2020 17:53 To: devel@edk2.groups.io ; hao.a.wu@intel.co= m ; kun.q@outlook.com = ; 'Yao, Jiewen' =20 Cc: 'Wang, Jian J' ; 'Bi, Dandan' =20 Subject: =BB=D8=B8=B4: [edk2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm =20 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, H= ao 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 =20 ------=_NextPart_000_000F_01D6DDC4.56E38C50 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
Kun:

 I prefer t= o include StatusCodeHandlerSmm with the basic che= ck. If so, the complete statuscode solution can be provided. =

 

Th= anks

Liming

= = =B7=A2=BC=FE=C8=CB: bounce+27952+69443+4905953+8761045@gro= ups.io <bounce+27952+69443+4905953+8761045@groups.io> =B4=FA=B1=ED Kun Qin
=B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA12=D4=C224=C8=D5 17:12
=CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; gaoliming@byosoft.com.cn; hao.a.wu@intel.com; 'Yao,= Jiewen' <jiewen.yao@intel.com>
=B3=AD=CB=CD: 'Wang, Jian J' <jian.j.wang@in= tel.com>; 'Bi, Dandan' <dandan.bi@intel.com>
=D6=F7= =CC=E2: Re: [edk2-devel] = [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib = in StandaloneMm

 

Liming,

 

I have not had a plan for StatusCodeHandlerSmm because our platforms are= not using it currently (we used a MU version instead). So it would be diff= icult to fully validate the functionality after updates. Please let me know= if you prefer to have this driver updated in this patch series, I can try = to update it locally with some fundamental sanity checks.=

 

Regards,

Kun

 

From: gaoliming
Sent: Wednesday, D= ecember 23, 2020 17:53
To: devel@edk2.groups.io; hao.a.wu@= intel.com; kun.q@outlook.com; = 'Yao, Jiewen'
Cc: 'Wang, Jian J'; 'Bi, Dandan'
Subject:
=BB=D8=B8=B4: [edk= 2-devel] [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatu= sCodeLib in StandaloneMm

 

Kun:

 I am OK for t= his solution. Have you plan to update StatusCodeHandlerSmm?

 

Thanks

Liming

=B7=A2=BC=FE=C8=CB: bounce+27952+69397+4905= 953+8761045@groups.io <bounce+27952+69397+4905953+8761045@groups.io> =B4=FA=B1=ED Wu, Hao A
<= span style=3D'font-family:=B5=C8=CF=DF'>=B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA12=D4=C223=C8=D5 14:10
=CA=D5=BC=FE=C8=CB:<= span lang=3DEN-US> devel@edk2.group= s.io; kun.q@outlook.com; Limin= g 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 <dandan.bi@intel.com>
=D6=F7=CC=E2: Re: [edk2-devel] [PATCH v1 06= /15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in Standalon= eMm

 

Hello Kun,

 

<= span lang=3DEN-US>Got it, thanks for the explanation. My preference is the = same with your current proposal in the patch.

 

 

= Hello Liming and Jiewen,

 

Do you have comments for this case? Thanks in adv= ance.

 

Best Regar= ds,

Hao Wu

 =

F= rom: = devel@edk2.groups.io <devel@= edk2.groups.io> On Behalf Of Kun Qin
Sent: Wednesda= y, December 23, 2020 3:15 AM
To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Bi, Danda= n <dandan.bi@intel.com>; L= iming Gao <gaoliming@byosoft= .com.cn>; Yao, Jiewen <ji= ewen.yao@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 06= /15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in Standalon= eMm

 

Hi Ha= o,

 =

That was my origin= al plan, but doing it might require a MmServiceTableLib instance for SMM_CO= RE type if PiSmmCore links in RSC lib (similar to PiSmmCoreSmmServicesTable= Lib). 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 do= es not look clean. Thus I just abstract the routine to avoid it.=

 =

Please let me know if you have = better ideas, I can add the change for next patch series.=

 

Thanks,

Kun

 

From: Wu, Hao A
Sent: Tuesday, December = 22, 2020 00:35
To: devel@= edk2.groups.io; kun.q@outlook.com<= /a>
Cc:
Wang, Jian J= ; Bi, Dandan; Liming Gao; Yao, Jiewen
Subject: Re: [edk2-devel] [PATCH v1 06/15]= MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm<= o:p>

 

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kun Qin
&= gt; Sent: Saturday, December 19, 2020 2:50 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J &l= t;jian.j.wang@intel.com>; W= u, Hao A <hao.a.wu@intel.com&g= t;;
> Bi, Dandan <dandan.bi= @intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
> Subject: [edk2-devel] [PATCH v= 1 06/15] MdeModulePkg:
> SmmReportStatusCodeLib: ReportStatusCodeLib = in StandaloneMm
>
> This change added support of StandaloneMm = for ReportStatusCodeLib. It
> adds a new instance of ReportStatusCode= Lib for MM_STANDALONE type,
> and abstracts the references of gMmst a= nd gSmst functionalities into
> separate files in order to link in pr= oper 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 imp= lementations for internal function InternalLocateProtocol()?

Since I= found that the definitions for gEfiMmStatusCodeProtocolGuid an gEfiSmmStat= usCodeProtocolGuid are identical.

Best Regards,
Hao Wu

>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc:= Liming Gao <gaoliming@byoso= ft.com.cn>
>
> Signed-off-by: Kun Qin <kun.q@outlook.com>
> ---
> = MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c
> = | 16 ++++----
>
> MdeModulePkg/Library/SmmReportStatusCodeLib/= ReportStatusCodeLibSta
> ndaloneMm.c     &nb= sp;            =             &nb= sp;    | 39 ++++++++++++++++++++
>
> MdeModuleP= kg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibTra
> ditional.c=             &nb= sp;            =            | 39 +++++++++= +++++++++++
>  MdeModulePkg/Library/SmmReportStatusCodeLib/Repor= tStatusCodeLib.h
> | 37 +++++++++++++++++++
>
> MdeModul= ePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLi
> b.inf&nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;   |  4 +-
>
> MdeModulePkg/Library/SmmRep= ortStatusCodeLib/{SmmReportStatusCode
> Lib.inf =3D> StandaloneMmR= eportStatusCodeLib.inf} | 17 +++++----
>  MdeModulePkg/MdeModule= Pkg.dsc
> |  1 +
>  7 files changed, 137 insertions(+= ), 16 deletions(-)
>
> diff --git
> a/MdeModulePkg/Libra= ry/SmmReportStatusCodeLib/ReportStatusCodeLib.c
> b/MdeModulePkg/Libr= ary/SmmReportStatusCodeLib/ReportStatusCodeLib.
> c
> index 3a1= 772538cdf..fb1769db9223 100644
> ---
> a/MdeModulePkg/Library/S= mmReportStatusCodeLib/ReportStatusCodeLib.c
> +++
> b/MdeModule= Pkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.
> c
> @= @ -1,5 +1,5 @@
>  /** @file
> -  Report Status Code L= ibrary for SMM Phase.
> +  Report Status Code Library for MM Pha= se.
>
>    Copyright (c) 2009 - 2018, Intel Cor= poration. All rights reserved.<BR>
>    SPDX-Lic= ense-Identifier: BSD-2-Clause-Patent @@ -8,7 +8,7 @@
>
> = #include <Library/ReportStatusCodeLib.h>  #include <Library/= DebugLib.h> -
> #include <Library/SmmServicesTableLib.h>
= > +#include <Library/MmServicesTableLib.h>
>  #include = <Library/BaseLib.h>
>  #include <Library/BaseMemoryLib.= h>
>  #include <Library/PcdLib.h>
> @@ -16,10 +16= ,12 @@
>
>  #include <Guid/StatusCodeDataTypeId.h><= br>>  #include <Guid/StatusCodeDataTypeDebug.h> -#include
= > <Protocol/SmmStatusCode.h>
> +#include <Protocol/MmStat= usCode.h>
>
> -EFI_SMM_REPORT_STATUS_CODE   =   mReportStatusCode =3D NULL;
> -EFI_SMM_STATUS_CODE_PROTOCOL&nb= sp;  *mStatusCodeProtocol =3D NULL;
> +#include "ReportStat= usCodeLib.h"
> +
> +EFI_MM_REPORT_STATUS_CODE  &= nbsp;  mReportStatusCode =3D NULL;
> +EFI_MM_STATUS_CODE_PROTOCO= L   *mStatusCodeProtocol =3D NULL;
>
>
> = ; /**
> @@ -29,14 +31,14 @@ EFI_SMM_STATUS_CODE_PROTOCOL
> *mSt= atusCodeProtocol =3D NULL;
>       = ;       NULL is returned if no status code se= rvice is available.
>
>  **/
> -EFI_SMM_REPORT_STAT= US_CODE
> +EFI_MM_REPORT_STATUS_CODE
>  InternalGetReportS= tatusCode (
>    VOID
>    )
&= gt;  {
>    EFI_STATUS    &nb= sp;            =    Status;
>
> -  Status =3D gSmst->SmmLocat= eProtocol (&gEfiSmmStatusCodeProtocolGuid,
> NULL, (VOID**)&m= StatusCodeProtocol);
> +  Status =3D InternalLocateProtocol (&am= p;gEfiMmStatusCodeProtocolGuid, NULL,
> + (VOID**)&mStatusCodePro= tocol);
>    if (!EFI_ERROR (Status) && mStatu= sCodeProtocol !=3D NULL) {
>      return mSt= atusCodeProtocol->ReportStatusCode;
>    }
> = diff --git
> a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStat= usCodeLibS
> tandaloneMm.c
> b/MdeModulePkg/Library/SmmReportSt= atusCodeLib/ReportStatusCodeLibS
> tandaloneMm.c
> new file mod= e 100644
> index 000000000000..fc47dffe9ffb
> --- /dev/null
= > +++
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatus= CodeLibS
> 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 <PiMm.h>
> +<= br>> +#include <Library/MmServicesTableLib.h>
> +
> +/= **
> +  Returns the first protocol instance that matches the giv= en protocol.
> +
> +  @param[in]  Protocol  = ;        Provides the protocol to search= for.
> +  @param[in]  Registration    =   Optional registration key returned from
> +   &= nbsp;           &nbs= p;            &= nbsp;   RegisterProtocolNotify().
> +  @param[out]&nbs= p; Interface        On return, a pointer= to the first interface that
> matches Protocol and
> + &n= bsp;            = ;            &n= bsp;     Registration.
> +
> +  @retva= l EFI_SUCCESS           A= protocol instance matching Protocol was
> found and returned in
&= gt; +           &nbs= p;            &= nbsp;       Interface.
> +  @retva= l EFI_NOT_FOUND         No protocol= instances were found that
> match Protocol and
> +  =             &nb= sp;            =      Registration.
> +  @retval EFI_INVALID_= PARAMETER Interface is NULL.
> +      &= nbsp;           &nbs= p;             = Protocol is NULL.
> +
> +**/
> +EFI_STATUS
> +EFIAP= I
> +InternalLocateProtocol (
> +  IN  EFI_GUID = *Protocol,
> +  IN  VOID      *Re= gistration, OPTIONAL
> +  OUT VOID     = **Interface
> +  )
> +{
> +  return gMmst->= MmLocateProtocol (Protocol, Registration, Interface); }
> diff --git<= br>> a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibT<= br>> raditional.c
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/= ReportStatusCodeLibT
> raditional.c
> new file mode 100644
&= gt; index 000000000000..6b3a7c6051c5
> --- /dev/null
> +++
&= gt; b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibT
&= gt; ra
> +++ ditional.c
> @@ -0,0 +1,39 @@
> +/** @file> +  Abstraction layer for SMM service table used by SMM
> = ReportStatusCodeLib.
> +
> +  Copyright (c) Microsoft Corp= oration.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
&g= t; +
> +**/
> +
> +#include <PiMm.h>
> +
&= gt; +#include <Library/SmmServicesTableLib.h>
> +
> +/**<= br>> +  Returns the first protocol instance that matches the given = protocol.
> +
> +  @param[in]  Protocol  &n= bsp;       Provides the protocol to search fo= r.
> +  @param[in]  Registration    &nb= sp; Optional registration key returned from
> +   &nbs= p;            &= nbsp;           &nbs= p;   RegisterProtocolNotify().
> +  @param[out]  = Interface        On return, a pointer to= the first interface that
> matches Protocol and
> +  = ;            &n= bsp;            = ;     Registration.
> +
> +  @retval E= FI_SUCCESS           A pr= otocol instance matching Protocol was
> found and returned in
>= +            &= nbsp;           &nbs= p;       Interface.
> +  @retval E= FI_NOT_FOUND         No protocol in= stances were found that
> match Protocol and
> +  &nb= sp;            =             &nb= sp;    Registration.
> +  @retval EFI_INVALID_PAR= AMETER Interface is NULL.
> +      &nbs= p;            &= nbsp;            Pro= tocol is NULL.
> +
> +**/
> +EFI_STATUS
> +EFIAPI> +InternalLocateProtocol (
> +  IN  EFI_GUID  *P= rotocol,
> +  IN  VOID      *Regis= tration, OPTIONAL
> +  OUT VOID      **= Interface
> +  )
> +{
> +  return gSmst->Smm= LocateProtocol (Protocol, Registration, Interface);
> +}
> diff= --git
> a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCo= deLib.
> h
> b/MdeModulePkg/Library/SmmReportStatusCodeLib/Repo= rtStatusCodeLib.
> h
> new file mode 100644
> index 00000= 0000000..9a16741e64f6
> --- /dev/null
> +++
> b/MdeModule= Pkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.
> h
> @= @ -0,0 +1,37 @@
> +/** @file
> +  Report Status Code Libra= ry 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_
> +#define _MM_RSC_LIB_H_
> +> +/**
> +  Returns the first protocol instance that matches= the given protocol.
> +
> +  @param[in]  Protocol&nb= sp;         Provides the protocol t= o search for.
> +  @param[in]  Registration  &nbs= p;   Optional registration key returned from
> +  = ;            &n= bsp;            = ;     RegisterProtocolNotify().
> +  @param[= out]  Interface        On return, a= pointer to the first interface that
> matches Protocol and
> +=             &nb= sp;            =        Registration.
> +
> + = ; @retval EFI_SUCCESS         =   A protocol instance matching Protocol was
> found and returned= in
> +          &n= bsp;            = ;         Interface.
> + = ; @retval EFI_NOT_FOUND         No = protocol instances were found that
> match Protocol and
> +&nbs= p;            &= nbsp;           &nbs= p;      Registration.
> +  @retval EFI_= INVALID_PARAMETER Interface is NULL.
> +     = ;            &n= bsp;            = ;  Protocol is NULL.
> +
> +**/
> +EFI_STATUS
>= ; +EFIAPI
> +InternalLocateProtocol (
> +  IN  EFI_GU= ID  *Protocol,
> +  IN  VOID    &n= bsp; *Registration, OPTIONAL
> +  OUT VOID   &nbs= p;  **Interface
> +  );
> +
> +#endif // _MM_RS= C_LIB_H_
> diff --git
> a/MdeModulePkg/Library/SmmReportStatusC= odeLib/SmmReportStatusCod
> eLib.inf
> b/MdeModulePkg/Library/S= mmReportStatusCodeLib/SmmReportStatusCod
> eLib.inf
> index 724= 96bfababd..02dce09a199d 100644
> ---
> a/MdeModulePkg/Library/S= mmReportStatusCodeLib/SmmReportStatusCod
> eLib.inf
> +++
&g= t; b/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCod
>= eLib
> +++ .inf
> @@ -28,6 +28,8 @@ [Defines]
>
>=   [Sources]
>    ReportStatusCodeLib.c
> +&= nbsp; ReportStatusCodeLib.h
> +  ReportStatusCodeLibTraditional.= c
>
>  [Packages]
>    MdePkg/MdePkg= .dec
> @@ -45,7 +47,7 @@ [Guids]
>    gEfiStatus= CodeDataTypeDebugGuid         =       ## SOMETIMES_CONSUMES
> ## UNDEFINED>
>  [Protocols]
> -  gEfiSmmStatusCodeProtocol= Guid            = ;     ## CONSUMES
> +  gEfiMmStatusCodeProto= colGuid           &n= bsp;      ## CONSUMES
>
>  [Pcd]=
>    gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodeProp= ertyMask  ##
> CONSUMES diff --git
> a/MdeModulePkg/Librar= y/SmmReportStatusCodeLib/SmmReportStatusCod
> eLib.inf
> b/MdeM= odulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReport
> StatusCo= deLib.inf
> similarity index 64%
> copy from
> MdeModuleP= kg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLi
> b.inf
&g= t; copy to
> MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMm= ReportSt
> atusCodeLib.inf
> index 72496bfababd..11ecc67fc4fa 1= 00644
> ---
> a/MdeModulePkg/Library/SmmReportStatusCodeLib/Smm= ReportStatusCod
> eLib.inf
> +++
> b/MdeModulePkg/Library= /SmmReportStatusCodeLib/StandaloneMmReport
> Stat
> +++ usCodeL= ib.inf
> @@ -12,13 +12,12 @@
>
>  [Defines]
>=     INF_VERSION       &nb= sp;            =3D 0= x00010005
> -  BASE_NAME      &nbs= p;            &= nbsp;  =3D SmmReportStatusCodeLib
> -  MODULE_UNI_FILE = ;            &n= bsp;  =3D SmmReportStatusCodeLib.uni
> -  FILE_GUID &n= bsp;            = ;        =3D 67089D19-B3D6-4d9e-A0EB-FED= C1F83A1EE
> -  MODULE_TYPE      &n= bsp;            = ; =3D DXE_SMM_DRIVER
> +  BASE_NAME     = ;            &n= bsp;    =3D StandaloneMmReportStatusCodeLib
> +  = FILE_GUID           =            =3D 17C7FC8C-8= C5D-497E-9C0E-C21255B30E04
> +  MODULE_TYPE   &nb= sp;            =     =3D MM_STANDALONE
>    VERSION_STRI= NG            &= nbsp;    =3D 1.0
> -  PI_SPECIFICATION_VERSION&nb= sp;      =3D 0x0001000A
> -  LIBRARY_CL= ASS            =       =3D ReportStatusCodeLib|DXE_SMM_DRIVER
&g= t; SMM_CORE
> +  PI_SPECIFICATION_VERSION    = ;   =3D 0x00010032
> +  LIBRARY_CLASS   = ;            &n= bsp;  =3D ReportStatusCodeLib|MM_STANDALONE
>
>  #>  # The following information is for reference only and not requ= ired by the
> build tools.
> @@ -28,6 +27,8 @@ [Defines]
>= ;
>  [Sources]
>    ReportStatusCodeLib.c<= br>> +  ReportStatusCodeLib.h
> +  ReportStatusCodeLibSt= andaloneMm.c
>
>  [Packages]
>    Md= ePkg/MdePkg.dec
> @@ -36,7 +37,7 @@ [Packages]
>  [Library= Classes]
>    PcdLib
>    BaseMem= oryLib
> -  SmmServicesTableLib
> +  MmServicesTableL= ib
>    DebugLib
>    MemoryAlloc= ationLib
>
> @@ -45,7 +46,7 @@ [Guids]
>  &nbs= p; gEfiStatusCodeDataTypeDebugGuid       = ;        ## SOMETIMES_CONSUMES
> #= # UNDEFINED
>
>  [Protocols]
> -  gEfiSmmStatu= sCodeProtocolGuid         &nbs= p;       ## CONSUMES
> +  gEfiMmSt= atusCodeProtocolGuid         &= nbsp;        ## CONSUMES
>
>= ;  [Pcd]
>    gEfiMdePkgTokenSpaceGuid.PcdReportS= tatusCodePropertyMask  ##
> CONSUMES diff --git a/MdeModulePkg/M= deModulePkg.dsc
> b/MdeModulePkg/MdeModulePkg.dsc index cd91a70b4fdd.= .05bf5fe08094
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dsc> +++ b/MdeModulePkg/MdeModulePkg.dsc
> @@ -473,6 +473,7 @@ [Comp= onents.IA32, Components.X64]
>    }
>
> M= deModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.i
> n= f
>
> MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportSta= tusCodeLi
> b.inf
> +
> +
> MdeModulePkg/Library/Sm= mReportStatusCodeLib/StandaloneMmReportSt
> atusCo
> + deLib.in= f
>
> MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeH= andlerSm
> m.inf
>
> MdeModulePkg/Universal/ReportStatus= CodeRouter/Smm/ReportStatusCod
> eRouterSmm.inf
>  &n= bsp; MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
> --> 2.28.0.windows.1
>
>
>
>
>

=

 = ;

&n= bsp;

------=_NextPart_000_000F_01D6DDC4.56E38C50--