Re: [edk2-devel] [Patch] BaseTools: Remove the redundant __FLEXIBLE_SIZE from PcdValueInit.c

2022-03-18 Thread Bob Feng
Liming, Christine

Could you review this patch?

Thanks,
Bob

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Bob Feng
Sent: Tuesday, March 15, 2022 8:17 PM
To: devel@edk2.groups.io
Cc: Gao, Liming ; Chen, Christine 

Subject: [edk2-devel] [Patch] BaseTools: Remove the redundant __FLEXIBLE_SIZE 
from PcdValueInit.c

For the multiple SKU cases, basetools generates multiple redundant 
__FLEXIBLE_SIZE statement that is from the same line in dsc file.

This behavior causes the generated PcdValueInit.c file to have huge size, and 
the compilation time is very long.

This patch is going to fix this issue.

Signed-off-by: Bob Feng Cc: Liming Gao 
Cc: Yuwei Chen 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index d29b9bf13d..fc1e773417 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1874,10 +1874,11 @@ class DscBuildData(PlatformBuildClassObject):
 FieldName = FieldName.split(']', 1)[1] 
FieldName = NewFieldName + FieldName while '[' in 
FieldName and not Pcd.IsArray(): FieldName = 
FieldName.rsplit('[', 1)[0] CApp = CApp + '  
__FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % 
(Pcd.DatumType, FieldName.strip("."), Array_Index + 1, 
FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], 
FieldList[FieldName_ori][0])+flexisbale_size_statement_cache = set()
 for skuname in Pcd.SkuOverrideValues: if skuname == 
TAB_COMMON: continue for defaultstorenameitem in 
Pcd.SkuOverrideValues[skuname]: CApp = CApp + "// SkuName: %s,  
DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)@@ -1886,10 +1887,14 
@@ class DscBuildData(PlatformBuildClassObject):
 ActualCap.append(index) for 
FieldList in [Pcd.SkuOverrideValues[skuname][defaultstorenameitem][index]]: 
if not FieldList: continue  
   for FieldName in FieldList:+
fieldinfo = tuple(FieldList[FieldName])+if 
fieldinfo in flexisbale_size_statement_cache:+
continue+
flexisbale_size_statement_cache.add(fieldinfo) 
FieldName = "." + FieldName IsArray = 
_IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
 if IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') 
and FieldList[FieldName.strip(".")][0].endswith('}')):  
   try: Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)-- 
2.29.1.windows.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87589): https://edk2.groups.io/g/devel/message/87589
Mute This Topic: https://groups.io/mt/89796157/1768742
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [bob.c.f...@intel.com] 
-=-=-=-=-=-=




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87752): https://edk2.groups.io/g/devel/message/87752
Mute This Topic: https://groups.io/mt/89796157/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 0/6] [RFC] Rework UefiCpuPkg

2022-03-18 Thread Abner Chang

Just aware that I didn’t Cc stakeholders to the cover letter, add those people 
in CC.

-Original Message-
> From: Kinney, Michael D 
> Sent: Saturday, March 19, 2022 12:47 AM
> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
> ; Kinney, Michael D ;
> Ni, Ray 
> Subject: RE: [edk2-devel] [PATCH 0/6] [RFC] Rework UefiCpuPkg
> 
> Hi Abner,
> 
> Will OpenSBI content be needed by libs/modules outside of UefiCpuPkg?
Edk2OpenSBILib is the wrapper library of OpenSBI, so there is module neither 
inside nor outside UefiCpuPkg uses OpenSBI directly. Edk2OpenSbiLib is 
currently used by SecCore only as it describes here:
https://github.com/tianocore/edk2-platforms/tree/master/Platform/RISC-V/PlatformPkg.
 
We had designed to expose OepnSBI API in both edk2 version OpenSBI PPI and 
Protocol, so the answer to your question is: No, OpenSBI/Edk2OpenSbiLib is not 
needed by modules outside UefiCpuPkg as the design we have so far.

> 
> Should OpenSBI includes be promoted to MdePkg?
That is possible and seems reasonable to move the entire 
OpenSBI(Edk2OpenSbiLib) source/include to under MdePkg because there is no 
dependency with edk2 RISC-V header files under UefiCpuPkg. 
But one question: Shall we have OpenSBI lib under MdePkg if it is only used by 
UefiCpuPkg?
> 
> I do not think the dir name "RISC-V" follows the file/dir name requirements.
> The '-' should not be used.
We had the same discussion before and '-' is valid in the file name as it 
defined in the coding standard. I remember we also agreed or accepted having 
"RISC-V' as the directory name for the modules on edk2-platforms repo. Same 
scenario can applied on edk2 repo.

> 
> I think there is a discussion about moving UefiCpuLib to MdePkg.
Is that a serious discussion or just a verbal discussion? 😊 Any conclusion we 
had from the discussion?
Move UefiCpuLib to MdePkg leads the dependency with UefiCpuPkg for those 
architecture header files. I consider this doesn't make sense to MdePkg, right?
I would suggest still having UefiCPuPkg under UefiCpuPkg for now. Move it 
around one day when there is a clear decision for UefiCpuPkg comes out.

Thanks for feedbacks
Abner

> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Abner
> Chang
> > Sent: Thursday, March 17, 2022 10:43 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner 
> > Subject: [edk2-devel] [PATCH 0/6] [RFC] Rework UefiCpuPkg
> >
> >
> INVALID URI REMOVED
> d=3860__;!!NpxR!ymTSNAU_VEYCUYtX3YUSGsB0Ma3GzipVS95V5WEZxBeO
> QvdiEx6MgV61kZMs6TM$
> >
> > This is the project having rework on UefiCpuPkg in order to support a
> variety
> > of processor architectures. Some modules under UefiCpuPkg are required
> to be
> > abstract for the different archs.
> >
> > The first step is to classify UefiCpuPkg modules to IA32 and X64 sections in
> > DSC file (Patch 1/6). Move the module to Common section later if more
> than one
> > archs can leverage the same module (such as Patch 3/6 for BaseUefiCpuLib).
> >
> > Abner Chang (6):
> >   [RFC] UefiCpuPkg: Classify IA32/X64 modules in DSC file
> >   [RFC] UefiCpuPkg/Include: Add header files of RISC-V processor
> > architecture
> >   [RFC] UefiCpuPkg/BaseUefiCpuLib: Add RISC-V RISCV64 instace
> >   [RFC] UefiCpuPkg/RiscVOpensbLib: Add opensbi submodule
> >   [RFC] UefiCpuPkg/Library: Add RiscVOpensbiLib
> >   [RFC] UefiCpuPkg: Update YAML file for RISC-V arch
> >
> >  UefiCpuPkg/UefiCpuPkg.dec |  12 +-
> >  UefiCpuPkg/UefiCpuPkg.dsc |  45 +++--
> >  .../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |   8 +-
> >  .../RiscVOpensbiLib/RiscVOpensbiLib.inf   |  89 ++
> >  .../Include/IndustryStandard/RISC-V/RiscV.h   | 162
> ++
> >  .../IndustryStandard/RISC-V/RiscVOpensbi.h|  62 +++
> >  .../Include/Library/RISC-V/RiscVCpuLib.h  | 118 +
> >  UefiCpuPkg/Include/RISC-V/OpensbiTypes.h  |  82 +
> >  UefiCpuPkg/Include/RISC-V/RiscVImpl.h |  87 ++
> >  .gitmodules   |  45 ++---
> >  BaseTools/Conf/tools_def.template |   2 +-
> >  .../Library/BaseUefiCpuLib/BaseUefiCpuLib.uni |   5 +-
> >  .../Library/BaseUefiCpuLib/RISCV64/Cpu.S  | 143 
> >  .../Library/RISC-V/RiscVOpensbiLib/opensbi|   1 +
> >  UefiCpuPkg/UefiCpuPkg.ci.yaml |  61 ++-
> >  15 files changed, 877 insertions(+), 45 deletions(-)
> >  create mode 100644 UefiCpuPkg/Library/RISC-
> V/RiscVOpensbiLib/RiscVOpensbiLib.inf
> >  create mode 100644 UefiCpuPkg/Include/IndustryStandard/RISC-
> V/RiscV.h
> >  create mode 100644 UefiCpuPkg/Include/IndustryStandard/RISC-
> V/RiscVOpensbi.h
> >  create mode 100644 UefiCpuPkg/Include/Library/RISC-V/RiscVCpuLib.h
> >  create mode 100644 UefiCpuPkg/Include/RISC-V/OpensbiTypes.h
> >  create mode 100644 UefiCpuPkg/Include/RISC-V/RiscVImpl.h
> >  create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/RISCV64/Cpu.S

Re: [edk2-devel] [PATCH 0/6] [RFC] Rework UefiCpuPkg

2022-03-18 Thread Michael D Kinney
Hi Abner,

Will OpenSBI content be needed by libs/modules outside of UefiCpuPkg?

Should OpenSBI includes be promoted to MdePkg?

I do not think the dir name "RISC-V" follows the file/dir name requirements.
The '-' should not be used.

I think there is a discussion about moving UefiCpuLib to MdePkg.

