From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web12.1602.1593123976241377983 for ; Thu, 25 Jun 2020 15:26:16 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0445bc115a=brian.johnson@hpe.com) Received: from pps.filterd (m0134425.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05PMKfnD013766; Thu, 25 Jun 2020 22:26:13 GMT Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com with ESMTP id 31w2aa8uut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jun 2020 22:26:13 +0000 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2354.austin.hpe.com (Postfix) with ESMTP id 8731B83; Thu, 25 Jun 2020 22:26:12 +0000 (UTC) Received: from [16.214.35.118] (unknown [16.214.35.118]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 97D203F; Thu, 25 Jun 2020 22:26:08 +0000 (UTC) Subject: Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules To: "Dong, Eric" , "Bi, Dandan" , Andrew Fish , edk2-devel-groups-io Cc: "rfc@edk2.groups.io" , "Ni, Ray" , "Wang, Jian J" , "Wu, Hao A" , "Tan, Ming" , Laszlo Ersek References: <17a085f3-424b-ad6f-b1c1-5dc6834c4e4a@hpe.com> From: "Brian J. Johnson" Message-ID: Date: Thu, 25 Jun 2020 17:26:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 In-Reply-To: X-Proofpoint-UnRewURL: 14 URL's were un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-25_19:2020-06-25,2020-06-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 spamscore=0 cotscore=-2147483648 phishscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006250131 Content-Type: multipart/alternative; boundary="------------A859E71DE02D536486D0126F" Content-Language: en-US --------------A859E71DE02D536486D0126F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Thanks for the link.=C2=A0 I agree that this change will make the=20 StatusCodeHandler driver more modular, and is a step in the right directio= n. But I think it could go further, with almost no additional work, and=20 simplify the overall Status Code mechanism, not just the=20 StatusCodeHandler driver.=C2=A0 Currently, the StatusCodeHandler driver en= try=20 routines run some initialization code, register callbacks (eg. for=20 ExitBootServices and SetVirtualAddressMap), and call the RscHandler=20 PPI/Protocol to register the worker routines.=C2=A0 If I'm understanding t= he=20 proposal correctly, all that code will be moved to the individual NULL=20 libraries, since any particular library may or may not need any of it.=C2= =A0=20 Then the StatusCodeHandler modules will be left with no code of their=20 own at all:=C2=A0 they will only be wrappers for the NULL libraries. Their= = =20 entry routines will do nothing except return EFI_SUCCESS! (1) It seems strange and wasteful to keep around empty modules like this.=C2= =A0=20 So I'm suggesting adding the NULL libraries to the StatusCodeRouter=20 modules instead.=C2=A0 They would need to export the protocol/PPI routines= to=20 the NULL libraries via a header file, so they could call them directly=20 instead of looking up the protocol/PPI.=C2=A0 But that's a minor change.= =C2=A0=20 Then you could remove the empty StatusCodeHandler modules entirely.=C2=A0 = The=20 advantage would be that there would be fewer modules in the build,=20 simplifying the .dsc and .fdf files slightly.=C2=A0 It would also reduce c= ode=20 size a bit by sharing common library routines, such as BaseLib, with the= =20 StatusCodeRouter modules. If those don't seem like worthwhile advantages, that's OK with me.=C2=A0 I= = =20 don't want to belabor the point, or impede progress.=C2=A0 If others are O= K=20 with the proposal as it stands, then I am too. Thanks, *Brian J. Johnson *Enterprise X86 Lab Hewlett Packard Enterprise (1) The StatusCodeHandlerRuntimeDxe driver also handles=20 PcdStatusCodeReplayIn as part of its entry code.=C2=A0 That code would=20 probably have to stay in a separate module rather than being linked to=20 StatusCodeRouter as a NULL library.=C2=A0 That way it could be dispatched= =20 after the ReportStatusCode protocol is available. ------------------------------------------------------------------------ *From:* Dong, Eric [mailto:eric.dong@intel.com] *Sent:* Thursday, June 25, 2020, 10:41 AM *To:* Brian J. Johnson , Bi, Dandan=20 , Andrew Fish ,=20 edk2-devel-groups-io *Cc:* rfc@edk2.groups.io , Ni, Ray=20 , Wang, Jian J , Wu, Hao A=20 , Tan, Ming , Laszlo Ersek=20 *Subject:* [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler:=20 Separate NULL class libraries for Memory and serial handlers from=20 MdeModulePkg/Universal/StatusCodeHandler modules > Hi Brian, > > In this new design, we still use register status code handler=20 > Protocol/Ppi to register the handler logic. We just want to change the= =20 > StatusCodeHandler driver. We try to split the register logic to NULL=20 > library to make the code more modularity. We already created sample=20 > library in Edk2-Platforms repo=20 > https://github.com/tianocore/edk2-platforms/tree/master/Features/Intel/D= ebugging/PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib.=20 > You can check this code to understand more about what we want to do. > > Thanks, > > Eric > > *From:* Brian J. Johnson > *Sent:* Thursday, June 25, 2020 4:25 AM > *To:* Bi, Dandan ; Andrew Fish ;= =20 > edk2-devel-groups-io > *Cc:* rfc@edk2.groups.io; Dong, Eric ; Ni, Ray=20 > ; Wang, Jian J ; Wu, Hao A=20 > ; Tan, Ming ; Laszlo Ersek=20 > > *Subject:* Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler:= =20 > Separate NULL class libraries for Memory and serial handlers from=20 > MdeModulePkg/Universal/StatusCodeHandler modules > > Dandan, > > The Status Code Protocol/PPI is the high-level interface which is=20 > being implemented.=C2=A0 The ReportStatusCodeRouter module implements th= is=20 > in terms of the ReportStatusCodeHandler Protocol/PPI.=C2=A0 That allows= =20 > multiple ReportStatusCodeHandler modules to be used at once, so they=20 > can each react to different types of status codes, or report them=20 > through multiple channels.=C2=A0 That sort of multiplexing seems like a= =20 > useful feature. > > Now we're considering adding a mechanism which allows registering=20 > status code handlers via NULL libraries, rather than via the=20 > protocol/PPI. That sounds like exactly what ReportStatusCodeRouter is=20 > intended for.=C2=A0 It wouldn't really change its scope, it would just m= ake=20 > it more flexible.=C2=A0 Adding this feature via a StatusCodeHandler modu= le=20 > wouldn't improve modularity, it would just add complexity.=C2=A0 As an O= EM,=20 > adding a custom handler would look the same to me either way:=C2=A0 I wo= uld=20 > have to add the NULL class library to a MdeModulePkg driver's entry in= =20 > my .dsc file.=C2=A0 It doesn't matter to me whether it's the=20 > ReportStatusCodeRouter or StatusCodeHandler module.=C2=A0 And if I can d= o=20 > it in ReportStatusCodeRouter, then I don't need to include any=20 > StatusCodeHandler modules in the build at all.=C2=A0 That saves code spa= ce=20 > and reduces the number of modules in the APRIORI list, which are both=20 > good things. > > ReportStatusCodeRouterPei already has to track registered handlers in=20 > PEI when running from ROM (it uses a HOB.)=C2=A0 Tracking handlers from= =20 > NULL libraries wouldn't be any harder.=C2=A0 In fact, it looks like it= =20 > could just export the Register() function to the NULL libraries, and=20 > they could call it in their constructors. > > I think using NULL libraries for status code handlers is a great=20 > idea.=C2=A0 I'd just like to take that opportunity to reduce the complex= ity=20 > of the overall status code stack while we're at it. > > Thanks, > > *Brian J. Johnson > *Enterprise X86 Lab > > Hewlett Packard Enterprise > > ------------------------------------------------------------------------ > > *From:* Bi, Dandan [mailto:dandan.bi@intel.com] > > *Sent:* Monday, June 22, 2020, 2:27 AM > > *To:* Andrew Fish ,=20 > edk2-devel-groups-io =20 > , brian.johnson@hpe.com=20 > =20 > > > *Cc:* rfc@edk2.groups.io =20 > , Dong, Eric=20 > , Ni, Ray=20 > , Wang, Jian J=20 > , Wu, Hao A=20 > , Tan, Ming=20 > , Laszlo Ersek=20 > , Bi, Dandan=20 > > > *Subject:* [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler:=20 > Separate NULL class libraries for Memory and serial handlers from=20 > MdeModulePkg/Universal/StatusCodeHandler modules > > Hi Brian, > > Personally, I prefer to add the NULL class Library to > StatusCodeHandler modules. > > 1. I think we should make the functionality of each module clear > and separated. It may also be why we added > ReportStatusCodeRouter and StatusCodeHandler modules in edk2 > repo before. > > ReportStatusCodeRouter modules are responsible for producing > Status Code Protocol/PPI and Report Status Code Handler > Protocol/PPI, and StatusCodeHandler modules are responsible for > producing handlers (Handlers can be provided by NULL class > Libraries in this RFC). > > =C2=A0So, that=E2=80=99s why I don=E2=80=99t want to add the NULL cl= ass Library to > ReportStatusCodeRouter modules directly, which change the > functionality scope of existing modules. > > 2. I agree that we have a lot of layers of indirection now, but > what we may gain is the good modularity. And you also > mentioned that one or more StatusCodeHandler Modules may be > used. We also want to achieve that only the StatusCodeHandler > modules in MdeModulePkg can be used after this separation, > platform can only add its own handler Libs to meet its > requirement. > > 3. As Andrew mentioned below, if add the libraries to > ReportStatusCodeRouter, there will be some issue we need to > fix, which seems also make the code logic a little tricky to me. > > Thanks, > > Dandan > > *From:* Andrew Fish > *Sent:* Saturday, June 20, 2020 2:04 AM > *To:* edk2-devel-groups-io > ; brian.johnson@hpe.com > > *Cc:* Bi, Dandan > ; rfc@edk2.groups.io > ; Dong, Eric > ; Ni, Ray > ; Wang, Jian J > ; Wu, Hao A > ; Tan, Ming > > *Subject:* Re: [edk2-devel] [edk2-rfc] > MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for > Memory and serial handlers from > MdeModulePkg/Universal/StatusCodeHandler modules > > > > > On Jun 19, 2020, at 10:29 AM, Brian J. Johnson > wrote: > > On 6/18/20 2:01 AM, Dandan Bi wrote: > > Hi All, > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2816 > > > We plan to separate two kinds of NULL class libraries for > Memory and serial handlers > from*MdeModulePkg/Universal/StatusCodeHandler/=E2=80=A6/ > StatusCodeHandlerPei/RuntimeDxe/Smm*modules. > > The benefit we want to gain from this separation is to 1) > make the code clear and easy to maintain, 2) make platform > flexible to choose any handler library they need, and it > also can reduce image size since the unused handlers can > be excluded. > > If you have any concern or comments for this separation, > please let me know. > > We plan to add new separated NULL class > library*MemoryStausCodeHandlerLib*and***SerialStatusCodeHand= lerLib*with > different phase implementation > into*MdeModulePkg\Library\*directory. > > The main tree structure may like below: > > MdeModulePkg\Library > > |------*MemoryStausCodeHandlerLib* > > |------|------ PeiMemoryStausCodeHandlerLib.inf > > |------|------ RuntimeDxeMemoryStatusCodeHandlerLib.inf > > |------|------ SmmMemoryStausCodeHandlerLib.inf > > |------*SerialStatusCodeHandlerLib* > > |------|------ PeiSerialStatusCodeHandlerLib.inf > > |------|------ RuntimeDxeSerialStatusCodeHandlerLib.inf > > |------|------ SmmSerialStatusCodeHandlerLib.inf > > ** > > ** > > We will update existing platform use cases in edk2 and > edk2-platform repo to cover the new NULL class library to > make sure this change doesn=E2=80=99t impact any platform. > > After this separation, StatusCodeHandler module usage will > like below, and it=E2=80=99s also very flexible for platform= to > cover more handler libraries to meet their requirements. > > MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandl= erPei.inf > { > > > > NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/PeiMemor= yStausCodeHandlerLib.inf > > NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/PeiSeri= alStatusCodeHandlerLib.inf > > =E2=80=A6 > > } > > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCo= deHandlerRuntimeDxe.inf > { > > > > NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/RuntimeD= xeMemoryStausCodeHandlerLib.inf > > NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/Runtime= DxeSerialStatusCodeHandlerLib.inf > > =E2=80=A6 > > } > > MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandl= erSmm.inf > { > > > > =C2=A0NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/Sm= mMemoryStausCodeHandlerLib.inf > > NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/SmmSeri= alStatusCodeHandlerLib.inf > > =E2=80=A6 > > } > > Thanks, > > Dandan > > Dandan, > > We'll have a lot of layers of indirection....=C2=A0 The > ReportStatusCodeRouter modules will call one or more > StatusCodeHandlerModules, and the standard StatusCodeHandler > modules will call multiple StatusCodeHandlerLib libraries. > > How about adding StatusCodeHandlerLib support directly to the > ReportStatusCodeRouter modules? Then platforms could omit the > StatusCodeHandler modules if they're only using the > open-source code.=C2=A0 That sounds like less overhead since few= er > modules would be needed. > > I think the need to execute from ROM makes this tricky. > > It looks to me that it is easy to move from PCD to libs for the > StatusCodeHandler since registration is basically > `RscHandlerPpi->Register (SerialStatusCodeReportWorker);`. The > issue I see is the ReportStatusCodeRouter publishes=C2=A0RscHandlerP= pi > after the PEIMs constructor has been called and if the PEIM. Given > globals don=E2=80=99t work when running from ROM you would have to d= o > something like publish a HOB in the library constructor and then > have the=C2=A0GenericStatusCodePeiEntry() walk the HOBs and install = the > handlers. So I guess it is a little easier than I 1st thought when > I started writing this mail, but it would require a new public API. > > Thanks, > > Andrew Fish > > > Thanks, > > -- > > *Brian J. Johnson > *Enterprise X86 Lab > > Hewlett Packard Enterprise > > *hpe.com* > > =20 > > - > --------------A859E71DE02D536486D0126F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Thanks for the link.=C2=A0 I agree that thi= s change will make the StatusCodeHandler driver more modular, and is a step in the right direction.

But I think it could go further, with almost no additional work, and simplify the overall Status Code mechanism, not just the StatusCodeHandler driver.=C2=A0 Currently, the StatusCodeHandl= er driver entry routines run some initialization code, register callbacks (eg. for ExitBootServices and SetVirtualAddressMap), and call the RscHandler PPI/Protocol to register the worker routines.=C2=A0 If I'm understanding the proposal correctly, all t= hat code will be moved to the individual NULL libraries, since any particular library may or may not need any of it.=C2=A0 Then the StatusCodeHandler modules will be left with no code of their own at all:=C2=A0 they will only be wrappers for the NULL libraries.= =C2=A0 Their entry routines will do nothing except return EFI_SUCCESS! (1)

It seems strange and wasteful to keep around empty modules like this.=C2=A0 So I'm suggesting adding the NULL libraries to th= e StatusCodeRouter modules instead.=C2=A0 They would need to export = the protocol/PPI routines to the NULL libraries via a header file, so they could call them directly instead of looking up the protocol/PPI.=C2=A0 But that's a minor change.=C2=A0 Then you coul= d remove the empty StatusCodeHandler modules entirely.=C2=A0 The advantage would be that there would be fewer modules in the build, simplifying the .dsc and .fdf files slightly.=C2=A0 It would also reduce code size a bit by sharing common library routines, such as BaseLib, with the StatusCodeRouter modules.

If those don't seem like worthwhile advantages, that's OK with me.=C2=A0 I don't want to belabor the point, or impede progress.=C2=A0 If others are OK with the proposal as it stands, t= hen I am too.

Thanks,

Brian J. Johnson
Enterprise X86 Lab

Hewlett Packard Enterprise


(1) The StatusCodeHandlerRuntimeDxe driver also handles PcdStatusCodeReplayIn as part of its entry code.=C2=A0 That code would probably have to stay in a separate module rather than being linked to StatusCodeRouter as a NULL library.=C2=A0 That way= it could be dispatched after the ReportStatusCode protocol is available.


From: Dong, Eric [mailto:eric.dong@intel.com]
Sent: Thursday, June 25, 2020, 10:41 AM
To: Brian J. Johnson <brian.johnson@hpe.com>, Bi, Dandan <dandan.bi@intel.com>, Andrew Fish <afish@apple.com>, edk2-devel-groups-io <devel@edk2.groups.io>
Subject: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

Hi Brian,

=C2=A0

In this new design, we still use register status code handler Protocol/Ppi to register the handler logic. We just want to change the StatusCodeHandler driver. We try to split the register logic to NULL library to make the code more modularity. We already created sample library in Edk2-Platforms repo =C2=A0https://g= ithub.com/tianocore/edk2-platforms/tree/master/Features/Intel/Debugging/Pos= tCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib.=C2=A0 You can check this code to understand more about what we want to do.

=C2=A0

Thanks,

Eric

From: Brian J. Johnson <brian.johnson@hpe.com>
Sent: Thursday, June 25, 2020 4:25 AM
To: Bi, Dandan <dandan.bi@intel.com>; Andrew Fish <afish@apple.com>; edk2-devel-groups-io <devel@edk2.groups.io>
Cc: rfc@edk2.groups.io; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Tan, Ming <ming.tan@intel.com>; Laszlo Ersek <lersek@redhat.com>
Subject: Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

=C2=A0

Dandan,

=C2=A0

The Status Code Protocol/PPI is the high-level interface which is being implemented.=C2=A0 The ReportStatusCodeRouter module implements this in terms of the ReportStatusCodeHandler Protocol/PPI.=C2=A0 That allows multiple ReportStatusCodeHandler modules to be used at once, so they can each react to different types of status codes, or report them through multiple channels.=C2=A0 That sort of multiplexing seems like a use= ful feature.

=C2=A0

Now we're considering adding a mechanism which allows registering status code handlers via NULL libraries, rather than via the protocol/PPI.=C2= =A0 That sounds like exactly what ReportStatusCodeRouter is intended for.=C2=A0 It wouldn't really change its scope, i= t would just make it more flexible.=C2=A0 Adding this featur= e via a StatusCodeHandler module wouldn't improve modularity, it would just add complexity.=C2=A0 As an OEM, adding a custom handler would look the same to me either way:=C2=A0 I would have to add the NULL class library to a MdeModulePkg driver's entry in my .dsc file.=C2=A0 It does= n't matter to me whether it's the ReportStatusCodeRouter or StatusCodeHandler module.=C2=A0 And if I can do it in ReportStatusCodeRouter, then I don't need to include any StatusCodeHandler modules in the build at all.=C2=A0 That saves code space and reduces the number of modules in the APRIORI list, which are both good things.

=C2=A0

ReportStatusCodeRouterPei already has to track registered handlers in PEI when running from ROM (it uses a HOB.)=C2=A0 Tracking handlers from NULL libraries wouldn't be any harder.=C2=A0 In fact, it looks like it could just export the Register() function to the NULL libraries, and they could call it in their constructors.

=C2=A0

I think using NULL libraries for status code handlers is a great idea.=C2=A0 I'd just like = to take that opportunity to reduce the complexity of the overall status code stack while we're at it.

=C2=A0

Thanks,

Brian J. Johnson
Enterprise X86 Lab

Hewlett Packard Enterprise


From: Bi, Dandan [mailto:dandan.bi@intel.com]

Sent: Monday, June 22, 2020, 2:27 AM

Subject: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

=C2=A0

Hi Brian,

=C2=A0

Personally, I prefer to add the NULL class Library to StatusCodeHandler modules.

  1. I think we should make the functionality of each module clear and separated. It may also be why we added ReportStatusCodeRouter and StatusCodeHandler modules in edk2 repo before.

ReportStatusCodeRouter modules are responsible for producing Status Code Protocol/PPI and Report Status Code Handler Protocol/PPI, and StatusCodeHandler modules are responsible for producing handlers (Handlers can be provided by NULL class Libraries in this RFC).

=C2=A0So, that=E2=80=99s why I don=E2=80=99t want to add the NULL clas= s Library to ReportStatusCodeRouter modules directly, which change the functionality scope of existing modules.

=C2= =A0

  1. I agree that we have a lot of layers of indirection now, but what we may gain is the good modularity. And you also mentioned that one or more StatusCodeHandler Modules may be used. We also want to achieve that only the StatusCodeHandler modules in MdeModulePkg can be used after this separation, platform can only add its own handler Libs to meet its requirement.

=C2=A0

  1. As Andrew mentioned below, if add the libraries to ReportStatusCodeRouter, there will be some issue we need to fix, which seems also make the code logic a little tricky to me.

=C2=A0

=C2=A0

=C2=A0

Thanks,

Dandan

From: Andrew Fish <afish@apple.com&g= t;
Sent: Saturday, June 20, 2020 2:04 AM
To: edk2-devel-groups-io <devel@edk2.groups.io>= ; brian.johnson@hpe.com
Cc: Bi, Dandan <dandan.bi@intel.com>; rfc@edk2.groups.io; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com><= /a>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Tan, Ming <ming.tan@intel.com= >
Subject: Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules<= /o:p>

=C2=A0

=C2=A0




On Jun 19, 2020, at 10:29 AM, Brian J. Johnson <brian.johnson@hpe.comwrote:

=C2=A0

On 6/18/20 2:01 AM, Dandan Bi wrote:

Hi All,

=C2=A0

REF:=C2=A0<= a href=3D"https://bugzilla.tianocore.org/show_bug.cgi?id=3D2816" moz-do-not= -send=3D"true">https://bugzilla.tia= nocore.org/show_bug.cgi?id=3D2816

=C2=A0

We plan to separate two kinds of NULL class libraries for Memory and serial handlers fromMdeModulePkg/Universal/St= atusCodeHandler/=E2=80=A6/ StatusCodeHandlerPei/RuntimeDxe/Smm=C2=A0m= odules.

The benefit we want to gain from this separation is to 1) make the code clear and easy to maintain, 2) make platform flexible to choose any handler library they need, and it also can reduce image size since the unused handlers can be excluded.<= /p>

