Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/TraceHubDebugSysTLib: Use wider type for loop comparisons

2024-02-20 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: mikub...@linux.microsoft.com  
Sent: Tuesday, February 20, 2024 11:26 PM
To: devel@edk2.groups.io
Cc: Liming Gao ; Guo, Gua ; 
Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 

Subject: [PATCH v1 1/1] MdeModulePkg/TraceHubDebugSysTLib: Use wider type for 
loop comparisons

From: Michael Kubacki 

Resolves a new CodeQL error due to the value being incremented in the loop 
being a narrower type than the variable it is being compared against.

The variable is changed to a UINT32 type so it has the same width as the type 
it is being compared against.

Issue explanation: In a loop condition, comparison of a value of a narrow type 
with a value of a wide type may result in unexpected behavior if the wider 
value is sufficiently large (or small). This is because the narrower value may 
overflow. This can lead to an infinite loop.

Cc: Liming Gao 
Cc: Gua Guo 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Michael Kubacki 
---
 MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c   | 4 ++--
 MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c | 2 +-
 MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c| 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
index 45dfd3127a4c..050210cb958b 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib
+++ .c
@@ -41,7 +41,7 @@ TraceHubSysTDebugWrite (
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
   UINT32DbgInstCount;
-  UINT16Index;
+  UINT32Index;
 
   if (NumberOfBytes == 0) {
 //
@@ -109,7 +109,7 @@ TraceHubSysTWriteCataLog64StatusCode (
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
   UINT32DbgInstCount;
-  UINT16Index;
+  UINT32Index;
 
   if (Guid == NULL) {
 return RETURN_INVALID_PARAMETER;
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
index 35c239b5feae..6001f4dfd93d 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTL
+++ ib.c
@@ -45,7 +45,7 @@ TraceHubSysTDebugWrite (
   MIPI_SYST_HANDLE  MipiSystHandle;
   MIPI_SYST_HEADER  MipiSystHeader;
   RETURN_STATUS Status;
-  UINT16Index;
+  UINT32Index;
 
   if ((mDbgInstCount == 0) || (mThDebugInstArray == NULL)) {
 return RETURN_ABORTED;
diff --git a/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
index fe946fe60c7d..035618faece5 100644
--- a/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
@@ -56,7 +56,7 @@ PackThDebugInstance (
   )
 {
   UINT8   *DbgContext;
-  UINT16  Index;
+  UINT32  Index;
 
   DbgContext = GetFirstGuidHob (&gTraceHubDebugInfoHobGuid);
   if (DbgContext != NULL) {
--
2.40.1.vfs.0.0



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




Re: [edk2-devel] [PATCH v1 0/1] UefiPayloadPkg: Make Dsc accomodative of other archs

2024-02-25 Thread Guo, Gua
Series Reviewed-by: Gua Guo 

From: Dhaval 
Sent: Sunday, February 25, 2024 10:50:50 PM
To: devel@edk2.groups.io 
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua 
Subject: [PATCH v1 0/1] UefiPayloadPkg: Make Dsc accomodative of other archs

Current DSC files contains a lot of files which are
specific to X86 arch. Need to move around files under
arch specific sections.

Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Dhaval Sharma 

Dhaval (1):
  UefiPayloadPkg: Make Dsc accomodative of other archs

 UefiPayloadPkg/UefiPayloadPkg.dsc | 48 +++-
 1 file changed, 27 insertions(+), 21 deletions(-)

--
2.39.2



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




[edk2-devel] [PATCH v1] UefiPayloadPkg: UPL arch backward support ELF

2024-03-03 Thread Guo, Gua
From: Gua Guo 

After 11ad164bcea6b0ed3628d merge,
ELF format API won't meet backward requirement.

Cc: Guo Dong 
Cc: Sean Rhodes 
Reviewed-by: James Lu 
Cc: Gua Guo 
Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 49de882798..0423e6da17 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -348,7 +348,7 @@ def main():
 if os.path.exists (SectionFvFile) == False:
 continue
 if (args.Fit == False):
-status = ReplaceFv (UniversalPayloadBinary, SectionFvFile, 
SectionName)
+status = ReplaceFv (UniversalPayloadBinary, SectionFvFile, 
SectionName, args.Arch)
 else:
 status = ReplaceFv (UniversalPayloadBinary, SectionFvFile, 
SectionName.replace ("_", "-"), args.Arch)
 if status != 0:
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 1/1] UefiPayloadPkg: Cleanup ProcessLibraryConstructorList()

2024-03-15 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Friday, March 15, 2024 5:21 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; 
Rhodes, Sean ; Lu, James ; Guo, Gua 

Subject: [PATCH v1 1/1] UefiPayloadPkg: Cleanup ProcessLibraryConstructorList()

From: Bruce Wang 

ProcessLibraryConstructorList() no needs to be called manually after INF 
version greater or equal to 1.30.

Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: BruceX Wang 
---
 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c | 2 --
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 2 --
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c| 2 --
 3 files changed, 6 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
index eb0b325369..58a7e8190f 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
@@ -616,8 +616,6 @@ _ModuleEntryPoint (
mHobList = (VOID *)BootloaderParameter;   DxeFv= NULL;-  // Call 
constructor for all libraries-  ProcessLibraryConstructorList ();DEBUG 
((DEBUG_INFO, "Entering Universal Payload...\n"));   DEBUG ((DEBUG_INFO, 
"sizeof(UINTN) = 0x%x\n", sizeof (UINTN)));diff --git 
a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 030a5baed9..7c65869563 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -434,8 +434,6 @@ _ModuleEntryPoint (
 UniversalSerialPort->RegisterStride  = (UINT8)SerialPortInfo.RegWidth;   } 
-  // The library constructors might depend on serial port, so call it after 
serial port hob-  ProcessLibraryConstructorList ();   DEBUG ((DEBUG_INFO, 
"sizeof(UINTN) = 0x%x\n", sizeof (UINTN)));// Build HOB based on 
information from Bootloaderdiff --git 
a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index f37c00fad7..019b6b3d8b 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -462,8 +462,6 @@ _ModuleEntryPoint (
mHobList = (VOID *)BootloaderParameter;   DxeFv= NULL;-  // Call 
constructor for all libraries-  ProcessLibraryConstructorList ();DEBUG 
((DEBUG_INFO, "Entering Universal Payload...\n"));   DEBUG ((DEBUG_INFO, 
"sizeof(UINTN) = 0x%x\n", sizeof (UINTN)));-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH v1 06/13] UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib

2024-04-10 Thread Guo, Gua
Reviewed-by: Gua Guo 

From: Wu, Jiaxin 
Sent: Wednesday, April 10, 2024 9:57:17 PM
To: devel@edk2.groups.io 
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua ; Ni, Ray 

Subject: [PATCH v1 06/13] UefiPayloadPkg/UefiPayloadPkg.dsc: Include 
SmmRelocationLib

This patch just includes SmmRelocationLib in UefiPayloadPkg.

Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Cc: Ray Ni 
Signed-off-by: Jiaxin Wu 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 433fb51a56..328b7fd4fe 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -313,10 +313,12 @@
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
   FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
+  SmmRelocationLib|UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf
+
 [LibraryClasses.common]
 !if $(BOOTSPLASH_IMAGE)
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 !endif
--
2.16.2.windows.1



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




[edk2-devel] [PATCH v1 1/1] BaseTools/GetUtcDateTime.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
utcnow() and utcfromtimestamp() are deprecated
Prevent use it cause build error.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Gua Guo 
---
 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/GetUtcDateTime.py 
b/BaseTools/Scripts/GetUtcDateTime.py
index 3cfb6ac2ae..6764fb22a7 100644
--- a/BaseTools/Scripts/GetUtcDateTime.py
+++ b/BaseTools/Scripts/GetUtcDateTime.py
@@ -29,7 +29,7 @@ def Main():
 print ("ERROR: At least one argument is required!\n")
 PARSER.print_help()
 
-today = datetime.datetime.utcnow()
+today = datetime.datetime.now(datetime.UTC)
 if ARGS.year:
 ReversedNumber = str(today.year)[::-1]
 print (''.join(hex(ord(HexString))[2:] for HexString in 
ReversedNumber))
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5576
V1: Currently, Build FSP will be failure by python3.12 by calling 
GetUtcDateTime.py

Gua Guo (1):
  BaseTools/GetUtcDateTime.py: Python 3.12 support

 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

2024-04-21 Thread Guo, Gua
Hi @Liming Gao and @Rebecca Cran

May I get one of your help for code review + 1 ?
Maybe we can merge it EOW, I think it's no harmful change.

Thanks,
Gua

-Original Message-
From: Guo, Gua  
Sent: Sunday, April 21, 2024 8:51 PM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Kasbekar, Saloni 
Subject: [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5576
V1: Currently, Build FSP will be failure by python3.12 by calling 
GetUtcDateTime.py

Gua Guo (1):
  BaseTools/GetUtcDateTime.py: Python 3.12 support

 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5577
V1: Prevent Syntax Warning after upgrade python version to 3.12


Gua Guo (2):
  IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support
  IntelFsp2Pkg/PatchFv.py: Python 3.12 support

 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 IntelFsp2Pkg/Tools/PatchFv.py   | 24 -
 2 files changed, 60 insertions(+), 60 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 1/2] IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid
escape sequence now generates

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Duggapu Chinni B 
Cc: Star Zeng 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Signed-off-by: Gua Guo 
---
 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 13be81ddbc..79923c07ed 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -136,7 +136,7 @@ class CLogicalExpression:
 var = var.strip()
 if   re.match('^0x[a-fA-F0-9]+$', var):
 value = int(var, 16)
-elif re.match('^[+-]?\d+$', var):
+elif re.match(r'^[+-]?\d+$', var):
 value = int(var, 10)
 else:
 value = None
@@ -147,7 +147,7 @@ class CLogicalExpression:
 var = ''
 while not self.isLast():
 char = self.getCurr()
-if re.match('^[\w.]', char):
+if re.match(r'^[\w.]', char):
 var += char
 self.moveNext()
 else:
@@ -161,7 +161,7 @@ class CLogicalExpression:
 
 def parseSingleOp(self):
 self.skipSpace()
-if re.match('^NOT\W', self.getCurr(-1)):
+if re.match(r'^NOT\W', self.getCurr(-1)):
 self.moveNext(3)
 op  = self.parseBrace()
 val = self.getNumber (op)
@@ -225,7 +225,7 @@ class CLogicalExpression:
 value = self.parseCompare()
 while True:
 self.skipSpace()
-if re.match('^AND\W', self.getCurr(-1)):
+if re.match(r'^AND\W', self.getCurr(-1)):
 self.moveNext(3)
 result = self.parseCompare()
 test = self.getNonNumber(result, value)
@@ -243,10 +243,10 @@ class CLogicalExpression:
 while True:
 self.skipSpace()
 op = None
-if re.match('^XOR\W', self.getCurr(-1)):
+if re.match(r'^XOR\W', self.getCurr(-1)):
 self.moveNext(3)
 op = '^'
-elif re.match('^OR\W', self.getCurr(-1)):
+elif re.match(r'^OR\W', self.getCurr(-1)):
 self.moveNext(2)
 op = '|'
 else:
@@ -330,11 +330,11 @@ EndList
 continue
 if IsExpression:
 IsExpression = False
-Match = re.match("(\w+)=(.+)", Macro)
+Match = re.match(r"(\w+)=(.+)", Macro)
 if Match:
 self._MacroDict[Match.group(1)] = Match.group(2)
 else:
-Match = re.match("(\w+)", Macro)
+Match = re.match(r"(\w+)", Macro)
 if Match:
 self._MacroDict[Match.group(1)] = ''
 if len(self._MacroDict) == 0:
@@ -355,7 +355,7 @@ EndList
 
 def ExpandMacros (self, Input, Preserve = False):
 Line = Input
-Match = re.findall("\$\(\w+\)", Input)
+Match = re.findall(r"\$\(\w+\)", Input)
 if Match:
 for Each in Match:
   Variable = Each[2:-1]
@@ -370,7 +370,7 @@ EndList
 
 def ExpandPcds (self, Input):
 Line = Input
-Match = re.findall("(\w+\.\w+)", Input)
+Match = re.findall(r"(\w+\.\w+)", Input)
 if Match:
 for PcdName in Match:
   if PcdName in self._PcdsDict:
@@ -390,7 +390,7 @@ EndList
 return Result
 
 def ValueToByteArray (self, ValueStr, Length):
-Match = re.match("\{\s*FILE:(.+)\}", ValueStr)
+Match = re.match(r"\{\s*FILE:(.+)\}", ValueStr)
 if Match:
   FileList = Match.group(1).split(',')
   Result  = bytearray()
@@ -427,7 +427,7 @@ EndList
 if Each[0] in ['"', "'"]:
 Result.extend(list(bytearray(Each[1:-1], 'utf-8')))
 elif ':' in Each:
-Match= re.match("(.+):(\d+)b", Each)
+Match= re.match(r"(.+):(\d+)b", Each)
 if Match is None:
 raise Exception("Invald value list format '%s' !" 
% Each)
 InBitField = True
@@ -539,7 +539,7 @@ EndList
   continue
 
 Handle   = False
-Match= re.match("^\[(.+)\]", DscLine)
+Match= re.match(r"^\[(.+)\]", DscLine)
 if Match is not None:
 IsDefSect = False
 IsPcdSect = False
@@ -575,7 +575,7 @@ EndList
 
 Match = False if DscLine[0] != '!' else True
 if Match:
-Match = 
re.match("^!(else|endif|ifdef|ifndef|if|elseif|include)\s*(.+)?$", 
DscLine.split("#")[0])
+Match = 
re.match(r"^!(e

[edk2-devel] [PATCH v1 2/2] IntelFsp2Pkg/PatchFv.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid
escape sequence now generates

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Duggapu Chinni B 
Cc: Star Zeng 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Signed-off-by: Gua Guo 
---
 IntelFsp2Pkg/Tools/PatchFv.py | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 73ab877c71..bd9aa71e3c 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -143,7 +143,7 @@ class Symbols:
 fdIn.close()
 fvInfo['Base'] = 0
 for rptLine in rptLines:
-match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
+match = re.match(r"^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match:
 fvInfo['Base'] = int(match.group(1), 16)
 break
@@ -312,7 +312,7 @@ class Symbols:
 self.fdBase = 0x
 while (rptLine != "" ):
 #EFI_BASE_ADDRESS = 0xFFFDF400
-match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
+match = re.match(r"^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match is not None:
 self.fdBase = int(match.group(1), 16) - fvOffset
 break
@@ -340,7 +340,7 @@ class Symbols:
 fdIn = open(fvTxtFile, "r")
 rptLine  = fdIn.readline()
 while (rptLine != "" ):
-match = re.match("(0x[a-fA-F0-9]+)\s([0-9a-fA-F\-]+)", rptLine)
+match = re.match(r"(0x[a-fA-F0-9]+)\s([0-9a-fA-F\-]+)", rptLine)
 if match is not None:
 if match.group(2) in self.dictFfsOffset:
 self.dictFfsOffset[fvName + ':' + match.group(2)] = 
"0x%08X" % (int(match.group(1), 16) + fvOffset)
@@ -374,10 +374,10 @@ class Symbols:
 while (rptLine != "" ):
 if rptLine[0] != ' ':
 #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, 
EntryPoint=0x00fffb4958,Type=PE)
-match = 
re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)",
 rptLine)
+match = 
re.match(r"([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)",
 rptLine)
 if match is None:
 #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, 
EntryPoint=0x00fffb4958)
-match = 
re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
 rptLine)
+match = 
re.match(r"([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
 rptLine)
 if match is not None:
 foundModHdr = True
 modName = match.group(1)
@@ -386,7 +386,7 @@ class Symbols:
 self.dictModBase['%s:BASE'  % modName] = int 
(match.group(2), 16)
 self.dictModBase['%s:ENTRY' % modName] = int 
(match.group(3), 16)
 #(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 
.textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
-match = 
re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)",
 rptLine)
+match = 
re.match(r"\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)",
 rptLine)
 if match is not None:
 if foundModHdr:
 foundModHdr = False
@@ -399,7 +399,7 @@ class Symbols:
 else:
 #   0x00fff8016c__ModuleEntryPoint
 foundModHdr = False
-match = re.match("^\s+(0x[a-z0-9]+)\s+([_a-zA-Z0-9]+)", 
rptLine)
+match = re.match(r"^\s+(0x[a-z0-9]+)\s+([_a-zA-Z0-9]+)", 
rptLine)
 if match is not None:
 self.dictSymbolAddress["%s:%s"%(modName, match.group(2))] 
= match.group(1)
 rptLine  = fdIn.readline()
@@ -432,14 +432,14 @@ class Symbols:
 if reportLine.strip().find("Archive member included") != -1:
 #GCC
 #0x1d55IoRead8
-patchMapFileMatchString = 
"\s+(0x[0-9a-fA-F]{16})\s+([^\s][^0x][_a-zA-Z0-9\-]+)\s"
+patchMapFileMatchString = 
r"\s+(0x[0-9a-fA-F]{16})\s+([^\s][^0x][_a-zA-Z0-9\-]+)\s"
 matchKeyGroupIndex = 2
 matchSymbolGroupIndex  = 1
 prefix = '_'
 else:
 #MSFT
 #0003:0190   _gComBase  7a50 
SerialPo
-patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"
+patchMapFileMatchString =  
r"^\s[0-9a-fA-F]{

Re: [edk2-devel] [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

2024-04-21 Thread Guo, Gua
Hi FSP folks 

Need to get one of your help, to approve this PR, maybe we can merge it EOW.

Thanks
Gua
-Original Message-
From: Guo, Gua  
Sent: Monday, April 22, 2024 9:37 AM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5577
V1: Prevent Syntax Warning after upgrade python version to 3.12


Gua Guo (2):
  IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support
  IntelFsp2Pkg/PatchFv.py: Python 3.12 support

 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 IntelFsp2Pkg/Tools/PatchFv.py   | 24 -
 2 files changed, 60 insertions(+), 60 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 0/1] BaseTools/Fmmt.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5579

V1:
  Ref to https://docs.python.org/3/whatsnew/3.12.html
  A backslash-character pair that is not a valid
  escape sequence now generates

Gua Guo (1):
  BaseTools/Fmmt.py: Python 3.12 support

 BaseTools/Source/Python/FMMT/FMMT.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 1/1] BaseTools/Fmmt.py: Python 3.12 support

2024-04-21 Thread Guo, Gua
From: Gua Guo 

Ref to https://docs.python.org/3/whatsnew/3.12.html
A backslash-character pair that is not a valid
escape sequence now generates

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Gua Guo 
---
 BaseTools/Source/Python/FMMT/FMMT.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index 26fc4c5792..7505b6c88a 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -37,7 +37,7 @@ parser.add_argument("-l", "--LayoutFileName", 
dest="LayoutFileName", nargs='+',
 the file will be generated with default name 
(Layout_'InputFileName'.txt). \
 Currently supports two formats: json, txt. More 
formats will be added in the future")
 parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", nargs='+',
-help="Provide the target FmmtConf.ini file path: '-c 
C:\Code\FmmtConf.ini' \
+help="Provide the target FmmtConf.ini file path: '-c 
C:\\Code\\FmmtConf.ini' \
 FmmtConf file saves the target guidtool used in 
compress/uncompress process.\
 If do not provide, FMMT tool will search the inputfile 
folder for FmmtConf.ini firstly, if not found,\
 the FmmtConf.ini saved in FMMT tool's folder will be 
used as default.")
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

2024-04-21 Thread Guo, Gua
Thank @S, Ashraf Ali help for quick code review.

I've update rb message and will add push label tomorrow to make sure everyone 
aware this change.
PR: https://github.com/tianocore/edk2/pull/5577

Thanks,
Gua
-Original Message-
From: Guo, Gua 
Sent: Monday, April 22, 2024 9:41 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Duggapu, Chinni B 
; Zeng, Star ; Kuo, Ted 
; S, Ashraf Ali ; Mohapatra, Susovan 
; Kasbekar, Saloni 
Subject: RE: [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

Hi FSP folks 

Need to get one of your help, to approve this PR, maybe we can merge it EOW.

Thanks
Gua
-Original Message-
From: Guo, Gua  
Sent: Monday, April 22, 2024 9:37 AM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [PATCH v1 0/2] IntelFsp2Pkg: Python3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5577
V1: Prevent Syntax Warning after upgrade python version to 3.12


Gua Guo (2):
  IntelFsp2Pkg/GenCfgOpt.py: Python 3.12 support
  IntelFsp2Pkg/PatchFv.py: Python 3.12 support

 IntelFsp2Pkg/Tools/GenCfgOpt.py | 96 -
 IntelFsp2Pkg/Tools/PatchFv.py   | 24 -
 2 files changed, 60 insertions(+), 60 deletions(-)

--
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 0/1] BaseTools/Fmmt.py: Python 3.12 support

2024-04-22 Thread Guo, Gua
Hi @Chiu, Chasel and @Kinney, Michael D

As you know, Intel don't have owner own basetools now, may I get your help to 
reach the PR to maintainer.

Thanks,
Gua
-Original Message-
From: Guo, Gua  
Sent: Monday, April 22, 2024 9:50 AM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [PATCH v1 0/1] BaseTools/Fmmt.py: Python 3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5579

V1:
  Ref to https://docs.python.org/3/whatsnew/3.12.html
  A backslash-character pair that is not a valid
  escape sequence now generates

Gua Guo (1):
  BaseTools/Fmmt.py: Python 3.12 support

 BaseTools/Source/Python/FMMT/FMMT.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

2024-04-22 Thread Guo, Gua
Hi @Chiu, Chasel and @Kinney, Michael D

As you know, Intel don't have owner own basetools now, may I get your help to 
reach the PR to maintainer.

Thanks,
Gua

-Original Message-
From: Guo, Gua 
Sent: Monday, April 22, 2024 9:06 AM
To: devel@edk2.groups.io; Liming Gao ; Rebecca Cran 

Cc: Kasbekar, Saloni 
Subject: RE: [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

Hi @Liming Gao and @Rebecca Cran

May I get one of your help for code review + 1 ?
Maybe we can merge it EOW, I think it's no harmful change.

Thanks,
Gua

-Original Message-----
From: Guo, Gua  
Sent: Sunday, April 21, 2024 8:51 PM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Kasbekar, Saloni 
Subject: [PATCH v1 0/1] BaseTools/GetUtcDateTime.py 3.12 support

From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5576
V1: Currently, Build FSP will be failure by python3.12 by calling 
GetUtcDateTime.py

Gua Guo (1):
  BaseTools/GetUtcDateTime.py: Python 3.12 support

 BaseTools/Scripts/GetUtcDateTime.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 1/1] BaseTools/Fmmt.py: Python 3.12 support

2024-04-23 Thread Guo, Gua
Thanks @gaoliming for the reviewed-by, I've updated the RB info into PR and add 
push label.
https://github.com/tianocore/edk2/pull/5579

Thanks,
Gua
-Original Message-
From: gaoliming  
Sent: Tuesday, April 23, 2024 10:42 PM
To: devel@edk2.groups.io; Guo, Gua 
Cc: 'Rebecca Cran' ; Feng, Bob C ; 
Chen, Christine 
Subject: 回复: [edk2-devel] [PATCH v1 1/1] BaseTools/Fmmt.py: Python 3.12 support

Reviewed-by: Liming Gao 

> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Guo, Gua
> 发送时间: 2024年4月22日 9:50
> 收件人: devel@edk2.groups.io
> 抄送: gua@intel.com; Rebecca Cran ; Liming Gao 
> ; Bob Feng ; Yuwei 
> Chen 
> 主题: [edk2-devel] [PATCH v1 1/1] BaseTools/Fmmt.py: Python 3.12 support
> 
> From: Gua Guo 
> 
> Ref to https://docs.python.org/3/whatsnew/3.12.html
> A backslash-character pair that is not a valid escape sequence now 
> generates
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> Signed-off-by: Gua Guo 
> ---
>  BaseTools/Source/Python/FMMT/FMMT.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/FMMT/FMMT.py
> b/BaseTools/Source/Python/FMMT/FMMT.py
> index 26fc4c5792..7505b6c88a 100644
> --- a/BaseTools/Source/Python/FMMT/FMMT.py
> +++ b/BaseTools/Source/Python/FMMT/FMMT.py
> @@ -37,7 +37,7 @@ parser.add_argument("-l", "--LayoutFileName", 
> dest="LayoutFileName", nargs='+',
>  the file will be generated with default name 
> (Layout_'InputFileName'.txt). \
> 
>  Currently supports two formats: json, txt.
> More formats will be added in the future")
> 
>  parser.add_argument("-c", "--ConfigFilePath", dest="ConfigFilePath", 
> nargs='+',
> 
> -help="Provide the target FmmtConf.ini file path: '-c
> C:\Code\FmmtConf.ini' \
> 
> +help="Provide the target FmmtConf.ini file path: 
> + '-c
> C:\\Code\\FmmtConf.ini' \
> 
>  FmmtConf file saves the target guidtool used 
> in compress/uncompress process.\
> 
>  If do not provide, FMMT tool will search the 
> inputfile folder for FmmtConf.ini firstly, if not found,\
> 
>  the FmmtConf.ini saved in FMMT tool's folder 
> will be used as default.")
> 
> --
> 2.39.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#118064):
> https://edk2.groups.io/g/devel/message/118064
> Mute This Topic: https://groups.io/mt/105662555/4905953
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaolim...@byosoft.com.cn]
> -=-=-=-=-=-=
> 





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




Re: [edk2-devel] [PATCH v4 13/14] UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib

2024-04-26 Thread Guo, Gua
Reviewed-by: Gua Guo 

From: Wu, Jiaxin 
Sent: Friday, April 26, 2024 8:17:19 PM
To: devel@edk2.groups.io 
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua ; Ni, Ray 

Subject: [PATCH v4 13/14] UefiPayloadPkg/UefiPayloadPkg.dsc: Include 
SmmRelocationLib

This patch just includes SmmRelocationLib in UefiPayloadPkg.

Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Cc: Ray Ni 
Signed-off-by: Jiaxin Wu 
Reviewed-by: Gua Guo 
Reviewed-by: Guo Dong 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index e1b9d5ecf1..2860a659f6 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -314,10 +314,12 @@
   
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
   CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   AmdSvsmLib|UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
   FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
+  SmmRelocationLib|UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf
+
 [LibraryClasses.common]
 !if $(BOOTSPLASH_IMAGE)
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 !endif
--
2.16.2.windows.1



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




[edk2-devel] [PATCH v1 0/1] UefiPayloadPkg: Update swig install process

2024-05-15 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5661

V1: Update swig install process into ReadMe.md

Cc: Chasel Chiu 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Gua Guo (1):
  UefiPayloadPkg: Update ReadMe.md to swig install

 UefiPayloadPkg/Readme.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 1/1] UefiPayloadPkg: Update ReadMe.md to swig install

2024-05-15 Thread Guo, Gua
From: Gua Guo 

Update ReadMe.md for swig install process in
windows OS.

Cc: Chasel Chiu 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/Readme.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/Readme.md b/UefiPayloadPkg/Readme.md
index cb7f39b3f7..4149eab90d 100644
--- a/UefiPayloadPkg/Readme.md
+++ b/UefiPayloadPkg/Readme.md
@@ -55,11 +55,13 @@ FIT Format URL: 
https://universalpayload.github.io/spec/chapter2-payload-image-f
 ```
   - FIT
 - Windows
+  ```
+  Download and install swig by https://swig.org/ and also set install path 
into environment variable
+  ```
   ```powershell
   Set-ExecutionPolicy Bypass -Scope Process -Force; 
[System.Net.ServicePointManager]::SecurityProtocol = 
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object 
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
   choco install dtc-msys2
   pip3 install pefile
-  pip3 install swig
   pip3 install pylibfdt
   ```
 - Ubuntu
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 1/1] UefiPayloadPkg: Update ReadMe.md to swig install

2024-05-15 Thread Guo, Gua
Update RB info into PR, wait Edk2 202405 Hard Freeze unlock, will merge it.

-Original Message-
From: Dong, Guo  
Sent: Thursday, May 16, 2024 12:03 AM
To: Guo, Gua ; devel@edk2.groups.io
Cc: Chiu, Chasel ; Rhodes, Sean ; 
Lu, James 
Subject: RE: [PATCH v1 1/1] UefiPayloadPkg: Update ReadMe.md to swig install


Reviewed-by: Guo Dong 

-Original Message-
From: Guo, Gua  
Sent: Wednesday, May 15, 2024 3:23 AM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Chiu, Chasel ; Dong, 
Guo ; Rhodes, Sean ; Lu, James 

Subject: [PATCH v1 1/1] UefiPayloadPkg: Update ReadMe.md to swig install

From: Gua Guo 

Update ReadMe.md for swig install process in windows OS.

Cc: Chasel Chiu 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/Readme.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/Readme.md b/UefiPayloadPkg/Readme.md index 
cb7f39b3f7..4149eab90d 100644
--- a/UefiPayloadPkg/Readme.md
+++ b/UefiPayloadPkg/Readme.md
@@ -55,11 +55,13 @@ FIT Format URL: 
https://universalpayload.github.io/spec/chapter2-payload-image-f
 ```   - FIT - Windows+  ```+  Download and install swig by 
https://swig.org/ and also set install path into environment variable+  ``` 
  ```powershell   Set-ExecutionPolicy Bypass -Scope Process -Force; 
[System.Net.ServicePointManager]::SecurityProtocol = 
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object 
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 
  choco install dtc-msys2   pip3 install pefile-  pip3 install swig 
  pip3 install pylibfdt   ``` - Ubuntu-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix LoadDxeCore for payload size > 16MB

2024-06-05 Thread Guo, Gua
Please send PR also.

From: Lean Sheng Tan 
Sent: Wednesday, June 5, 2024 10:18:27 PM
To: devel@edk2.groups.io ; Witt, Sebastian 
; Guo, Gua ; Rhodes, Sean 
; Lu, James ; Dong, Guo 

Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix LoadDxeCore for payload 
size > 16MB

+ edk2 payload maintainers

Best Regards,
Lean Sheng Tan

[http://static.9elements.com/logo-signature.png]

9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
Email: sheng@9elements.com<mailto:sheng@9elements.com>
Phone: +49 234 68 94 188
Mobile: +49 176 76 113842

Registered office: Bochum
Commercial register: Amtsgericht Bochum, HRB 17519
Management: Sebastian German, Eray Bazaar

Data protection information according to Art. 13 
GDPR<https://9elements.com/privacy>


On Mon, 3 Jun 2024 at 23:20, Witt, Sebastian via groups.io<http://groups.io> 
mailto:siemens@groups.io>> wrote:

Fix calculation of first section in FileFindSection for FILE2 headers in 
UefiPayloadEntry module.

Signed-of-by: Sebastian Witt 
mailto:sebastian.w...@siemens.com>>
---
 UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c 
b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
index 898d610951..9cb6edefcf 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
@@ -211,13 +211,14 @@ FileFindSection (

   if (IS_FFS_FILE2 (FileHeader)) {
 FileSize = FFS_FILE2_SIZE (FileHeader);
+Section = (EFI_COMMON_SECTION_HEADER *)(((EFI_FFS_FILE_HEADER2 
*)FileHeader) + 1);
   } else {
 FileSize = FFS_FILE_SIZE (FileHeader);
+Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
   }

   FileSize -= sizeof (EFI_FFS_FILE_HEADER);

-  Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
   Index   = 0;
   while (Index < FileSize) {
 if (Section->Type == SectionType) {
--
2.39.2








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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix LoadDxeCore for payload size > 16MB

2024-06-10 Thread Guo, Gua
I’ve added push label, it will be merged tomorrow.

From: Lean Sheng Tan 
Sent: Monday, June 10, 2024 11:28 PM
To: Witt, Sebastian 
Cc: Guo, Gua ; devel@edk2.groups.io; Rhodes, Sean 
; Lu, James ; Dong, Guo 

Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix LoadDxeCore for payload 
size > 16MB

Hi Gua/ Dong Guo,
Do you know how to proceed?
https://github.com/tianocore/edk2/pull/5732
Does the patch submitter have to actively rebase its patch?

Best Regards,
Lean Sheng Tan

[http://static.9elements.com/logo-signature.png]
9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
Email: sheng@9elements.com<mailto:sheng@9elements.com>
Phone: +49 234 68 94 188
Mobile: +49 176 76 113842

Registered office: Bochum
Commercial register: Amtsgericht Bochum, HRB 17519
Management: Sebastian German, Eray Bazaar

Data protection information according to Art. 13 
GDPR<https://9elements.com/privacy>


On Thu, 6 Jun 2024 at 15:38, Witt, Sebastian 
mailto:sebastian.w...@siemens.com>> wrote:
Done here: https://github.com/tianocore/edk2/pull/5732

Regards,
Sebastian

From: Guo, Gua mailto:gua@intel.com>>
Sent: Wednesday, 5 June 2024 16:22
To: Tan, Lean Sheng mailto:sheng@9elements.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Witt, Sebastian (DI FA CTR 
IPC PRC2) mailto:sebastian.w...@siemens.com>>; 
Rhodes, Sean mailto:sean@starlabs.systems>>; Lu, James 
mailto:james...@intel.com>>; Dong, Guo 
mailto:guo.d...@intel.com>>
Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix LoadDxeCore for payload 
size > 16MB

Please send PR also.

From: Lean Sheng Tan mailto:sheng@9elements.com>>
Sent: Wednesday, June 5, 2024 10:18:27 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>; Witt, Sebastian 
mailto:sebastian.w...@siemens.com>>; Guo, Gua 
mailto:gua@intel.com>>; Rhodes, Sean 
mailto:sean@starlabs.systems>>; Lu, James 
mailto:james...@intel.com>>; Dong, Guo 
mailto:guo.d...@intel.com>>
Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix LoadDxeCore for payload 
size > 16MB

+ edk2 payload maintainers

Best Regards,
Lean Sheng Tan

[Image removed by sender.]
9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
Email: sheng@9elements.com<mailto:sheng@9elements.com>
Phone: +49 234 68 94 188
Mobile: +49 176 76 113842

Registered office: Bochum
Commercial register: Amtsgericht Bochum, HRB 17519
Management: Sebastian German, Eray Bazaar

Data protection information according to Art. 13 
GDPR<https://9elements.com/privacy>


On Mon, 3 Jun 2024 at 23:20, Witt, Sebastian via groups.io<http://groups.io/> 
mailto:siemens@groups.io>> wrote:

Fix calculation of first section in FileFindSection for FILE2 headers in 
UefiPayloadEntry module.

Signed-of-by: Sebastian Witt 
mailto:sebastian.w...@siemens.com>>
---
 UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c 
b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
index 898d610951..9cb6edefcf 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
@@ -211,13 +211,14 @@ FileFindSection (

   if (IS_FFS_FILE2 (FileHeader)) {
 FileSize = FFS_FILE2_SIZE (FileHeader);
+Section = (EFI_COMMON_SECTION_HEADER *)(((EFI_FFS_FILE_HEADER2 
*)FileHeader) + 1);
   } else {
 FileSize = FFS_FILE_SIZE (FileHeader);
+Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
   }

   FileSize -= sizeof (EFI_FFS_FILE_HEADER);

-  Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
   Index   = 0;
   while (Index < FileSize) {
 if (Section->Type == SectionType) {
--
2.39.2






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




Re: [edk2-devel] [PATCH v1 1/1] UefiPayloadPkg: Enable UPL FIT build config from cmdline

2024-06-10 Thread Guo, Gua
parser.add_argument('-c', '--DscPath', type=str, required=True, help='Path to 
the DSC file')
> required should be False

Default should be UefiPayloadPkg.dsc, --DscPath can give customized dsc path. I 
will be better for backward compatibility.

Thanks,
Gua

-Original Message-
From: Dhaval  
Sent: Monday, June 10, 2024 11:45 PM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Dong, Guo ; Lu, James 
; Rhodes, Sean 
Subject: [PATCH v1 1/1] UefiPayloadPkg: Enable UPL FIT build config from cmdline

Provide commandline configuration to select proper platform file.

Cc: Gua Guo 
Cc: Guo Dong 
Cc: James Lu 
Cc: Sean Rhodes 

Signed-off-by: Dhaval Sharma 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 0423e6da17ff..e2d2e3ffbd1f 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -112,6 +112,7 @@ def RunCommand(cmd):
 raise Exception("ERROR: when run command: %s"%cmd)

 

 def BuildUniversalPayload(Args):

+DscPath = os.path.normpath(Args.DscPath)

 BuildTarget = Args.Target

 ToolChain = Args.ToolChain

 Quiet = "--quiet"  if Args.Quiet else ""

@@ -140,7 +141,6 @@ def BuildUniversalPayload(Args):
 

 EntryOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
PayloadEntryToolChain), 
os.path.normpath("{}/UefiPayloadPkg/UefiPayloadEntry/{}/DEBUG/{}.dll".format 
(Args.Arch, UpldEntryFile, UpldEntryFile)))

 EntryModuleInf = 
os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/{}.inf".format 
(UpldEntryFile))

-DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")

 DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/DXEFV.Fv"))

 BdsFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/BDSFV.Fv"))

 NetworkFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/NETWORKFV.Fv"))

@@ -321,6 +321,7 @@ def main():
 parser.add_argument("-af", "--AddFv", type=ValidateAddFv, action='append', 
help='Add or replace specific FV into payload, Ex: uefi_fv=XXX.fv')

 parser.add_argument("-f", "--Fit", action='store_true', help='Build 
UniversalPayload file as UniversalPayload.fit', default=False)

 parser.add_argument('-l', "--LoadAddress", type=int, help='Specify payload 
load address', default =0x00080)

+parser.add_argument('-c', '--DscPath', type=str, required=True, help='Path 
to the DSC file')

 

 args = parser.parse_args()

 

-- 
2.40.1



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




Re: [edk2-devel] [PATCH v3 8/9] UefiPayloadPkg: Remove UefiCpuLib from module INFs.

2022-11-01 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Lu, James
Sent: Wednesday, November 2, 2022 1:23 PM
To: devel@edk2.groups.io; Liu, Zhiguang 
Cc: Yu Pu ; Dong, Guo ; Ni, Ray 
; Maurice Ma ; You, Benjamin 
; Rhodes, Sean 
Subject: Re: [edk2-devel] [PATCH v3 8/9] UefiPayloadPkg: Remove UefiCpuLib from 
module INFs.

Reviewed-by: James Lu 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Zhiguang Liu
Sent: Tuesday, November 1, 2022 3:59 PM
To: devel@edk2.groups.io
Cc: Yu Pu ; Dong, Guo ; Ni, Ray 
; Maurice Ma ; You, Benjamin 
; Rhodes, Sean 
Subject: [edk2-devel] [PATCH v3 8/9] UefiPayloadPkg: Remove UefiCpuLib from 
module INFs.

From: Yu Pu 

Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the dependency 
of UefiCpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
Reviewed-by: Ray Ni 
---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h| 1 -
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf  | 1 -
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 1 -
 UefiPayloadPkg/UefiPayloadPkg.dsc | 1 -
 4 files changed, 4 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h 
b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index d1c7425b28..ad8a9fd22b 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -24,7 +24,6 @@
 #include 
 #include   #include  -#include 
  #include   #include 

 #include 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf 
b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 95446dd997..d47e8e76cf 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -55,7 +55,6 @@
   PeCoffLib
   PlatformSupportLib
   CpuLib
-  UefiCpuLib
 
 [Guids]
   gEfiMemoryTypeInformationGuid
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf 
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 3b4836042a..c4f4f28eaa 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -53,7 +53,6 @@
   HobLib
   PeCoffLib
   CpuLib
-  UefiCpuLib
 
 [Guids]
   gEfiMemoryTypeInformationGuid
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1150be6acd..b7712d4de1 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -221,7 +221,6 @@
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
 
   #
--
2.31.1.windows.1













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




Re: [edk2-devel] [PATCH 4/8] UefiPayloadPkg: Use CcExitLib instead of VmgExitLib

2022-11-01 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Lu, James  
Sent: Wednesday, November 2, 2022 1:29 PM
To: Xu, Min M ; devel@edk2.groups.io
Cc: Dong, Guo ; Ni, Ray ; Rhodes, Sean 
; Guo, Gua 
Subject: RE: [PATCH 4/8] UefiPayloadPkg: Use CcExitLib instead of VmgExitLib

Reviewed-by: James Lu 

-Original Message-
From: Xu, Min M  
Sent: Wednesday, November 2, 2022 1:11 PM
To: devel@edk2.groups.io
Cc: Xu, Min M ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH 4/8] UefiPayloadPkg: Use CcExitLib instead of VmgExitLib

From: Min M Xu 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123

VmgExitLib is renamed as CcExitLib. So UefiPayloadPkg.dsc should be updated as 
well.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Min Xu 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1150be6acd0e..723a50a42284 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -301,7 +301,7 @@
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 
 [LibraryClasses.common]
--
2.29.2.windows.2



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Boot mode in PHIT HOB will not be updated

2022-11-03 Thread Guo, Gua
Give + 1, it can help to unlock Capsule Update through have correct Boot Mode 
value.

Reviewed-by: Gua Guo 
-Original Message-
From: Hsu, VictorX  
Sent: Thursday, November 3, 2022 5:11 PM
To: devel@edk2.groups.io
Cc: Hsu, VictorX ; Dong, Guo ; Ni, 
Ray ; Lu, James ; Guo, Gua 

Subject: [PATCH] UefiPayloadPkg: Boot mode in PHIT HOB will not be updated

From: VictorX Hsu 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4136

System will depend on Boot Mode value to do different behavior Update during 
Capsule Update process. So UPL need to support update boot mode.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: VictorX Hsu 
---
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index edb3c20471..2ae6b088ab 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -309,6 +309,7 @@ BuildHobs (
   EFI_HOB_FIRMWARE_VOLUME   *FvHob;   UNIVERSAL_PAYLOAD_ACPI_TABLE  
*AcpiTable;   ACPI_BOARD_INFO   *AcpiBoardInfo;+  
EFI_HOB_HANDOFF_INFO_TABLE*HobInfo;Hob.Raw   = (UINT8 
*)BootloaderParameter;   MinimalNeededSize = FixedPcdGet32 
(PcdSystemMemoryUefiRegionSize);@@ -368,7 +369,8 @@ BuildHobs (
 MemoryTop= FreeMemoryTop;   } -  HobConstructor ((VOID 
*)(UINTN)MemoryBottom, (VOID *)(UINTN)MemoryTop, (VOID 
*)(UINTN)FreeMemoryBottom, (VOID *)(UINTN)FreeMemoryTop);+  HobInfo = 
HobConstructor ((VOID *)(UINTN)MemoryBottom, (VOID *)(UINTN)MemoryTop, (VOID 
*)(UINTN)FreeMemoryBottom, (VOID *)(UINTN)FreeMemoryTop);+  HobInfo->BootMode = 
Hob.HandoffInformationTable->BootMode;   //   // From now on, mHobList will 
point to the new Hob range.   //-- 
2.28.0.windows.1



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: remove the redundant PCD definition.

2022-11-09 Thread Guo, Gua
In dec file, it have compatibility for [PcdsFixedAtBuild, 
PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
In UefiPayloadPkg.dsc, in the same time it only choose one of these attributes, 
so on UefiPayloadPkg is choosing DynamicEx PCD as its attribute.

Thanks,
Gua
From: devel@edk2.groups.io  On Behalf Of Jiading Zhang
Sent: Thursday, November 10, 2022 10:11 AM
To: Ni; Ni, Ray ; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: remove the redundant PCD 
definition.

Yes, these pcds is used by PciBus driver,  my comment is not correct. My 
intention is these PCDs have no value in the UefiPaylodPkd.dsc,  we can use the 
default values in MdeModulePkg.dec or  override the values in  
UefiPaylodPkd.dsc.

On Thu, Nov 10, 2022 at 09:58 AM, Ni, Ray wrote:

These PCDs are used by PciBus driver and MP init logic which are included in 
the UefiPayloadPkg.



From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Jiading Zhang
Sent: Thursday, November 10, 2022 9:53 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] UefiPayloadPkg: remove the redundant PCD 
definition.





The following PCDs have no value in the file of UefiPayloadPkg.dsc, and they 
are not used in UefiPayloadPkg, so remove them from [PcdsDynamicExDefault] 
section.

  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport

  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport

  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport

  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize

  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds

  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode

  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress

  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize



Signed-off-by: jdzhang 
mailto:jdzh...@kunluntech.com.cn>>

---

 UefiPayloadPkg/UefiPayloadPkg.dsc | 8 

 1 file changed, 8 deletions(-)



diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc

index 1150be6acd..43768909b3 100644

--- a/UefiPayloadPkg/UefiPayloadPkg.dsc

+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc

@@ -530,14 +530,6 @@

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|$(UART_DEFAULT_PARITY)

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|$(UART_DEFAULT_STOP_BITS)

   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|$(DEFAULT_TERMINAL_TYPE)

-  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport

-  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport

-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport

-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize

-  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds

-  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode

-  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress

-  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize

 !if ($(TARGET) == DEBUG || $(USE_CBMEM_FOR_CONSOLE) == TRUE)

   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE

 !else

--

2.38.1.windows.1







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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Define default values for the DynamicEX PCDs

2022-11-10 Thread Guo, Gua
Due to hardware freeze, it needs to wait after hardware freeze.

Reviewed-by: Gua Guo mailto:gua@intel.com>>

From: devel@edk2.groups.io  On Behalf Of Jiading Zhang
Sent: Friday, November 11, 2022 8:56 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Define default values for the 
DynamicEX PCDs

The following PCDs have no value in UefiPayloadPkg.dsc,and they can not pass 
the Ecc tool check, so assign the default values the same as they are in *.dec 
file.
  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport
  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport
  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport
  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize
  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds
  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode
  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress
  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize

Signed-off-by: jdzhang 
mailto:jdzh...@kunluntech.com.cn>>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1150be6acd..ce7d3a7f89 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -530,14 +530,14 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|$(UART_DEFAULT_PARITY)
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|$(UART_DEFAULT_STOP_BITS)
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|$(DEFAULT_TERMINAL_TYPE)
-  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport|FALSE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize|0x1
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|5
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode|1
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress|0x0
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize|0x0
 !if ($(TARGET) == DEBUG || $(USE_CBMEM_FOR_CONSOLE) == TRUE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
 !else
--
2.38.1.windows.1




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




[edk2-devel] Edk2 support MIPI SyS-T TraceHub Debug Library [TraceHubDebugLibSysT]

2022-11-22 Thread Guo, Gua
@Kinney, Michael D and 
@gaoliming

We want to add TraceHubDebug library support on Edk2. It's new added library on 
Edk2, so it doesn't have any backward and forward issue.

May I know have any process we may need to follow up. Have any comment or 
concern please also share for me.



Reviewers/Maintainers: @Prakashan, Krishnadas 
Veliyathuparambil, 
@Chan, Laura, @K N, 
Karthik.



USF UPL spec update: 
https://github.com/UniversalScalableFirmware/documentation/pull/52 (Done)

Edk2 Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4144 (On-Going)

Edk2 PR: https://github.com/tianocore/edk2/pull/3613 (On-Going)



Background:

  * Problem: In the UPL (Universal Payload) binary which contains only the 
Edk2 drivers, Tracehub debug message are missing during the execution of early 
DXE Core modules (before ReportStatusCode is ready).
  * Solution: Add TraceHub lib on Edk2, to be consumed by the UPL.


About TraceHubDebugLibSysT:

  *   Library is consumed by the DebugLib and StatusCodeHandler to send the 
PostCodes, ProgressCodes and DEBUG messages to the TraceHub/NPK in MIPI SyS-T 
format.
  *   The MIPI SyS-T APIs in this library are taken from the OpenSource 
implementation: https://github.com/MIPI-Alliance/public-mipi-sys-t.
  *   Library changes done for upstreaming:  MipiSystLib is rewritten to comply 
EDK2 coding standards and changed ways to pass trace address/verbosity with HOB 
directly instead of calling into TraceHubHookLib to get these info.
  *   Proposal With UPL: consume HOB gUniversalPayloadTraceHubDebugInfoGuid to 
print TraceHub Debug message in DXE Core

Thanks,
Gua


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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Support multiple-firmware volume

2022-11-23 Thread Guo, Gua
Reviewed-by: Gua Guo   

-Original Message-
From: Lin, MarsX  
Sent: Wednesday, November 23, 2022 6:50 PM
To: devel@edk2.groups.io
Cc: Lin, MarsX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Support multiple-firmware volume

From: MarsX Lin 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4164

To support multiple FVs provided by UPL

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: MarsX Lin 
---
 .../UefiPayloadEntry/UniversalPayloadEntry.c| 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 09aee89680..9df7d3ee19 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -397,12 +397,21 @@ BuildHobs (
   GuidHob = GetFirstGuidHob (&gUniversalPayloadExtraDataGuid);

   ASSERT (GuidHob != NULL);

   ExtraData = (UNIVERSAL_PAYLOAD_EXTRA_DATA *)GET_GUID_HOB_DATA (GuidHob);

-  ASSERT (ExtraData->Count == 1);

+  DEBUG ((DEBUG_INFO, "Multiple Fv Count=%d\n", ExtraData->Count));

   ASSERT (AsciiStrCmp (ExtraData->Entry[0].Identifier, "uefi_fv") == 0);

 

   *DxeFv = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)ExtraData->Entry[0].Base;

   ASSERT ((*DxeFv)->FvLength == ExtraData->Entry[0].Size);

-

+  //

+  // support multiple FVs provided by UPL

+  //

+  for (UINT8 idx = 1; idx < ExtraData->Count ; idx++) {

+BuildFvHob (ExtraData->Entry[idx].Base, ExtraData->Entry[idx].Size);

+DEBUG ((DEBUG_INFO, "UPL Multiple fv[%d], Base=0x%x, size=0x%x\n",

+idx,

+ExtraData->Entry[idx].Base,

+ExtraData->Entry[idx].Size));

+  }

   //

   // Create guid hob for acpi board information

   //

-- 
2.33.0.windows.2



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Define default values for the DynamicEX PCDs

2022-11-30 Thread Guo, Gua
@jdzh...@kunluntech.com.cn<mailto:jdzh...@kunluntech.com.cn>

Edk2 hardware freeze in unlock, Could you help send the Edk2 PR for it ? We can 
help to check in it to unlock the ECC failure.

Thanks
Gua
From: Guo, Gua
Sent: Friday, November 11, 2022 9:40 AM
To: devel@edk2.groups.io; jdzh...@kunluntech.com.cn
Subject: RE: [edk2-devel] [PATCH] UefiPayloadPkg: Define default values for the 
DynamicEX PCDs

Due to hardware freeze, it needs to wait after hardware freeze.

Reviewed-by: Gua Guo mailto:gua@intel.com>>

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of Jiading Zhang
Sent: Friday, November 11, 2022 8:56 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Define default values for the 
DynamicEX PCDs

The following PCDs have no value in UefiPayloadPkg.dsc,and they can not pass 
the Ecc tool check, so assign the default values the same as they are in *.dec 
file.
  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport
  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport
  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport
  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize
  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds
  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode
  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress
  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize

Signed-off-by: jdzhang 
mailto:jdzh...@kunluntech.com.cn>>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1150be6acd..ce7d3a7f89 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -530,14 +530,14 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|$(UART_DEFAULT_PARITY)
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|$(UART_DEFAULT_STOP_BITS)
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|$(DEFAULT_TERMINAL_TYPE)
-  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport|FALSE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize|0x1
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|5
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode|1
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress|0x0
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize|0x0
 !if ($(TARGET) == DEBUG || $(USE_CBMEM_FOR_CONSOLE) == TRUE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
 !else
--
2.38.1.windows.1




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




Re: [edk2-devel] Edk2 support MIPI SyS-T TraceHub Debug Library [TraceHubDebugLibSysT]

2022-11-30 Thread Guo, Gua
@Kinney, Michael D<mailto:michael.d.kin...@intel.com>

As we offline sync, there are below opens like below. Have any open, please 
also share for us.


  1.  Need to add TraceHub PCD into edk2/MdeModulePkg.uni at master * 
tianocore/edk2 * 
GitHub<https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModulePkg.uni>

Answer: Will update it in next patch

  1.  What about the license ?

Answer: It's BSD license, based on public-mipi-sys-t/LICENSE at master * 
MIPI-Alliance/public-mipi-sys-t 
(github.com)<https://github.com/MIPI-Alliance/public-mipi-sys-t/blob/master/LICENSE>

  1.  Is PcdTraceHubDebugAddress MMIO address ? If yes, why we use UINT32

Answer: It's MMIO address, we can change it to UINT64, it make sense to let the 
PCH more generic. Will update it in next patch.

  1.  For TraceHubWriteCataLog64_[0-6] try to use below macro to implement it.

#define VA_START va_start

#define VA_ARG   va_arg

#define VA_END   va_end

#define VA_LIST  va_list

Answer: Will update it in next patch

  1.  Is have SMM or MM version ?

Answer: MdeModulePkg/Library/TraceHubDebugLibSysT/DxeTraceHubDebugLibSyst.inf 
can take care for SMM case. We can rename it like below to make it more clearly.

MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf

  1.  Whether have any chance to use .gitsubmodule to leverage 
https://github.com/MIPI-Alliance/public-mipi-sys-t.

Answer: Will draft another PR and try to use gitsubmodule to check whether 
exist any predicament.

Thanks
Gua

From: Guo, Gua
Sent: Wednesday, November 23, 2022 3:29 PM
To: Kinney, Michael D ; gaoliming 
; devel@edk2.groups.io
Cc: Chan, Laura ; Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 
; Lu, James ; Chen, Arthur G 
; Chiu, Chasel ; Zimmer, 
Vincent ; Hsu, VictorX 
Subject: Edk2 support MIPI SyS-T TraceHub Debug Library [TraceHubDebugLibSysT]


@Kinney, Michael D<mailto:michael.d.kin...@intel.com> and 
@gaoliming<mailto:gaolim...@byosoft.com.cn>

We want to add TraceHubDebug library support on Edk2. It's new added library on 
Edk2, so it doesn't have any backward and forward issue.

May I know have any process we may need to follow up. Have any comment or 
concern please also share for me.



Reviewers/Maintainers: @Prakashan, Krishnadas 
Veliyathuparambil<mailto:krishnadas.veliyathuparambil.prakas...@intel.com>, 
@Chan, Laura<mailto:laura.c...@intel.com>, @K N, 
Karthik<mailto:karthik@intel.com>.



USF UPL spec update: 
https://github.com/UniversalScalableFirmware/documentation/pull/52 (Done)

Edk2 Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4144 (On-Going)

Edk2 PR: https://github.com/tianocore/edk2/pull/3613 (On-Going)



Background:

  * Problem: In the UPL (Universal Payload) binary which contains only the 
Edk2 drivers, Tracehub debug message are missing during the execution of early 
DXE Core modules (before ReportStatusCode is ready).
  * Solution: Add TraceHub lib on Edk2, to be consumed by the UPL.


About TraceHubDebugLibSysT:

  *   Library is consumed by the DebugLib and StatusCodeHandler to send the 
PostCodes, ProgressCodes and DEBUG messages to the TraceHub/NPK in MIPI SyS-T 
format.
  *   The MIPI SyS-T APIs in this library are taken from the OpenSource 
implementation: https://github.com/MIPI-Alliance/public-mipi-sys-t.
  *   Library changes done for upstreaming:  MipiSystLib is rewritten to comply 
EDK2 coding standards and changed ways to pass trace address/verbosity with HOB 
directly instead of calling into TraceHubHookLib to get these info.
  *   Proposal With UPL: consume HOB gUniversalPayloadTraceHubDebugInfoGuid to 
print TraceHub Debug message in DXE Core

Thanks,
Gua


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




Re: [edk2-devel] [PATCH v2 5/6] UefiPayloadPkg: Specifies SmmCpuSyncLib instance

2023-12-05 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wu, Jiaxin  
Sent: Thursday, November 30, 2023 2:32 PM
To: devel@edk2.groups.io
Cc: Laszlo Ersek ; Dong, Guo ; Rhodes, 
Sean ; Lu, James ; Guo, Gua 
; Ni, Ray ; Zeng, Star 

Subject: [PATCH v2 5/6] UefiPayloadPkg: Specifies SmmCpuSyncLib instance

This patch is to specify SmmCpuSyncLib instance for UefiPayloadPkg.

Cc: Laszlo Ersek 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Cc: Ray Ni 
Cc: Zeng Star 
Signed-off-by: Jiaxin Wu 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index a65f9d5b83..b8b13ad201 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -253,10 +253,11 @@
   #
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
   CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
+  SmmCpuSyncLib|UefiCpuPkg/Library/SmmCpuSyncLib/SmmCpuSyncLib.inf
 
   #
   # Platform
   #
 !if $(CPU_TIMER_LIB_ENABLE) == TRUE && $(UNIVERSAL_PAYLOAD) == TRUE
-- 
2.16.2.windows.1



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




Re: [edk2-devel] [PATCH 2/2] UefiPayloadPkg/UefiPayloadEntry: Add 5 level paging support

2023-12-06 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Liu, Zhiguang  
Sent: Thursday, December 7, 2023 10:40 AM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang ; Gao, Liming 
; Wu, Jiaxin ; Ni, Ray 
; Dong, Guo ; Rhodes, Sean 
; Lu, James ; Guo, Gua 

Subject: [PATCH 2/2] UefiPayloadPkg/UefiPayloadEntry: Add 5 level paging support

Add 5 level paging support when set the page table memory range as RO to 
protect page table.

Cc: Liming Gao 
Cc: Jiaxin Wu 
Cc: Ray Ni 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Zhiguang Liu 
---
 .../UefiPayloadEntry/Ia32/DxeLoadFunc.c   |  2 +-
 .../UefiPayloadEntry/X64/VirtualMemory.c  | 23 ---
 .../UefiPayloadEntry/X64/VirtualMemory.h  |  5 +++-
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c 
b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index 61a9f01ec9..4912298109 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -174,7 +174,7 @@ Create4GPageTablesIa32Pae (
   // Protect the page table by marking the memory used for page table to be
   // read-only.
   //
-  EnablePageTableProtection ((UINTN)PageMap, FALSE);
+  EnablePageTableProtection ((UINTN)PageMap, FALSE, FALSE);
 
   return (UINTN)PageMap;
 }
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c 
b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
index 1899404b24..8401eba83d 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
@@ -482,13 +482,15 @@ Split1GPageTo2M (
   @param[in] PageTableBaseBase address of page table (CR3).
   @param[in] Address  Start address of a page to be set as read-only.
   @param[in] Level4Paging Level 4 paging flag.
+  @param[in] Level5Paging Level 5 paging flag.
 
 **/
 VOID
 SetPageTablePoolReadOnly (
   IN  UINTN PageTableBase,
   IN  EFI_PHYSICAL_ADDRESS  Address,
-  IN  BOOLEAN   Level4Paging
+  IN  BOOLEAN   Level4Paging,
+  IN  BOOLEAN   Level5Paging
   )
 {
   UINTN Index;
@@ -498,9 +500,9 @@ SetPageTablePoolReadOnly (
   UINT64*PageTable;
   UINT64*NewPageTable;
   UINT64PageAttr;
-  UINT64LevelSize[5];
-  UINT64LevelMask[5];
-  UINTN LevelShift[5];
+  UINT64LevelSize[6];
+  UINT64LevelMask[6];
+  UINTN LevelShift[6];
   UINTN Level;
   UINT64PoolUnitSize;
 
@@ -517,23 +519,26 @@ SetPageTablePoolReadOnly (
   LevelShift[2] = PAGING_L2_ADDRESS_SHIFT;
   LevelShift[3] = PAGING_L3_ADDRESS_SHIFT;
   LevelShift[4] = PAGING_L4_ADDRESS_SHIFT;
+  LevelShift[5] = PAGING_L5_ADDRESS_SHIFT;
 
   LevelMask[1] = PAGING_4K_ADDRESS_MASK_64;
   LevelMask[2] = PAGING_2M_ADDRESS_MASK_64;
   LevelMask[3] = PAGING_1G_ADDRESS_MASK_64;
   LevelMask[4] = PAGING_1G_ADDRESS_MASK_64;
+  LevelMask[5] = 0;
 
   LevelSize[1] = SIZE_4KB;
   LevelSize[2] = SIZE_2MB;
   LevelSize[3] = SIZE_1GB;
   LevelSize[4] = SIZE_512GB;
+  LevelSize[5] = SIZE_256TB;
 
   AddressEncMask = PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) &
PAGING_1G_ADDRESS_MASK_64;
   PageTable= (UINT64 *)(UINTN)PageTableBase;
   PoolUnitSize = PAGE_TABLE_POOL_UNIT_SIZE;
 
-  for (Level = (Level4Paging) ? 4 : 3; Level > 0; --Level) {
+  for (Level = Level5Paging ? 5 : (Level4Paging ? 4 : 3); Level > 0; 
+ --Level) {
 Index  = ((UINTN)RShiftU64 (Address, LevelShift[Level]));
 Index &= PAGING_PAE_INDEX_MASK;
 
@@ -604,12 +609,14 @@ SetPageTablePoolReadOnly (
 
   @param[in] PageTableBaseBase address of page table (CR3).
   @param[in] Level4Paging Level 4 paging flag.
+  @param[in] Level5Paging Level 5 paging flag.
 
 **/
 VOID
 EnablePageTableProtection (
   IN  UINTNPageTableBase,
-  IN  BOOLEAN  Level4Paging
+  IN  BOOLEAN  Level4Paging,
+  IN  BOOLEAN  Level5Paging
   )
 {
   PAGE_TABLE_POOL   *HeadPool;
@@ -638,7 +645,7 @@ EnablePageTableProtection (
 // protection to them one by one.
 //
 while (PoolSize > 0) {
-  SetPageTablePoolReadOnly (PageTableBase, Address, Level4Paging);
+  SetPageTablePoolReadOnly (PageTableBase, Address, Level4Paging, 
+ Level5Paging);
   Address  += PAGE_TABLE_POOL_UNIT_SIZE;
   PoolSize -= PAGE_TABLE_POOL_UNIT_SIZE;
 }
@@ -933,7 +940,7 @@ CreateIdentityMappingPageTables (
   // Protect the page table by marking the memory used for page table to be
   // read-only.
   //
-  EnablePageTableProtection ((UINTN)PageMap, TRUE);
+  EnablePageTableProtection ((UINTN)PageMap, !Enable5LevelPaging, 
+ Enable5LevelPaging);
 
   //
   // Set IA32_EFER.NXE if necessary.
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.h 
b/UefiPayloadPkg/UefiPayloadEntry/X64/Virt

Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/DxeIpl: Add 5 level paging support

2023-12-14 Thread Guo, Gua
Reviewed-by: Gua Guo 

From: Liu, Zhiguang 
Sent: Thursday, December 14, 2023 3:59:38 PM
To: devel@edk2.groups.io 
Cc: Gao, Liming ; Wu, Jiaxin ; 
Ni, Ray ; Dong, Guo ; Rhodes, Sean 
; Lu, James ; Guo, Gua 

Subject: RE: [PATCH 1/2] MdeModulePkg/DxeIpl: Add 5 level paging support

Hi MdeModulePkg/UefiPayloadPkg Maintainers,

This patch set fix a potential issue when handling paging table.
Please help review.

Thanks
Zhiguang

> -Original Message-
> From: Liu, Zhiguang 
> Sent: Thursday, December 7, 2023 10:39 AM
> To: devel@edk2.groups.io
> Cc: Liu, Zhiguang ; Gao, Liming
> ; Wu, Jiaxin ; Ni, Ray
> ; Dong, Guo ; Rhodes, Sean
> ; Lu, James ; Guo, Gua
> 
> Subject: [PATCH 1/2] MdeModulePkg/DxeIpl: Add 5 level paging support
>
> Add 5 level paging support when set the page table memory range as RO to
> protect page table.
>
> Cc: Liming Gao 
> Cc: Jiaxin Wu 
> Cc: Ray Ni 
> Cc: Guo Dong 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Zhiguang Liu 
> ---
>  .../Core/DxeIplPeim/Ia32/DxeLoadFunc.c|  2 +-
>  .../Core/DxeIplPeim/X64/VirtualMemory.c   | 23 ---
>  .../Core/DxeIplPeim/X64/VirtualMemory.h   |  5 +++-
>  3 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
> b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
> index 65e9bdc99e..ba871dafc7 100644
> --- a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
> +++ b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
> @@ -166,7 +166,7 @@ Create4GPageTablesIa32Pae (
>// Protect the page table by marking the memory used for page table to be
>// read-only.
>//
> -  EnablePageTableProtection ((UINTN)PageMap, FALSE);
> +  EnablePageTableProtection ((UINTN)PageMap, FALSE, FALSE);
>
>return (UINTN)PageMap;
>  }
> diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> index 980c2002d4..1c2e29b132 100644
> --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> @@ -486,13 +486,15 @@ Split1GPageTo2M (
>@param[in] PageTableBaseBase address of page table (CR3).
>@param[in] Address  Start address of a page to be set as read-only.
>@param[in] Level4Paging Level 4 paging flag.
> +  @param[in] Level5Paging Level 5 paging flag.
>
>  **/
>  VOID
>  SetPageTablePoolReadOnly (
>IN  UINTN PageTableBase,
>IN  EFI_PHYSICAL_ADDRESS  Address,
> -  IN  BOOLEAN   Level4Paging
> +  IN  BOOLEAN   Level4Paging,
> +  IN  BOOLEAN   Level5Paging
>)
>  {
>UINTN Index;
> @@ -502,9 +504,9 @@ SetPageTablePoolReadOnly (
>UINT64*PageTable;
>UINT64*NewPageTable;
>UINT64PageAttr;
> -  UINT64LevelSize[5];
> -  UINT64LevelMask[5];
> -  UINTN LevelShift[5];
> +  UINT64LevelSize[6];
> +  UINT64LevelMask[6];
> +  UINTN LevelShift[6];
>UINTN Level;
>UINT64PoolUnitSize;
>
> @@ -521,23 +523,26 @@ SetPageTablePoolReadOnly (
>LevelShift[2] = PAGING_L2_ADDRESS_SHIFT;
>LevelShift[3] = PAGING_L3_ADDRESS_SHIFT;
>LevelShift[4] = PAGING_L4_ADDRESS_SHIFT;
> +  LevelShift[5] = PAGING_L5_ADDRESS_SHIFT;
>
>LevelMask[1] = PAGING_4K_ADDRESS_MASK_64;
>LevelMask[2] = PAGING_2M_ADDRESS_MASK_64;
>LevelMask[3] = PAGING_1G_ADDRESS_MASK_64;
>LevelMask[4] = PAGING_1G_ADDRESS_MASK_64;
> +  LevelMask[5] = 0;
>
>LevelSize[1] = SIZE_4KB;
>LevelSize[2] = SIZE_2MB;
>LevelSize[3] = SIZE_1GB;
>LevelSize[4] = SIZE_512GB;
> +  LevelSize[5] = SIZE_256TB;
>
>AddressEncMask = PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) &
> PAGING_1G_ADDRESS_MASK_64;
>PageTable= (UINT64 *)(UINTN)PageTableBase;
>PoolUnitSize = PAGE_TABLE_POOL_UNIT_SIZE;
>
> -  for (Level = (Level4Paging) ? 4 : 3; Level > 0; --Level) {
> +  for (Level = Level5Paging ? 5 : (Level4Paging ? 4 : 3); Level > 0;
> + --Level) {
>  Index  = ((UINTN)RShiftU64 (Address, LevelShift[Level]));
>  Index &= PAGING_PAE_INDEX_MASK;
>
> @@ -608,12 +613,14 @@ SetPageTablePoolReadOnly (
>
>@param[in] PageTableBaseBase address of page table (CR3).
>@param[in] Level4Paging Level 4 paging flag.
> +  @param[in] Level5Paging Level 5 paging flag.
>
>  **/
>  VOID
>  EnablePageTableProtection (
>IN  UINTNPageTableBase,
> -  IN  BOOLEAN 

Re: [edk2-devel] [PATCH] BaseTools: FMMT GuidTool Auto Select Config file Enabling

2023-12-18 Thread Guo, Gua
Hi @Gao, Liming and @Rebecca Cran

I may need to get your help for review it, any concern you can also share for 
us.

Thanks,
Gua

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Yuwei Chen
Sent: Friday, December 15, 2023 5:12 PM
To: devel@edk2.groups.io
Cc: Rebecca Cran ; Gao, Liming ; 
Feng, Bob C 
Subject: [edk2-devel] [PATCH] BaseTools: FMMT GuidTool Auto Select Config file 
Enabling

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4624

Currently, Python FMMT tool does not support automatically select FMMTConf.ini 
file which saves GuidTool settings.
This patch supports this features.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 

Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/GuidTools.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/core/GuidTools.py 
b/BaseTools/Source/Python/FMMT/core/GuidTools.py
index a25681709b..f6bdeffa50 100644
--- a/BaseTools/Source/Python/FMMT/core/GuidTools.py
+++ b/BaseTools/Source/Python/FMMT/core/GuidTools.py
@@ -110,7 +110,7 @@ class GUIDTools:
 if os.environ['FmmtConfPath']: self.tooldef_file = 
os.path.join(os.environ['FmmtConfPath'], 'FmmtConf.ini') else:- 
   PathList = os.environ['PATH']+PathList = 
os.environ['PATH'].split(os.pathsep) for CurrentPath in PathList:   
  if os.path.exists(os.path.join(CurrentPath, 'FmmtConf.ini')): 
self.tooldef_file = os.path.join(CurrentPath, 'FmmtConf.ini')-- 
2.42.0.windows.2



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




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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-05 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Ma, Hua  
Sent: Friday, January 5, 2024 2:19 PM
To: devel@edk2.groups.io; Guo, Gua ; Dong, Guo 
; Lu, James ; Rhodes, Sean 

Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection 
of timer

Add maintainers to help review the patch,

thank you,
Ma Hua

On 1/5/2024 1:38 PM, Ma, Hua wrote:
> Add macro to enable selection of timer
> 
> - HPET:  UEFI Payload will use HPET timer
> - LAPIC: UEFI Payload will use local APIC timer
> 
> Signed-off-by: Hua Ma 
> ---
>   UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
>   UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
>   2 files changed, 20 insertions(+)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index b8b13ad201..4f195c1e52 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -139,6 +139,12 @@
> # Note: for emulation platform such as QEMU, this may not work and should 
> set it as FALSE
> DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
>   
> +  #
> +  # HPET:  UEFI Payload will use HPET timer  # LAPIC: UEFI Payload 
> + will use local APIC timer  #
> +  DEFINE TIMER_SUPPORT  = HPET
> +
> DEFINE MULTIPLE_DEBUG_PORT_SUPPORT = FALSE
>   
>   [BuildOptions]
> @@ -676,7 +682,17 @@
> MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
>   
>   
> +!if $(TIMER_SUPPORT) == "HPET"
> PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +!elseif $(TIMER_SUPPORT) == "LAPIC"
> +  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf {
> +
> +  
> +NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInt
> +erruptTplLib.inf
> +  }
> +!else
> +  !error "Invalid TIMER_SUPPORT"
> +!endif
> +
> MdeModulePkg/Universal/Metronome/Metronome.inf
> MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index 835798be1c..7d04a8cffd 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -161,7 +161,11 @@ INF 
> MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>   !endif
>   INF UefiCpuPkg/CpuDxe/CpuDxe.inf
>   
> +!if $(TIMER_SUPPORT) == "HPET"
>   INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +!elseif $(TIMER_SUPPORT) == "LAPIC"
> +INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
> +!endif
>   INF MdeModulePkg/Universal/Metronome/Metronome.inf
>   INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>   INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf


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




Re: [edk2-devel] [PATCH 1/1] UefiPayloadPkg/UefiPayloadEntry: Remove SCI enabling check

2024-01-07 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Chen, Gang C  
Sent: Monday, January 8, 2024 3:26 PM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Dong, Guo ; Lu, James 
; Rhodes, Sean ; Chen, Gang C 

Subject: [PATCH 1/1] UefiPayloadPkg/UefiPayloadEntry: Remove SCI enabling check

It's too early to check the SCI enable status, which is set in the BDS phase 
ususally. Remove the check from UPL.

Signed-off-by: Gang Chen 
Cc: Gua Guo 
Cc: Guo Dong 
Cc: James Lu 
Cc: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c | 38 -
 1 file changed, 38 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c 
b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
index 1b9208b6d3..748728981a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
@@ -134,44 +134,6 @@ Done:
   ASSERT (Fadt->Pm1aEvtBlk != 0);   ASSERT (Fadt->Gpe0Blk != 0); -  
DEBUG_CODE_BEGIN ();-  BOOLEAN  SciEnabled;--  //-  // Check the consistency of 
SCI enabling-  //--  //-  // Get SCI_EN value-  //-  if (Fadt->Pm1CntLen == 4) 
{-SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0) ? TRUE : FALSE;-  } 
else {-//-// if (Pm1CntLen == 2), use 16 bit IO read;-// if 
(Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback-//-
SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0) ? TRUE : FALSE;-  }--  if 
(!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&-  (Fadt->SmiCmd == 0) &&- 
 !SciEnabled)-  {-//-// The ACPI enabling status is inconsistent: 
SCI is not enabled but ACPI-// table does not provide a means to enable it 
through FADT->SmiCmd-//-DEBUG ((-  DEBUG_ERROR,-  "ERROR: The 
ACPI enabling status is inconsistent: SCI is not"-  " enabled but the ACPI 
table does not provide a means to enable it through FADT->SmiCmd."-  " This 
may cause issues in OS.\n"-  ));-  }--  DEBUG_CODE_END ();-   return 
RETURN_SUCCESS; } -- 
2.40.1



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




[edk2-devel] [PATCH v1 0/4] Bz4166: Integer Overflow in CreateHob()

2024-01-10 Thread Guo, Gua
From: Gua Guo 

Fix Integer Overflow for CVE-2022-36765
1. UefiPayloadPkg/Hob: Integer Overflow in CreateHob()
2. StandaloneMmPkg/Hob: Integer Overflow in CreateHob()
3. EmbeddedPkg/Hob: Integer Overflow in CreateHob()
4. MdeModulePkg/Hob: Integer Overflow in CreateHob()


Gerd Hoffmann (4):
  UefiPayloadPkg/Hob: Integer Overflow in CreateHob()
  StandaloneMmPkg/Hob: Integer Overflow in CreateHob()
  EmbeddedPkg/Hob: Integer Overflow in CreateHob()
  MdeModulePkg/Hob: Integer Overflow in CreateHob()

 EmbeddedPkg/Library/PrePiHobLib/Hob.c   | 6 ++
 MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
 .../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c | 6 ++
 UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c | 6 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 1/4] UefiPayloadPkg/Hob: Integer Overflow in CreateHob()

2024-01-10 Thread Guo, Gua
From: Gerd Hoffmann 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Reviewed-by: Gua Guo 
Cc: John Mathew 
Signed-off-by: Gerd Hoffmann 
---
 UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c 
b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index 2c3acbbc19..f2bd2650b6 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -110,6 +110,12 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

2024-01-10 Thread Guo, Gua
From: Gerd Hoffmann 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Ray Ni 
Cc: John Mathew 
Signed-off-by: Gerd Hoffmann 
---
 .../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
index 1550e1babc..29ade2e4ef 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
@@ -34,6 +34,12 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 3/4] EmbeddedPkg/Hob: Integer Overflow in CreateHob()

2024-01-10 Thread Guo, Gua
From: Gerd Hoffmann 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Abner Chang 
Cc: John Mathew 
Signed-off-by: Gerd Hoffmann 
---
 EmbeddedPkg/Library/PrePiHobLib/Hob.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c 
b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
index 8eb175aa96..ee2e3176be 100644
--- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
+++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
@@ -110,6 +110,12 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v1 4/4] MdeModulePkg/Hob: Integer Overflow in CreateHob()

2024-01-10 Thread Guo, Gua
From: Gerd Hoffmann 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Liming Gao 
Cc: John Mathew 
Signed-off-by: Gerd Hoffmann 
---
 MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c b/MdeModulePkg/Core/Pei/Hob/Hob.c
index c4882a23cd..985da50995 100644
--- a/MdeModulePkg/Core/Pei/Hob/Hob.c
+++ b/MdeModulePkg/Core/Pei/Hob/Hob.c
@@ -85,7 +85,7 @@ PeiCreateHob (
   //
   // Check Length to avoid data overflow.
   //
-  if (0x1 - Length <= 0x7) {
+  if (MAX_UINT16 - Length < 0x7) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v1 0/4] Bz4166: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
CC: @Mathews, John and @Zimmer, Vincent

Hi @Gerd Hoffmann

My company teammate share me your patch can resolved 
https://bugzilla.tianocore.org/show_bug.cgi?id=4166. So the signed-off name is 
your name. 

If you have any concern, you can also share for me, if you don't have concern 
please also let me know, before merging it.

It's PR https://github.com/tianocore/edk2/pull/5252/

Thanks,
Gua
-Original Message-
From: devel@edk2.groups.io  On Behalf Of Guo, Gua
Sent: Thursday, January 11, 2024 1:15 PM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [edk2-devel] [PATCH v1 0/4] Bz4166: Integer Overflow in CreateHob()

From: Gua Guo 

Fix Integer Overflow for CVE-2022-36765
1. UefiPayloadPkg/Hob: Integer Overflow in CreateHob() 2. StandaloneMmPkg/Hob: 
Integer Overflow in CreateHob() 3. EmbeddedPkg/Hob: Integer Overflow in 
CreateHob() 4. MdeModulePkg/Hob: Integer Overflow in CreateHob()


Gerd Hoffmann (4):
  UefiPayloadPkg/Hob: Integer Overflow in CreateHob()
  StandaloneMmPkg/Hob: Integer Overflow in CreateHob()
  EmbeddedPkg/Hob: Integer Overflow in CreateHob()
  MdeModulePkg/Hob: Integer Overflow in CreateHob()

 EmbeddedPkg/Library/PrePiHobLib/Hob.c   | 6 ++
 MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
 .../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c | 6 ++
 UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c | 6 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

--
2.39.2.windows.1








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




[edk2-devel] [PATCH v2 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Reviewed-by: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Ray Ni 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 .../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c| 7 +++
 1 file changed, 7 insertions(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
index 1550e1babc..bb8426dc0a 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
@@ -34,6 +34,13 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
+
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 0/4] Bz4166: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

V2
1. UefiPayloadPkg/Hob: Integer : Add Reviewed-by and Authored-by

2. StandaloneMmPkg/Hob: Integer Overflow in : Add Reviewed-by and Authored-by

3. EmbeddedPkg/Hob: Integer Overflow in CreateHob() : Add Reviewed-by and 
Authored-by

4. MdeModulePkg/Hob: Integer Overflow in CreateHob() : Add Authored-by

V1

1. UefiPayloadPkg/Hob: Integer

2. StandaloneMmPkg/Hob: Integer Overflow in

3. EmbeddedPkg/Hob: Integer Overflow in CreateHob()

4. MdeModulePkg/Hob: Integer Overflow in CreateHob()

Cc: Ard Biesheuvel 

Cc: Gerd Hoffmann 

Cc: John Mathew 

Cc: Vincent Zimmer 

Gua Guo (4):
  UefiPayloadPkg/Hob: Integer Overflow in CreateHob()
  StandaloneMmPkg/Hob: Integer Overflow in CreateHob()
  EmbeddedPkg/Hob: Integer Overflow in CreateHob()
  MdeModulePkg/Hob: Integer Overflow in CreateHob()

 EmbeddedPkg/Library/PrePiHobLib/Hob.c  | 7 +++
 MdeModulePkg/Core/Pei/Hob/Hob.c| 2 +-
 .../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c| 7 +++
 UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c| 7 +++
 4 files changed, 22 insertions(+), 1 deletion(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 3/4] EmbeddedPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Leif Lindholm 
Reviewed-by: Ard Biesheuvel 
Cc: Abner Chang 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 EmbeddedPkg/Library/PrePiHobLib/Hob.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c 
b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
index 8eb175aa96..1fe3ea93e4 100644
--- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
+++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
@@ -110,6 +110,13 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
+
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 1/4] UefiPayloadPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Reviewed-by: Gua Guo 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c 
b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index 2c3acbbc19..39f07d1964 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -110,6 +110,13 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
+
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 4/4] MdeModulePkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Liming Gao 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c b/MdeModulePkg/Core/Pei/Hob/Hob.c
index c4882a23cd..985da50995 100644
--- a/MdeModulePkg/Core/Pei/Hob/Hob.c
+++ b/MdeModulePkg/Core/Pei/Hob/Hob.c
@@ -85,7 +85,7 @@ PeiCreateHob (
   //
   // Check Length to avoid data overflow.
   //
-  if (0x1 - Length <= 0x7) {
+  if (MAX_UINT16 - Length < 0x7) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v2 4/4] MdeModulePkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
Hi @Gao, Liming

I may need to get your help to check this change when you're available.
If it's fine for you from MdeModulePkg. I think we can merge this PR.

https://github.com/tianocore/edk2/pull/5252

Thanks,
Gua

-Original Message-----
From: Guo, Gua  
Sent: Thursday, January 11, 2024 5:15 PM
To: devel@edk2.groups.io
Cc: Guo, Gua ; Marc Beatove ; Gao, 
Liming ; Mathews, John ; Gerd 
Hoffmann 
Subject: [PATCH v2 4/4] MdeModulePkg/Hob: Integer Overflow in CreateHob()

From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8 performing the 
following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ```

No checks are performed to ensure this value doesn't overflow, and could lead 
to CreateHob() returning a smaller HOB than requested, which could lead to OOB 
HOB accesses.

Reported-by: Marc Beatove 
Cc: Liming Gao 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c b/MdeModulePkg/Core/Pei/Hob/Hob.c 
index c4882a23cd..985da50995 100644
--- a/MdeModulePkg/Core/Pei/Hob/Hob.c
+++ b/MdeModulePkg/Core/Pei/Hob/Hob.c
@@ -85,7 +85,7 @@ PeiCreateHob (
   //   // Check Length to avoid data overflow.   //-  if (0x1 - Length <= 
0x7) {+  if (MAX_UINT16 - Length < 0x7) { return EFI_INVALID_PARAMETER;   } 
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v2 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
You mean we need to add below error handle after all callers ?

Hob = CreateHob (...)
ASSERT (Hob != NULL); < Here


Thanks,
Gua
-Original Message-
From: Sami Mujawar  
Sent: Thursday, January 11, 2024 10:06 PM
To: Guo, Gua ; devel@edk2.groups.io
Cc: Marc Beatove ; Ard Biesheuvel 
; Ni, Ray ; Mathews, John 
; Gerd Hoffmann ; nd 
Subject: Re: [PATCH v2 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

Hi Gua,

Thank you for this patch.
Please see my response inline marked [SAMI].

Regards,

Sami Mujawar

On 11/01/2024, 09:15, "gua@intel.com <mailto:gua@intel.com>" 
mailto:gua@intel.com>> wrote:


From: Gua Guo mailto:gua@intel.com>>


REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166 
<https://bugzilla.tianocore.org/show_bug.cgi?id=4166>


Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765


The CreateHob() function aligns the requested size to 8 performing the 
following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ```


No checks are performed to ensure this value doesn't overflow, and could lead 
to CreateHob() returning a smaller HOB than requested, which could lead to OOB 
HOB accesses.


Reported-by: Marc Beatove mailto:mbeat...@google.com>>
Reviewed-by: Ard Biesheuvel mailto:ardb+tianoc...@kernel.org>>
Cc: Sami Mujawar mailto:sami.muja...@arm.com>>
Cc: Ray Ni mailto:ray...@intel.com>>
Cc: John Mathew mailto:john.math...@intel.com>>
Authored-by: Gerd Hoffmann mailto:kra...@redhat.com>>
Signed-off-by: Gua Guo mailto:gua@intel.com>>
---
.../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c | 7 +++
1 file changed, 7 insertions(+)


diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
index 1550e1babc..bb8426dc0a 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCor
+++ eHobLib.c
@@ -34,6 +34,13 @@ CreateHob (




HandOffHob = GetHobList ();






+ //


+ // Check Length to avoid data overflow.


+ //


+ if (HobLength > MAX_UINT16 - 0x7) {


+ return NULL;
[SAMI] Although this fix is correct, I think it shifts the problem somewhere 
else. 
If the above condition occurs, a NULL is returned. A quick scan reveals that 
the calling functions do not check the returned value before use.
e.g. 
https://github.com/tianocore/edk2/blob/master/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c#L167-L170
There are multiple such places where the calling functions do not check the 
pointer returned by CreateHob(). 
I believe a similar situation can happen for the other patches in this series.
[/SAMI]

+ }


+


HobLength = (UINT16)((HobLength + 0x7) & (~0x7));






FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;


--
2.39.2.windows.1







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




Re: [edk2-devel] [PATCH v2 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
Maybe I can add error handle but they will have several case need to do if it's 
fine.
It maybe increasing some BIOS size.

Error Handle Error HandleError Handle   
Error Handle
A > B -> C --> CreateHob 
> return NULL

All caller chain may need to add it if we really want to prevent it on release.

Thanks,
Gua
-Original Message-
From: Sami Mujawar  
Sent: Thursday, January 11, 2024 11:02 PM
To: Guo, Gua ; devel@edk2.groups.io
Cc: Marc Beatove ; Ard Biesheuvel 
; Ni, Ray ; Mathews, John 
; Gerd Hoffmann ; nd 
Subject: Re: [PATCH v2 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

Hi Gua,

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar
On 11/01/2024, 14:19, "Guo, Gua" mailto:gua@intel.com>> wrote:


You mean we need to add below error handle after all callers ?


Hob = CreateHob (...)
ASSERT (Hob != NULL); < Here [SAMI] That would certainly help 
catch issues in the debug builds. But the problem with asserts is, they vanish 
in release builds. 
I think we should consider adding appropriate error handling in the calling 
functions to make sure that they do not result in a crash.
[/SAMI]




Thanks,
Gua
-Original Message-
From: Sami Mujawar mailto:sami.muja...@arm.com>>
Sent: Thursday, January 11, 2024 10:06 PM
To: Guo, Gua mailto:gua@intel.com>>; 
devel@edk2.groups.io <mailto:devel@edk2.groups.io>
Cc: Marc Beatove mailto:mbeat...@google.com>>; Ard 
Biesheuvel mailto:ardb+tianoc...@kernel.org>>; Ni, 
Ray mailto:ray...@intel.com>>; Mathews, John 
mailto:john.math...@intel.com>>; Gerd Hoffmann 
mailto:kra...@redhat.com>>; nd mailto:n...@arm.com>>
Subject: Re: [PATCH v2 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()


Hi Gua,


Thank you for this patch.
Please see my response inline marked [SAMI].


Regards,


Sami Mujawar


On 11/01/2024, 09:15, "gua@intel.com <mailto:gua@intel.com> 
<mailto:gua@intel.com <mailto:gua@intel.com>>" mailto:gua@intel.com> <mailto:gua@intel.com 
<mailto:gua@intel.com>>> wrote:




From: Gua Guo mailto:gua@intel.com> 
<mailto:gua@intel.com <mailto:gua@intel.com>>>




REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166 
<https://bugzilla.tianocore.org/show_bug.cgi?id=4166> 
<https://bugzilla.tianocore.org/show_bug.cgi?id=4166> 
<https://bugzilla.tianocore.org/show_bug.cgi?id=4166>;>




Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765




The CreateHob() function aligns the requested size to 8 performing the 
following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ```




No checks are performed to ensure this value doesn't overflow, and could lead 
to CreateHob() returning a smaller HOB than requested, which could lead to OOB 
HOB accesses.




Reported-by: Marc Beatove mailto:mbeat...@google.com> 
<mailto:mbeat...@google.com <mailto:mbeat...@google.com>>>
Reviewed-by: Ard Biesheuvel mailto:ardb+tianoc...@kernel.org> <mailto:ardb+tianoc...@kernel.org 
<mailto:ardb+tianoc...@kernel.org>>>
Cc: Sami Mujawar mailto:sami.muja...@arm.com> 
<mailto:sami.muja...@arm.com <mailto:sami.muja...@arm.com>>>
Cc: Ray Ni mailto:ray...@intel.com> <mailto:ray...@intel.com 
<mailto:ray...@intel.com>>>
Cc: John Mathew mailto:john.math...@intel.com> 
<mailto:john.math...@intel.com <mailto:john.math...@intel.com>>>
Authored-by: Gerd Hoffmann mailto:kra...@redhat.com> 
<mailto:kra...@redhat.com <mailto:kra...@redhat.com>>>
Signed-off-by: Gua Guo mailto:gua@intel.com> 
<mailto:gua@intel.com <mailto:gua@intel.com>>>
---
.../StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c | 7 +++
1 file changed, 7 insertions(+)




diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
index 1550e1babc..bb8426dc0a 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCor
+++ eHobLib.c
@@ -34,6 +34,13 @@ CreateHob (








HandOffHob = GetHobList ();












+ //




+ // Check Length to avoid data overflow.




+ //




+ if (HobLength > MAX_UINT16 - 0x7) {




+ return NULL;
[SAMI] Although this fix is correct, I think it shifts the problem somewhere 
else. 
If the above condition occurs, a NULL is returned. A quick scan reveals that 
the calling functions do not check the returned value before use.
e.g. 
https://github.com/tianocore/edk2/blob/master/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/St

[edk2-devel] [PATCH v3 0/4] Bz4166: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

PR: https://github.com/tianocore/edk2/pull/5252

V3
1. UefiPayloadPkg/Hob: Integer : Add error handle

2. StandaloneMmPkg/Hob: Integer Overflow in : Add error handle

3. EmbeddedPkg/Hob: Integer Overflow in CreateHob() : Add error handle

V2
1. UefiPayloadPkg/Hob: Integer : Add Reviewed-by and Authored-by

2. StandaloneMmPkg/Hob: Integer Overflow in : Add Reviewed-by and Authored-by

3. EmbeddedPkg/Hob: Integer Overflow in CreateHob() : Add Reviewed-by and 
Authored-by

4. MdeModulePkg/Hob: Integer Overflow in CreateHob() : Add Authored-by

V1

1. UefiPayloadPkg/Hob: Integer

2. StandaloneMmPkg/Hob: Integer Overflow in

3. EmbeddedPkg/Hob: Integer Overflow in CreateHob()

4. MdeModulePkg/Hob: Integer Overflow in CreateHob()

Cc: Ard Biesheuvel 

Cc: Gerd Hoffmann 

Cc: John Mathew 

Cc: Vincent Zimmer 

Cc: Sami Mujawar 

Gua Guo (4):
  UefiPayloadPkg/Hob: Integer Overflow in CreateHob()
  StandaloneMmPkg/Hob: Integer Overflow in CreateHob()
  EmbeddedPkg/Hob: Integer Overflow in CreateHob()
  MdeModulePkg/Hob: Integer Overflow in CreateHob()

 EmbeddedPkg/Library/PrePiHobLib/Hob.c | 43 +++
 MdeModulePkg/Core/Pei/Hob/Hob.c   |  2 +-
 .../Arm/StandaloneMmCoreHobLib.c  | 35 +++
 .../Library/PayloadEntryHobLib/Hob.c  | 43 +++
 .../FitUniversalPayloadEntry.c|  8 ++--
 .../UefiPayloadEntry/UniversalPayloadEntry.c  |  8 ++--
 6 files changed, 132 insertions(+), 7 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 1/4] UefiPayloadPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Reviewed-by: Gua Guo 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 .../Library/PayloadEntryHobLib/Hob.c  | 43 +++
 .../FitUniversalPayloadEntry.c|  8 ++--
 .../UefiPayloadEntry/UniversalPayloadEntry.c  |  8 ++--
 3 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c 
b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index 2c3acbbc19..51c2e28d7d 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -110,6 +110,13 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
+
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
@@ -160,6 +167,9 @@ BuildResourceDescriptorHob (
 
   Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof 
(EFI_HOB_RESOURCE_DESCRIPTOR));
   ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->ResourceType  = ResourceType;
   Hob->ResourceAttribute = ResourceAttribute;
@@ -330,6 +340,10 @@ BuildModuleHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION_MODULE));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   CopyGuid (&(Hob->MemoryAllocationHeader.Name), 
&gEfiHobMemoryAllocModuleGuid);
   Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
@@ -378,6 +392,11 @@ BuildGuidHob (
   ASSERT (DataLength <= (0x - sizeof (EFI_HOB_GUID_TYPE)));
 
   Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16)(sizeof 
(EFI_HOB_GUID_TYPE) + DataLength));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return NULL;
+  }
+
   CopyGuid (&Hob->Name, Guid);
   return Hob + 1;
 }
@@ -441,6 +460,10 @@ BuildFvHob (
   EFI_HOB_FIRMWARE_VOLUME  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress = BaseAddress;
   Hob->Length  = Length;
@@ -472,6 +495,10 @@ BuildFv2Hob (
   EFI_HOB_FIRMWARE_VOLUME2  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress = BaseAddress;
   Hob->Length  = Length;
@@ -513,6 +540,10 @@ BuildFv3Hob (
   EFI_HOB_FIRMWARE_VOLUME3  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB_FIRMWARE_VOLUME3));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress  = BaseAddress;
   Hob->Length   = Length;
@@ -546,6 +577,10 @@ BuildCpuHob (
   EFI_HOB_CPU  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->SizeOfMemorySpace = SizeOfMemorySpace;
   Hob->SizeOfIoSpace = SizeOfIoSpace;
@@ -583,6 +618,10 @@ BuildStackHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION_STACK));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
@@ -664,6 +703,10 @@ BuildMemoryAllocationHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
diff --git a/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
index d2e7df4fbe..eb0b325369 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
@@ -207,10 +207,12 @@ AddNewHob (
   }
 
   NewHob.Header = CreateHob (Hob->Header->HobType, Hob->Header->HobLength);
-
-  if (NewHob.Header != NULL) {
-CopyMem (NewHob.Header + 1, Hob->Header + 1, Hob->Header->HobLength - 
sizeof (EFI_HOB_GENERIC_HEADER));
+  ASSERT (NewHob.Header != NULL);
+  if (NewHob.Header == NULL) {
+return;
   }
+
+  CopyMem (NewHob.Header + 1, Hob->Header + 1, Hob->Header->HobLength - sizeof 
(EFI_HOB_GE

[edk2-devel] [PATCH v3 2/4] StandaloneMmPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Reviewed-by: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Ray Ni 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 .../Arm/StandaloneMmCoreHobLib.c  | 35 +++
 1 file changed, 35 insertions(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
index 1550e1babc..59473e28fe 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Arm/StandaloneMmCoreHobLib.c
@@ -34,6 +34,13 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
+
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
@@ -89,6 +96,10 @@ BuildModuleHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION_MODULE));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   CopyGuid (&(Hob->MemoryAllocationHeader.Name), 
&gEfiHobMemoryAllocModuleGuid);
   Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
@@ -129,6 +140,9 @@ BuildResourceDescriptorHob (
 
   Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof 
(EFI_HOB_RESOURCE_DESCRIPTOR));
   ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->ResourceType  = ResourceType;
   Hob->ResourceAttribute = ResourceAttribute;
@@ -167,6 +181,11 @@ BuildGuidHob (
   ASSERT (DataLength <= (0x - sizeof (EFI_HOB_GUID_TYPE)));
 
   Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16)(sizeof 
(EFI_HOB_GUID_TYPE) + DataLength));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return NULL;
+  }
+
   CopyGuid (&Hob->Name, Guid);
   return Hob + 1;
 }
@@ -226,6 +245,10 @@ BuildFvHob (
   EFI_HOB_FIRMWARE_VOLUME  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress = BaseAddress;
   Hob->Length  = Length;
@@ -255,6 +278,10 @@ BuildFv2Hob (
   EFI_HOB_FIRMWARE_VOLUME2  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress = BaseAddress;
   Hob->Length  = Length;
@@ -282,6 +309,10 @@ BuildCpuHob (
   EFI_HOB_CPU  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->SizeOfMemorySpace = SizeOfMemorySpace;
   Hob->SizeOfIoSpace = SizeOfIoSpace;
@@ -319,6 +350,10 @@ BuildMemoryAllocationHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 3/4] EmbeddedPkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Leif Lindholm 
Reviewed-by: Ard Biesheuvel 
Cc: Abner Chang 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 EmbeddedPkg/Library/PrePiHobLib/Hob.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c 
b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
index 8eb175aa96..cbc35152cc 100644
--- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
+++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
@@ -110,6 +110,13 @@ CreateHob (
 
   HandOffHob = GetHobList ();
 
+  //
+  // Check Length to avoid data overflow.
+  //
+  if (HobLength > MAX_UINT16 - 0x7) {
+return NULL;
+  }
+
   HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
 
   FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
@@ -160,6 +167,9 @@ BuildResourceDescriptorHob (
 
   Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof 
(EFI_HOB_RESOURCE_DESCRIPTOR));
   ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->ResourceType  = ResourceType;
   Hob->ResourceAttribute = ResourceAttribute;
@@ -401,6 +411,10 @@ BuildModuleHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION_MODULE));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   CopyGuid (&(Hob->MemoryAllocationHeader.Name), 
&gEfiHobMemoryAllocModuleGuid);
   Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
@@ -449,6 +463,11 @@ BuildGuidHob (
   ASSERT (DataLength <= (0x - sizeof (EFI_HOB_GUID_TYPE)));
 
   Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16)(sizeof 
(EFI_HOB_GUID_TYPE) + DataLength));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return NULL;
+  }
+
   CopyGuid (&Hob->Name, Guid);
   return Hob + 1;
 }
@@ -512,6 +531,10 @@ BuildFvHob (
   EFI_HOB_FIRMWARE_VOLUME  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress = BaseAddress;
   Hob->Length  = Length;
@@ -543,6 +566,10 @@ BuildFv2Hob (
   EFI_HOB_FIRMWARE_VOLUME2  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress = BaseAddress;
   Hob->Length  = Length;
@@ -584,6 +611,10 @@ BuildFv3Hob (
   EFI_HOB_FIRMWARE_VOLUME3  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB_FIRMWARE_VOLUME3));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->BaseAddress  = BaseAddress;
   Hob->Length   = Length;
@@ -639,6 +670,10 @@ BuildCpuHob (
   EFI_HOB_CPU  *Hob;
 
   Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   Hob->SizeOfMemorySpace = SizeOfMemorySpace;
   Hob->SizeOfIoSpace = SizeOfIoSpace;
@@ -676,6 +711,10 @@ BuildStackHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION_STACK));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
@@ -756,6 +795,10 @@ BuildMemoryAllocationHob (
 );
 
   Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof 
(EFI_HOB_MEMORY_ALLOCATION));
+  ASSERT (Hob != NULL);
+  if (Hob == NULL) {
+return;
+  }
 
   ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 4/4] MdeModulePkg/Hob: Integer Overflow in CreateHob()

2024-01-11 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166

Fix integer overflow in various CreateHob instances.
Fixes: CVE-2022-36765

The CreateHob() function aligns the requested size to 8
performing the following operation:
```
HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
```

No checks are performed to ensure this value doesn't
overflow, and could lead to CreateHob() returning a smaller
HOB than requested, which could lead to OOB HOB accesses.

Reported-by: Marc Beatove 
Cc: Liming Gao 
Cc: John Mathew 
Authored-by: Gerd Hoffmann 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c b/MdeModulePkg/Core/Pei/Hob/Hob.c
index c4882a23cd..985da50995 100644
--- a/MdeModulePkg/Core/Pei/Hob/Hob.c
+++ b/MdeModulePkg/Core/Pei/Hob/Hob.c
@@ -85,7 +85,7 @@ PeiCreateHob (
   //
   // Check Length to avoid data overflow.
   //
-  if (0x1 - Length <= 0x7) {
+  if (MAX_UINT16 - Length < 0x7) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: CbParseLib: Fix integer overflow

2024-01-12 Thread Guo, Gua
Reviewed-by: Gua Guo 

From: Lean Sheng Tan 
Sent: Friday, January 12, 2024 7:33:00 PM
To: Rudolph, Patrick 
Cc: devel@edk2.groups.io ; Rhodes, Sean 
; Guo, Gua ; Lu, James 
; Ni, Ray ; Dong, Guo 
Subject: Re: [PATCH] UefiPayloadPkg: CbParseLib: Fix integer overflow

Hi Gua or Sean,
Would you mind to help review this?
Thanks!

Best Regards,
Lean Sheng Tan

[http://static.9elements.com/logo-signature.png]

9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany
Email: sheng@9elements.com<mailto:sheng@9elements.com>
Phone: +49 234 68 94 188
Mobile: +49 176 76 113842

Registered office: Bochum
Commercial register: Amtsgericht Bochum, HRB 17519
Management: Sebastian German, Eray Bazaar

Data protection information according to Art. 13 
GDPR<https://9elements.com/privacy>


On Mon, 8 Jan 2024 at 08:00, Patrick Rudolph 
mailto:patrick.rudo...@9elements.com>> wrote:
The IMD entry uses the 32bit start field as relative offset
to root. On Ia32X64 this works fine as UINTN is also 32 bit and
negative relative offsets are properly calculated due to an
integer overflow.

On X64 this doesn't work as UINTN is 64 bit and the offset
is no longer subtracted, but it's added to the root. Fix that
by sign extending the start field to 64 bit.

Test: Booting UefiPayloadPkg still works on Ia32X64 and now also
  works on X64.

Signed-off-by: Patrick Rudolph 
mailto:patrick.rudo...@9elements.com>>
---
 UefiPayloadPkg/Library/CbParseLib/CbParseLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c 
b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
index 8a353f77f6..9e149532a7 100644
--- a/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
+++ b/UefiPayloadPkg/Library/CbParseLib/CbParseLib.c
@@ -282,7 +282,7 @@ FindCbMemTable (
   for (Idx = 0; Idx < Root->num_entries; Idx++) {
 if (Entries[Idx].id == TableId) {
   if (IsImdEntry) {
-*MemTable = (VOID *)((UINTN)Entries[Idx].start + (UINTN)Root);
+*MemTable = (VOID *)((INTN)(INT32)Entries[Idx].start + (UINTN)Root);
   } else {
 *MemTable = (VOID *)(UINTN)Entries[Idx].start;
   }
--
2.43.0



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




Re: [edk2-devel] [PATCH v3 0/4] Bz4166: Integer Overflow in CreateHob()

2024-01-23 Thread Guo, Gua
For MdeModulePkg, I think no need to change because no any logic change.

For StandaloneMmPkg and EmbeddedPkg
- Don't have enough abilities to close Sami Mujawar and Ni Ray open currently, 
so hold on the change until I find how to introduce Panic. So give up these two 
packages patch currently.

-Original Message-
From: Gerd Hoffmann  
Sent: Tuesday, January 23, 2024 10:50 PM
To: Guo, Gua 
Cc: devel@edk2.groups.io; Ard Biesheuvel ; Mathews, 
John ; Zimmer, Vincent ; Sami 
Mujawar ; jma...@redhat.com
Subject: Re: [PATCH v3 0/4] Bz4166: Integer Overflow in CreateHob()

On Fri, Jan 12, 2024 at 10:25:16AM +0800, gua@intel.com wrote:
> From: Gua Guo 
> 
> PR: https://github.com/tianocore/edk2/pull/5252

> Gua Guo (4):
>   UefiPayloadPkg/Hob: Integer Overflow in CreateHob()
>   StandaloneMmPkg/Hob: Integer Overflow in CreateHob()
>   EmbeddedPkg/Hob: Integer Overflow in CreateHob()
>   MdeModulePkg/Hob: Integer Overflow in CreateHob()

Ping.  What is the status here?

Patch 1/4 has been merged (commit 59f024c76ee5), the other tree patches are 
missing still.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v2 1/1] MdePkg: Add FdtLib gmock support

2024-01-23 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael D Kinney
Sent: Wednesday, January 24, 2024 7:19 AM
To: Jeff Brasen ; devel@edk2.groups.io
Cc: gaolim...@byosoft.com.cn; Liu, Zhiguang ; Kinney, 
Michael D 
Subject: Re: [edk2-devel] [PATCH v2 1/1] MdePkg: Add FdtLib gmock support

Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Jeff Brasen 
> Sent: Tuesday, January 23, 2024 3:13 PM
> To: devel@edk2.groups.io
> Cc: gaolim...@byosoft.com.cn; Kinney, Michael D 
> ; Liu, Zhiguang ; 
> Jeff Brasen 
> Subject: [PATCH v2 1/1] MdePkg: Add FdtLib gmock support
> 
> Add Google Mock Library for FdtLib
> 
> Signed-off-by: Jeff Brasen 
> ---
>  .../GoogleTest/MockFdtLib/MockFdtLib.inf  |  28 +++
>  .../Include/GoogleTest/Library/MockFdtLib.h   | 164 ++
>  .../GoogleTest/MockFdtLib/MockFdtLib.cpp  |  34 
>  3 files changed, 226 insertions(+)
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf
>  create mode 100644
> MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp
> 
> diff --git
> a/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf
> b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf
> new file mode 100644
> index ..b227bcbae963
> --- /dev/null
> +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf
> @@ -0,0 +1,28 @@
> +## @file
> +# Google Test mocks for FdtLib
> +#
> +# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (c) 2023, Intel Corporation. All rights reserved.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent ##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = MockFdtLib
> +  FILE_GUID  = 0f5471bc-fc2c-4cf4-b9f7-c1396d32831c
> +  MODULE_TYPE= HOST_APPLICATION
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = FdtLib
> +
> +[Sources]
> +  MockFdtLib.cpp
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
> +
> +[LibraryClasses]
> +  GoogleTestLib
> +
> +[BuildOptions]
> +  MSFT:*_*_*_CC_FLAGS = /EHsc /bigobj
> diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h
> b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h
> new file mode 100644
> index ..73da571910df
> --- /dev/null
> +++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h
> @@ -0,0 +1,164 @@
> +/** @file
> +  Google Test mocks for FdtLib
> +
> +  Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +  Copyright (c) 2023, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#ifndef MOCK_FDT_LIB_H_
> +#define MOCK_FDT_LIB_H_
> +
> +#include 
> +#include 
> +extern "C" {
> +  #include 
> +  #include 
> +}
> +
> +struct MockFdtLib {
> +  MOCK_INTERFACE_DECLARATION (MockFdtLib);
> +
> +  MOCK_FUNCTION_DECLARATION (
> +UINT16,
> +Fdt16ToCpu,
> +(IN UINT16 Value)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +UINT16,
> +CpuToFdt16,
> +(IN UINT16 Value)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +UINT32,
> +Fdt32ToCpu,
> +(IN UINT32 Value)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +UINT32,
> +CpuToFdt32,
> +(IN UINT32 Value)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +UINT64,
> +Fdt64ToCpu,
> +(IN UINT64 Value)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +UINT64,
> +CpuToFdt64,
> +(IN UINT64 Value)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtCheckHeader,
> +(IN CONST VOID  *Fdt)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtCreateEmptyTree,
> +(IN VOID*Buffer,
> + IN UINT32  BufferSize)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtNextNode,
> +(IN CONST VOID  *Fdt,
> + IN INT32   Offset,
> + IN INT32   *Depth)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtFirstSubnode,
> +(IN CONST VOID  *Fdt,
> + IN INT32   Offset)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtNextSubnode,
> +(IN CONST VOID  *Fdt,
> + IN INT32   Offset)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtSubnodeOffsetNameLen,
> +(IN CONST VOID   *Fdt,
> + IN INT32ParentOffset,
> + IN CONST CHAR8  *Name,
> + IN INT32NameLength)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +INT32,
> +FdtNodeOffsetByPropValue,
> +(IN CONST VOID   *Fdt,
> + IN INT32StartOffset,
> + IN CONST CHAR8  *PropertyName,
> + IN CONST VOID   *PropertyValue,
> + IN INT32PropertyLength)
> +);
> +  MOCK_FUNCTION_DECLARATION (
> +CONST FDT_PROPERTY *,
> +FdtGetProperty,
> +(IN CONST VOID   *F

[edk2-devel] [PATCH v1] UefiPayloadPkg/Crypto: Make crypto driver as optional

2024-01-24 Thread Guo, Gua
From: Gua Guo 

Crypto in serveral case will use old version, treat as optional
will make customer easy to upgrade it.

Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 +++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 4f195c1e52..01e1684e27 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -38,6 +38,7 @@
   DEFINE SD_ENABLE= TRUE
   DEFINE PS2_MOUSE_ENABLE = TRUE
   DEFINE CRYPTO_PROTOCOL_SUPPORT  = FALSE
+  DEFINE   CRYPTO_DRIVER_SUPPORT  = TRUE
   DEFINE SD_MMC_TIMEOUT   = 100
   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
   DEFINE BOOTSPLASH_IMAGE = FALSE
@@ -860,11 +861,13 @@
   # Misc
   #
 !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE
+!if $(CRYPTO_DRIVER_SUPPORT) == TRUE
   CryptoPkg/Driver/CryptoDxe.inf {
 
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
   }
+!endif
 !endif
 
   #--
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 7d04a8cffd..8cb7e5ac50 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -154,8 +154,10 @@ INF 
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRou
 INF 
MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
 
 !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE
+!if $(CRYPTO_DRIVER_SUPPORT) == TRUE
 INF CryptoPkg/Driver/CryptoDxe.inf
 !endif
+!endif
 !if $(SECURITY_STUB_ENABLE) == TRUE
 INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2] UefiPayloadPkg/Crypto: Support external Crypto drivers.

2024-01-24 Thread Guo, Gua
From: Gua Guo 

Crypto in serveral case will use old version or latest version,
Platform may choose to only update Crypto drivers without updating
whole UPL, in this case the Crypto driver will provide by platform
payload outside the common UPL binary.

Cc: Chasel Chiu 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 10 +-
 UefiPayloadPkg/UefiPayloadPkg.fdf |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 4f195c1e52..2c4013bd9d 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -37,12 +37,18 @@
   DEFINE ATA_ENABLE   = TRUE
   DEFINE SD_ENABLE= TRUE
   DEFINE PS2_MOUSE_ENABLE = TRUE
-  DEFINE CRYPTO_PROTOCOL_SUPPORT  = FALSE
   DEFINE SD_MMC_TIMEOUT   = 100
   DEFINE USE_CBMEM_FOR_CONSOLE= FALSE
   DEFINE BOOTSPLASH_IMAGE = FALSE
   DEFINE NVME_ENABLE  = TRUE
   DEFINE CAPSULE_SUPPORT  = FALSE
+
+  #
+  # Crypto Support
+  #
+  DEFINE CRYPTO_PROTOCOL_SUPPORT= FALSE
+  DEFINE CRYPTO_DRIVER_EXTERNAL_SUPPORT = FALSE
+
   #
   # Setup Universal Payload
   #
@@ -860,11 +866,13 @@
   # Misc
   #
 !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE
+!if $(CRYPTO_DRIVER_EXTERNAL_SUPPORT) == FALSE
   CryptoPkg/Driver/CryptoDxe.inf {
 
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
   }
+!endif
 !endif

   #--
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 7d04a8cffd..c1b1e35f32 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -154,8 +154,10 @@ INF 
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRou
 INF 
MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf

 !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE
+!if $(CRYPTO_DRIVER_EXTERNAL_SUPPORT) == FALSE
 INF CryptoPkg/Driver/CryptoDxe.inf
 !endif
+!endif
 !if $(SECURITY_STUB_ENABLE) == TRUE
 INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
--
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v3 0/4] Bz4166: Integer Overflow in CreateHob()

2024-01-25 Thread Guo, Gua
Hi @Gerd Hoffmann

It's PR https://github.com/tianocore/edk2/pull/5298 if no more concern 
received, will merge it tomorrow morning.

Thanks,
Gua

-Original Message-
From: Gerd Hoffmann  
Sent: Wednesday, January 24, 2024 8:48 PM
To: Guo, Gua 
Cc: devel@edk2.groups.io; Ard Biesheuvel ; Mathews, 
John ; Zimmer, Vincent ; Sami 
Mujawar ; jma...@redhat.com
Subject: Re: RE: [PATCH v3 0/4] Bz4166: Integer Overflow in CreateHob()

On Tue, Jan 23, 2024 at 03:16:32PM +0000, Guo, Gua wrote:
> For MdeModulePkg, I think no need to change because no any logic change.
> 
> For StandaloneMmPkg and EmbeddedPkg
> - Don't have enough abilities to close Sami Mujawar and Ni Ray open 
> currently, so hold on the change until I find how to introduce Panic. So give 
> up these two packages patch currently.

On StandaloneMmPkg: I think the patch is fine, I've replied in that subthread.

On EmbeddedPkg:  I think the BuildGuidDataHob() callsites need review whenever 
they do:

  (a) check the return value properly, or
  (b) allocate a fixed size HOB so the new check in CreateHob() can't
  fail.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV in elf

2023-04-20 Thread Guo, Gua
Reviewed-by: gua@intel.com

-Original Message-
From: Wu, LinusX  
Sent: Thursday, April 20, 2023 3:31 PM
To: devel@edk2.groups.io
Cc: Wu, LinusX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Move Network modules from Dxe FV to Network FV 
in elf

From: Linus Wu 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4417

Since UefiPayload had supported multiple FV, move Network.fdf.inc to new 
firmware volume and add this network FV into elf file.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UefiPayloadPkg.fdf   | 32 +++--
 UefiPayloadPkg/UniversalPayloadBuild.py | 12 ++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index ee7d718b3f..f8c2aa8c4a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -60,6 +60,35 @@ FILE FV_IMAGE = 4E35FD93-9C72-4c15-8C4B-E77F1DB2D793 {
 SECTION FV_IMAGE = DXEFV } +!if $(NETWORK_DRIVER_ENABLE) == 
TRUE++[FV.NETWORKFV]+FvNameGuid
 = 3CF5CB69-C439-4B84-AF11-8167B22D7221+BlockSize  = 
$(FD_BLOCK_SIZE)+FvForceRebase  = FALSE+FvAlignment= 
16+ERASE_POLARITY = 1+MEMORY_MAPPED  = TRUE+STICKY_WRITE   = 
TRUE+LOCK_CAP   = TRUE+LOCK_STATUS= TRUE+WRITE_DISABLED_CAP = 
TRUE+WRITE_ENABLED_CAP  = TRUE+WRITE_STATUS   = TRUE+WRITE_LOCK_CAP = 
TRUE+WRITE_LOCK_STATUS  = TRUE+READ_DISABLED_CAP  = TRUE+READ_ENABLED_CAP   = 
TRUE+READ_STATUS= TRUE+READ_LOCK_CAP  = TRUE+READ_LOCK_STATUS   = 
TRUE++#+# UEFI network modules+#+!include NetworkPkg/Network.fdf.inc+!endif+ 

 [FV.BDSFV] FvNameGuid = CA5590AF-9558-4822-B5EA-BE2E876CD3EC@@ -276,14 
+305,13 @@ INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResour
  !if $(UNIVERSAL_PAYLOAD) == FALSE INF 
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf-!endif- # # UEFI network modules # !if 
$(NETWORK_DRIVER_ENABLE) == TRUE   !include NetworkPkg/Network.fdf.inc 
!endif+!endif  # # Shelldiff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index db7ce0500b..83e0de95d8 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -108,6 +108,7 @@ def BuildUniversalPayload(Args, MacroList):
 DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc") 
DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ToolChain), os.path.normpath("FV/DXEFV.Fv")) BdsFvOutputDir = 
os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), 
os.path.normpath("FV/BDSFV.Fv"))+NetworkFvOutputDir = 
os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), 
os.path.normpath("FV/NETWORKFV.Fv")) PayloadReportPath = 
os.path.join(BuildDir, "UefiUniversalPayload.txt") ModuleReportPath = 
os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt") UpldInfoFile = 
os.path.join(BuildDir, "UniversalPayloadInfo.bin")@@ -185,6 +186,17 @@ def 
BuildUniversalPayload(Args, MacroList):
ObjCopyFlag,
EntryOutputDir)+#+# Append network 
fv to sections if exists+#+if 
os.path.isfile(NetworkFvOutputDir):+index = 
remove_section.find(EntryOutputDir)+remove_section = 
remove_section[:index] + '--remove-section .upld.network_fv ' + 
remove_section[index:]+index = add_section.find(EntryOutputDir)+
add_section = add_section[:index] + '--add-section .upld.network_fv=' + 
NetworkFvOutputDir + ' ' + add_section[index:]+index = 
set_section.find(EntryOutputDir)+set_section = set_section[:index] 
+ '--set-section-alignment .upld.network_fv=16 ' + set_section[index:]+ 
RunCommand(remove_section) RunCommand(add_section) 
RunCommand(set_section)-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103292): https://edk2.groups.io/g/devel/message/103292
Mute This Topic: https://groups.io/mt/98384854/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/4] Trace Hub debug library support

2023-04-20 Thread Guo, Gua
+ Related folk

I want to let the PR for related stakeholder review it.

And have any open ?
https://github.com/tianocore/edk2/pull/3901


Thanks,
Gua

-Original Message-
From: devel@edk2.groups.io  On Behalf Of 
victorx@intel.com
Sent: Tuesday, April 18, 2023 7:05 PM
To: devel@edk2.groups.io
Cc: Hsu, VictorX 
Subject: [edk2-devel] [PATCH 0/4] Trace Hub debug library support

From: VictorX Hsu 

-   TraceHub UniversalPayload Spec: 
https://github.com/UniversalScalableFirmware/documentation/pull/52  (Industry 
Standard)
-   MipiSysTLib Wrapper: 
https://github.com/MIPI-Alliance/public-mipi-sys-t.git (Industry Standard)
-   TraceHubDebugLib: Intel(R) Trace Hub (TH) — The Linux Kernel 
documentation (Industry Standard)
Developers Guide: 
https://cdrdv2-public.intel.com/671536/intel-trace-hub-developers-manual-2-1-2.pdf
 (Public Document)

VictorX Hsu (4):
  MdePkg: Add MipiSysTLib library
  MdeModulePkg: Add TraceHubDebugSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg
lib.

 .gitmodules   |   5 +-
 .pytool/CISettings.py |   2 +
 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  25 +
 .../BaseTraceHubDebugSysTLib.c| 251 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 247 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  50 ++
 .../InternalTraceHubApi.c |  82 ++
 .../InternalTraceHubApi.h |  46 +
 .../InternalTraceHubApiCommon.c   | 208 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 290 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  30 +
 MdeModulePkg/MdeModulePkg.dec |  21 +
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 +
 MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  55 ++
 MdePkg/Library/MipiSysTLib/Platform.c | 164 
 MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
 MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
 MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
 .../TraceHubDebugSysTLibNull.c|  76 ++
 .../TraceHubDebugSysTLibNull.inf  |  29 +
 MdePkg/MdePkg.ci.yaml |  15 +-
 MdePkg/MdePkg.dec |   9 +
 MdePkg/MdePkg.dsc |   2 +
 ReadMe.rst|   1 +
 34 files changed, 3212 insertions(+), 3 deletions(-)  create mode 100644 
MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
 create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
 create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
 create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h
 create mode 16 MdePkg/Library/MipiSysTLib/mipisyst
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

--
2.40.0.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all message

[edk2-devel] [PATCH] BaseTools/Plugin: Report error if code coverage failure

2023-04-22 Thread Guo, Gua
From: Gua Guo 

If code coverage exist failure, CI/CD need to catch it

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner/HostBasedUnitTestRunner.py  | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index 0e013c5f1a..a3da253d93 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -117,9 +117,11 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 
 if thebuilder.env.GetValue("CODE_COVERAGE") != "FALSE":
 if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
-self.gen_code_coverage_gcc(thebuilder)
+status = self.gen_code_coverage_gcc(thebuilder)
+failure_count += status
 elif thebuilder.env.GetValue("TOOL_CHAIN_TAG").startswith 
("VS"):
-self.gen_code_coverage_msvc(thebuilder)
+status = self.gen_code_coverage_msvc(thebuilder)
+failure_count += status
 else:
 logging.info("Skipping code coverage. Currently, support 
GCC and MSVC compiler.")
 
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 1/2] BaseTools/Plugin: Report error if code coverage failure

2023-04-22 Thread Guo, Gua
From: Gua Guo 

If code coverage exist failure, CI/CD need to catch it

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner/HostBasedUnitTestRunner.py| 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index 0e013c5f1a..86b6bd36df 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -117,9 +117,13 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 
 if thebuilder.env.GetValue("CODE_COVERAGE") != "FALSE":
 if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
-self.gen_code_coverage_gcc(thebuilder)
+ret = self.gen_code_coverage_gcc(thebuilder)
+if ret != 0:
+failure_count += 1
 elif thebuilder.env.GetValue("TOOL_CHAIN_TAG").startswith 
("VS"):
-self.gen_code_coverage_msvc(thebuilder)
+ret = self.gen_code_coverage_msvc(thebuilder)
+if ret != 0:
+failure_count += 1
 else:
 logging.info("Skipping code coverage. Currently, support 
GCC and MSVC compiler.")
 
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage tool

2023-04-22 Thread Guo, Gua
From: Gua Guo 

Azure should install code coverage tool (lcov), it didn't
exist on Fedora and Ubuntu by default.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Cc: Oliver Steffen 
Signed-off-by: Gua Guo 
---
 .azurepipelines/Ubuntu-GCC5.yml | 4 
 1 file changed, 4 insertions(+)

diff --git a/.azurepipelines/Ubuntu-GCC5.yml b/.azurepipelines/Ubuntu-GCC5.yml
index b9a3b851cf..d884256148 100644
--- a/.azurepipelines/Ubuntu-GCC5.yml
+++ b/.azurepipelines/Ubuntu-GCC5.yml
@@ -24,3 +24,7 @@ jobs:
 container: ${{ variables.default_linux_image }}
 arch_list: "IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64"
 usePythonVersion: ''  # use Python from the container image
+extra_install_step:
+- bash: sudo dnf install -y lcov
+  displayName: Install Code Coverage Tools
+  condition: and(gt(variables.pkg_count, 0), succeeded())
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage tool

2023-04-23 Thread Guo, Gua
I know maybe I need to update https://github.com/tianocore/containers but add 
these step, i f have any guidelines for me that will be great.



寄件者: 「devel@edk2.groups.io 」代表「Sean 
」
寄件日期: 2023年4月23日 星期日 下午2:13
收件者: devel@edk2.groups.io ; Kinney, Michael D 
; Guo, Gua ; fernald, chris 

副本: Sean Brogan ; Michael Kubacki 
; Oliver Steffen ; Kinney, 
Michael D 
主旨: Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage tool

Sorry a little late to review this. It looks like these are container based 
builds. If that is the case we should handle this by updating the container. 
The whole point of the container is to get the requirements all included in the 
container. @Chris Fernald<mailto:chfer...@microsoft.com> can you share details.

Thanks
Sean

From: devel@edk2.groups.io  on behalf of Michael D Kinney 

Sent: Saturday, April 22, 2023 8:15:56 PM
To: Guo, Gua ; devel@edk2.groups.io 
Cc: Sean Brogan ; Michael Kubacki 
; Oliver Steffen ; Kinney, 
Michael D 
Subject: Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage 
tool

Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Guo, Gua 
> Sent: Saturday, April 22, 2023 6:22 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua ; Kinney, Michael D 
> ; Sean Brogan ;
> Michael Kubacki ; Oliver Steffen 
> 
> Subject: [PATCH v2 2/2] .azurepipelines: Install code coverage tool
>
> From: Gua Guo 
>
> Azure should install code coverage tool (lcov), it didn't
> exist on Fedora and Ubuntu by default.
>
> Cc: Michael D Kinney 
> Cc: Sean Brogan 
> Cc: Michael Kubacki 
> Cc: Oliver Steffen 
> Signed-off-by: Gua Guo 
> ---
>  .azurepipelines/Ubuntu-GCC5.yml | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/.azurepipelines/Ubuntu-GCC5.yml b/.azurepipelines/Ubuntu-GCC5.yml
> index b9a3b851cf..d884256148 100644
> --- a/.azurepipelines/Ubuntu-GCC5.yml
> +++ b/.azurepipelines/Ubuntu-GCC5.yml
> @@ -24,3 +24,7 @@ jobs:
>  container: ${{ variables.default_linux_image }}
>
>  arch_list: "IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64"
>
>  usePythonVersion: ''  # use Python from the container image
>
> +extra_install_step:
>
> +- bash: sudo dnf install -y lcov
>
> +  displayName: Install Code Coverage Tools
>
> +  condition: and(gt(variables.pkg_count, 0), succeeded())
>
> --
> 2.39.2.windows.1










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103448): https://edk2.groups.io/g/devel/message/103448
Mute This Topic: https://groups.io/mt/98443857/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/4] Trace Hub debug library support

2023-04-23 Thread Guo, Gua
@Kinney, Michael D<mailto:michael.d.kin...@intel.com>, @K N, 
Karthik<mailto:karthik@intel.com>, @Prakashan, Krishnadas 
Veliyathuparambil<mailto:krishnadas.veliyathuparambil.prakas...@intel.com>, 
@Chan, Laura<mailto:laura.c...@intel.com>



Could you share me about your concern ?

If no additional concern, please help to give your review-by we can check in 
ASAP.



Thanks,

Gua



-Original Message-
From: devel@edk2.groups.io  On Behalf Of Guo, Gua
Sent: Friday, April 21, 2023 10:33 AM
To: devel@edk2.groups.io; Hsu, VictorX 
Cc: Chiu, Chasel ; Kinney, Michael D 
; Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 
; Chan, Laura 
Subject: Re: [edk2-devel] [PATCH 0/4] Trace Hub debug library support



+ Related folk



I want to let the PR for related stakeholder review it.



And have any open ?

https://github.com/tianocore/edk2/pull/3901





Thanks,

Gua



-Original Message-

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of 
victorx@intel.com<mailto:victorx@intel.com>

Sent: Tuesday, April 18, 2023 7:05 PM

To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>

Cc: Hsu, VictorX mailto:victorx@intel.com>>

Subject: [edk2-devel] [PATCH 0/4] Trace Hub debug library support



From: VictorX Hsu mailto:victorx@intel.com>>



-  TraceHub UniversalPayload Spec: 
https://github.com/UniversalScalableFirmware/documentation/pull/52  (Industry 
Standard)

-  MipiSysTLib Wrapper: 
https://github.com/MIPI-Alliance/public-mipi-sys-t.git (Industry Standard)

-  TraceHubDebugLib: Intel(R) Trace Hub (TH) — The Linux Kernel 
documentation (Industry Standard)

Developers Guide: 
https://cdrdv2-public.intel.com/671536/intel-trace-hub-developers-manual-2-1-2.pdf
 (Public Document)



VictorX Hsu (4):

  MdePkg: Add MipiSysTLib library

  MdeModulePkg: Add TraceHubDebugSysTLib library

  MdePkg: Add NULL library of TraceHubDebugSysTLib

  Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg

lib.



.gitmodules   |   5 +-

.pytool/CISettings.py |   2 +

Maintainers.txt   |  18 +

.../Include/Guid/TraceHubDebugInfoHob.h   |  25 +

.../BaseTraceHubDebugSysTLib.c| 251 ++

.../BaseTraceHubDebugSysTLib.inf  |  44 +

.../DxeSmmTraceHubDebugSysTLib.c  | 247 ++

.../DxeSmmTraceHubDebugSysTLib.inf|  50 ++

.../InternalTraceHubApi.c |  82 ++

.../InternalTraceHubApi.h |  46 +

.../InternalTraceHubApiCommon.c   | 208 +

.../InternalTraceHubApiCommon.h   | 119 +++

.../PeiTraceHubDebugSysTLib.c | 290 +++

.../PeiTraceHubDebugSysTLib.inf   |  50 ++

.../Library/TraceHubDebugSysTLib/Readme.md|  30 +

MdeModulePkg/MdeModulePkg.dec |  21 +

MdeModulePkg/MdeModulePkg.dsc |   3 +

MdeModulePkg/MdeModulePkg.uni |  18 +

MdePkg/Include/Library/MipiSysTLib.h  |  66 ++

MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++

MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++

MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++

MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  55 ++

MdePkg/Library/MipiSysTLib/Platform.c | 164 

MdePkg/Library/MipiSysTLib/Platform.h | 138 +++

MdePkg/Library/MipiSysTLib/Readme.md  |  25 +

MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++

MdePkg/Library/MipiSysTLib/mipisyst   |   1 +

.../TraceHubDebugSysTLibNull.c|  76 ++

.../TraceHubDebugSysTLibNull.inf  |  29 +

MdePkg/MdePkg.ci.yaml |  15 +-

MdePkg/MdePkg.dec |   9 +

MdePkg/MdePkg.dsc |   2 +

ReadMe.rst|   1 +

34 files changed, 3212 insertions(+), 3 deletions(-)  create mode 100644 
MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h

create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c

c

Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage tool

2023-04-23 Thread Guo, Gua
In parallel, I’ve sent the PR Install lcov in all linux based image by 
gguo11837463 * Pull Request #70 * tianocore/containers 
(github.com)<https://github.com/tianocore/containers/pull/70>  to 
https://github.com/tianocore/containers, if the PR looks good and deploy into 
latest images that can be used by latest Edk2 azurepipeline. I can revert 
commit “ba3afb0d474241e26442dd4ccf45c81d03a4c50e” on the PR 
https://github.com/tianocore/edk2/pull/4300.

Thanks,
Gua
From: Guo, Gua 
Sent: Sunday, April 23, 2023 4:44 PM
To: devel@edk2.groups.io; Kinney, Michael D ; 
fernald, chris 
Cc: Sean Brogan ; Michael Kubacki 
; Oliver Steffen ; Kinney, 
Michael D 
Subject: Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage 
tool

I know maybe I need to update https://github.com/tianocore/containers but add 
these step, i f have any guidelines for me that will be great.



寄件者: 「devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>」代表「Sean 
mailto:spbro...@outlook.com>>」
寄件日期: 2023年4月23日 星期日 下午2:13
收件者: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>; Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>; Guo, Gua 
mailto:gua@intel.com>>; fernald, chris 
mailto:chfer...@microsoft.com>>
副本: Sean Brogan mailto:sean.bro...@microsoft.com>>; 
Michael Kubacki 
mailto:mikub...@linux.microsoft.com>>; Oliver 
Steffen mailto:ostef...@redhat.com>>; Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>
主旨: Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage tool

Sorry a little late to review this. It looks like these are container based 
builds. If that is the case we should handle this by updating the container. 
The whole point of the container is to get the requirements all included in the 
container. @Chris Fernald<mailto:chfer...@microsoft.com> can you share details.

Thanks
Sean

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> on behalf of Michael D 
Kinney mailto:michael.d.kin...@intel.com>>
Sent: Saturday, April 22, 2023 8:15:56 PM
To: Guo, Gua mailto:gua@intel.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>
Cc: Sean Brogan mailto:sean.bro...@microsoft.com>>; 
Michael Kubacki 
mailto:mikub...@linux.microsoft.com>>; Oliver 
Steffen mailto:ostef...@redhat.com>>; Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>
Subject: Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Install code coverage 
tool

Reviewed-by: Michael D Kinney 
mailto:michael.d.kin...@intel.com>>

> -Original Message-----
> From: Guo, Gua mailto:gua@intel.com>>
> Sent: Saturday, April 22, 2023 6:22 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Guo, Gua mailto:gua@intel.com>>; Kinney, Michael D 
> mailto:michael.d.kin...@intel.com>>; Sean Brogan 
> mailto:sean.bro...@microsoft.com>>;
> Michael Kubacki 
> mailto:mikub...@linux.microsoft.com>>; Oliver 
> Steffen mailto:ostef...@redhat.com>>
> Subject: [PATCH v2 2/2] .azurepipelines: Install code coverage tool
>
> From: Gua Guo mailto:gua@intel.com>>
>
> Azure should install code coverage tool (lcov), it didn't
> exist on Fedora and Ubuntu by default.
>
> Cc: Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>
> Cc: Sean Brogan mailto:sean.bro...@microsoft.com>>
> Cc: Michael Kubacki 
> mailto:mikub...@linux.microsoft.com>>
> Cc: Oliver Steffen mailto:ostef...@redhat.com>>
> Signed-off-by: Gua Guo mailto:gua@intel.com>>
> ---
>  .azurepipelines/Ubuntu-GCC5.yml | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/.azurepipelines/Ubuntu-GCC5.yml b/.azurepipelines/Ubuntu-GCC5.yml
> index b9a3b851cf..d884256148 100644
> --- a/.azurepipelines/Ubuntu-GCC5.yml
> +++ b/.azurepipelines/Ubuntu-GCC5.yml
> @@ -24,3 +24,7 @@ jobs:
>  container: ${{ variables.default_linux_image }}
>
>  arch_list: "IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64"
>
>  usePythonVersion: ''  # use Python from the container image
>
> +extra_install_step:
>
> +- bash: sudo dnf install -y lcov
>
> +  displayName: Install Code Coverage Tools
>
> +  condition: and(gt(variables.pkg_count, 0), succeeded())
>
> --
> 2.39.2.windows.1









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




Re: [edk2-devel] [PATCH] * UefiPayloadPkg: Clang dependency removal

2023-04-26 Thread Guo, Gua
@Wang, BruceX

Bugzilla please fill this link 
https://bugzilla.tianocore.org/show_bug.cgi?id=4426

Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Wednesday, April 26, 2023 3:12 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; Ni, 
Ray ; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] * UefiPayloadPkg: Clang dependency removal

From: BruceX Wang 

REF: TBD

Use Python to replace llvm-objcopy in UniversalPayloadBuild.py.
1. AddSection32() and AddSection64(): Make a section named
 with the contents of .
2. RemoveSection32() and RemoveSection64(): Remove .
3. ReplaceFv (): remove the section before add the section
if the file exists.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: BruceX Wang 
---
 UefiPayloadPkg/Tools/ElfFv.py   | 809 
 UefiPayloadPkg/Tools/__init__.py|  19 +
 UefiPayloadPkg/UniversalPayloadBuild.py | 232 ---
 3 files changed, 935 insertions(+), 125 deletions(-)
 create mode 100644 UefiPayloadPkg/Tools/ElfFv.py
 create mode 100644 UefiPayloadPkg/Tools/__init__.py

diff --git a/UefiPayloadPkg/Tools/ElfFv.py b/UefiPayloadPkg/Tools/ElfFv.py
new file mode 100644
index 00..a3d5bf08b9
--- /dev/null
+++ b/UefiPayloadPkg/Tools/ElfFv.py
@@ -0,0 +1,809 @@
+## @file

+# OBJCOPY parser, it's used to replace FV

+#

+# Copyright (c) 2023, Intel Corporation. All rights reserved.

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

+##

+

+import argparse

+from   ctypes import *

+import struct

+

+class ElfSectionHeader64:

+def __init__(self, sh_name, sh_type, sh_flags, sh_addr, sh_offset, 
sh_size, sh_link, sh_info, sh_addralign, sh_entsize):

+self.sh_name = sh_name

+self.sh_type = sh_type

+self.sh_flags = sh_flags

+self.sh_addr = sh_addr

+self.sh_offset = sh_offset

+self.sh_size = sh_size

+self.sh_link = sh_link

+self.sh_info = sh_info

+self.sh_addralign = sh_addralign

+self.sh_entsize = sh_entsize

+

+def pack(self):

+return struct.pack(' RemoveNameOffset):

+unpacked_header.sh_name -= RemoveNameOffset

+# Modify size of name string section entry in section entry.

+if (Index == StringIndexNumber):

+unpacked_header.sh_size -= len (SectionName)

+# added section

+else :

+if (Index == StringIndexNumber):

+unpacked_header.sh_size += len (SectionName)

+NewSHentry = ElfSectionHeader64 (

+unpacked_header.sh_name,

+unpacked_header.sh_type,

+unpacked_header.sh_flags,

+unpacked_header.sh_addr,

+unpacked_header.sh_offset,

+unpacked_header.sh_size,

+unpacked_header.sh_link,

+unpacked_header.sh_info,

+unpacked_header.sh_addralign,

+unpacked_header.sh_entsize).pack()

+return NewSHentry

+

+def AddSectionHeader32(SHentry, NewUPLEntrylen, SectionHeaderEntrySize, Index, 
RemoveNameOffset, SectionName, StringIndexNumber):

+SHentry = bytearray(SHentry)

+unpacked_header = ElfSectionHeader32.unpack(SHentry[(Index * 
SectionHeaderEntrySize):((Index * SectionHeaderEntrySize) + 
SectionHeaderEntrySize)])

+if (Index != 0):

+NewSHentry = SHentry[(Index * SectionHeaderEntrySize):((Index * 
SectionHeaderEntrySize) + SectionHeaderEntrySize)]

+unpacked_header.sh_offset = NewUPLEntrylen

+# Modify offset of name in section entry

+# if RemoveNameOffset != 0 that is remove function.

+if (RemoveNameOffset != 0):

+if (unpacked_header.sh_name > RemoveNameOffset):

+unpacked_header.sh_name -= RemoveNameOffset

+# Modify size of name string section entry in section entry.

+if (Index == StringIndexNumber):

+unpacked_header.sh_size -= len (SectionName)

+# added section

+else :

+if (Index == StringIndexNumber):

+unpacked_header.sh_size += len (SectionName)

+NewSHentry = ElfSectionHeader32 (

+unpacked_header.sh_name,

+unpacked_header.sh_type,

+unpacked_header.sh_flags,

+unpacked_header.sh_addr,

+unpacked_header.sh_offset,

+unpacked_header.sh_size,

+unpacked_header.sh_link,

+unpacked_header.sh_info,

+unpacked_header.sh_addralign,

+unpacked_header.sh_entsize).pack()

+return NewSHentry

+

+def ModifyPHSegmentOffset64(NewUPLEntry, ElfHeaderOffset, PHSegmentName):

+# Modify offset and address of program header tables.

+elf_header = ElfHeader64(NewUPLEntry[:64])

+SHentry = NewUPLEntry[ElfHeaderOffset:]

+# Elf program header tables start from 0x40 in 64-bits objects

+PHentry = NewUPLEntry[64: 64 + (elf_header.e_phnum * 
elf_header.e_phentsize)]

+PHdrs = []

+SHdrs = []

+f

Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Enable RNG support

2023-04-26 Thread Guo, Gua
Do we separate these Security Driver into separate FV ?

I really don’t want to see gather everything into uefi_fv.
Separate it into a lot of fv, we can easy to plug in and plug out.

Thanks,
Gua

From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
Sent: Wednesday, April 26, 2023 8:33 PM
To: Benjamin Doron 
Cc: devel@edk2.groups.io; Dong, Guo ; Ni, Ray 
; Lu, James ; Guo, Gua 
Subject: Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Enable RNG support

Reviewed-by: Sean Rhodes mailto:sean@starlabs.systems>>

On Tue, 25 Apr 2023 at 18:09, Benjamin Doron 
mailto:benjamin.doro...@gmail.com>> wrote:
From: Benjamin Doron 
mailto:benjamin.do...@9elements.com>>

Uses CPU RDRAND support and installs the EfiRngProtocol.
The protocol may be used by iPXE or the Linux kernel to gather entropy.

Cc: Guo Dong mailto:guo.d...@intel.com>>
Cc: Ray Ni mailto:ray...@intel.com>>
Cc: Sean Rhodes mailto:sean@starlabs.systems>>
Cc: James Lu mailto:james...@intel.com>>
Cc: Gua Guo mailto:gua@intel.com>>
Signed-off-by: Benjamin Doron 
mailto:benjamin.do...@9elements.com>>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 +++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1e803ba01567..486af2396731 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -634,6 +634,9 @@
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
+!if $(CPU_RNG_ENABLE) == TRUE
+  SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
+!endif
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 !if $(BOOTSPLASH_IMAGE)
   MdeModulePkg/Logo/LogoDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index f8c2aa8c4a02..53add65a6a40 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -157,6 +157,9 @@ INF CryptoPkg/Driver/CryptoDxe.inf
 INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
 INF UefiCpuPkg/CpuDxe/CpuDxe.inf
+!if $(CPU_RNG_ENABLE) == TRUE
+INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
+!endif

 INF RuleOverride = UI MdeModulePkg/Application/UiApp/UiApp.inf
 INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
--
2.39.2



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




Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Enable RNG support

2023-04-26 Thread Guo, Gua
You can check with network_fv or bds_fv

[cid:image001.png@01D978D3.909189F0]

Thanks,
Gua

From: devel@edk2.groups.io  On Behalf Of Sheng Lean Tan
Sent: Wednesday, April 26, 2023 9:11 PM
To: devel@edk2.groups.io; Guo, Gua 
Cc: Rhodes, Sean ; Benjamin Doron 
; Dong, Guo ; Ni, Ray 
; Lu, James 
Subject: Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Enable RNG support

Hi Gua,
Thanks for the review. Do you have a proposal or small example on how you want 
to separate into another FV?

Thanks,
Sheng



On Wed, 26 Apr 2023 at 14:55, Guo, Gua 
mailto:gua@intel.com>> wrote:
Do we separate these Security Driver into separate FV ?

I really don’t want to see gather everything into uefi_fv.
Separate it into a lot of fv, we can easy to plug in and plug out.

Thanks,
Gua

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of Sean Rhodes
Sent: Wednesday, April 26, 2023 8:33 PM
To: Benjamin Doron 
mailto:benjamin.doro...@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Dong, Guo 
mailto:guo.d...@intel.com>>; Ni, Ray 
mailto:ray...@intel.com>>; Lu, James 
mailto:james...@intel.com>>; Guo, Gua 
mailto:gua@intel.com>>
Subject: Re: [edk2-devel][PATCH v1 2/2] UefiPayloadPkg: Enable RNG support

Reviewed-by: Sean Rhodes mailto:sean@starlabs.systems>>

On Tue, 25 Apr 2023 at 18:09, Benjamin Doron 
mailto:benjamin.doro...@gmail.com>> wrote:
From: Benjamin Doron 
mailto:benjamin.do...@9elements.com>>

Uses CPU RDRAND support and installs the EfiRngProtocol.
The protocol may be used by iPXE or the Linux kernel to gather entropy.

Cc: Guo Dong mailto:guo.d...@intel.com>>
Cc: Ray Ni mailto:ray...@intel.com>>
Cc: Sean Rhodes mailto:sean@starlabs.systems>>
Cc: James Lu mailto:james...@intel.com>>
Cc: Gua Guo mailto:gua@intel.com>>
Signed-off-by: Benjamin Doron 
mailto:benjamin.do...@9elements.com>>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 +++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1e803ba01567..486af2396731 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -634,6 +634,9 @@
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
+!if $(CPU_RNG_ENABLE) == TRUE
+  SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
+!endif
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
 !if $(BOOTSPLASH_IMAGE)
   MdeModulePkg/Logo/LogoDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index f8c2aa8c4a02..53add65a6a40 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -157,6 +157,9 @@ INF CryptoPkg/Driver/CryptoDxe.inf
 INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
 INF UefiCpuPkg/CpuDxe/CpuDxe.inf
+!if $(CPU_RNG_ENABLE) == TRUE
+INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf
+!endif

 INF RuleOverride = UI MdeModulePkg/Application/UiApp/UiApp.inf
 INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
--
2.39.2



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




[edk2-devel] [PATCH v2 2/2] .azurepipelines: Choose container that have installed lcov

2023-04-26 Thread Guo, Gua
From: Gua Guo 

Azure should install code coverage tool (lcov), it didn't
exist on Fedora and Ubuntu by default.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Cc: Oliver Steffen 
Cc: Chris Fernald 
Signed-off-by: Gua Guo 
---
 .azurepipelines/templates/defaults.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.azurepipelines/templates/defaults.yml 
b/.azurepipelines/templates/defaults.yml
index 74d6b41783..8412a43cad 100644
--- a/.azurepipelines/templates/defaults.yml
+++ b/.azurepipelines/templates/defaults.yml
@@ -9,4 +9,4 @@
 
 variables:
   default_python_version: ">=3.10.6"
-  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:47addc9"
+  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:3b3eb8f"
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 1/2] BaseTools/Plugin: Report error if code coverage failure

2023-04-26 Thread Guo, Gua
From: Gua Guo 

If code coverage exist failure, CI/CD need to catch it

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner/HostBasedUnitTestRunner.py| 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index a384b55629..d993de9412 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -130,9 +130,13 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 
 if thebuilder.env.GetValue("CODE_COVERAGE") != "FALSE":
 if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
-self.gen_code_coverage_gcc(thebuilder)
+ret = self.gen_code_coverage_gcc(thebuilder)
+if ret != 0:
+failure_count += 1
 elif thebuilder.env.GetValue("TOOL_CHAIN_TAG").startswith 
("VS"):
-self.gen_code_coverage_msvc(thebuilder)
+ret = self.gen_code_coverage_msvc(thebuilder)
+if ret != 0:
+failure_count += 1
 else:
 logging.info("Skipping code coverage. Currently, support 
GCC and MSVC compiler.")
 
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH v2 2/2] .azurepipelines: Choose container that have installed lcov

2023-04-26 Thread Guo, Gua
Sure, I will update the commit message.

From: Kinney, Michael D 
Sent: Thursday, April 27, 2023 8:52:40 AM
To: Guo, Gua ; devel@edk2.groups.io 
Cc: Sean Brogan ; Michael Kubacki 
; Oliver Steffen ; fernald, 
chris ; Kinney, Michael D 
Subject: RE: [PATCH v2 2/2] .azurepipelines: Choose container that have 
installed lcov

Hi Gua,

It is hard to review this type of patch without more context.

Can you provide a link to the PR or branch where the docker image was updated?  
That information should be part of the commit message.

Thanks,

Mike

> -Original Message-
> From: Guo, Gua 
> Sent: Wednesday, April 26, 2023 5:34 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua ; Kinney, Michael D
> ; Sean Brogan ;
> Michael Kubacki ; Oliver Steffen
> ; fernald, chris 
> Subject: [PATCH v2 2/2] .azurepipelines: Choose container that have installed
> lcov
>
> From: Gua Guo 
>
> Azure should install code coverage tool (lcov), it didn't
> exist on Fedora and Ubuntu by default.
>
> Cc: Michael D Kinney 
> Cc: Sean Brogan 
> Cc: Michael Kubacki 
> Cc: Oliver Steffen 
> Cc: Chris Fernald 
> Signed-off-by: Gua Guo 
> ---
>  .azurepipelines/templates/defaults.yml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/.azurepipelines/templates/defaults.yml
> b/.azurepipelines/templates/defaults.yml
> index 74d6b41783..8412a43cad 100644
> --- a/.azurepipelines/templates/defaults.yml
> +++ b/.azurepipelines/templates/defaults.yml
> @@ -9,4 +9,4 @@
>
>
>  variables:
>
>default_python_version: ">=3.10.6"
>
> -  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:47addc9"
>
> +  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:3b3eb8f"
>
> --
> 2.39.2.windows.1



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




[edk2-devel] [PATCH v3 1/3] BaseTools/Plugin: Report error if code coverage failure

2023-04-26 Thread Guo, Gua
From: Gua Guo 

If code coverage exist failure, CI/CD need to catch it

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
Reviewed-by: Michael D Kinney 
Reviewed-by: Michael Kubacki 
---
 .../HostBasedUnitTestRunner/HostBasedUnitTestRunner.py| 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index 0e013c5f1a..86b6bd36df 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -117,9 +117,13 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 
 if thebuilder.env.GetValue("CODE_COVERAGE") != "FALSE":
 if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
-self.gen_code_coverage_gcc(thebuilder)
+ret = self.gen_code_coverage_gcc(thebuilder)
+if ret != 0:
+failure_count += 1
 elif thebuilder.env.GetValue("TOOL_CHAIN_TAG").startswith 
("VS"):
-self.gen_code_coverage_msvc(thebuilder)
+ret = self.gen_code_coverage_msvc(thebuilder)
+if ret != 0:
+failure_count += 1
 else:
 logging.info("Skipping code coverage. Currently, support 
GCC and MSVC compiler.")
 
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 2/3] .azurepipelines: Choose container that have installed lcov

2023-04-26 Thread Guo, Gua
From: Gua Guo 

Azure should install code coverage tool (lcov), it didn't
exist on Fedora and Ubuntu by default.

Update docker setting, pick below solution between 47addc9 and 3b3eb8f
3b3eb8f Fixes and improvements to dev containers (#69)
54e5bd1 Enable GTK on Fedora QEMU (#63)
f1c7a20 Fedora: install code coverage tools for GCC (#62)
2ce82af Ubuntu-22: Add initial Ubuntu-22 image (#61)
14d2aba Add Fedora 37 image with gcc12 (#60)
5b8a008 Add dotnet runtime to fedora build (#57)
f5c874a Fix platform build file name for EDK2 change (#58)
48540ad Ubuntu-20: Fix dev image entrypoint (#55)
98e849d Fedora-35: Add Powershell to build image (#52)

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Cc: Oliver Steffen 
Cc: Chris Fernald 
Signed-off-by: Gua Guo 
Reviewed-by: Michael D Kinney 
Reviewed-by: Michael Kubacki 
Reviewed-by: Chris Fernald 
---
 .azurepipelines/templates/defaults.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.azurepipelines/templates/defaults.yml 
b/.azurepipelines/templates/defaults.yml
index 74d6b41783..8412a43cad 100644
--- a/.azurepipelines/templates/defaults.yml
+++ b/.azurepipelines/templates/defaults.yml
@@ -9,4 +9,4 @@
 
 variables:
   default_python_version: ">=3.10.6"
-  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:47addc9"
+  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:3b3eb8f"
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 3/3] .azurepipelines: Switch linux image default to Fedora-37

2023-04-26 Thread Guo, Gua
From: Gua Guo 

Switch default linux build image from Fedora-35 to Fedora-37

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Cc: Oliver Steffen 
Cc: Chris Fernald 
Signed-off-by: Gua Guo 
Reviewed-by: Michael Kubacki 
---
 .azurepipelines/templates/defaults.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.azurepipelines/templates/defaults.yml 
b/.azurepipelines/templates/defaults.yml
index 8412a43cad..6730a0e8e4 100644
--- a/.azurepipelines/templates/defaults.yml
+++ b/.azurepipelines/templates/defaults.yml
@@ -9,4 +9,4 @@
 
 variables:
   default_python_version: ">=3.10.6"
-  default_linux_image: "ghcr.io/tianocore/containers/fedora-35-test:3b3eb8f"
+  default_linux_image: "ghcr.io/tianocore/containers/fedora-37-test:3b3eb8f"
-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix issues when MULTIPLE_DEBUG_PORT_SUPPORT is true

2023-04-26 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Hsieh, PaytonX  
Sent: Thursday, April 27, 2023 2:14 PM
To: devel@edk2.groups.io
Cc: Hsieh, PaytonX ; Dong, Guo ; 
Ni, Ray ; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Fix issues when MULTIPLE_DEBUG_PORT_SUPPORT is 
true

From: PaytonX Hsieh 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4427

1. Since UART speed is slower than CPU, BIOS need to check the write
   buffer is empty, to avoid overwrite the buffer content.
2. LPSS UART might disable MMIO space for Windows debug usage during
   ExitBootServices event. BIOS need to avoid access the MMIO space
   after ExitBootServices.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: PaytonX Hsieh 
---
 .../BaseSerialPortLibHob.c|   7 +
 .../DxeBaseSerialPortLibHob.c | 903 ++
 .../DxeBaseSerialPortLibHob.inf   |  40 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  11 +-
 4 files changed, 959 insertions(+), 2 deletions(-)  create mode 100644 
UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c
 create mode 100644 
UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.inf

diff --git a/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c 
b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c
index 8216195c62..3f844a42e1 100644
--- a/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c
+++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c
@@ -294,6 +294,13 @@ SerialPortWrite (
 BytesLeft  = NumberOfBytes;  while (BytesLeft != 0) {+  //+  
// Wait for the serial port to be ready, to make sure both the transmit FIFO+   
   // and shift register empty.+  //+  while ((SerialPortReadRegister 
(BaseAddress, R_UART_LSR, UseMmio, Stride) & B_UART_LSR_TXRDY) == 0) {+  }+ 
  //   // Fill the entire Tx FIFO   //diff --git 
a/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c 
b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c
new file mode 100644
index 00..5fcae9a699
--- /dev/null
+++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHo
+++ b.c
@@ -0,0 +1,903 @@
+/** @file+  UART Serial Port library functions.++  Copyright (c) 2022, Intel 
Corporation. All rights reserved.+  SPDX-License-Identifier: 
BSD-2-Clause-Patent++**/+#include +#include +#include 
+#include +#include +#include 
+#include +#include 
+#include +#include 
+#include ++//+// 16550 
UART register offsets and bitfields+//+#define R_UART_RXBUF 0// 
LCR_DLAB = 0+#define R_UART_TXBUF 0// LCR_DLAB = 0+#define 
R_UART_BAUD_LOW  0// LCR_DLAB = 1+#define R_UART_BAUD_HIGH 1// 
LCR_DLAB = 1+#define R_UART_IER   1// LCR_DLAB = 0+#define 
R_UART_FCR   2+#define   B_UART_FCR_FIFOE   BIT0+#define   
B_UART_FCR_FIFO64  BIT5+#define R_UART_LCR   3+#define   
B_UART_LCR_DLABBIT7+#define R_UART_MCR   4+#define   
B_UART_MCR_DTRCBIT0+#define   B_UART_MCR_RTS BIT1+#define R_UART_LSR
   5+#define   B_UART_LSR_RXRDY   BIT0+#define   B_UART_LSR_TXRDY   
BIT5+#define   B_UART_LSR_TEMTBIT6+#define R_UART_MSR   6+#define   
B_UART_MSR_CTS BIT4+#define   B_UART_MSR_DSR BIT5+#define   
B_UART_MSR_RI  BIT6+#define   B_UART_MSR_DCD BIT7++#define MAX_SIZE  
16++typedef struct {+  UINTN  BaseAddress;+  BOOLEANUseMmio;+  UINT32   
  BaudRate;+  UINT8  RegisterStride;+} UART_INFO;++UART_INFO  
mUartInfo[MAX_SIZE];+UINT8  mUartCount = 0;+EFI_EVENT  
mBaseSerialPortLibHobExitBootServicesEvent;+BOOLEAN
mBaseSerialPortLibHobAtRuntime = FALSE;++/**+  Reads an 8-bit register. If 
UseMmio is TRUE, then the value is read from+  MMIO space. If UseMmio is FALSE, 
then the value is read from I/O space. The+  parameter Offset is added to the 
base address of the register.++  @param  Base The base address 
register of UART device.+  @param  Offset   The offset of the register 
to read.+  @param  UseMmio  Check if value has to be read from MMIO 
space or IO space.+  @param  RegisterStride   Number of bytes between registers 
in serial device.++  @return The value read from the 
register.++**/+UINT8+SerialPortReadRegister (+  UINTNBase,+  UINTN
Offset,+  BOOLEAN  UseMmio,+  UINT8RegisterStride+  )+{+  if (UseMmio) {+   
 return MmioRead8 (Base + Offset * RegisterStride);+  } else {+return 
IoRead8 (Base + Offset * RegisterStride);+  }+}++/**+  Writes an 8-bit 
register.. If UseMmio is TRUE, then the value is written to+  MMIO space. If 
UseMmio is FALSE, then the value is written to I/O space. The+  parameter 
Offset is added to the base address of the registers.++  @param  Base   
  The base address register of UART device.+  @param  Offset   The 
offset of

Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix issues when MULTIPLE_DEBUG_PORT_SUPPORT is true

2023-04-27 Thread Guo, Gua
Hi Payton

For BaseSerialPortLibHob.inf please use BaseSerialPortLibHob.c
For DxeSerialPortLibHob.inf please use BaseSerialPortLibHob.c and 
DxeSerialPortLibHob.c and remove redundant code.

Have any limitation, please share for us.

Thanks,
Gua

From: devel@edk2.groups.io  On Behalf Of Benjamin Doron
Sent: Friday, April 28, 2023 1:36 AM
To: Hsieh, PaytonX ; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Fix issues when 
MULTIPLE_DEBUG_PORT_SUPPORT is true

Hi,
Can you deduplicate this code by moving the functions into a common, or "base" 
file, and DXE's constructor and event into a separate file? As I see it, it 
should be alright to reuse DXE's functions for other phases, the 
`mBaseSerialPortLibHobAtRuntime` variable will never be changed in this case.

Regards,
Benjamin



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




Re: [edk2-devel] [PATCH v3] UefiPayloadPkg: Fix issues when MULTIPLE_DEBUG_PORT_SUPPORT is true

2023-04-28 Thread Guo, Gua
Thanks for follow up that.

Reviewed-by: Gua Guo 

-Original Message-
From: Hsieh, PaytonX  
Sent: Friday, April 28, 2023 7:41 PM
To: devel@edk2.groups.io
Cc: Hsieh, PaytonX ; Dong, Guo ; 
Ni, Ray ; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH v3] UefiPayloadPkg: Fix issues when MULTIPLE_DEBUG_PORT_SUPPORT 
is true

From: PaytonX Hsieh 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4427

1. Since UART speed is slower than CPU, BIOS need to check the write
   buffer is empty, to avoid overwrite the buffer content.
2. LPSS UART might disable MMIO space for Windows debug usage during
   ExitBootServices event. BIOS need to avoid access the MMIO space
   after ExitBootServices.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: PaytonX Hsieh 
---
 UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c  | 15 
+-
 UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c   | 56 

 UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.inf | 41 
++
 UefiPayloadPkg/UefiPayloadPkg.dsc   | 11 
+++-
 4 files changed, 120 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c 
b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c
index 8216195c62..82d0dd5855 100644
--- a/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c
+++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.c
@@ -52,7 +52,8 @@ typedef struct {
 } UART_INFO;

 

 UART_INFO  mUartInfo[MAX_SIZE];

-UINT8  mUartCount = 0;

+UINT8  mUartCount = 0;

+BOOLEANmBaseSerialPortLibHobAtRuntime = FALSE;

 

 /**

   Reads an 8-bit register. If UseMmio is TRUE, then the value is read from

@@ -285,6 +286,11 @@ SerialPortWrite (
 UseMmio = mUartInfo[Count].UseMmio;

 Stride  = mUartInfo[Count].RegisterStride;

 

+if (UseMmio && mBaseSerialPortLibHobAtRuntime) {

+  Count++;

+  continue;

+}

+

 if (BaseAddress == 0) {

   Count++;

   continue;

@@ -294,6 +300,13 @@ SerialPortWrite (
 BytesLeft  = NumberOfBytes;

 

 while (BytesLeft != 0) {

+  //

+  // Wait for the serial port to be ready, to make sure both the transmit 
FIFO

+  // and shift register empty.

+  //

+  while ((SerialPortReadRegister (BaseAddress, R_UART_LSR, UseMmio, 
Stride) & B_UART_LSR_TXRDY) == 0) {

+  }

+

   //

   // Fill the entire Tx FIFO

   //

diff --git 
a/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c 
b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c
new file mode 100644
index 00..6106e9a933
--- /dev/null
+++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c
@@ -0,0 +1,56 @@
+/** @file

+  UART Serial Port library functions.

+

+  Copyright (c) 2023, Intel Corporation. All rights reserved.

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

+

+**/

+#include 

+

+extern BOOLEAN  mBaseSerialPortLibHobAtRuntime;

+

+/**

+  Set mSerialIoUartLibAtRuntime flag as TRUE after ExitBootServices.

+

+  @param[in]  Event   The Event that is being processed.

+  @param[in]  Context The Event Context.

+

+**/

+STATIC

+VOID

+EFIAPI

+BaseSerialPortLibHobExitBootServicesEvent (

+  IN EFI_EVENT  Event,

+  IN VOID   *Context

+  )

+{

+  mBaseSerialPortLibHobAtRuntime = TRUE;

+}

+

+/**

+  The constructor function registers a callback for the ExitBootServices event.

+

+  @param[in]  ImageHandle   The firmware allocated handle for the EFI image.

+  @param[in]  SystemTable   A pointer to the EFI System Table.

+

+  @retval EFI_SUCCESS   The operation completed successfully.

+  @retval other Either the serial port failed to initialize or the

+ExitBootServices event callback registration failed.

+**/

+EFI_STATUS

+EFIAPI

+DxeBaseSerialPortLibHobConstructor (

+  IN EFI_HANDLEImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  EFI_EVENT  SerialPortLibHobExitBootServicesEvent;

+

+  return SystemTable->BootServices->CreateEvent (

+  EVT_SIGNAL_EXIT_BOOT_SERVICES,

+  TPL_NOTIFY,

+  
BaseSerialPortLibHobExitBootServicesEvent,

+  NULL,

+  &SerialPortLibHobExitBootServicesEvent

+  );

+}

diff --git 
a/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.inf 
b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.inf
new file mode 100644
index 00..7bb3a6ae96
--- /dev/null
+++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.inf
@@ -0,0 +1,41 @@
+## @file

+#  Seri

Re: [edk2-devel] [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into MultiFv BdsFv

2023-05-01 Thread Guo, Gua
Reviewed-by:Gua Guo 

-Original Message-
From: Lin, MarsX  
Sent: Tuesday, May 2, 2023 11:29 AM
To: devel@edk2.groups.io
Cc: Lin, MarsX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Integrate UiApp and BootManagerMenuApp into 
MultiFv BdsFv

From: MarsX Lin 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4347

To put UiApp.inf and BootManagerMenuApp.inf to proper FV(BDSFV)

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 

Signed-off-by: MarsX Lin 
---
 .../PlatformBootManager.c | 55 ---
 .../PlatformBootManagerLib.inf|  4 --
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c| 25 +
 .../UniversalPayloadEntry.inf |  1 -
 UefiPayloadPkg/UefiPayloadPkg.dec |  2 -
 UefiPayloadPkg/UefiPayloadPkg.dsc |  9 ++-
 UefiPayloadPkg/UefiPayloadPkg.fdf |  9 ++-
 7 files changed, 12 insertions(+), 93 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 62637ae6aa..31d1d29435 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -9,8 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 

 #include "PlatformBootManager.h"

 #include "PlatformConsole.h"

-#include 

-#include 

 

 /**

   Signal EndOfDxe event and install SMM Ready to lock protocol.

@@ -296,56 +294,3 @@ PlatformBootManagerUnableToBoot (
 {

   return;

 }

-

-/**

-  Get/update PcdBootManagerMenuFile from GUID HOB which will be assigned in 
bootloader.

-

-  @param  ImageHandle   The firmware allocated handle for the EFI image.

-  @param  SystemTable   A pointer to the EFI System Table.

-

-  @retval EFI_SUCCESS   The entry point is executed successfully.

-  @retval other Some error occurs.

-

-**/

-EFI_STATUS

-EFIAPI

-PlatformBootManagerLibConstructor (

-  IN EFI_HANDLEImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-{

-  EFI_STATUS   Status;

-  UINTNSize;

-  VOID *GuidHob;

-  UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;

-  UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU  *BootManagerMenuFile;

-

-  GuidHob = GetFirstGuidHob (&gEdkiiBootManagerMenuFileGuid);

-

-  if (GuidHob == NULL) {

-//

-// If the HOB is not create, the default value of PcdBootManagerMenuFile 
will be used.

-//

-return EFI_SUCCESS;

-  }

-

-  GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA 
(GuidHob);

-  if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE 
(GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {

-return EFI_NOT_FOUND;

-  }

-

-  if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION) 
{

-BootManagerMenuFile = (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU 
*)GET_GUID_HOB_DATA (GuidHob);

-if (BootManagerMenuFile->Header.Length < 
UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU, 
FileName)) {

-  return EFI_NOT_FOUND;

-}

-

-Size   = sizeof (BootManagerMenuFile->FileName);

-Status = PcdSetPtrS (PcdBootManagerMenuFile, &Size, 
&BootManagerMenuFile->FileName);

-ASSERT_EFI_ERROR (Status);

-  } else {

-return EFI_NOT_FOUND;

-  }

-

-  return EFI_SUCCESS;

-}

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index f9626175e2..b9387a4d36 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -13,7 +13,6 @@
   MODULE_TYPE= DXE_DRIVER

   VERSION_STRING = 1.0

   LIBRARY_CLASS  = PlatformBootManagerLib|DXE_DRIVER

-  CONSTRUCTOR= PlatformBootManagerLibConstructor

 

 #

 # The following information is for reference only and not required by the 
build tools.

@@ -47,11 +46,9 @@
   HiiLib

   PrintLib

   PlatformHookLib

-  HobLib

 

 [Guids]

   gEfiEndOfDxeEventGroupGuid

-  gEdkiiBootManagerMenuFileGuid

 

 [Protocols]

   gEfiGenericMemTestProtocolGuid  ## CONSUMES

@@ -74,5 +71,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits

-  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile

   gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape

diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c 
b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
index e959be5d95..3b2b7788d4 100644
--- a/UefiPayloadPkg/UefiPaylo

Re: [edk2-devel] [PATCH 0/4] Trace Hub debug library support

2023-05-03 Thread Guo, Gua
Thanks for @K N, Karthik<mailto:karthik@intel.com> and @Prakashan, 
Krishnadas 
Veliyathuparambil<mailto:krishnadas.veliyathuparambil.prakas...@intel.com> help 
to review it from your side.

Hi Mike

Do we have any stakeholder from Edk2 side also need to them to review it before 
checking the source code ? I can also cc them into the mail loop.

Thanks,
Gua

From: devel@edk2.groups.io  On Behalf Of Guo, Gua
Sent: Monday, April 24, 2023 9:38 AM
To: devel@edk2.groups.io; Guo, Gua ; Hsu, VictorX 
; Kinney, Michael D ; 
Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 
; Chan, Laura 
Cc: Chiu, Chasel ; Lu, James 
Subject: Re: [edk2-devel] [PATCH 0/4] Trace Hub debug library support


@Kinney, Michael D<mailto:michael.d.kin...@intel.com>, @K N, 
Karthik<mailto:karthik@intel.com>, @Prakashan, Krishnadas 
Veliyathuparambil<mailto:krishnadas.veliyathuparambil.prakas...@intel.com>, 
@Chan, Laura<mailto:laura.c...@intel.com>



Could you share me about your concern ?

If no additional concern, please help to give your review-by we can check in 
ASAP.



Thanks,

Gua



-Original Message-
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of Guo, Gua
Sent: Friday, April 21, 2023 10:33 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Hsu, VictorX 
mailto:victorx@intel.com>>
Cc: Chiu, Chasel mailto:chasel.c...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>; 
Prakashan, Krishnadas Veliyathuparambil 
mailto:krishnadas.veliyathuparambil.prakas...@intel.com>>;
 K N, Karthik mailto:karthik@intel.com>>; Chan, 
Laura mailto:laura.c...@intel.com>>
Subject: Re: [edk2-devel] [PATCH 0/4] Trace Hub debug library support



+ Related folk



I want to let the PR for related stakeholder review it.



And have any open ?

https://github.com/tianocore/edk2/pull/3901





Thanks,

Gua



-Original Message-

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of 
victorx@intel.com<mailto:victorx@intel.com>

Sent: Tuesday, April 18, 2023 7:05 PM

To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>

Cc: Hsu, VictorX mailto:victorx@intel.com>>

Subject: [edk2-devel] [PATCH 0/4] Trace Hub debug library support



From: VictorX Hsu mailto:victorx@intel.com>>



-  TraceHub UniversalPayload Spec: 
https://github.com/UniversalScalableFirmware/documentation/pull/52  (Industry 
Standard)

-  MipiSysTLib Wrapper: 
https://github.com/MIPI-Alliance/public-mipi-sys-t.git (Industry Standard)

-  TraceHubDebugLib: Intel(R) Trace Hub (TH) — The Linux Kernel 
documentation (Industry Standard)

Developers Guide: 
https://cdrdv2-public.intel.com/671536/intel-trace-hub-developers-manual-2-1-2.pdf
 (Public Document)



VictorX Hsu (4):

  MdePkg: Add MipiSysTLib library

  MdeModulePkg: Add TraceHubDebugSysTLib library

  MdePkg: Add NULL library of TraceHubDebugSysTLib

  Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg

lib.



.gitmodules   |   5 +-

.pytool/CISettings.py |   2 +

Maintainers.txt   |  18 +

.../Include/Guid/TraceHubDebugInfoHob.h   |  25 +

.../BaseTraceHubDebugSysTLib.c| 251 ++

.../BaseTraceHubDebugSysTLib.inf  |  44 +

.../DxeSmmTraceHubDebugSysTLib.c  | 247 ++

.../DxeSmmTraceHubDebugSysTLib.inf|  50 ++

.../InternalTraceHubApi.c |  82 ++

.../InternalTraceHubApi.h |  46 +

.../InternalTraceHubApiCommon.c   | 208 +

.../InternalTraceHubApiCommon.h   | 119 +++

.../PeiTraceHubDebugSysTLib.c | 290 +++

.../PeiTraceHubDebugSysTLib.inf   |  50 ++

.../Library/TraceHubDebugSysTLib/Readme.md|  30 +

MdeModulePkg/MdeModulePkg.dec |  21 +

MdeModulePkg/MdeModulePkg.dsc |   3 +

MdeModulePkg/MdeModulePkg.uni |  18 +

MdePkg/Include/Library/MipiSysTLib.h  |  66 ++

MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++

MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++

MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++

MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  55 ++

MdePkg/Library/MipiSysTLib/Platform.c | 164 

MdePkg/Library/MipiSysTLib/Platform.h | 138 +++

MdePkg/Library/MipiSysTLib/Readme.md  |  25 +

MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++

MdePkg/Library/MipiSysTLib/mipisyst   |   1 +

.../TraceHubDebugSysTLibNull.c|  76 ++

.../TraceHubDebugSysTLibNull.inf  |  29 +

MdePkg/MdePkg.ci.yaml |  15 +-

MdePkg/MdePkg.dec  

[edk2-devel] [PATCH v1 1/2] MdeModulePkg: Add more PciHostBridgeLib gmock support

2023-05-04 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

Add Google Mock Library for PciHostBridgeLib

Cc: Michael D Kinney 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/MdeModulePkg.dec |  1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|  5 +++
 .../GoogleTest/Library/MockPciHostBridgeLib.h | 40 +++
 .../MockPciHostBridgeLib.cpp  | 14 +++
 .../MockPciHostBridgeLib.inf  | 35 
 5 files changed, 95 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 3eb4a79bf7..9bb0d3ba2d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -24,6 +24,7 @@
 
 [Includes]
   Include
+  Test/Mock/Include
 
 [Includes.Common.Private]
   Library/BrotliCustomDecompressLib/brotli/c/include
diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index a2bbbe8adf..8fb982a270 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -53,3 +53,8 @@
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  #
+  # Build HOST_APPLICATION Libraries
+  #
+  
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
diff --git 
a/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h 
b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
new file mode 100644
index 00..14e45139af
--- /dev/null
+++ b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
@@ -0,0 +1,40 @@
+/** @file
+  Google Test mocks for PciHostBridgeLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_PCI_HOST_BRIDGE_LIB_H_
+#define MOCK_PCI_HOST_BRIDGE_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+}
+
+struct MockPciHostBridgeLib {
+  MOCK_INTERFACE_DECLARATION (MockPciHostBridgeLib);
+
+  MOCK_FUNCTION_DECLARATION (
+PCI_ROOT_BRIDGE *,
+PciHostBridgeGetRootBridges,
+(UINTN  *Count)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeFreeRootBridges,
+(PCI_ROOT_BRIDGE  *Bridges,
+ UINTNCount)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeResourceConflict,
+(EFI_HANDLE  HostBridgeHandle,
+ VOID*Configuration)
+ );
+};
+
+#endif
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
new file mode 100644
index 00..4b15aed169
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
@@ -0,0 +1,14 @@
+/** @file
+  Mock instance of the PCI Host Bridge Library.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+
+MOCK_INTERFACE_DEFINITION(MockPciHostBridgeLib);
+
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, 
EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 
2, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeResourceConflict, 
2, EFIAPI);
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
new file mode 100644
index 00..d5b4a47abe
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
@@ -0,0 +1,35 @@
+## @file
+#  Mock instance of the PCI Host Bridge Library.
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = MockPciHostBridgeLib
+  FILE_GUID  = B51721FE-0BBA-4611-B9A5-ED13C49AC060
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#
+
+[Sources]
+  MockPciHostBridgeLib.cpp
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]

[edk2-devel] [PATCH v1 2/2] MdePkg: Add more HobLib/PeiServicesLib gmock support

2023-05-04 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

Add Google Mock Library for HobLib
Add Google Mock Library for PeiServicesLib

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  33 +++
 7 files changed, 473 insertions(+)
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 35e3ef6d97..529ea69024 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -36,3 +36,5 @@
   MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
   
MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h 
b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
new file mode 100644
index 00..7b5ba5a02e
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
@@ -0,0 +1,150 @@
+/** @file
+  Google Test mocks for HobLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_HOB_LIB_H_
+#define MOCK_HOB_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+#include 
+}
+
+struct MockHobLib {
+  MOCK_INTERFACE_DECLARATION (MockHobLib);
+
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetHobList,
+()
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextHob,
+(IN UINT16  Type,
+ IN CONST VOID  *HobStart)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstHob,
+(IN UINT16  Type)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN CONST VOID  *HobStart)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstGuidHob,
+(IN CONST EFI_GUID  *Guid)
+ );
+  MOCK_FUNCTION_DECLARATION (
+EFI_BOOT_MODE,
+GetBootModeHob,
+()
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildModuleHob,
+(IN CONST EFI_GUID*ModuleName,
+ IN EFI_PHYSICAL_ADDRESS  MemoryAllocationModule,
+ IN UINT64ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS  EntryPoint)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorWithOwnerHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes,
+ IN EFI_GUID *OwnerGUID)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN UINTN   DataLength)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidDataHob,
+(IN CONST EFI_GUID  *Guid,
+ IN VOID*Data,
+ IN UINTN   DataLength)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFvHob,
+(IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN UINT64Length)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv2Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN CONSTEFI_GUID  *FvName,
+ IN CONSTEFI_GUID  *FileName)
+ );
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv3Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN  UINT32AuthenticationStatus,
+ IN  BOOLEAN  

[edk2-devel] [PATCH v1 0/2] Add more google mock library

2023-05-04 Thread Guo, Gua
From: Gua Guo 

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

PR: https://github.com/tianocore/edk2/pull/4335

V1:
  Add google mock support for HobLib
  Add google mock support for PciHostBridgeLib
  Add google mock support for PeiServicesLib

Gua Guo (2):
  MdeModulePkg: Add more PciHostBridgeLib gmock support
  MdePkg: Add more HobLib/PeiServicesLib gmock support

 MdeModulePkg/MdeModulePkg.dec |   1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   5 +
 .../GoogleTest/Library/MockPciHostBridgeLib.h |  40 
 .../MockPciHostBridgeLib.cpp  |  14 ++
 .../MockPciHostBridgeLib.inf  |  35 
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  33 +++
 12 files changed, 568 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

-- 
2.39.2.windows.1



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Use clearer debug flags with more flexibility

2023-05-04 Thread Guo, Gua
Could you also create Edk2 PR ?

-Original Message-
From: Benjamin Doron  
Sent: Friday, May 5, 2023 6:36 AM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Ni, Ray ; Rhodes, Sean 
; Lu, James ; Guo, Gua 

Subject: [PATCH] UefiPayloadPkg: Use clearer debug flags with more flexibility

The default behaviour is that RELEASE builds have all DebugLib macros removed 
by MDEPKG_NDEBUG. Currently, UefiPayloadPkg has been using 
USE_CBMEM_FOR_CONSOLE to disable this behaviour, but it's unclear that this 
option changes DEBUG build behaviour too.

Therefore, add a new build flag, RELEASE_LOGGING, that can be used to set the 
logging behaviour. The USE_CBMEM_FOR_CONSOLE flag only selects the library and 
options specific to it. For instance, logs can only be retrieved when the boot 
completes, so do not produce a CPU breakpoint or deadloop in this case.

There are also cases where the platform builder may want behaviour or 
information from the DEBUG_CODE macros. Therefore, separate this into another 
build flag.

Bitwise ORs enable this flexibility.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Benjamin Doron 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 44 +++
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 998d22290922..360ea71b149d 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -26,7 +26,6 @@
   FLASH_DEFINITION= UefiPayloadPkg/UefiPayloadPkg.fdf   
PCD_DYNAMIC_AS_DYNAMICEX= TRUE -  DEFINE SOURCE_DEBUG_ENABLE
  = FALSE   DEFINE PS2_KEYBOARD_ENABLE  = FALSE   DEFINE 
RAM_DISK_ENABLE  = FALSE   DEFINE SIO_BUS_ENABLE   = 
FALSE@@ -40,7 +39,6 @@
   DEFINE PS2_MOUSE_ENABLE = TRUE   DEFINE CRYPTO_PROTOCOL_SUPPORT  
= FALSE   DEFINE SD_MMC_TIMEOUT   = 100-  DEFINE 
USE_CBMEM_FOR_CONSOLE= FALSE   DEFINE BOOTSPLASH_IMAGE = 
FALSE   DEFINE NVME_ENABLE  = TRUE @@ -101,6 +99,15 @@
   #   [Vendor]   [Device]  
[ClockRate---]  [Offset---] [Bar] [Stride] [RxFifo] 
[TxFifo]   [Rsvd]   [Vendor]   DEFINE PCI_SERIAL_PARAMETERS= 
{0xff,0xff, 0x00,0x00, 0x0,0x20,0x1c,0x00, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 
0x00,0x01, 0x0,0x0, 0x0,0x0, 0x0,0x0, 0xff,0xff} +  #+  # Debug options+  
#+  DEFINE RELEASE_LOGGING  = FALSE+  DEFINE USE_CBMEM_FOR_CONSOLE  
  = FALSE+  DEFINE ENABLE_DEBUG_CODE= FALSE++  DEFINE 
SOURCE_DEBUG_ENABLE  = FALSE+   #   # Shell options: [BUILD_SHELL, 
MIN_BIN, NONE, UEFI_BIN]   #@@ -135,7 +142,7 @@
  [BuildOptions]   *_*_*_CC_FLAGS = -D 
DISABLE_NEW_DEPRECATED_INTERFACES-!if $(USE_CBMEM_FOR_CONSOLE) == FALSE+!if 
$(RELEASE_LOGGING) == FALSE   GCC:RELEASE_*_*_CC_FLAGS   = -DMDEPKG_NDEBUG  
 INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG   MSFT:RELEASE_*_*_CC_FLAGS  
= /D MDEPKG_NDEBUG@@ -436,6 +443,21 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|FALSE   
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE +  #+  # Build the 
PcdDebugPropertyMask from build flags+  #+  
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x03+!if $(ENABLE_DEBUG_CODE) == 
TRUE+  
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|(gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask
 | 0x04)+!endif+!if $(USE_CBMEM_FOR_CONSOLE) == FALSE+  !if 
$(SOURCE_DEBUG_ENABLE) == TRUE+
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|(gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask
 | 0x10)+  !else+
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|(gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask
 | 0x28)+  !endif+!endif+   gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 
0x57, 0x72, 0xcf, 0x80, 0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 
0xd8, 0x95, 0x41 }  !if $(SOURCE_DEBUG_ENABLE)@@ -484,20 +506,8 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }  
 gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x7   
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x804F-!if 
$(USE_CBMEM_FOR_CONSOLE) == FALSE-  !if $(SOURCE_DEBUG_ENABLE)-
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17-  !else-
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F-  !endif-!else-  !if 
$(TARGET) == DEBUG-gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07-  
!else-gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x03-  !endif-!endif   
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|$(MAX_SIZE_NON_POPULATE_CAPSULE)+
   #   # The following parameters are set by Library/PlatformHookLib   #@@ 
-541,7 +551,7 @@
   gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode|1   
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddres

[edk2-devel] [PATCH v2 0/2] Add more google mock library

2023-05-04 Thread Guo, Gua
From: Gua Guo 

V2
Fix AzurePipe line plugin report failure

V1
Add google mock support for HobLib
Add google mock support for PciHostBridgeLib
Add google mock support for PeiServicesLib

Gua Guo (2):
  MdeModulePkg: Add more PciHostBridgeLib gmock support
  MdePkg: Add more HobLib/PeiServicesLib gmock support

 MdeModulePkg/MdeModulePkg.dec |   1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   5 +
 .../GoogleTest/Library/MockPciHostBridgeLib.h |  40 
 .../MockPciHostBridgeLib.cpp  |  14 ++
 .../MockPciHostBridgeLib.inf  |  35 
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  33 +++
 12 files changed, 568 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2 1/2] MdeModulePkg: Add more PciHostBridgeLib gmock support

2023-05-04 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

Add Google Mock Library for PciHostBridgeLib

Cc: Michael D Kinney 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/MdeModulePkg.dec |  1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|  5 +++
 .../GoogleTest/Library/MockPciHostBridgeLib.h | 40 +++
 .../MockPciHostBridgeLib.cpp  | 14 +++
 .../MockPciHostBridgeLib.inf  | 35 
 5 files changed, 95 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 3eb4a79bf7..9bb0d3ba2d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -24,6 +24,7 @@
 
 [Includes]
   Include
+  Test/Mock/Include
 
 [Includes.Common.Private]
   Library/BrotliCustomDecompressLib/brotli/c/include
diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index a2bbbe8adf..8fb982a270 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -53,3 +53,8 @@
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  #
+  # Build HOST_APPLICATION Libraries
+  #
+  
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
diff --git 
a/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h 
b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
new file mode 100644
index 00..a63bed895c
--- /dev/null
+++ b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
@@ -0,0 +1,40 @@
+/** @file
+  Google Test mocks for PciHostBridgeLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_PCI_HOST_BRIDGE_LIB_H_
+#define MOCK_PCI_HOST_BRIDGE_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+}
+
+struct MockPciHostBridgeLib {
+  MOCK_INTERFACE_DECLARATION (MockPciHostBridgeLib);
+
+  MOCK_FUNCTION_DECLARATION (
+PCI_ROOT_BRIDGE *,
+PciHostBridgeGetRootBridges,
+(UINTN  *Count)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeFreeRootBridges,
+(PCI_ROOT_BRIDGE  *Bridges,
+ UINTNCount)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeResourceConflict,
+(EFI_HANDLE  HostBridgeHandle,
+ VOID*Configuration)
+);
+};
+
+#endif
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
new file mode 100644
index 00..4b15aed169
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
@@ -0,0 +1,14 @@
+/** @file
+  Mock instance of the PCI Host Bridge Library.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+
+MOCK_INTERFACE_DEFINITION(MockPciHostBridgeLib);
+
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, 
EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 
2, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeResourceConflict, 
2, EFIAPI);
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
new file mode 100644
index 00..ad4edec73e
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
@@ -0,0 +1,35 @@
+## @file
+#  Mock instance of the PCI Host Bridge Library.
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = MockPciHostBridgeLib
+  FILE_GUID  = B51721FE-0BBA-4611-B9A5-ED13C49AC060
+  MODULE_TYPE= HOST_APPLICATION
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#
+
+[Sources]
+  MockPciHostBridgeLib.cpp
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[Library

[edk2-devel] [PATCH v2 2/2] MdePkg: Add more HobLib/PeiServicesLib gmock support

2023-05-04 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

Add Google Mock Library for HobLib
Add Google Mock Library for PeiServicesLib

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  33 +++
 7 files changed, 473 insertions(+)
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 35e3ef6d97..529ea69024 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -36,3 +36,5 @@
   MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
   
MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h 
b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
new file mode 100644
index 00..994b8133e5
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
@@ -0,0 +1,150 @@
+/** @file
+  Google Test mocks for HobLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_HOB_LIB_H_
+#define MOCK_HOB_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+#include 
+}
+
+struct MockHobLib {
+  MOCK_INTERFACE_DECLARATION (MockHobLib);
+
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetHobList,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextHob,
+(IN UINT16  Type,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstHob,
+(IN UINT16  Type)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstGuidHob,
+(IN CONST EFI_GUID  *Guid)
+);
+  MOCK_FUNCTION_DECLARATION (
+EFI_BOOT_MODE,
+GetBootModeHob,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildModuleHob,
+(IN CONST EFI_GUID*ModuleName,
+ IN EFI_PHYSICAL_ADDRESS  MemoryAllocationModule,
+ IN UINT64ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS  EntryPoint)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorWithOwnerHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes,
+ IN EFI_GUID *OwnerGUID)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidDataHob,
+(IN CONST EFI_GUID  *Guid,
+ IN VOID*Data,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFvHob,
+(IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN UINT64Length)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv2Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN CONSTEFI_GUID  *FvName,
+ IN CONSTEFI_GUID  *FileName)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv3Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN  UINT32AuthenticationStatus,
+ IN  BOOLEAN   

[edk2-devel] [PATCH v1] BaseTools/Plugin: Too many execute file will be failure

2023-05-08 Thread Guo, Gua
From: Gua Guo 

Windows command prompt have 8191 character limitation,
enhance it to make command too long can be resloved.

Change-Id: I7f1d8d46274f1c0104572d47253d499900effe76
Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner.py| 31 ---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..05bb6da50a 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 coverageFile = ""
 for testFile in testList:
 ret = RunCmd("OpenCppCoverage", f"--source {workspace} 
--export_type binary:{testFile}.cov -- {testFile}")
-coverageFile += " --input_coverage=" + testFile + ".cov"
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
+
+coverageFile  = f" --input_coverage={testFile}.cov"
+if (os.path.isfile(f"{os.path.join(buildOutputBase, 
'coverage.cov')}")):
+coverageFile += f" 
--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{os.path.join(buildOutputBase, 'coverage.cov')} 
--working_dir={workspace}Build {coverageFile}")
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
 return 1
 
 # Generate and XML file if requested.by each package
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{os.path.join(buildOutputBase, 'coverage.xml')} 
--working_dir={workspace}Build {coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{os.path.join(buildOutputBase, 
'coverage.xml')} " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
 coverageFile = ""
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+coverageFile += f" 
--input_coverage={workspace}Build/coverage.cov"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{workspace}Build/coverage.cov --working_dir={workspace}Build 
{coverageFile}")
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
 
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{workspace}Build/coverage.xml --working_dir={workspace}Build 
{coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{workspace}Build/coverage.xml " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={workspace}Build/coverage.cov"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml.")
 return 1
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v2] BaseTools/Plugin: Too many execute file report cmd too long failure

2023-05-08 Thread Guo, Gua
From: Gua Guo 

Windows command prompt have 8191 characters limitation,
enhance it to make command too long can be resloved.

Provide an example, if have to many *.cov, it causes to run single
command over the 8191 characters limitation.
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  ...
>  --input_coverage=NNN.cov

The solution is passing many coverage files in single command line to
breaking it up into many command lines with one coverage file per
command line in order to prevent single line is over to 8191 characters.

- Command Line 1
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  --input_coverage=coverage.cov
...

- Command Line N
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=NNN.cov
>  --input_coverage=coverage.cov

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner.py| 31 ---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..05bb6da50a 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 coverageFile = ""
 for testFile in testList:
 ret = RunCmd("OpenCppCoverage", f"--source {workspace} 
--export_type binary:{testFile}.cov -- {testFile}")
-coverageFile += " --input_coverage=" + testFile + ".cov"
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
+
+coverageFile  = f" --input_coverage={testFile}.cov"
+if (os.path.isfile(f"{os.path.join(buildOutputBase, 
'coverage.cov')}")):
+coverageFile += f" 
--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{os.path.join(buildOutputBase, 'coverage.cov')} 
--working_dir={workspace}Build {coverageFile}")
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
 return 1
 
 # Generate and XML file if requested.by each package
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{os.path.join(buildOutputBase, 'coverage.xml')} 
--working_dir={workspace}Build {coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{os.path.join(buildOutputBase, 
'coverage.xml')} " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
 coverageFile = ""
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+coverageFile += f" 
--input_coverage={workspace}Build/coverage.cov"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{workspace}Build/coverage.cov --working_dir={workspace}Build 
{coverageFile}")
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
 
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{workspace}Build/coverage.xml --working_dir={workspace}Build 
{coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{workspace}Build/coverage.xml " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={workspace}Build/coverage.cov"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml.")
 return 1
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3] BaseTools/Plugin: Too many execute filess cause "cmd too long" failure

2023-05-08 Thread Guo, Gua
From: Gua Guo 

Windows command prompt have 8191 characters limitation,
enhance it to make command too long can be resloved.

Provide an example, if have too many cov files, it causes to run single
command over the 8191 characters limitation.
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  ...
>  --input_coverage=NNN.cov

The solution is passing many coverage files in single command line to
breaking it up into many command lines with one coverage file per
command line in order to prevent single line is over to 8191 characters.

- Command Line 1
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  --input_coverage=coverage.cov
...

- Command Line N
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=NNN.cov
>  --input_coverage=coverage.cov

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner.py| 31 ---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..05bb6da50a 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 coverageFile = ""
 for testFile in testList:
 ret = RunCmd("OpenCppCoverage", f"--source {workspace} 
--export_type binary:{testFile}.cov -- {testFile}")
-coverageFile += " --input_coverage=" + testFile + ".cov"
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
+
+coverageFile  = f" --input_coverage={testFile}.cov"
+if (os.path.isfile(f"{os.path.join(buildOutputBase, 
'coverage.cov')}")):
+coverageFile += f" 
--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{os.path.join(buildOutputBase, 'coverage.cov')} 
--working_dir={workspace}Build {coverageFile}")
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
 return 1
 
 # Generate and XML file if requested.by each package
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{os.path.join(buildOutputBase, 'coverage.xml')} 
--working_dir={workspace}Build {coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{os.path.join(buildOutputBase, 
'coverage.xml')} " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
 coverageFile = ""
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+coverageFile += f" 
--input_coverage={workspace}Build/coverage.cov"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{workspace}Build/coverage.cov --working_dir={workspace}Build 
{coverageFile}")
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
 
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{workspace}Build/coverage.xml --working_dir={workspace}Build 
{coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{workspace}Build/coverage.xml " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={workspace}Build/coverage.cov"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml.")
 return 1
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 0/2] Add more google mock library

2023-05-08 Thread Guo, Gua
From: Gua Guo 

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

PR: https://github.com/tianocore/edk2/pull/4335

V3
Remove EBC and fix some coding rule

V2:
Fixed Azure build failure

V1:
Add google mock support for HobLib
Add google mock support for PciHostBridgeLib Add google mock support for 
PeiServicesLib

Gua Guo (2):
  MdeModulePkg: Add more PciHostBridgeLib gmock support
  MdePkg: Add more HobLib/PeiServicesLib gmock support

 MdeModulePkg/MdeModulePkg.dec |   1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   5 +
 .../GoogleTest/Library/MockPciHostBridgeLib.h |  40 
 .../MockPciHostBridgeLib.cpp  |  14 ++
 .../MockPciHostBridgeLib.inf  |  35 
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  32 +++
 12 files changed, 567 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 2/2] MdePkg: Add more HobLib/PeiServicesLib gmock support

2023-05-08 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

Add Google Mock Library for HobLib
Add Google Mock Library for PeiServicesLib

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  32 +++
 7 files changed, 472 insertions(+)
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 35e3ef6d97..529ea69024 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -36,3 +36,5 @@
   MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
   
MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h 
b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
new file mode 100644
index 00..994b8133e5
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
@@ -0,0 +1,150 @@
+/** @file
+  Google Test mocks for HobLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_HOB_LIB_H_
+#define MOCK_HOB_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+#include 
+}
+
+struct MockHobLib {
+  MOCK_INTERFACE_DECLARATION (MockHobLib);
+
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetHobList,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextHob,
+(IN UINT16  Type,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstHob,
+(IN UINT16  Type)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstGuidHob,
+(IN CONST EFI_GUID  *Guid)
+);
+  MOCK_FUNCTION_DECLARATION (
+EFI_BOOT_MODE,
+GetBootModeHob,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildModuleHob,
+(IN CONST EFI_GUID*ModuleName,
+ IN EFI_PHYSICAL_ADDRESS  MemoryAllocationModule,
+ IN UINT64ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS  EntryPoint)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorWithOwnerHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes,
+ IN EFI_GUID *OwnerGUID)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidDataHob,
+(IN CONST EFI_GUID  *Guid,
+ IN VOID*Data,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFvHob,
+(IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN UINT64Length)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv2Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN CONSTEFI_GUID  *FvName,
+ IN CONSTEFI_GUID  *FileName)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv3Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN  UINT32AuthenticationStatus,
+ IN  BOOLEAN   

[edk2-devel] [PATCH v3 1/2] MdeModulePkg: Add more PciHostBridgeLib gmock support

2023-05-08 Thread Guo, Gua
From: Gua Guo 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4443

Add Google Mock Library for PciHostBridgeLib

Cc: Michael D Kinney 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/MdeModulePkg.dec |  1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|  5 +++
 .../GoogleTest/Library/MockPciHostBridgeLib.h | 40 +++
 .../MockPciHostBridgeLib.cpp  | 14 +++
 .../MockPciHostBridgeLib.inf  | 35 
 5 files changed, 95 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 3eb4a79bf7..9bb0d3ba2d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -24,6 +24,7 @@
 
 [Includes]
   Include
+  Test/Mock/Include
 
 [Includes.Common.Private]
   Library/BrotliCustomDecompressLib/brotli/c/include
diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index a2bbbe8adf..8fb982a270 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -53,3 +53,8 @@
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  #
+  # Build HOST_APPLICATION Libraries
+  #
+  
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
diff --git 
a/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h 
b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
new file mode 100644
index 00..a63bed895c
--- /dev/null
+++ b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
@@ -0,0 +1,40 @@
+/** @file
+  Google Test mocks for PciHostBridgeLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_PCI_HOST_BRIDGE_LIB_H_
+#define MOCK_PCI_HOST_BRIDGE_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+}
+
+struct MockPciHostBridgeLib {
+  MOCK_INTERFACE_DECLARATION (MockPciHostBridgeLib);
+
+  MOCK_FUNCTION_DECLARATION (
+PCI_ROOT_BRIDGE *,
+PciHostBridgeGetRootBridges,
+(UINTN  *Count)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeFreeRootBridges,
+(PCI_ROOT_BRIDGE  *Bridges,
+ UINTNCount)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeResourceConflict,
+(EFI_HANDLE  HostBridgeHandle,
+ VOID*Configuration)
+);
+};
+
+#endif
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
new file mode 100644
index 00..4b15aed169
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
@@ -0,0 +1,14 @@
+/** @file
+  Mock instance of the PCI Host Bridge Library.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+
+MOCK_INTERFACE_DEFINITION(MockPciHostBridgeLib);
+
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, 
EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 
2, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeResourceConflict, 
2, EFIAPI);
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
new file mode 100644
index 00..89daefb9f0
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
@@ -0,0 +1,35 @@
+## @file
+#  Mock instance of the PCI Host Bridge Library.
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = MockPciHostBridgeLib
+  FILE_GUID  = B51721FE-0BBA-4611-B9A5-ED13C49AC060
+  MODULE_TYPE= HOST_APPLICATION
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  MockPciHostBridgeLib.cpp
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClas

  1   2   3   >