Thanks,

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Abner Chang
> Sent: Thursday, March 17, 2022 10:43 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner 
> Subject: [edk2-devel] [PATCH 0/6] [RFC] Rework UefiCpuPkg
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=3860
> 
> This is the project having rework on UefiCpuPkg in order to support a variety
> of processor architectures. Some modules under UefiCpuPkg are required to be
> abstract for the different archs.
> 
> The first step is to classify UefiCpuPkg modules to IA32 and X64 sections in
> DSC file (Patch 1/6). Move the module to Common section later if more than one
> archs can leverage the same module (such as Patch 3/6 for BaseUefiCpuLib).
> 
> Abner Chang (6):
>   [RFC] UefiCpuPkg: Classify IA32/X64 modules in DSC file
>   [RFC] UefiCpuPkg/Include: Add header files of RISC-V processor
> architecture
>   [RFC] UefiCpuPkg/BaseUefiCpuLib: Add RISC-V RISCV64 instace
>   [RFC] UefiCpuPkg/RiscVOpensbLib: Add opensbi submodule
>   [RFC] UefiCpuPkg/Library: Add RiscVOpensbiLib
>   [RFC] UefiCpuPkg: Update YAML file for RISC-V arch
> 
>  UefiCpuPkg/UefiCpuPkg.dec |  12 +-
>  UefiCpuPkg/UefiCpuPkg.dsc |  45 +++--
>  .../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |   8 +-
>  .../RiscVOpensbiLib/RiscVOpensbiLib.inf   |  89 ++
>  .../Include/IndustryStandard/RISC-V/RiscV.h   | 162 ++
>  .../IndustryStandard/RISC-V/RiscVOpensbi.h|  62 +++
>  .../Include/Library/RISC-V/RiscVCpuLib.h  | 118 +
>  UefiCpuPkg/Include/RISC-V/OpensbiTypes.h  |  82 +
>  UefiCpuPkg/Include/RISC-V/RiscVImpl.h |  87 ++
>  .gitmodules   |  45 ++---
>  BaseTools/Conf/tools_def.template |   2 +-
>  .../Library/BaseUefiCpuLib/BaseUefiCpuLib.uni |   5 +-
>  .../Library/BaseUefiCpuLib/RISCV64/Cpu.S  | 143 
>  .../Library/RISC-V/RiscVOpensbiLib/opensbi|   1 +
>  UefiCpuPkg/UefiCpuPkg.ci.yaml |  61 ++-
>  15 files changed, 877 insertions(+), 45 deletions(-)
>  create mode 100644 
> UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/RiscVOpensbiLib.inf
>  create mode 100644 UefiCpuPkg/Include/IndustryStandard/RISC-V/RiscV.h
>  create mode 100644 UefiCpuPkg/Include/IndustryStandard/RISC-V/RiscVOpensbi.h
>  create mode 100644 UefiCpuPkg/Include/Library/RISC-V/RiscVCpuLib.h
>  create mode 100644 UefiCpuPkg/Include/RISC-V/OpensbiTypes.h
>  create mode 100644 UefiCpuPkg/Include/RISC-V/RiscVImpl.h
>  create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/RISCV64/Cpu.S
>  create mode 16 UefiCpuPkg/Library/RISC-V/RiscVOpensbiLib/opensbi
> 
> --
> 2.31.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87750): https://edk2.groups.io/g/devel/message/87750
Mute This Topic: https://groups.io/mt/89863231/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [GSoC 2022] How to begin contributing?

2022-03-18 Thread Tejesh Anand
Hello all, My name is Tejesh Anand, a first year computer engineering student. 
I'm interested applying for the task of writing more unit tests for edk2. I 
wanted to ask if anyone had any advice for a first issue to begin to contribute 
with?

Thanks in advance!


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87749): https://edk2.groups.io/g/devel/message/87749
Mute This Topic: https://groups.io/mt/89869613/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] UefiPayloadPkg: Make Boot Timeout configurable

2022-03-18 Thread Sean Rhodes
Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 14a8d157a2..3f172c5912 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -35,6 +35,7 @@
   DEFINE SMM_SUPPORT  = FALSE
   DEFINE ABOVE_4G_MEMORY  = TRUE
   DEFINE BOOT_MANAGER_ESCAPE  = FALSE
+  DEFINE PLATFORM_BOOT_TIMEOUT= 3
   DEFINE SD_MMC_TIMEOUT   = 100
   #
   # SBL:  UEFI payload for Slim Bootloader
@@ -475,7 +476,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
-  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
+  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|$(PLATFORM_BOOT_TIMEOUT)
 !if $(VARIABLE_SUPPORT) == "SPI"
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize  |0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0
-- 
2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87748): https://edk2.groups.io/g/devel/message/87748
Mute This Topic: https://groups.io/mt/89868842/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH] MdeModulePkg: Make RSP 16-byte boundary aligned for PEI 64bit

2022-03-18 Thread Kuo, Ted
Thanks Marvin for your feedback. I think your direction is right. The original 
stack alignment is correct before switching to new stack but the current 
implementation in SecCore's SecTemporaryRamSupport() will break the stack 
alignment after switching to new stack. We need to ensure the new stack and 
stack offset have same alignment as well as the old stack. I'll resend a new 
patch to keep the stack alignment aligned before and after switching stack.

Thanks,
Ted

-Original Message-
From: Marvin Häuser  
Sent: Thursday, March 17, 2022 7:09 PM
To: devel@edk2.groups.io; Kuo, Ted 
Cc: Bi, Dandan ; Gao, Liming ; 
De, Debkumar ; Han, Harry ; West, 
Catharine ; Wang, Jian J ; S, 
Ashraf Ali ; Kinney, Michael D 

Subject: Re: [edk2-devel][PATCH] MdeModulePkg: Make RSP 16-byte boundary 
aligned for PEI 64bit

Good day,