If you have any concern or comments for this separation, please let me know.

=C2=A0

We plan to add new separated NULL class library=C2=A0<= b>MemoryStausCodeHandlerLib=C2=A0and=C2=A0<= /span>SerialStatusCodeHandlerLib=C2=A0with different phase implementation into=C2=A0<= b>MdeModulePkg\Library\=C2=A0d= irectory.

The main tree structure may like below:

MdeModulePkg\Library

|------MemoryStausCodeHa= ndlerLib

|------|------ PeiMemoryStausCodeHandlerLib.inf

|------|------ RuntimeDxeMemoryStatusCodeHandlerLib.inf

|------|------ SmmMemoryStausCodeHandlerLib.inf

|------SerialStatusCodeH= andlerLib

|------|------ PeiSerialStatusCodeHandlerLib.inf

|------|------ RuntimeDxeSerialStatusCodeHandlerLib.inf

|------|------ SmmSerialStatusCodeHandlerLib.inf

=C2=A0

=C2=A0

We will update existing platform use cases in edk2 and edk2-platform repo to cover the new NULL class library to make sure this change doesn=E2=80=99t impact any platform.

After this separation, StatusCodeHandler module usage will like below, and it=E2=80=99s also very flexible for platform to cover more handler libraries to meet their requirements.

MdeModulePkg/Universal/Stat= usCodeHandler/Pei/StatusCodeHandlerPei.inf {

=C2=A0=C2=A0&= lt;LibraryClasses>

NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/PeiMemoryStausCodeHan= dlerLib.inf

NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/PeiSerialStatusCodeH= andlerLib.inf

=C2=A0=C2=A0=C2=A0=C2=A0= =E2=80=A6

}

=C2=A0

MdeModulePkg/Universal/Stat= usCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf=C2=A0 {

=C2=A0=C2=A0&= lt;LibraryClasses>

NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/RuntimeDxeMemoryStaus= CodeHandlerLib.inf

NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/RuntimeDxeSerialStat= usCodeHandlerLib.inf

=C2=A0=C2=A0=C2=A0=C2=A0= =E2=80=A6

}

=C2=A0

MdeModulePkg/Universal/Stat= usCodeHandler/Smm/StatusCodeHandlerSmm.inf {

=C2=A0=C2=A0&= lt;LibraryClasses>

=C2=A0=C2=A0 =C2=A0NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/SmmMemoryStausCo= deHandlerLib.inf

NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/SmmSerialStatusCodeH= andlerLib.inf

=C2=A0=C2=A0=C2=A0=C2=A0= =E2=80=A6

}

=C2=A0