> On 17. Mar 2022, at 02:05, Kuo, Ted  wrote:
>
> Hi Liming and Mike,
>
> Can you please review the change?
>
> Thanks,
> Ted
>
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Kuo, 
> Ted
> Sent: Thursday, March 10, 2022 2:21 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan ; Gao, Liming 
> ; De, Debkumar ; Han, 
> Harry ; West, Catharine 
> ; Wang, Jian J ; S, 
> Ashraf Ali 
> Subject: [edk2-devel][PATCH] MdeModulePkg: Make RSP 16-byte boundary 
> aligned for PEI 64bit
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3865
> Use SwitchPeiCore instead of calling PeiCore directly when switching 
> PeiCore from temporary memory to permanent memory. For PEI 32bit, 
> SwitchPeiCore always calls PeiCore without any additional step. For 
> PEI 64bit, SwitchPeiCore makes RSP 16-byte boundary aligned and then 
> allocate 32 bytes as a shadow store on call stack before calling PeiCore.
>
> Cc: Dandan Bi 
> Cc: Liming Gao 
> Cc: Debkumar De 
> Cc: Harry Han 
> Cc: Catharine West 
> Cc: Jian J Wang 
> Cc: Ashraf Ali S 
> Signed-off-by: Ted Kuo 
> ---
> MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c |  2 +-
>  MdeModulePkg/Core/Pei/Ia32/SwitchPeiCore.nasm | 33
> +++
> MdeModulePkg/Core/Pei/PeiMain.h   | 25 ++ 
> MdeModulePkg/Core/Pei/PeiMain.inf |  6 + 
> MdeModulePkg/Core/Pei/X64/SwitchPeiCore.nasm  | 38
> +++
> 5 files changed, 103 insertions(+), 1 deletion(-)  create mode 100644 
> MdeModulePkg/Core/Pei/Ia32/SwitchPeiCore.nasm
> create mode 100644 MdeModulePkg/Core/Pei/X64/SwitchPeiCore.nasm
>
> diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> index 3552feda8f..5af6e6e86f 100644
> --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> @@ -871,7 +871,7 @@ PeiCheckAndSwitchStack (
>   //
>   // Entry PEI Phase 2
>   //
> -  PeiCore (SecCoreData, NULL, Private);
> +  SwitchPeiCore (SecCoreData, NULL, Private);
> } else {
>   //
>   // Migrate memory pages allocated in pre-memory phase.
> diff --git a/MdeModulePkg/Core/Pei/Ia32/SwitchPeiCore.nasm
> b/MdeModulePkg/Core/Pei/Ia32/SwitchPeiCore.nasm
> new file mode 100644
> index 00..23cfb5090b
> --- /dev/null
> +++ b/MdeModulePkg/Core/Pei/Ia32/SwitchPeiCore.nasm
> @@ -0,0 +1,33 @@
> +;
> +--
> +
> +;
> +; Copyright (c) 2022, Intel Corporation. All rights reserved. ;
> +SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Abstract:
> +;
> +;   Switch PeiCore from temporary memory to permanent memory.
> +;
> +;
> +--
> +
> +
> +    SECTION .text
> +
> +extern ASM_PFX(PeiCore)
> +
> +;
> +--
> +
> +; VOID
> +; EFIAPI
> +; SwitchPeiCore (
> +;   EFI_SEC_PEI_HAND_OFF    *SecCoreDataPtr, ;   
> +EFI_PEI_PPI_DESCRIPTOR  *PpiList, ;   VOID    *Data ;   
> +);
> +;
> +--
> +
> +global ASM_PFX(SwitchPeiCore)
> +ASM_PFX(SwitchPeiCore):
> +  push   DWORD [esp + 12]
> +  push   DWORD [esp + 12]
> +  push   DWORD [esp + 12]
> +  call   ASM_PFX(PeiCore)
> +  jmp    $    ; Should never reach here
> +  ret
> +

I think there were efforts in the past to avoid ASM whenever possible. 
Can’t this just remain a C function (for IA32 only of course) and if not, 
wouldn't a simple jmp instruction be sufficient?

> diff --git a/MdeModulePkg/Core/Pei/PeiMain.h 
> b/MdeModulePkg/Core/Pei/PeiMain.h index 556beddad5..8e8ed3dadf 100644
> --- a/MdeModulePkg/Core/Pei/PeiMain.h
> +++ b/MdeModulePkg/Core/Pei/PeiMain.h
> @@ -2038,4 +2038,29 @@ PeiReinitializeFv (
>   IN  PEI_CORE_INSTANCE  *PrivateData
>   );
>
> +/**
> +  This routine is invoked by main entry of PeiMain module during 
> +transition
> +  from temporary memory to permanent memory.
> +
> +  @param SecCoreDataPtr  Points to a data struc

Re: [edk2-devel] [PATCH V4 09/10] MdeModulePkg: Update PciEnumeratorSupport to ignore OptionRom if needed

2022-03-18 Thread Ni, Ray
Reviewed-by: Ray Ni 

-Original Message-
From: Xu, Min M  
Sent: Monday, February 28, 2022 4:17 PM
To: devel@edk2.groups.io
Cc: Xu, Min M ; Wang, Jian J ; Gao, 
Liming ; Wu, Hao A ; Ni, Ray 
; Brijesh Singh ; Aktas, Erdem 
; James Bottomley ; Yao, Jiewen 
; Tom Lendacky ; Gerd Hoffmann 

Subject: [PATCH V4 09/10] MdeModulePkg: Update PciEnumeratorSupport to ignore 
OptionRom if needed

RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Function of UpdatePciInfo() in PciEnumeratorSupport.c is used to update the bar 
information for those incompatible PCI device. It is the right place to check 
if the OptionRom need to be ignored.

According to "Table 20. ACPI 2.0 & 3.0 QWORD Address Space Descriptor Usage" in 
PI Spec 1.7, Type-specific flags can be set to 0 when Address Translation 
Offset == 6 to skip device option ROM (do not probe option rom BAR).

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Tom Lendacky 
Cc: Gerd Hoffmann 
Signed-off-by: Min Xu 
---
 .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c  | 23 +++  
.../Bus/Pci/PciBusDxe/PciEnumeratorSupport.h  |  4 +++-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 9251388bc268..509f828b621d 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -220,8 +220,10 @@ PciSearchDevice (
   )
 {
   PCI_IO_DEVICE  *PciIoDevice;
+  BOOLEANIgnoreOptionRom;
 
-  PciIoDevice = NULL;
+  PciIoDevice = NULL;
+  IgnoreOptionRom = FALSE;
 
   DEBUG ((
 DEBUG_INFO,
@@ -285,7 +287,7 @@ PciSearchDevice (
   //
   // Update the bar information for this PCI device so as to support some 
specific device
   //
-  UpdatePciInfo (PciIoDevice);
+  UpdatePciInfo (PciIoDevice, &IgnoreOptionRom);
 
   if (PciIoDevice->DevicePath == NULL) {
 return EFI_OUT_OF_RESOURCES;
@@ -295,7 +297,7 @@ PciSearchDevice (
   // Detect this function has option rom
   //
   if (gFullEnumeration) {
-if (!IS_CARDBUS_BRIDGE (Pci)) {
+if (!IS_CARDBUS_BRIDGE (Pci) && !IgnoreOptionRom) {
   GetOpRomInfo (PciIoDevice);
 }
 
@@ -1310,6 +1312,7 @@ DetermineDeviceAttribute (
 
   @param PciIoDevice  Input Pci device instance. Output Pci device 
instance with updated
   Bar information.
+  @param IgnoreOptionRom  Output If the option rom of incompatible device need 
to be ignored.
 
   @retval EFI_SUCCESS Successfully updated bar information.
   @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI 
device list.
@@ -1317,7 +1320,8 @@ DetermineDeviceAttribute (  **/  EFI_STATUS  
UpdatePciInfo (
-  IN OUT PCI_IO_DEVICE  *PciIoDevice
+  IN OUT PCI_IO_DEVICE  *PciIoDevice,
+  OUT BOOLEAN   *IgnoreOptionRom
   )
 {
   EFI_STATUS Status;
@@ -1374,6 +1378,17 @@ UpdatePciInfo (
   break;
 }
 
+//
+// According to "Table 20. ACPI 2.0 & 3.0 QWORD Address Space Descriptor 
Usage"
+// in PI Spec 1.7, Type-specific flags can be set to 0 when Address 
Translation
+// Offset == 6 to skip device option ROM (do not probe option rom BAR).
+//
+if (((Ptr->AddrTranslationOffset == PCI_MAX_BAR) && (Ptr->SpecificFlag == 
0))) {
+  *IgnoreOptionRom = TRUE;
+  Ptr++;
+  continue;
+}
+
 for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
   if ((Ptr->AddrTranslationOffset != MAX_UINT64) &&
   (Ptr->AddrTranslationOffset != MAX_UINT8) && diff --git 
a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h
index 0ded4bea4f89..7daa6e020d09 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h
@@ -262,6 +262,7 @@ DetermineDeviceAttribute (
 
   @param PciIoDevice  Input Pci device instance. Output Pci device 
instance with updated
   Bar information.
+  @param IgnoreOptionRom  Output If the option rom of incompatible device need 
to be ignored.
 
   @retval EFI_SUCCESS Successfully updated bar information.
   @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI 
device list.
@@ -269,7 +270,8 @@ DetermineDeviceAttribute (  **/  EFI_STATUS  UpdatePciInfo (
-  IN OUT PCI_IO_DEVICE  *PciIoDevice
+  IN OUT PCI_IO_DEVICE  *PciIoDevice,
+  OUT BOOLEAN   *IgnoreOptionRom
   );
 
 /**
--
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87746): https://edk2.groups.io/g/devel/message/87746
Mute This Topic: https://groups.io/mt/89446698/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=

Re: [edk2-devel] [PATCH V9 35/47] MdeModulePkg: Skip setting IA32_ERER.NXE if it has already been set

2022-03-18 Thread Ni, Ray
Reviewed-by: Ray Ni 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Min Xu
Sent: Friday, March 18, 2022 8:46 AM
To: devel@edk2.groups.io
Cc: Xu, Min M ; Wang, Jian J ; Wu, 
Hao A ; Brijesh Singh ; Aktas, Erdem 
; James Bottomley ; Yao, Jiewen 
; Tom Lendacky ; Gerd Hoffmann 

Subject: [edk2-devel] [PATCH V9 35/47] MdeModulePkg: Skip setting IA32_ERER.NXE 
if it has already been set

RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

If IA32_ERER.NXE has already been set, skip setting it again.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Brijesh Singh 
Cc: Erdem Aktas 
Cc: James Bottomley 
Cc: Jiewen Yao 
Cc: Tom Lendacky 
Cc: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 
Reviewed-by: Jian J Wang 
Signed-off-by: Min Xu 
---
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 1ebab2782010..a451ca160408 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -179,9 +179,11 @@ EnableExecuteDisableBit (
 {
   UINT64  MsrRegisters;
 
-  MsrRegisters  = AsmReadMsr64 (0xC080);
-  MsrRegisters |= BIT11;
-  AsmWriteMsr64 (0xC080, MsrRegisters);
+  MsrRegisters = AsmReadMsr64 (0xC080);
+  if ((MsrRegisters & BIT11) == 0) {
+MsrRegisters |= BIT11;
+AsmWriteMsr64 (0xC080, MsrRegisters);
+  }
 }
 
 /**
-- 
2.29.2.windows.2








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87745): https://edk2.groups.io/g/devel/message/87745
Mute This Topic: https://groups.io/mt/89859052/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 0/2] ShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser

2022-03-18 Thread Abdul Lateef Attar via groups.io
Replaced shift operator with compiler intrinsic functions.

Cc: Ray Ni 
Cc: Zhichao Gao 
Cc: Sami Mujawar 

Abdul Lateef Attar (2):
  ShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser
  ShellPkg/AcpiView: PrintFormatter for FADT Flags field

 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  48 
+
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  | 188 

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 167 
+++--
 3 files changed, 348 insertions(+), 55 deletions(-)

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87744): https://edk2.groups.io/g/devel/message/87744
Mute This Topic: https://groups.io/mt/89867230/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 2/2] ShellPkg/AcpiView: PrintFormatter for FADT Flags field

2022-03-18 Thread Abdul Lateef Attar via groups.io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3839

Adds PrintFormatter function to the FADT flags field.
Prints indivisual flag name along with flag value.

Cc: Ray Ni 
Cc: Zhichao Gao 
Cc: Sami Mujawar 
Signed-off-by: Abdul Lateef Attar 
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  |   2 +-
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 167 
+---
 2 files changed, 113 insertions(+), 56 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
index fcc56c189d65..eac928617609 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -884,7 +884,7 @@ ParseAcpiBitFields (
 }

 

 // extract Bitfield data for the current item

-Data = (BitsData >> Parser[Index].Offset) & ~(~0ULL << 
Parser[Index].Length);

+Data = RShiftU64 (BitsData, Parser[Index].Offset) & ~(LShiftU64 (~0ULL, 
Parser[Index].Length));

 

 if (Trace) {

   // if there is a Formatter function let the function handle

diff --git 
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
index f8fbb4bcb8e9..abc58d65520e 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
@@ -2,6 +2,7 @@
   FADT table parser

 

   Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.

+  Copyright (c) 2022, AMD Incorporated. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

 

   @par Reference(s):

@@ -130,69 +131,125 @@ ValidateFlags (
  #endif

 }

 

+STATIC CONST ACPI_PARSER  FadtFlagParser[] = {

+  { L"WBINVD",   1,  0,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"WBINVD_FLUSH", 1,  1,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"PROC_C1",  1,  2,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"P_LVL2_UP",1,  3,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"PWR_BUTTON",   1,  4,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"SLP_BUTTON",   1,  5,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"FIX_RTC",  1,  6,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"RTC_S4",   1,  7,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"TMR_VAL_EXT",  1,  8,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"DCK_CAP",  1,  9,  L"%d", NULL, NULL, NULL, 
NULL },

+  { L"RESET_REG_SUP",1,  10, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"SEALED_CASE",  1,  11, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"HEADLESS", 1,  12, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"CPU_SW_SLP",   1,  13, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"PCI_EXP_WAK",  1,  14, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"USE_PLATFORM_CLOCK",   1,  15, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"S4_RTC_STS_VALID", 1,  16, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"REMOTE_POWER_ON_CAPABLE",  1,  17, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"FORCE_APIC_CLUSTER_MODEL", 1,  18, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"FORCE_APIC_PHYSICAL_DESTINATION_MODE", 1,  19, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"HW_REDUCED_ACPI",  1,  20, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"LOW_POWER_S0_IDLE_CAPABLE",1,  21, L"%d", NULL, NULL, NULL, 
NULL },

+  { L"Reserved", 10, 22, L"%d", NULL, NULL, NULL, 
NULL }

+};

+

+/**

+  This function traces FADT Flags fields.

+  If no format string is specified the Format must be NULL.

+

+  @param [in] Format  Optional format string for tracing the data.

+  @param [in] Ptr Pointer to the start of the buffer.

+**/

+VOID

+EFIAPI

+DumpFadtFlags (

+  IN CONST CHAR16  *Format OPTIONAL,

+  IN UINT8 *Ptr

+  )

+{

+  if (Format != NULL) {

+Print (Format, *(UINT32 *)Ptr);

+return;

+  }

+

+  Print (L"0x%X\n", *(UINT32 *)Ptr);

+  ParseAcpiBitFields (

+TRUE,

+2,

+NULL,

+Ptr,

+4,

+PARSER_PARAMS (FadtFlagParser)

+);

+}

+

 /**

   An ACPI_PARSER array describing the ACPI FADT Table.

 **/

 STATIC CONST ACPI_PARSER  FadtParser[] = {

   PARSE_ACPI_HEADER (&AcpiHdrInfo),

-  { L"FIRMWARE_CTRL",  4,   36,  L"0x%x",  NULL,(VOID 
**)&FirmwareCtrl,

+  { L"FIRMWARE_CTRL",  4,   36,  L"0x%x",  NULL,  (VOID 
**)&FirmwareCtrl,

 ValidateFirmwareCtrl,  NULL },

-  { L"DSDT",   4,   40,  L"0x%x",  NULL,(VOID 
**)

[edk2-devel] [PATCH v6 1/2] ShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser

2022-03-18 Thread Abdul Lateef Attar via groups.io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3839

Adds ParseAcpiBitFields() which is based on
ParseAcpi() and capable of parsing the bit fields.
Supports parsing of UINT8, UINT16, UINT32 and UINT64 byte data.

Cc: Ray Ni 
Cc: Zhichao Gao 
Cc: Sami Mujawar 
Signed-off-by: Abdul Lateef Attar 
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h |  48 +
 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 188 

 2 files changed, 236 insertions(+)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
index 5c916a4720b8..db8c88f6dfa4 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -2,6 +2,7 @@
   Header file for ACPI parser

 

   Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.

+  Copyright (c) 2022, AMD Incorporated. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/

 

@@ -251,6 +252,11 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, 
VOID *Context);
   the field data. If the field is more complex and requires additional

   processing for formatting and representation a print formatter function

   can be specified in 'PrintFormatter'.

+

+  ParseAcpiBitFields() uses AcpiParser structure to parse the bit fields.

+  It considers Length as a number of bits that need to be parsed.

+  Also, the Offset field will be considered as starting offset of the bitfield.

+

   The PrintFormatter function may choose to use the format string

   specified by 'Format' or use its own internal format string.

 

@@ -264,10 +270,12 @@ typedef struct AcpiParser {
 

   /// The length of the field.

   /// (Byte Length column from ACPI table spec)

+  /// Length(in bits) of the bitfield if used with ParseAcpiBitFields().

   UINT32   Length;

 

   /// The offset of the field from the start of the table.

   /// (Byte Offset column from ACPI table spec)

+  /// The Bit offset of the field if used with ParseAcpiBitFields().

   UINT32   Offset;

 

   /// Optional Print() style format string for tracing the data. If not

@@ -285,6 +293,7 @@ typedef struct AcpiParser {
   /// a pointer to the field data. This value is set after the FieldValidator

   /// has been called and therefore should not be used by the FieldValidator.

   /// If unused this must be set to NULL.

+  /// ItemPtr is not supported with ParseAcpiBitFields().

   VOID **ItemPtr;

 

   /// Optional pointer to a field validator function.

@@ -364,6 +373,45 @@ ParseAcpi (
   IN UINT32 ParserItems

   );

 

+/**

+  This function is used to parse an ACPI table bitfield buffer.

+

+  The ACPI table buffer is parsed using the ACPI table parser information

+  specified by a pointer to an array of ACPI_PARSER elements. This parser

+  function iterates through each item on the ACPI_PARSER array and logs the 
ACPI table bitfields.

+

+  This function can optionally be used to parse ACPI tables and fetch specific

+  field values. The ItemPtr member of the ACPI_PARSER structure (where used)

+  is updated by this parser function to point to the selected field data

+  (e.g. useful for variable length nested fields).

+

+  ItemPtr member of ACPI_PARSER is not supported with this function.

+

+  @param [in] TraceTrace the ACPI fields TRUE else only parse the

+   table.

+  @param [in] Indent   Number of spaces to indent the output.

+  @param [in] AsciiNameOptional pointer to an ASCII string that describes

+   the table being parsed.

+  @param [in] Ptr  Pointer to the start of the buffer.

+  @param [in] Length   Length of the buffer pointed by Ptr.

+  @param [in] Parser   Pointer to an array of ACPI_PARSER structure that

+   describes the table being parsed.

+  @param [in] ParserItems  Number of items in the ACPI_PARSER array.

+

+  @retval Number of bits parsed.

+**/

+UINT32

+EFIAPI

+ParseAcpiBitFields (

+  IN BOOLEANTrace,

+  IN UINT32 Indent,

+  IN CONST CHAR8*AsciiName OPTIONAL,

+  IN UINT8  *Ptr,

+  IN UINT32 Length,

+  IN CONST ACPI_PARSER  *Parser,

+  IN UINT32 ParserItems

+  );

+

 /**

This is a helper macro to pass parameters to the Parser functions.

 

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c 
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
index cb193a5ea449..fcc56c189d65 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -2,12 +2,14 @@
   ACPI parser

 

   Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.

+  Copyright (c) 2022, AMD Incorporated. All rights reserved.

   SPDX-License-Identif

Re: [edk2-devel] [PATCH v7 1/1] CryptoPkg: Add new hash algorithm ParallelHash256HashAll in BaseCryptLib.

2022-03-18 Thread Yao, Jiewen
Merged https://github.com/tianocore/edk2/pull/2650


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yao, Jiewen
> Sent: Friday, March 18, 2022 2:29 PM
> To: Li, Zhihao ; devel@edk2.groups.io
> Cc: Wang, Jian J ; Lu, Xiaoyu1 ;
> Jiang, Guomin ; Fu, Siyuan 
> Subject: Re: [edk2-devel] [PATCH v7 1/1] CryptoPkg: Add new hash algorithm
> ParallelHash256HashAll in BaseCryptLib.
> 
> Reviewed-by: Jiewen Yao 
> 
> > -Original Message-
> > From: Li, Zhihao 
> > Sent: Friday, March 18, 2022 12:22 PM
> > To: devel@edk2.groups.io
> > Cc: Yao, Jiewen ; Wang, Jian J
> ;
> > Lu, Xiaoyu1 ; Jiang, Guomin
> ;
> > Fu, Siyuan 
> > Subject: [PATCH v7 1/1] CryptoPkg: Add new hash algorithm
> > ParallelHash256HashAll in BaseCryptLib.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3596
> >
> > Parallel hash function ParallelHash256HashAll, as defined in NIST's
> > Special Publication 800-185, published December 2016. It utilizes
> > multi-process to calculate the digest.
> >
> > Passed CI test.
> > Onprotocol version code passed test.
> >
> > Cc: Jiewen Yao 
> > Cc: Jian J Wang 
> > Cc: Xiaoyu Lu 
> > Cc: Guomin Jiang 
> > Cc: Siyuan Fu 
> >
> > Signed-off-by: Zhihao Li 
> > ---
> >  CryptoPkg/Driver/Crypto.c | 
> > 121 -
> >  CryptoPkg/Library/BaseCryptLib/Hash/CryptCShake256.c  | 282
> > 
> >  CryptoPkg/Library/BaseCryptLib/Hash/CryptParallelHash.c   | 278
> > +++
> >  CryptoPkg/Library/BaseCryptLib/Hash/CryptParallelHashNull.c   |  
> > 40 +++
> >  CryptoPkg/Library/BaseCryptLib/Hash/CryptSha3.c   | 166
> > 
> >  CryptoPkg/Library/BaseCryptLib/Hash/CryptXkcp.c   | 107
> 
> >  CryptoPkg/Library/BaseCryptLibNull/Hash/CryptParallelHashNull.c   |  40
> +++
> >  CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c|  
> > 34 ++-
> >  CryptoPkg/Test/UnitTest/Library/BaseCryptLib/ParallelhashTests.c  | 145
> > ++
> >  CryptoPkg/CryptoPkg.ci.yaml   |   
> > 4 +-
> >  CryptoPkg/Include/Library/BaseCryptLib.h  |  
> > 31 ++-
> >  CryptoPkg/Include/Pcd/PcdCryptoServiceFamilyEnable.h  |  
> > 15 +-
> >  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf   |   
> > 3 +-
> >  CryptoPkg/Library/BaseCryptLib/Hash/CryptParallelHash.h   | 201
> > ++
> >  CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf|   
> > 3 +-
> >  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf|   
> > 3 +-
> >  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf|   
> > 8 +-
> >  CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf   |   
> > 3 +-
> >  CryptoPkg/Library/Include/CrtLibSupport.h |   
> > 3 +-
> >  CryptoPkg/Private/Protocol/Crypto.h   |  
> > 35 ++-
> >  CryptoPkg/Test/CryptoPkgHostUnitTest.dsc  |   
> > 4 +
> >  CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf |   4
> +
> >  22 files changed, 1516 insertions(+), 14 deletions(-)
> >
> > diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c
> > index d5d6aa8e5820..76cb9f4da0a4 100644
> > --- a/CryptoPkg/Driver/Crypto.c
> > +++ b/CryptoPkg/Driver/Crypto.c
> > @@ -3,7 +3,7 @@
> >from BaseCryptLib and TlsLib.
> >
> >
> >
> >Copyright (C) Microsoft Corporation. All rights reserved.
> >
> > -  Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
> >
> > +  Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.
> >
> >SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >
> >
> >  **/
> >
> > @@ -4470,6 +4470,118 @@ CryptoServiceTlsGetCertRevocationList (
> >return CALL_BASECRYPTLIB (TlsGet.Services.CertRevocationList,
> > TlsGetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);
> >
> >  }
> >
> >
> >
> > +/**
> >
> > +  Carries out the RSA-SSA signature generation with EMSA-PSS encoding
> > scheme.
> >
> > +
> >
> > +  This function carries out the RSA-SSA signature generation with EMSA-PSS
> > encoding scheme defined in
> >
> > +  RFC 8017.
> >
> > +  Mask generation function is the same as the message digest algorithm.
> >
> > +  If the Signature buffer is too small to hold the contents of signature, 
> > FALSE
> >
> > +  is returned and SigSize is set to the required buffer size to obtain the
> signature.
> >
> > +
> >
> > +  If RsaContext is NULL, then return FALSE.
> >
> > +  If Message is NULL, then return FALSE.
> >
> > +  If MsgSize is zero or > INT_MAX, then return FALSE.
> >
> > +  If DigestLen is NOT 32, 48 or 64, return FALSE.
> >
> > +  If SaltLen is not equal to DigestLen, then return FALSE.
> >
> > +  If SigSize is large enough but Signature is NULL, then return FALSE.
> >
>