=C2=A0

Thanks,

Dandan

=C2=A0

Dandan,

We'll have a lot of layers of indirection....=C2=A0 The ReportStatusCodeRouter modules will call one or more StatusCodeHandlerModules, and the standard StatusCodeHandler modules will call multiple StatusCodeHandlerLib libraries.<= /p>

How about adding StatusCodeHandlerLib support directly to the ReportStatusCodeRouter modules?=C2= = =A0 Then platforms could omit the StatusCodeHandler modules if they're only using the open-source code.=C2=A0 That sounds like less overhead since fewer modules would be needed.

=C2=A0

=C2=A0

I think the need to execute from ROM makes this tricky.=C2=A0

=C2=A0

It looks to me that it is easy to move from PCD to libs for the StatusCodeHandler since registration is basically `RscHandlerPpi->Register (SerialStatusCodeReportWorker);`. The issue I see is the ReportStatusCodeRouter publishes=C2=A0RscHandlerPpi after the PEIMs constructor has been called and if the PEIM. Given globals don=E2=80=99t work when running from= ROM you would have to do something like publish a HOB in the library constructor and then have the=C2=A0GenericStatusCodePeiEntry() walk the HOBs and install the handlers. So I guess it is a little easier than I 1st thought when I started writing this mail, but it would require a new public API.=C2=A0<= /p>

=C2=A0

Thanks,

=C2=A0

Andrew Fish


Thanks,

--=C2=A0<= /span>

Brian J. Johnson
Enterprise X86 Lab

Hewlett Packard Enterprise

hpe.com=

=C2=A0

=C2=A0

-



--------------A859E71DE02D536486D0126F--