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] 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] 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 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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




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]
-=-=-=-=-=-=-=-=-=-=-=-




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 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 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/2] IntelFsp2Pkg: Python3.12 support

2024-04-22 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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




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 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 =  

[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 = 

[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]
-=-=-=-=-=-=-=-=-=-=-=-




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/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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




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]
-=-=-=-=-=-=-=-=-=-=-=-




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]
-=-=-=-=-=-=-=-=-=-=-=-




[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 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]
-=-=-=-=-=-=-=-=-=-=-=-




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 ();
   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 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 +, 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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




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   

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] 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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




[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), 
);
   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 (>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), );
   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 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), 
);
   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 (>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 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), 
);
   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 (>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), );
   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_GENERIC_HEADER));
 }
 
 /**
diff --git 

[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]
-=-=-=-=-=-=-=-=-=-=-=-




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/StandaloneMmCoreHobLib

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 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]
-=-=-=-=-=-=-=-=-=-=-=-




[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]
-=-=-=-=-=-=-=-=-=-=-=-




[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 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]
-=-=-=-=-=-=-=-=-=-=-=-




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 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]
-=-=-=-=-=-=-=-=-=-=-=-




[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 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 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 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]
-=-=-=-=-=-=-=-=-=-=-=-




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]
-=-=-=-=-=-=-=-=-=-=-=-




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] 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 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 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 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] IntelFsp2WrapperPkg: Add variable initialization

2023-11-09 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Hsu, JasonX  
Sent: Thursday, November 9, 2023 6:01 PM
To: devel@edk2.groups.io
Cc: Hsu, JasonX ; Desimone, Nathaniel L 
; Zeng, Star ; Chiu, 
Chasel ; Chen, Gang C ; Duggapu, 
Chinni B ; Kuo, Ted ; S, Ashraf 
Ali ; Mohapatra, Susovan ; 
Lu, James ; Guo, Gua 
Subject: [PATCH] IntelFsp2WrapperPkg: Add variable initialization

From: "JasonX.Hsu" 

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

Fix build error when remove "-Wno-sometimes-uninitialized" option, Add variable 
"FspMultiPhaseApiOffset" initialization.

Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Jason Hsu 
---
 .../PeiFspWrapperMultiPhaseProcessLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
index 834dca07a9..224c24881d 100644
--- 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
+++ b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspW
+++ rapperMultiPhaseProcessLib.c
@@ -80,6 +80,7 @@ CallFspMultiPhaseEntry (
   BOOLEAN IsVariableServiceRequest;   FSP_MULTI_PHASE_PARAMS  
*FspMultiPhaseParamsPtr; +  FspMultiPhaseApiOffset   = 0;   
FspMultiPhaseParamsPtr   = (FSP_MULTI_PHASE_PARAMS *)FspMultiPhaseParams;   
IsVariableServiceRequest = FALSE;   if 
((FspMultiPhaseParamsPtr->MultiPhaseAction == 
EnumMultiPhaseGetVariableRequestInfo) ||-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110963): https://edk2.groups.io/g/devel/message/110963
Mute This Topic: https://groups.io/mt/102482693/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 6/7] UefiPayloadPkg: Specifies SmmCpuSyncLib instance

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

-Original Message-
From: Wu, Jiaxin  
Sent: Friday, November 3, 2023 11:30 PM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua ; Ni, Ray 
; Zeng, Star 
Subject: [PATCH v1 6/7] UefiPayloadPkg: Specifies SmmCpuSyncLib instance

The SmmCpuSyncLib instance is included in UefiCpuLibs.dsc.inc.
This patch is to specify SmmCpuSyncLib instance in UefiPayloadPkg by using 
"!include UefiCpuPkg/UefiCpuLibs.dsc.inc".

Change-Id: Ib303a9cdf260ac1ffc146e5f2e68834dec00ff25
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 af9308ef8e..6f6d815c07 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -169,10 +169,11 @@
 # Library Class section - list of all Library Classes needed by this Platform.
 #
 

 
 !include MdePkg/MdeLibs.dsc.inc
+!include UefiCpuPkg/UefiCpuLibs.dsc.inc
 
 [LibraryClasses]
   #
   # Entry point
   #
--
2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110692): https://edk2.groups.io/g/devel/message/110692
Mute This Topic: https://groups.io/mt/102366304/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] UefiPayloadPkg: Fix incorrect code on Fit function.

2023-10-27 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Saturday, October 28, 2023 7:13 AM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; 
Rhodes, Sean ; Lu, James ; Guo, Gua 

Subject: [PATCH v2 1/1] UefiPayloadPkg: Fix incorrect code on Fit function.

From: BruceX Wang 

1. Add firmware volume need to check firmware volume exist or not.
2. Remove clang version check dependency.

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

Signed-off-by: BruceX Wang 
---
 UefiPayloadPkg/Tools/MkFitImage.py  |  7 ++-
 UefiPayloadPkg/UniversalPayloadBuild.py | 10 --
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/UefiPayloadPkg/Tools/MkFitImage.py 
b/UefiPayloadPkg/Tools/MkFitImage.py
index 82ab933d6d..41a259960b 100644
--- a/UefiPayloadPkg/Tools/MkFitImage.py
+++ b/UefiPayloadPkg/Tools/MkFitImage.py
@@ -10,6 +10,7 @@ from os.path import exists
 import libfdt

 from ctypes import *

 import time

+import os

 

 class FIT_IMAGE_INFO_HEADER:

 """Class for user setting data to use MakeFitImage()

@@ -139,6 +140,8 @@ def BuildFitImage(Fdt, InfoHeader):
 ImageNode = libfdt.fdt_add_subnode(Fdt, 0, 'images')

 for Item in reversed (MultiImage):

 Name, Path, BuildFvNode, Description, BinaryData, DataOffset = Item

+if os.path.exists (Item[1]) == False:

+continue

 FvNode = libfdt.fdt_add_subnode(Fdt, ImageNode, Name)

 BuildFvNode (Fdt, InfoHeader, FvNode, DataOffset, len(BinaryData), 
Description)

 

@@ -149,7 +152,9 @@ def BuildFitImage(Fdt, InfoHeader):
 DtbFile.truncate()

 DtbFile.write(Fdt)

 for Item in MultiImage:

-_, _, _, _, BinaryData, _ = Item

+_, FilePath, _, _, BinaryData, _ = Item

+if os.path.exists (Item[1]) == False:

+continue

 DtbFile.write(BinaryData)

 DtbFile.close()

 

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 6f57fa6df6..046c62e21c 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -146,16 +146,6 @@ def BuildUniversalPayload(Args):
 ModuleReportPath = os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt")

 UpldInfoFile = os.path.join(BuildDir, "UniversalPayloadInfo.bin")

 

-if "CLANG_BIN" in os.environ:

-LlvmObjcopyPath = os.path.join(os.environ["CLANG_BIN"], "llvm-objcopy")

-else:

-LlvmObjcopyPath = "llvm-objcopy"

-try:

-RunCommand('"%s" --version'%LlvmObjcopyPath)

-except:

-print("- Failed - Please check if LLVM is installed or if CLANG_BIN is 
set correctly")

-sys.exit(1)

-

 Pcds = ""

 if (Args.pcd != None):

 for PcdItem in Args.pcd:

-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110233): https://edk2.groups.io/g/devel/message/110233
Mute This Topic: https://groups.io/mt/102232380/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 05/14] UefiPayloadPkg: Add ImagePropertiesRecordLib Instance

2023-10-23 Thread Guo, Gua
Reviewed-by: Gua Guo 

From: Kinney, Michael D 
Sent: Tuesday, October 24, 2023 8:09:16 AM
To: devel@edk2.groups.io ; t...@taylorbeebe.com 

Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua ; Kinney, Michael D 

Subject: RE: [edk2-devel] [PATCH v4 05/14] UefiPayloadPkg: Add 
ImagePropertiesRecordLib Instance

Hi Taylor,

I see there have been no reviews from the package maintainers for this
small update to some DSC files.  You can use my Rb for this patch
as a steward.

Reviewed-by: Michael D Kinney 

Thanks,

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Taylor
> Beebe
> Sent: Friday, August 4, 2023 12:47 PM
> To: devel@edk2.groups.io
> Cc: Dong, Guo ; Rhodes, Sean
> ; Lu, James ; Guo, Gua
> 
> Subject: [edk2-devel] [PATCH v4 05/14] UefiPayloadPkg: Add
> ImagePropertiesRecordLib Instance
>
> From: Taylor Beebe 
>
> Add an instance of ImagePropertiesRecordLib which will be used by the
> DXE Core.
>
> Signed-off-by: Taylor Beebe 
> Cc: Guo Dong 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index 47812048ddcf..8d237b23339a 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -277,6 +277,7 @@ [LibraryClasses]
>#
>
> DebugPrintErrorLevelLib|UefiPayloadPkg/Library/DebugPrintErrorLevelLib
> Hob/DebugPrintErrorLevelLibHob.inf
>
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLi
> bNull.inf
> +
> ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib
> /ImagePropertiesRecordLib.inf
>  !if $(SOURCE_DEBUG_ENABLE) == TRUE
>
> PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibD
> ebug/PeCoffExtraActionLibDebug.inf
>
> DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLi
> bSerialPort/DebugCommunicationLibSerialPort.inf
> --
> 2.41.0.windows.3
>
>
>
> 
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109960): https://edk2.groups.io/g/devel/message/109960
Mute This Topic: https://groups.io/mt/100553435/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] Maintainers.txt: Stop to be reviewer of several modules

2023-10-19 Thread Guo, Gua
Reviewed-by: Gua Guo 

From: Kinney, Michael D 
Sent: Friday, October 20, 2023 8:56:26 AM
To: devel@edk2.groups.io ; Ni, Ray 
Cc: Gao, Zhichao ; Wu, Hao A ; Liu, 
Zhiguang ; Guo, Gua ; Kinney, 
Michael D 
Subject: RE: [edk2-devel] [PATCH V2] Maintainers.txt: Stop to be reviewer of 
several modules

Reviewed-by: Michael D Kinney 

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Ni, Ray
> Sent: Monday, June 12, 2023 11:36 PM
> To: devel@edk2.groups.io
> Cc: Gao, Zhichao ; Wu, Hao A
> ; Liu, Zhiguang ; Guo, Gua
> 
> Subject: [edk2-devel] [PATCH V2] Maintainers.txt: Stop to be reviewer
> of several modules
>
> Remove my name from reviewer list of following modules:
> * MdeModulePkg: Console and Graphics modules
> * MdeModulePkg: Reset modules
> * MdeModulePkg: Serial modules
> * MdeModulePkg: Universal Payload definitions
>
> Signed-off-by: Ray Ni 
> Cc: Zhichao Gao 
> Cc: Hao A Wu 
> Cc: Zhiguang Liu 
> Cc: Gua Guo 
> ---
>  Maintainers.txt | 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 42e40dced3..a523fb41c1 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -294,7 +294,6 @@ F: MdeModulePkg/Library/BaseBmpSupportLib/
>  F: MdeModulePkg/Library/FrameBufferBltLib/
>
>  F: MdeModulePkg/Universal/Console/
>
>  R: Zhichao Gao  [ZhichaoGao]
>
> -R: Ray Ni  [niruiyu]
>
>
>
>  MdeModulePkg: Core services (PEI, DXE and Runtime) modules
>
>  F: MdeModulePkg/*Mem*/
>
> @@ -398,12 +397,10 @@ MdeModulePkg: Reset modules
>  F: MdeModulePkg/*Reset*/
>
>  F: MdeModulePkg/Include/*Reset*.h
>
>  R: Zhichao Gao  [ZhichaoGao]
>
> -R: Ray Ni  [niruiyu]
>
>
>
>  MdeModulePkg: Serial modules
>
>  F: MdeModulePkg/*Serial*/
>
>  F: MdeModulePkg/Include/*SerialPort*.h
>
> -R: Ray Ni  [niruiyu]
>
>  R: Zhichao Gao  [ZhichaoGao]
>
>
>
>  MdeModulePkg: SMBIOS modules
>
> @@ -426,7 +423,6 @@ R: Liming Gao  [lgao4]
>  MdeModulePkg: Universal Payload definitions
>
>  F: MdeModulePkg/Include/UniversalPayload/
>
>  R: Zhiguang Liu  [LiuZhiguang001]
>
> -R: Ray Ni  [niruiyu]
>
>  R: Gua Guo  [gguo11837463]
>
>
>
>  MdeModulePkg: Trace Hub debug message related library instance
>
> --
> 2.37.2.windows.2
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#106051):
> https://edk2.groups.io/g/devel/message/106051
> Mute This Topic: https://groups.io/mt/99500362/1643496
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe:
> https://edk2.groups.io/g/devel/leave/3603567/1643496/1659866329/xyzzy
> [michael.d.kin...@intel.com]
> -=-=-=-=-=-=
>



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




Re: [edk2-devel] [PATCH v5 0/2] Add FIT support

2023-09-25 Thread Guo, Gua
Series Reviewed-by: Gua Guo 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of 
brucex.w...@intel.com
Sent: Monday, September 25, 2023 10:15 AM
To: devel@edk2.groups.io
Cc: Wang, BruceX 
Subject: [edk2-devel] [PATCH v5 0/2] Add FIT support

From: "Brucex.Wang" 

V5: Fix Gcc build failure.
V4: Fix Benny comment in patch mail.
V3: Fix Lean Sheng comment in patch mail
V2: Fix Gua and Chasel comment in PR
V1: Initialize Version


Brucex.Wang (2):
  MdePkg/BaseFdtLib: Add Fdt function.
  UefiPayloadPkg: Add FIT support

 MdePkg/Include/Library/FdtLib.h   |  34 +
 MdePkg/Library/BaseFdtLib/FdtLib.c|  40 ++
 .../Include/Guid/UniversalPayloadBase.h   |  19 +
 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h |  60 ++
 .../PayloadLoaderPeim/FitLib/FitLib.c | 127 
 .../PayloadLoaderPeim/FitPayloadLoaderPeim.c  | 150 
 .../FitPayloadLoaderPeim.inf  |  59 ++
 UefiPayloadPkg/Readme.md  | 189 +
 UefiPayloadPkg/Tools/MkFitImage.py| 272 
 .../FitUniversalPayloadEntry.c| 653 ++
 .../FitUniversalPayloadEntry.inf  |  98 +++
 UefiPayloadPkg/UefiPayloadPkg.dec |   3 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  27 +-
 UefiPayloadPkg/UniversalPayloadBuild.py   | 331 ++---
 14 files changed, 1966 insertions(+), 96 deletions(-)  create mode 100644 
UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib/FitLib.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.inf
 create mode 100644 UefiPayloadPkg/Readme.md  create mode 100644 
UefiPayloadPkg/Tools/MkFitImage.py
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf

--
2.39.1.windows.1








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




Re: [edk2-devel] [PATCH v5 1/2] MdePkg/BaseFdtLib: Add Fdt function.

2023-09-24 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Monday, September 25, 2023 10:15 AM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Lin, Benny ; 
Guo, Gua ; Chiu, Chasel ; Lu, James 

Subject: [PATCH v5 1/2] MdePkg/BaseFdtLib: Add Fdt function.

From: "Brucex.Wang" 

Add FdtGetName() and FdtNodeDepth() function.

Cc: Benny Lin 
Cc: Gua Guo 
Cc: Chasel Chiu 
Cc: James Lu 

Signed-off-by: BruceX Wang 
---
 MdePkg/Include/Library/FdtLib.h| 34 +
 MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++
 2 files changed, 74 insertions(+)

diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h 
index cf5ceba9e9..d9300a18e3 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -398,4 +398,38 @@ FdtSetProp (
   IN UINT32   Length   ); +/**+  Returns the name of a given node.++  
@param[in] FdtThe pointer to FDT blob.+  @param[in] NodeOffse  
Offset of node to check.+  @param[in] Length The pointer to an integer 
variable (will be overwritten) or NULL.++  @return The pointer to the node's 
name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+  IN VOID*Fdt,+  IN INT32   
NodeOffset,+  IN UINT32  *Length+  );++/**+  FdtNodeDepth() finds the depth of 
a given node.  The root node+  has depth 0, its immediate subnodes depth 1 and 
so forth.++  @param[in] FdtThe pointer to FDT blob.+  @param[in] 
NodeOffset Offset of node to check.++  @return Depth of the node at 
NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+  IN CONST VOID  *Fdt,+  IN INT32   
NodeOffset+  );+ #endif /* FDT_LIB_H_ */diff --git 
a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c
index 090b0b3fd4..1ef99ea882 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -402,3 +402,43 @@ FdtSetProp (
 {   return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length); }++/**+  
Returns the name of a given node.++  @param[in] FdtThe pointer to 
FDT blob.+  @param[in] NodeOffset Offset of node to check.+  @param[in] 
Length The pointer to an integer variable (will be overwritten) or 
NULL.++  @return The pointer to the node's name.++**/+CONST CHAR8 
*+EFIAPI+FdtGetName (+  IN VOID*Fdt,+  IN INT32   NodeOffset,+  IN UINT32  
*Length+  )+{+  return fdt_get_name (Fdt, NodeOffset, (int *)Length);+}++/**+  
FdtNodeDepth() finds the depth of a given node.  The root node+  has depth 0, 
its immediate subnodes depth 1 and so forth.++  @param[in] FdtThe 
pointer to FDT blob.+  @param[in] NodeOffset Offset of node to check.++  
@returns Depth of the node at NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+  IN 
CONST VOID  *Fdt,+  IN INT32   NodeOffset+  )+{+  return fdt_node_depth 
(Fdt, NodeOffset);+}-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH v5 2/2] UefiPayloadPkg: Add FIT support

2023-09-24 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Monday, September 25, 2023 10:15 AM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; 
Rhodes, Sean ; Lu, James ; Guo, Gua 

Subject: [PATCH v5 2/2] UefiPayloadPkg: Add FIT support

From: "Brucex.Wang" 

Provide Fit format for UniversalPayload, developer can use argument
"--Fit" to build UniversalPayload.fit

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

Signed-off-by: BruceX Wang 
---
 MdePkg/Include/Library/FdtLib.h   |   6 +-
 MdePkg/Library/BaseFdtLib/FdtLib.c|   8 +-
 .../Include/Guid/UniversalPayloadBase.h   |  19 +
 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h |  60 ++
 .../PayloadLoaderPeim/FitLib/FitLib.c | 127 
 .../PayloadLoaderPeim/FitPayloadLoaderPeim.c  | 150 
 .../FitPayloadLoaderPeim.inf  |  59 ++
 UefiPayloadPkg/Readme.md  | 189 +
 UefiPayloadPkg/Tools/MkFitImage.py| 272 
 .../FitUniversalPayloadEntry.c| 653 ++
 .../FitUniversalPayloadEntry.inf  |  98 +++
 UefiPayloadPkg/UefiPayloadPkg.dec |   3 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  27 +-
 UefiPayloadPkg/UniversalPayloadBuild.py   | 331 ++---
 14 files changed, 1899 insertions(+), 103 deletions(-)
 create mode 100644 UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib/FitLib.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.inf
 create mode 100644 UefiPayloadPkg/Readme.md
 create mode 100644 UefiPayloadPkg/Tools/MkFitImage.py
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf

diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h
index d9300a18e3..65d74609cd 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -411,9 +411,9 @@ FdtSetProp (
 CONST CHAR8 *

 EFIAPI

 FdtGetName (

-  IN VOID*Fdt,

-  IN INT32   NodeOffset,

-  IN UINT32  *Length

+  IN VOID   *Fdt,

+  IN INT32  NodeOffset,

+  IN INT32  *Length

   );

 

 /**

diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c 
b/MdePkg/Library/BaseFdtLib/FdtLib.c
index 1ef99ea882..c9514af673 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -416,12 +416,12 @@ FdtSetProp (
 CONST CHAR8 *

 EFIAPI

 FdtGetName (

-  IN VOID*Fdt,

-  IN INT32   NodeOffset,

-  IN UINT32  *Length

+  IN VOID   *Fdt,

+  IN INT32  NodeOffset,

+  IN INT32  *Length

   )

 {

-  return fdt_get_name (Fdt, NodeOffset, (int *)Length);

+  return fdt_get_name (Fdt, NodeOffset, Length);

 }

 

 /**

diff --git a/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h 
b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
new file mode 100644
index 00..60f2aa37dd
--- /dev/null
+++ b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
@@ -0,0 +1,19 @@
+/** @file

+  Universal Payload general definitions.

+

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

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

+

+**/

+

+#ifndef UNIVERSAL_PAYLOAD_BASE_H_

+#define UNIVERSAL_PAYLOAD_BASE_H_

+

+extern GUID  gUniversalPayloadBaseGuid;

+

+typedef struct {

+  UNIVERSAL_PAYLOAD_GENERIC_HEADERHeader;

+  EFI_PHYSICAL_ADDRESSEntry;

+} UNIVERSAL_PAYLOAD_BASE;

+

+#endif // UNIVERSAL_PAYLOAD_BASE_H_

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h 
b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
new file mode 100644
index 00..6a93b41590
--- /dev/null
+++ b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
@@ -0,0 +1,60 @@
+/** @file

+  FIT Load Image Support

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

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

+**/

+

+#ifndef FIT_LIB_H_

+#define FIT_LIB_H_

+

+#include 

+#include 

+#include 

+

+typedef struct {

+  UINT64RelocateType;

+  UINT64Offset;

+} FIT_RELOCATE_ITEM;

+

+typedef struct {

+  EFI_PHYSICAL_ADDRESSImageBase;

+  EFI_PHYSICAL_ADDRESSPayloadBaseAddress;

+  UINT64  PayloadSize;

+  UINTN   PayloadEntryOffset;

+  UINTN   PayloadEntrySize;

+  EFI_PHYSICAL_ADDRESSPayloadEntryPoint;

+  UINTN   RelocateTableOffset;

+  UINTN   RelocateTableCount;

+  EFI_PHYSICAL_ADDRESSPayloadLoadAddress;

+} FIT_IMAGE_CONTEXT;

+

+typedef struct {

+  CHAR8 *Name;

+  UINT32Offset;

+} PROPERTY_DATA;

+

+#define IMAGE_BASE_OFFSET OFFSET_OF (FIT_IMAGE_CONTEXT, ImageBase)

+#define PAYLOAD_BASE_ADDR_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadBaseAddress)

+#define PAYL

Re: [edk2-devel] [PATCH v2] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version

2023-09-24 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Lien, HoraceX  
Sent: Monday, September 25, 2023 10:07 AM
To: devel@edk2.groups.io
Cc: Lien, HoraceX ; Liu, Zhiguang 
; Guo, Gua ; Bi, Dandan 
; Kinney, Michael D ; Zeng, 
Star ; Gao, Zhichao 
Subject: [PATCH v2] MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with 
SMBIOS version

From: HoraceX Lien 

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

These value of Major/Minor version are updated from SMBIOS memory data, but BCD 
Revision is updated from PCD PcdSmbiosVersion.
We should also update BCD Revision from SMBIOS memory data, to ensure that get 
consistent version value.

Cc: Zhiguang Liu 
Reviewed-by: Gua Guo 
Reviewed-by: Dandan Bi 
Reviewed-by: Michael D Kinney 
Cc: Star Zeng 
Cc: Zhichao Gao 
Signed-off-by: HoraceX Lien 
---
 MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c 
b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 1a86e69d3c..2ef7b8e21c 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1072,14 +1072,18 @@ SmbiosCreateTable (
 DEBUG ((DEBUG_INFO, "SmbiosCreateTable: Initialize 32-bit entry point 
structure\n"));

 EntryPointStructureData.MajorVersion  = 
mPrivateData.Smbios.MajorVersion;

 EntryPointStructureData.MinorVersion  = 
mPrivateData.Smbios.MinorVersion;

-EntryPointStructureData.SmbiosBcdRevision = (UINT8)((PcdGet16 
(PcdSmbiosVersion) >> 4) & 0xf0) | (UINT8)(PcdGet16 (PcdSmbiosVersion) & 0x0f);

-PhysicalAddress   = 0x;

-Status= gBS->AllocatePages (

-   AllocateMaxAddress,

-   EfiRuntimeServicesData,

-   EFI_SIZE_TO_PAGES 
(sizeof (SMBIOS_TABLE_ENTRY_POINT)),

-   

-   );

+EntryPointStructureData.SmbiosBcdRevision = 0;

+if ((mPrivateData.Smbios.MajorVersion <= 9) && 
+ (mPrivateData.Smbios.MinorVersion <= 9)) {

+  EntryPointStructureData.SmbiosBcdRevision = 
+ ((mPrivateData.Smbios.MajorVersion & 0x0f) << 4) | 
+ (mPrivateData.Smbios.MinorVersion & 0x0f);

+}

+

+PhysicalAddress = 0x;

+Status  = gBS->AllocatePages (

+ AllocateMaxAddress,

+ EfiRuntimeServicesData,

+ EFI_SIZE_TO_PAGES (sizeof 
+ (SMBIOS_TABLE_ENTRY_POINT)),

+ 

+ );

 if (EFI_ERROR (Status)) {

   DEBUG ((DEBUG_ERROR, "SmbiosCreateTable () could not allocate 
EntryPointStructure < 4GB\n"));

   Status = gBS->AllocatePages (

--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109031): https://edk2.groups.io/g/devel/message/109031
Mute This Topic: https://groups.io/mt/101567470/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 0/2] UefiPayloadPkg: Add FIT support

2023-09-18 Thread Guo, Gua
Series Reviewed-by: Gua Guo 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of 
brucex.w...@intel.com
Sent: Monday, September 18, 2023 3:02 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX 
Subject: [edk2-devel] [PATCH v4 0/2] UefiPayloadPkg: Add FIT support

From: "Brucex.Wang" 

V4: Fix Benny comment in patch mail.
V3: Fix Lean Sheng comment in patch mail
V2: Fix Gua and Chasel comment in PR
V1: Initialize Version


Brucex.Wang (2):
  MdePkg/BaseFdtLib: Add Fdt function.
  UefiPayloadPkg: Add FIT support

 MdePkg/Include/Library/FdtLib.h   |  34 +
 MdePkg/Library/BaseFdtLib/FdtLib.c|  40 ++
 .../Include/Guid/UniversalPayloadBase.h   |  19 +
 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h |  60 ++
 .../PayloadLoaderPeim/FitLib/FitLib.c | 127 
 .../PayloadLoaderPeim/FitPayloadLoaderPeim.c  | 150 
 .../FitPayloadLoaderPeim.inf  |  59 ++
 UefiPayloadPkg/Readme.md  | 189 +
 UefiPayloadPkg/Tools/MkFitImage.py| 272 
 .../FitUniversalPayloadEntry.c| 654 ++
 .../FitUniversalPayloadEntry.inf  |  98 +++
 UefiPayloadPkg/UefiPayloadPkg.dec |   3 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  27 +-
 UefiPayloadPkg/UniversalPayloadBuild.py   | 328 ++---
 14 files changed, 1964 insertions(+), 96 deletions(-)  create mode 100644 
UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib/FitLib.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.inf
 create mode 100644 UefiPayloadPkg/Readme.md  create mode 100644 
UefiPayloadPkg/Tools/MkFitImage.py
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf

--
2.39.1.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108804): https://edk2.groups.io/g/devel/message/108804
Mute This Topic: https://groups.io/mt/101435622/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 2/2] UefiPayloadPkg: Add FIT support

2023-09-18 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Monday, September 18, 2023 3:02 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; 
Rhodes, Sean ; Lu, James ; Guo, Gua 

Subject: [PATCH v4 2/2] UefiPayloadPkg: Add FIT support

From: "Brucex.Wang" 

Provide Fit format for UniversalPayload, developer can use argument
"--Fit" to build UniversalPayload.fit

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

Signed-off-by: BruceX Wang 
---
 .../Include/Guid/UniversalPayloadBase.h   |  19 +
 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h |  60 ++
 .../PayloadLoaderPeim/FitLib/FitLib.c | 127 
 .../PayloadLoaderPeim/FitPayloadLoaderPeim.c  | 150 
 .../FitPayloadLoaderPeim.inf  |  59 ++
 UefiPayloadPkg/Readme.md  | 189 +
 UefiPayloadPkg/Tools/MkFitImage.py| 272 
 .../FitUniversalPayloadEntry.c| 654 ++
 .../FitUniversalPayloadEntry.inf  |  98 +++
 UefiPayloadPkg/UefiPayloadPkg.dec |   3 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  27 +-
 UefiPayloadPkg/UniversalPayloadBuild.py   | 328 ++---
 12 files changed, 1890 insertions(+), 96 deletions(-)
 create mode 100644 UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib/FitLib.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.inf
 create mode 100644 UefiPayloadPkg/Readme.md
 create mode 100644 UefiPayloadPkg/Tools/MkFitImage.py
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf

diff --git a/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h 
b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
new file mode 100644
index 00..60f2aa37dd
--- /dev/null
+++ b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
@@ -0,0 +1,19 @@
+/** @file

+  Universal Payload general definitions.

+

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

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

+

+**/

+

+#ifndef UNIVERSAL_PAYLOAD_BASE_H_

+#define UNIVERSAL_PAYLOAD_BASE_H_

+

+extern GUID  gUniversalPayloadBaseGuid;

+

+typedef struct {

+  UNIVERSAL_PAYLOAD_GENERIC_HEADERHeader;

+  EFI_PHYSICAL_ADDRESSEntry;

+} UNIVERSAL_PAYLOAD_BASE;

+

+#endif // UNIVERSAL_PAYLOAD_BASE_H_

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h 
b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
new file mode 100644
index 00..0514d675a6
--- /dev/null
+++ b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
@@ -0,0 +1,60 @@
+/** @file

+  FIT Load Image Support

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

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

+**/

+

+#ifndef FIT_LIB_H_

+#define FIT_LIB_H_

+

+#include 

+#include 

+#include 

+

+typedef struct {

+  UINT64RelocateType;

+  UINT64Offset;

+} FIT_RELOCATE_ITEM;

+

+typedef struct {

+  EFI_PHYSICAL_ADDRESSImageBase;

+  EFI_PHYSICAL_ADDRESSPayloadBaseAddress;

+  UINT64  PayloadSize;

+  UINTN   PayloadEntryOffset;

+  UINTN   PayloadEntrySize;

+  EFI_PHYSICAL_ADDRESSPayloadEntryPoint;

+  UINTN   RelocateTableOffset;

+  UINTN   RelocateTableCount;

+  EFI_PHYSICAL_ADDRESSPayloadLoadAddress;

+} FIT_IMAGE_CONTEXT;

+

+typedef struct {

+  UINT8 *Name;

+  UINT32Offset;

+} PROPERTY_DATA;

+

+#define IMAGE_BASE_OFFSET OFFSET_OF (FIT_IMAGE_CONTEXT, ImageBase)

+#define PAYLOAD_BASE_ADDR_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadBaseAddress)

+#define PAYLOAD_BASE_SIZE_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadSize)

+#define PAYLOAD_ENTRY_OFFSET_OFFSET   OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadEntryOffset)

+#define PAYLOAD_ENTRY_SIZE_OFFSET OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadEntrySize)

+#define PAYLOAD_ENTRY_POINT_OFFSETOFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadEntryPoint)

+#define RELOCATE_TABLE_OFFSET_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
RelocateTableOffset)

+#define RELOCATE_TABLE_COUNT_OFFSET   OFFSET_OF (FIT_IMAGE_CONTEXT, 
RelocateTableCount)

+#define PAYLOAD_LOAD_ADDR_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadLoadAddress)

+

+/**

+  Parse the FIT image info.

+  @param[in]  ImageBase  Memory address of an image.

+  @param[out] ContextThe FIT image context pointer.

+  @retval EFI_UNSUPPORTED Unsupported binary type.

+  @retval EFI_SUCCESS FIT binary is loaded successfully.

+**/

+EFI_STATUS

+EFIAPI

+ParseFitImage (

+  IN   VOID   *ImageBase,

+  OUT  FIT_IMAGE_CONTEXT  *Context

+  );

+

+#endif

diff --git a/UefiPayloadPkg/Payl

Re: [edk2-devel] [PATCH v4 1/2] MdePkg/BaseFdtLib: Add Fdt function.

2023-09-18 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Monday, September 18, 2023 3:02 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Lin, Benny ; 
Guo, Gua ; Chiu, Chasel ; Lu, James 

Subject: [PATCH v4 1/2] MdePkg/BaseFdtLib: Add Fdt function.

From: "Brucex.Wang" 

Add FdtGetName() and FdtNodeDepth() function.

Cc: Benny Lin 
Cc: Gua Guo 
Cc: Chasel Chiu 
Cc: James Lu 

Signed-off-by: BruceX Wang 
---
 MdePkg/Include/Library/FdtLib.h| 34 +
 MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++
 2 files changed, 74 insertions(+)

diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h 
index cf5ceba9e9..d9300a18e3 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -398,4 +398,38 @@ FdtSetProp (
   IN UINT32   Length   ); +/**+  Returns the name of a given node.++  
@param[in] FdtThe pointer to FDT blob.+  @param[in] NodeOffse  
Offset of node to check.+  @param[in] Length The pointer to an integer 
variable (will be overwritten) or NULL.++  @return The pointer to the node's 
name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+  IN VOID*Fdt,+  IN INT32   
NodeOffset,+  IN UINT32  *Length+  );++/**+  FdtNodeDepth() finds the depth of 
a given node.  The root node+  has depth 0, its immediate subnodes depth 1 and 
so forth.++  @param[in] FdtThe pointer to FDT blob.+  @param[in] 
NodeOffset Offset of node to check.++  @return Depth of the node at 
NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+  IN CONST VOID  *Fdt,+  IN INT32   
NodeOffset+  );+ #endif /* FDT_LIB_H_ */diff --git 
a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c
index 090b0b3fd4..1ef99ea882 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -402,3 +402,43 @@ FdtSetProp (
 {   return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length); }++/**+  
Returns the name of a given node.++  @param[in] FdtThe pointer to 
FDT blob.+  @param[in] NodeOffset Offset of node to check.+  @param[in] 
Length The pointer to an integer variable (will be overwritten) or 
NULL.++  @return The pointer to the node's name.++**/+CONST CHAR8 
*+EFIAPI+FdtGetName (+  IN VOID*Fdt,+  IN INT32   NodeOffset,+  IN UINT32  
*Length+  )+{+  return fdt_get_name (Fdt, NodeOffset, (int *)Length);+}++/**+  
FdtNodeDepth() finds the depth of a given node.  The root node+  has depth 0, 
its immediate subnodes depth 1 and so forth.++  @param[in] FdtThe 
pointer to FDT blob.+  @param[in] NodeOffset Offset of node to check.++  
@returns Depth of the node at NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+  IN 
CONST VOID  *Fdt,+  IN INT32   NodeOffset+  )+{+  return fdt_node_depth 
(Fdt, NodeOffset);+}-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108774): https://edk2.groups.io/g/devel/message/108774
Mute This Topic: https://groups.io/mt/101429071/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/2] UefiPayloadPkg supports Fit

2023-09-16 Thread Guo, Gua
Series Reviewed-by: Gua Gua 

-Original Message-
From: Wang, BruceX  
Sent: Saturday, September 16, 2023 6:53 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Guo, Gua 
Subject: [PATCH v3 0/2] UefiPayloadPkg supports Fit

From: Gua Guo 

V3: Fix Lean Sheng comment in patch mail
V2: Fix Gua and Chasel comment in PR
V1: Initialize Version

Brucex.Wang (2):
  MdePkg/BaseFdtLib: Add Fdt function.
  UefiPayloadPkg: Add FIT support

 MdePkg/Include/Library/FdtLib.h   |  34 +
 MdePkg/Library/BaseFdtLib/FdtLib.c|  40 ++
 .../Include/Guid/UniversalPayloadBase.h   |  19 +
 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h |  60 ++
 .../PayloadLoaderPeim/FitLib/FitLib.c | 127 
 .../PayloadLoaderPeim/FitPayloadLoaderPeim.c  | 150 
 .../FitPayloadLoaderPeim.inf  |  59 ++
 UefiPayloadPkg/Readme.md  | 189 +
 UefiPayloadPkg/Tools/MkFitImage.py| 272 
 .../FitUniversalPayloadEntry.c| 654 ++
 .../FitUniversalPayloadEntry.inf  |  98 +++
 UefiPayloadPkg/UefiPayloadPkg.dec |   3 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  27 +-
 UefiPayloadPkg/UniversalPayloadBuild.py   | 328 ++---
 14 files changed, 1964 insertions(+), 96 deletions(-)  create mode 100644 
UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib/FitLib.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.inf
 create mode 100644 UefiPayloadPkg/Readme.md  create mode 100644 
UefiPayloadPkg/Tools/MkFitImage.py
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf

--
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108752): https://edk2.groups.io/g/devel/message/108752
Mute This Topic: https://groups.io/mt/101396435/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/2] MdePkg/BaseFdtLib: Add Fdt function.

2023-09-15 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Friday, September 15, 2023 4:58 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Lin, Benny ; 
Guo, Gua ; Chiu, Chasel ; Lu, James 

Subject: [PATCH v2 1/2] MdePkg/BaseFdtLib: Add Fdt function.

From: "Brucex.Wang" 

Add FdtGetName() and FdtNodeDepth() function.

Cc: Benny Lin 
Cc: Gua Guo 
Cc: Chasel Chiu 
Cc: James Lu 

Signed-off-by: BruceX Wang 
---
 MdePkg/Include/Library/FdtLib.h| 34 +
 MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++
 2 files changed, 74 insertions(+)

diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h 
index cf5ceba9e9..2bd926b5b4 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -398,4 +398,38 @@ FdtSetProp (
   IN UINT32   Length   ); +/**+  Returns the name of a given node.++  
@param[in] FdtThe pointer to FDT blob.+  @param[in] NodeOffse  
Offset of node to check.+  @param[in] Length The pointer to an integer 
variable (will be overwritten) or NULL.++  @return The pointer to the node's 
name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+  IN VOID*Fdt,+  IN INT32   
NodeOffset,+  IN UINT32  *Length+  );++/**+  FdtNodeDepth() finds the depth of 
a given node.  The root node+  has depth 0, its immediate subnodes depth 1 and 
so forth.++  @param[in] FdtThe pointer to FDT blob.+  @param[in] 
NodeOffset Offset of node to check.++  @return Depth of the node at 
NodeOffset.+ **/+INT32+EFIAPI+FdtNodeDepth (+  IN CONST VOID  *Fdt,+  IN INT32  
 NodeOffset+  );+ #endif /* FDT_LIB_H_ */diff --git 
a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c
index 090b0b3fd4..1ef99ea882 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -402,3 +402,43 @@ FdtSetProp (
 {   return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length); }++/**+  
Returns the name of a given node.++  @param[in] FdtThe pointer to 
FDT blob.+  @param[in] NodeOffset Offset of node to check.+  @param[in] 
Length The pointer to an integer variable (will be overwritten) or 
NULL.++  @return The pointer to the node's name.++**/+CONST CHAR8 
*+EFIAPI+FdtGetName (+  IN VOID*Fdt,+  IN INT32   NodeOffset,+  IN UINT32  
*Length+  )+{+  return fdt_get_name (Fdt, NodeOffset, (int *)Length);+}++/**+  
FdtNodeDepth() finds the depth of a given node.  The root node+  has depth 0, 
its immediate subnodes depth 1 and so forth.++  @param[in] FdtThe 
pointer to FDT blob.+  @param[in] NodeOffset Offset of node to check.++  
@returns Depth of the node at NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+  IN 
CONST VOID  *Fdt,+  IN INT32   NodeOffset+  )+{+  return fdt_node_depth 
(Fdt, NodeOffset);+}-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108700): https://edk2.groups.io/g/devel/message/108700
Mute This Topic: https://groups.io/mt/101375949/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] UefiPayloadPkg: Add FIT support

2023-09-15 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wang, BruceX  
Sent: Friday, September 15, 2023 4:58 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; 
Rhodes, Sean ; Lu, James ; Guo, Gua 

Subject: [PATCH v2 2/2] UefiPayloadPkg: Add FIT support

From: "Brucex.Wang" 

Provide Fit format for UniversalPayload, developer can use argument
"--Fit" to build UniversalPayload.fit

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

Signed-off-by: BruceX Wang 
---
 .../Include/Guid/UniversalPayloadBase.h   |  21 +
 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h |  60 ++
 .../PayloadLoaderPeim/FitLib/FitLib.c | 127 
 .../PayloadLoaderPeim/FitPayloadLoaderPeim.c  | 150 
 .../FitPayloadLoaderPeim.inf  |  59 ++
 UefiPayloadPkg/Readme.md  | 191 +
 UefiPayloadPkg/Tools/MkFitImage.py| 272 
 .../FitUniversalPayloadEntry.c| 654 ++
 .../FitUniversalPayloadEntry.inf  |  98 +++
 UefiPayloadPkg/UefiPayloadPkg.dec |   3 +
 UefiPayloadPkg/UefiPayloadPkg.dsc |  27 +-
 UefiPayloadPkg/UniversalPayloadBuild.py   | 328 ++---
 12 files changed, 1894 insertions(+), 96 deletions(-)
 create mode 100644 UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitLib/FitLib.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
 create mode 100644 UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.inf
 create mode 100644 UefiPayloadPkg/Readme.md
 create mode 100644 UefiPayloadPkg/Tools/MkFitImage.py
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.c
 create mode 100644 UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf

diff --git a/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h 
b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
new file mode 100644
index 00..31c9ec0bfb
--- /dev/null
+++ b/UefiPayloadPkg/Include/Guid/UniversalPayloadBase.h
@@ -0,0 +1,21 @@
+/** @file

+  Universal Payload general definitions.

+

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

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

+

+  @par Revision Reference:

+- Universal Payload Specification 0.75 
(https://universalpayload.github.io/documentation/)

+**/

+

+#ifndef UNIVERSAL_PAYLOAD_BASE_H_

+#define UNIVERSAL_PAYLOAD_BASE_H_

+

+extern GUID  gUniversalPayloadBaseGuid;

+

+typedef struct {

+  UNIVERSAL_PAYLOAD_GENERIC_HEADERHeader;

+  EFI_PHYSICAL_ADDRESSEntry;

+} UNIVERSAL_PAYLOAD_BASE;

+

+#endif // UNIVERSAL_PAYLOAD_BASE_H_

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h 
b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
new file mode 100644
index 00..0514d675a6
--- /dev/null
+++ b/UefiPayloadPkg/PayloadLoaderPeim/FitLib.h
@@ -0,0 +1,60 @@
+/** @file

+  FIT Load Image Support

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

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

+**/

+

+#ifndef FIT_LIB_H_

+#define FIT_LIB_H_

+

+#include 

+#include 

+#include 

+

+typedef struct {

+  UINT64RelocateType;

+  UINT64Offset;

+} FIT_RELOCATE_ITEM;

+

+typedef struct {

+  EFI_PHYSICAL_ADDRESSImageBase;

+  EFI_PHYSICAL_ADDRESSPayloadBaseAddress;

+  UINT64  PayloadSize;

+  UINTN   PayloadEntryOffset;

+  UINTN   PayloadEntrySize;

+  EFI_PHYSICAL_ADDRESSPayloadEntryPoint;

+  UINTN   RelocateTableOffset;

+  UINTN   RelocateTableCount;

+  EFI_PHYSICAL_ADDRESSPayloadLoadAddress;

+} FIT_IMAGE_CONTEXT;

+

+typedef struct {

+  UINT8 *Name;

+  UINT32Offset;

+} PROPERTY_DATA;

+

+#define IMAGE_BASE_OFFSET OFFSET_OF (FIT_IMAGE_CONTEXT, ImageBase)

+#define PAYLOAD_BASE_ADDR_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadBaseAddress)

+#define PAYLOAD_BASE_SIZE_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadSize)

+#define PAYLOAD_ENTRY_OFFSET_OFFSET   OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadEntryOffset)

+#define PAYLOAD_ENTRY_SIZE_OFFSET OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadEntrySize)

+#define PAYLOAD_ENTRY_POINT_OFFSETOFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadEntryPoint)

+#define RELOCATE_TABLE_OFFSET_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
RelocateTableOffset)

+#define RELOCATE_TABLE_COUNT_OFFSET   OFFSET_OF (FIT_IMAGE_CONTEXT, 
RelocateTableCount)

+#define PAYLOAD_LOAD_ADDR_OFFSET  OFFSET_OF (FIT_IMAGE_CONTEXT, 
PayloadLoadAddress)

+

+/**

+  Parse the FIT image info.

+  @param[in]  ImageBase  Memory address of an image.

+  @param[out] ContextThe FIT image context pointer.

+  @retval EFI_UNSUPPORTED Unsupported binary type.

+  @retval EFI_SUCCESS FIT binary is loaded successfully.

+**/

+EFI_STATUS

+EFIAPI

+ParseFitI

Re: [edk2-devel] [PATCH 0/1] UefiPayloadPkg: Match BAR if framebuffer is at an offset

2023-09-05 Thread Guo, Gua
Below it Edk2 developer guideline 
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process

You may need to follow it to send review.


寄件者: Lean Sheng Tan 
寄件日期: 星期二, 9月 5, 2023 5:49:30 下午
收件者: devel@edk2.groups.io ; Tan, Lean Sheng 

副本: michael.buech...@posteo.net ; Guo, Gua 
; Dong, Guo ; Lu, James 
; Rhodes, Sean ; Doron, Benjamin 

主旨: Re: [edk2-devel] [PATCH 0/1] UefiPayloadPkg: Match BAR if framebuffer is at 
an offset

Reminder: Can anyone help to review this? Thanks!


On Fri, 25 Aug 2023 at 10:33, Sheng Lean Tan via groups.io<http://groups.io> 
mailto:9elements@groups.io>> wrote:
Hi Michael,
You will need to CC the maintainers/reviewers for UEFIpayloadpkg.
I have added them in ;)
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 Fri, 7 Jul 2023 at 20:04, Michael Büchler 
mailto:michael.buech...@posteo.net>> wrote:
Hi,

this is my first message to this list and the first time I am using git
send-email. Please let me know if I messed something up. For example, I
have to use `git am --keep-cr` to apply the patch myself.

Regards,
Michael

Michael Büchler (1):
  UefiPayloadPkg: Match BAR if framebuffer is at an offset

 UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--
2.39.3










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108281): https://edk2.groups.io/g/devel/message/108281
Mute This Topic: https://groups.io/mt/100011246/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] UefiPayloadPkg:Enhance the build processing for Universalpayload

2023-08-25 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Liu, KasimX  
Sent: Friday, August 25, 2023 5:28 PM
To: devel@edk2.groups.io
Cc: Liu, KasimX ; Dong, Guo ; Ni, Ray 
; Lu, James ; Guo, Gua 
Subject: [PATCH v2] UefiPayloadPkg:Enhance the build processing for 
Universalpayload

From: KasimX Liu 

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

To Copy the PrebuildUplBinary to Build folder then add/replace Fvs.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: KasimX Liu 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index ecc25dad83..47f37b3377 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -58,6 +58,7 @@ def BuildUniversalPayload(Args):
 BuildDir = os.path.join(os.environ['WORKSPACE'], 
os.path.normpath("Build/UefiPayloadPkgX64"))

 BuildModule = ""

 BuildArch = ""

+

 if Args.Arch == 'X64':

 BuildArch  = "X64"

 EntryOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ElfToolChain), 
os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))

@@ -65,8 +66,6 @@ def BuildUniversalPayload(Args):
 BuildArch  = "IA32 -a X64"

 EntryOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, 
ElfToolChain), 
os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))

 

-if Args.PreBuildUplBinary is not None:

-EntryOutputDir = os.path.abspath(Args.PreBuildUplBinary)

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

 ModuleReportPath = os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt")

 UpldInfoFile = os.path.join(BuildDir, "UniversalPayloadInfo.bin")

@@ -99,6 +98,11 @@ def BuildUniversalPayload(Args):
 BuildModule += Pcds

 BuildModule += Defines

 RunCommand(BuildModule)

+

+if Args.PreBuildUplBinary is not None:

+EntryOutputDir = os.path.join(BuildDir, "UniversalPayload.elf")

+shutil.copy (os.path.abspath(Args.PreBuildUplBinary), EntryOutputDir)

+

 #

 # Buid Universal Payload Information Section ".upld_info"

 #

@@ -122,7 +126,8 @@ def BuildUniversalPayload(Args):
 AddSectionName = '.upld_info'

 ReplaceFv (EntryOutputDir, UpldInfoFile, AddSectionName, Alignment = 4)

 

-shutil.copy (EntryOutputDir, os.path.join(BuildDir, 
'UniversalPayload.elf'))

+if Args.PreBuildUplBinary is None:

+shutil.copy (EntryOutputDir, os.path.join(BuildDir, 
'UniversalPayload.elf'))

 

 return MultiFvList, os.path.join(BuildDir, 'UniversalPayload.elf')

 

-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108033): https://edk2.groups.io/g/devel/message/108033
Mute This Topic: https://groups.io/mt/100952717/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 7/9] UefiPayloadPkg: Add ImagePropertiesRecordLib Instance

2023-07-18 Thread Guo, Gua
Reviewed-by: Gua Guo  

-Original Message-
From: Taylor Beebe  
Sent: Wednesday, July 19, 2023 2:40 AM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua 
Subject: [PATCH v1 7/9] UefiPayloadPkg: Add ImagePropertiesRecordLib Instance

Add an instance of ImagePropertiesRecordLib which will be used by the DXE Core.

Signed-off-by: Taylor Beebe 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 47812048ddcf..8d237b23339a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -277,6 +277,7 @@ [LibraryClasses]
   #
   
DebugPrintErrorLevelLib|UefiPayloadPkg/Library/DebugPrintErrorLevelLibHob/DebugPrintErrorLevelLibHob.inf
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  
+ ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib
+ /ImagePropertiesRecordLib.inf
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
--
2.41.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107032): https://edk2.groups.io/g/devel/message/107032
Mute This Topic: https://groups.io/mt/100221563/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: Integrate UiApp and BootManagerMenuApp into MultiFv

2023-07-10 Thread Guo, Gua
Reviewed-by: Gua Guo  

-Original Message-
From: Lin, MarsX  
Sent: Monday, July 10, 2023 5:02 PM
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

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 |  8 +--
 UefiPayloadPkg/UefiPayloadPkg.fdf |  9 ++-
 7 files changed, 11 insertions(+), 93 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 4a0219624d..a4a49da0e9 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 

 #include 

 

 /**

@@ -364,56 +362,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 ();

-

-  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, , 
>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 a3951b7a7e..ff92c95227 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.

@@ -48,11 +47,9 @@
   HiiLib

   PrintLib

   PlatformHookLib

-  HobLib

 

 [Guids]

   gEfiEndOfDxeEventGroupGuid

-  gEdkiiBootManagerMenuFileGuid

   gUefiShellFileGuid

 

 [Protocols]

@@ -75,5 +72,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/UefiPayloadEntry/PrintHob.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
@@ -10,7 +10,6 @@
 #include 

 #include 

 #include 

-#include 

 

 #

Re: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to MdePkg

2023-06-21 Thread Guo, Gua
SiliconPkg can build the hob so have the HOB interface is enough. Platform can 
use TraceHubLib to consume the HOB.

From: Ni, Ray 
Sent: Wednesday, June 21, 2023 9:25:08 PM
To: Guo, Gua ; devel@edk2.groups.io ; 
Hsu, VictorX 
Cc: Gao, Liming ; Chan Laura ; 
Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 

Subject: RE: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to 
MdePkg


I don’t think that’s the solution to resolve pkg dependencies by adding 
interfaces to mdePkg.



From: Guo, Gua 
Sent: Wednesday, June 21, 2023 9:23 PM
To: Ni, Ray ; devel@edk2.groups.io; Hsu, VictorX 

Cc: Gao, Liming ; Chan Laura ; 
Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 

Subject: Re: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to 
MdePkg



Based on Green H, we need to let the HOB can be consumed by SiliconPkg so move 
it from MdeModulePkg to MdePkg.



From: Ni, Ray mailto:ray...@intel.com>>
Sent: Wednesday, June 21, 2023 9:20:23 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>; Guo, Gua 
mailto:gua@intel.com>>; Hsu, VictorX 
mailto:victorx@intel.com>>
Cc: Gao, Liming mailto:gaolim...@byosoft.com.cn>>; 
Chan Laura mailto:laura.c...@intel.com>>; Prakashan, 
Krishnadas Veliyathuparambil 
mailto:krishnadas.veliyathuparambil.prakas...@intel.com>>;
 K N, Karthik mailto:karthik@intel.com>>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to 
MdePkg



Why is this GUID moved to MdePkg?

> -Original Message-
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
> mailto:devel@edk2.groups.io>> On Behalf Of Guo, Gua
> Sent: Wednesday, June 21, 2023 3:02 PM
> To: Hsu, VictorX mailto:victorx@intel.com>>; 
> devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Gao, Liming mailto:gaolim...@byosoft.com.cn>>; 
> Chan Laura
> mailto:laura.c...@intel.com>>; Prakashan, Krishnadas 
> Veliyathuparambil
> mailto:krishnadas.veliyathuparambil.prakas...@intel.com>>;
>  K N, Karthik
> mailto:karthik@intel.com>>
> Subject: Re: [edk2-devel] [PATCH] MdePkg: Move
> gTraceHubDebugInfoHobGuid to MdePkg
>
> Reviewed-by: Gua Guo mailto:gua@intel.com>>
>
> -Original Message-
> From: Hsu, VictorX mailto:victorx@intel.com>>
> Sent: Wednesday, June 21, 2023 3:01 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Hsu, VictorX mailto:victorx@intel.com>>; Gao, 
> Liming
> mailto:gaolim...@byosoft.com.cn>>; Guo, Gua 
> mailto:gua@intel.com>>; Chan Laura
> mailto:laura.c...@intel.com>>; Prakashan, Krishnadas 
> Veliyathuparambil
> mailto:krishnadas.veliyathuparambil.prakas...@intel.com>>;
>  K N, Karthik
> mailto:karthik@intel.com>>
> Subject: [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to MdePkg
>
> From: VictorX Hsu mailto:victorx@intel.com>>
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4486
>
> Move gTraceHubDebugInfoHobGuid to MdePkg.
>
> Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>
> Cc: Guo Gua mailto:gua@intel.com>>
> Cc: Chan Laura mailto:laura.c...@intel.com>>
> Cc: Prakashan Krishnadas Veliyathuparambil
> mailto:krishnadas.veliyathuparambil.prakas...@intel.com>>
> Cc: K N Karthik mailto:karthik@intel.com>>
> Signed-off-by: VictorX Hsu 
> mailto:victorx@intel.com>>
> ---
>  MdeModulePkg/MdeModulePkg.dec   | 3 ---
>  .../Include/Guid/TraceHubDebugInfoHob.h | 0
>  MdePkg/MdePkg.dec   | 6 ++
>  3 files changed, 6 insertions(+), 3 deletions(-)  rename {MdeModulePkg =>
> MdePkg}/Include/Guid/TraceHubDebugInfoHob.h (100%)
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..5b022b1f9f
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -439,9 +439,6 @@
>## Include/UniversalPayload/SerialPortInfo.h
> gUniversalPayloadSerialPortInfoGuid = { 0xaa7e190d, 0xbe21, 0x4409, { 0x8e,
> 0x67, 0xa2, 0xcd, 0xf, 0x61, 0xe1, 0x70 } } -  ##
> Include/Guid/TraceHubDebugInfoHob.h-  gTraceHubDebugInfoHobGuid =
> { 0xf88c9c23, 0x646c, 0x4f6c, { 0x8e, 0x3d, 0x36, 0xa9, 0x43, 0xc1, 0x08,
> 0x35 } }-   ## GUID used for Boot Discovery Policy FormSet guid and related
> variables.   gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c,
> 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } } diff --git
> a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> b/MdePkg/Include/Guid/TraceHubDebugInfoHob.h
> simila

Re: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to MdePkg

2023-06-21 Thread Guo, Gua
Based on Green H, we need to let the HOB can be consumed by SiliconPkg so move 
it from MdeModulePkg to MdePkg.

From: Ni, Ray 
Sent: Wednesday, June 21, 2023 9:20:23 PM
To: devel@edk2.groups.io ; Guo, Gua ; 
Hsu, VictorX 
Cc: Gao, Liming ; Chan Laura ; 
Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 

Subject: RE: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to 
MdePkg

Why is this GUID moved to MdePkg?

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Guo, Gua
> Sent: Wednesday, June 21, 2023 3:02 PM
> To: Hsu, VictorX ; devel@edk2.groups.io
> Cc: Gao, Liming ; Chan Laura
> ; Prakashan, Krishnadas Veliyathuparambil
> ; K N, Karthik
> 
> Subject: Re: [edk2-devel] [PATCH] MdePkg: Move
> gTraceHubDebugInfoHobGuid to MdePkg
>
> Reviewed-by: Gua Guo 
>
> -Original Message-
> From: Hsu, VictorX 
> Sent: Wednesday, June 21, 2023 3:01 PM
> To: devel@edk2.groups.io
> Cc: Hsu, VictorX ; Gao, Liming
> ; Guo, Gua ; Chan Laura
> ; Prakashan, Krishnadas Veliyathuparambil
> ; K N, Karthik
> 
> Subject: [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to MdePkg
>
> From: VictorX Hsu 
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4486
>
> Move gTraceHubDebugInfoHobGuid to MdePkg.
>
> Cc: Liming Gao 
> Cc: Guo Gua 
> Cc: Chan Laura 
> Cc: Prakashan Krishnadas Veliyathuparambil
> 
> Cc: K N Karthik 
> Signed-off-by: VictorX Hsu 
> ---
>  MdeModulePkg/MdeModulePkg.dec   | 3 ---
>  .../Include/Guid/TraceHubDebugInfoHob.h | 0
>  MdePkg/MdePkg.dec   | 6 ++
>  3 files changed, 6 insertions(+), 3 deletions(-)  rename {MdeModulePkg =>
> MdePkg}/Include/Guid/TraceHubDebugInfoHob.h (100%)
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 95dd077e19..5b022b1f9f
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -439,9 +439,6 @@
>## Include/UniversalPayload/SerialPortInfo.h
> gUniversalPayloadSerialPortInfoGuid = { 0xaa7e190d, 0xbe21, 0x4409, { 0x8e,
> 0x67, 0xa2, 0xcd, 0xf, 0x61, 0xe1, 0x70 } } -  ##
> Include/Guid/TraceHubDebugInfoHob.h-  gTraceHubDebugInfoHobGuid =
> { 0xf88c9c23, 0x646c, 0x4f6c, { 0x8e, 0x3d, 0x36, 0xa9, 0x43, 0xc1, 0x08,
> 0x35 } }-   ## GUID used for Boot Discovery Policy FormSet guid and related
> variables.   gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c,
> 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } } diff --git
> a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> b/MdePkg/Include/Guid/TraceHubDebugInfoHob.h
> similarity index 100%
> rename from MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> rename to MdePkg/Include/Guid/TraceHubDebugInfoHob.h
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> b85614992b..3b5d1bac13 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -875,6 +875,12 @@
>## Include/Protocol/CcMeasurement.h   gEfiCcFinalEventsTableGuid =
> { 0xdd4a4648, 0x2de7, 0x4665, { 0x96, 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4,
> 0x46 }} +  #+  # GUID used to store Trace Hub Debug information+  #+  ##
> Include/Guid/TraceHubDebugInfoHob.h+  gTraceHubDebugInfoHobGuid =
> { 0xf88c9c23, 0x646c, 0x4f6c, { 0x8e, 0x3d, 0x36, 0xa9, 0x43, 0xc1, 0x08,
> 0x35 } }+ [Guids.IA32, Guids.X64]   ## Include/Guid/Cper.h
> gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de,
> { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}--
> 2.40.0.windows.1
>
>
>
> 
>



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




Re: [edk2-devel] [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to MdePkg

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

-Original Message-
From: Hsu, VictorX  
Sent: Wednesday, June 21, 2023 3:01 PM
To: devel@edk2.groups.io
Cc: Hsu, VictorX ; Gao, Liming 
; Guo, Gua ; Chan Laura 
; Prakashan, Krishnadas Veliyathuparambil 
; K N, Karthik 

Subject: [PATCH] MdePkg: Move gTraceHubDebugInfoHobGuid to MdePkg

From: VictorX Hsu 

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

Move gTraceHubDebugInfoHobGuid to MdePkg.

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

Cc: K N Karthik 
Signed-off-by: VictorX Hsu 
---
 MdeModulePkg/MdeModulePkg.dec   | 3 ---
 .../Include/Guid/TraceHubDebugInfoHob.h | 0
 MdePkg/MdePkg.dec   | 6 ++
 3 files changed, 6 insertions(+), 3 deletions(-)  rename {MdeModulePkg => 
MdePkg}/Include/Guid/TraceHubDebugInfoHob.h (100%)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec 
index 95dd077e19..5b022b1f9f 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -439,9 +439,6 @@
   ## Include/UniversalPayload/SerialPortInfo.h   
gUniversalPayloadSerialPortInfoGuid = { 0xaa7e190d, 0xbe21, 0x4409, { 0x8e, 
0x67, 0xa2, 0xcd, 0xf, 0x61, 0xe1, 0x70 } } -  ## 
Include/Guid/TraceHubDebugInfoHob.h-  gTraceHubDebugInfoHobGuid = { 0xf88c9c23, 
0x646c, 0x4f6c, { 0x8e, 0x3d, 0x36, 0xa9, 0x43, 0xc1, 0x08, 0x35 } }-   ## GUID 
used for Boot Discovery Policy FormSet guid and related variables.   
gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 
0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } } diff --git 
a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h 
b/MdePkg/Include/Guid/TraceHubDebugInfoHob.h
similarity index 100%
rename from MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
rename to MdePkg/Include/Guid/TraceHubDebugInfoHob.h
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index b85614992b..3b5d1bac13 
100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -875,6 +875,12 @@
   ## Include/Protocol/CcMeasurement.h   gEfiCcFinalEventsTableGuid = { 
0xdd4a4648, 0x2de7, 0x4665, { 0x96, 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46 }} 
+  #+  # GUID used to store Trace Hub Debug information+  #+  ## 
Include/Guid/TraceHubDebugInfoHob.h+  gTraceHubDebugInfoHobGuid = { 0xf88c9c23, 
0x646c, 0x4f6c, { 0x8e, 0x3d, 0x36, 0xa9, 0x43, 0xc1, 0x08, 0x35 } }+ 
[Guids.IA32, Guids.X64]   ## Include/Guid/Cper.h   
gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de, { 0xAC, 
0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106244): https://edk2.groups.io/g/devel/message/106244
Mute This Topic: https://groups.io/mt/99671889/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 incorrect code on AddSectionHeader

2023-06-14 Thread Guo, Gua
Reviewed-by: Gua Guo 
-Original Message-
From: Wang, BruceX  
Sent: Wednesday, June 14, 2023 10:00 PM
To: devel@edk2.groups.io
Cc: Wang, BruceX ; Dong, Guo ; Ni, 
Ray ; Rhodes, Sean ; Lu, James 

Subject: [PATCH] UefiPayloadPkg: Fix incorrect code on AddSectionHeader

From: BruceX Wang 

Fix incorrect code on AddSectionHeader32() and AddSectionHeader64()

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Signed-off-by: BruceX Wang 
---
 UefiPayloadPkg/Tools/ElfFv.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/Tools/ElfFv.py b/UefiPayloadPkg/Tools/ElfFv.py 
index a3d5bf08b9..3f0f9272a7 100644
--- a/UefiPayloadPkg/Tools/ElfFv.py
+++ b/UefiPayloadPkg/Tools/ElfFv.py
@@ -267,7 +267,7 @@ def AddSectionHeader64(SHentry, NewUPLEntrylen, 
SectionHeaderEntrySize, Index, R
 # if RemoveNameOffset != 0 that is remove function. if 
(RemoveNameOffset != 0): if (unpacked_header.sh_name > 
RemoveNameOffset):-unpacked_header.sh_name -= RemoveNameOffset+ 
   unpacked_header.sh_name -= len (SectionName) # 
Modify size of name string section entry in section entry. if 
(Index == StringIndexNumber): unpacked_header.sh_size -= len 
(SectionName)@@ -298,7 +298,7 @@ def AddSectionHeader32(SHentry, 
NewUPLEntrylen, SectionHeaderEntrySize, Index, R
 # if RemoveNameOffset != 0 that is remove function. if 
(RemoveNameOffset != 0): if (unpacked_header.sh_name > 
RemoveNameOffset):-unpacked_header.sh_name -= RemoveNameOffset+ 
   unpacked_header.sh_name -= len (SectionName) # 
Modify size of name string section entry in section entry. if 
(Index == StringIndexNumber): unpacked_header.sh_size -= len 
(SectionName)@@ -710,7 +710,7 @@ def AddSection32(UniversalPayloadEntry, 
AddSectionName, ElfHeaderOffset, Section
 ElfHeaderSize = 52 ElfHandPH = ElfHeaderSize + 
(elf_header.e_phnum * elf_header.e_phentsize) NewUPLEntry = 
UPLEntry[:ElfHandPH]-# Keep Section header and program header table, 
AddSection64() only recombined section and section header.+# Keep 
Section header and program header table, AddSection32() only recombined section 
and section header. NewUPLEntry = bytearray(NewUPLEntry) # 
Sections is recombined. # 1. name of added section is added in name 
string section.-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH] Maintainers.txt: Stop to be reviewer of several modules

2023-06-12 Thread Guo, Gua
Reviewed-by: Gua Guo   for MdeModulePkg: Universal Payload 
definitions

-Original Message-
From: Ni, Ray  
Sent: Tuesday, June 13, 2023 10:07 AM
To: devel@edk2.groups.io
Cc: Gao, Zhichao ; Wu, Hao A ; Liu, 
Zhiguang ; Guo, Gua 
Subject: [PATCH] Maintainers.txt: Stop to be reviewer of several modules

Remove my name from reviewer list of following modules:
* MdeModulePkg: Console and Graphics modules
* MdeModulePkg: Disk modules
* MdeModulePkg: Reset modules
* MdeModulePkg: Serial modules
* MdeModulePkg: Universal Payload definitions

Signed-off-by: Ray Ni 
Cc: Zhichao Gao 
Cc: Hao A Wu 
Cc: Zhiguang Liu 
Cc: Gua Guo 
---
 Maintainers.txt | 5 -
 1 file changed, 5 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt index 42e40dced3..ba993b111d 
100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -294,7 +294,6 @@ F: MdeModulePkg/Library/BaseBmpSupportLib/
 F: MdeModulePkg/Library/FrameBufferBltLib/ F: MdeModulePkg/Universal/Console/ 
R: Zhichao Gao  [ZhichaoGao]-R: Ray Ni 
 [niruiyu]  MdeModulePkg: Core services (PEI, DXE and 
Runtime) modules F: MdeModulePkg/*Mem*/@@ -346,7 +345,6 @@ R: Ray Ni 
 [niruiyu]
 MdeModulePkg: Disk modules F: MdeModulePkg/Universal/Disk/ R: Hao A Wu 
 [hwu25]-R: Ray Ni  [niruiyu] R: Zhichao 
Gao  [ZhichaoGao]  MdeModulePkg: Firmware Update 
modules@@ -398,12 +396,10 @@ MdeModulePkg: Reset modules
 F: MdeModulePkg/*Reset*/ F: MdeModulePkg/Include/*Reset*.h R: Zhichao Gao 
 [ZhichaoGao]-R: Ray Ni  [niruiyu]  
MdeModulePkg: Serial modules F: MdeModulePkg/*Serial*/ F: 
MdeModulePkg/Include/*SerialPort*.h-R: Ray Ni  [niruiyu] R: 
Zhichao Gao  [ZhichaoGao]  MdeModulePkg: SMBIOS 
modules@@ -426,7 +422,6 @@ R: Liming Gao  [lgao4]
 MdeModulePkg: Universal Payload definitions F: 
MdeModulePkg/Include/UniversalPayload/ R: Zhiguang Liu  
[LiuZhiguang001]-R: Ray Ni  [niruiyu] R: Gua Guo 
 [gguo11837463]  MdeModulePkg: Trace Hub debug message 
related library instance--
2.37.2.windows.2



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




Re: [edk2-devel] [PATCH] Maintainers.txt: Remove me from maintainers of UefiPayloadPkg,ShellPkg

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

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Ni, Ray
Sent: Wednesday, June 7, 2023 11:31 AM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua ; Gao, Zhichao 

Subject: [edk2-devel] [PATCH] Maintainers.txt: Remove me from maintainers of 
UefiPayloadPkg,ShellPkg

Signed-off-by: Ray Ni 
Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Cc: Zhichao Gao 
---
 Maintainers.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt index 5209e21449..e40361a0ae 
100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -592,7 +592,6 @@ R: Rahul Kumar  [rahul1-kumar]  
ShellPkg F: ShellPkg/ W: 
https://github.com/tianocore/tianocore.github.io/wiki/ShellPkg-M: Ray Ni 
 [niruiyu] M: Zhichao Gao  
[ZhichaoGao]  SignedCapsulePkg@@ -630,7 +629,6 @@ UefiPayloadPkg
 F: UefiPayloadPkg/ W: 
https://github.com/tianocore/tianocore.github.io/wiki/UefiPayloadPkg M: Guo 
Dong  [gdong1]-M: Ray Ni  [niruiyu] M: 
Sean Rhodes  [Sean-StarLabs] M: James Lu 
 [jameslu8] R: Gua Guo  [gguo11837463]--
2.37.2.windows.2



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




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105845): https://edk2.groups.io/g/devel/message/105845
Mute This Topic: https://groups.io/mt/99378233/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: Enhance build script for BuildEntryOnly

2023-06-07 Thread Guo, Gua
From: Gua Guo 

Currently, have two command for pre-build binary support
1. --BuildEntryOnly: build UPL Entry file
2. --PreBuildUplBinary: build UPL binary based on UPL

And these two commands should be exclusived, shouldn't
have chance run it in the meantime.

Case1: Build UPL entry with CLANGDWARF
  python UefiPayloadPkg/UniversalPayloadBuild.py --BuildEntryOnly

Case2: Use pre-built UPL entry and build other fv by VS2019
  python UefiPayloadPkg/UniversalPayloadBuild.py -t VS2019 \
--PreBuildUplBinary UniversalPayload.elf

Case3: Build UPL Entry with CLANGDWARF and build other fv by VS2019
  python UefiPayloadPkg/UniversalPayloadBuild.py -t VS2019

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Gua Guo 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 416946a431..ecc25dad83 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -187,10 +187,11 @@ def main():
 parser.add_argument("-s", "--SpecRevision", type=ValidateSpecRevision, 
default ='0.7', help='Indicates compliance with a revision of this 
specification in the BCD format.')
 parser.add_argument("-r", "--Revision", type=Validate32BitInteger, default 
='0x010105', help='Revision of the Payload binary. 
Major.Minor.Revision.Build')
 parser.add_argument("-o", "--ProducerId", default ='INTEL', help='A 
null-terminated OEM-supplied string that identifies the payload producer (16 
bytes maximal).')
-parser.add_argument("-e", "--BuildEntryOnly", action='store_true', 
help='Build UniversalPayload Entry file')
-parser.add_argument("-pb", "--PreBuildUplBinary", default=None, 
help='Specify the UniversalPayload file')
 parser.add_argument("-sk", "--SkipBuild", action='store_true', help='Skip 
UniversalPayload build')
 parser.add_argument("-af", "--AddFv", type=ValidateAddFv, action='append', 
help='Add or replace specific FV into payload, Ex: uefi_fv=XXX.fv')
+command_group = parser.add_mutually_exclusive_group()
+command_group.add_argument("-e", "--BuildEntryOnly", action='store_true', 
help='Build UniversalPayload Entry file')
+command_group.add_argument("-pb", "--PreBuildUplBinary", default=None, 
help='Specify the UniversalPayload file')
 args = parser.parse_args()
 
 MultiFvList = []
-- 
2.39.2.windows.1



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




Re: [edk2-devel] EDK II Stable Tag release edk2-stable202305 completed

2023-05-28 Thread Guo, Gua
Thank for that, it looks good for me now.

Thanks,
Gua

From: devel@edk2.groups.io  On Behalf Of gaoliming via 
groups.io
Sent: Monday, May 29, 2023 9:16 AM
To: Guo, Gua ; devel@edk2.groups.io
Subject: 回复: [edk2-devel] EDK II Stable Tag release edk2-stable202305 completed

I have removed push limitation in Edk2 repo. Please try again.

Thanks
Liming
发件人: Guo, Gua mailto:gua@intel.com>>
发送时间: 2023年5月29日 8:43
收件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Gao, Liming 
mailto:gaolim...@byosoft.com.cn>>
主题: RE: [edk2-devel] EDK II Stable Tag release edk2-stable202305 completed

Remove All

Hi @Gao, Liming<mailto:gaolim...@byosoft.com.cn>

One more check, Do you know whether Edk2 Hard Freeze is unlock or not ?
I have two PR wait Hard Freeze unlock, want to add push label.
1. BaseTools: toolsetup.bat always execute PYTHON_HOME by gguo11837463 · Pull 
Request #4431 · tianocore/edk2 
(github.com)<https://github.com/tianocore/edk2/pull/4431>
2. PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD by 
gguo11837463 · Pull Request #4416 · tianocore/edk2 
(github.com)<https://github.com/tianocore/edk2/pull/4416>

Thanks,
Gua
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of gaoliming via 
groups.io
Sent: Monday, May 29, 2023 8:30 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; 
annou...@edk2.groups.io<mailto:annou...@edk2.groups.io>
Cc: Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>; 'Andrew Fish' 
mailto:af...@apple.com>>; 'Leif Lindholm' 
mailto:l...@nuviainc.com>>; Demeter, Miki 
mailto:miki.deme...@intel.com>>
Subject: [edk2-devel] EDK II Stable Tag release edk2-stable202305 completed

Hi, all

The tag edk2-stable202305 has been created. 
https://github.com/tianocore/edk2/releases/tag/edk2-stable202305
  git clone -b edk2-stable202305 https://github.com/tianocore/edk2.git

The tag edk2-stable202305 has been added into the main EDK II Wiki page.
  https://github.com/tianocore/tianocore.github.io/wiki/EDK-II

The quiet period has now ended. Thank you for your cooperation and patience. 
Normal commits can now be resumed.

Next edk2 stable tag (edk2-stable202305) planning has been added into wiki page.
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning.

If you have ideas for features in the next stable tag, please enter a Bugzilla 
for evaluation. Please let me know if there are existing open Bugzilla entries 
that should be targeted at this next stable tag.

Thanks
Liming



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




Re: [edk2-devel] EDK II Stable Tag release edk2-stable202305 completed

2023-05-28 Thread Guo, Gua
Remove All

Hi @Gao, Liming

One more check, Do you know whether Edk2 Hard Freeze is unlock or not ?
I have two PR wait Hard Freeze unlock, want to add push label.
1. BaseTools: toolsetup.bat always execute PYTHON_HOME by gguo11837463 * Pull 
Request #4431 * tianocore/edk2 
(github.com)
2. PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD by 
gguo11837463 * Pull Request #4416 * tianocore/edk2 
(github.com)

Thanks,
Gua
From: devel@edk2.groups.io  On Behalf Of gaoliming via 
groups.io
Sent: Monday, May 29, 2023 8:30 AM
To: devel@edk2.groups.io; annou...@edk2.groups.io
Cc: Kinney, Michael D ; 'Andrew Fish' 
; 'Leif Lindholm' ; Demeter, Miki 

Subject: [edk2-devel] EDK II Stable Tag release edk2-stable202305 completed

Hi, all

The tag edk2-stable202305 has been created. 
https://github.com/tianocore/edk2/releases/tag/edk2-stable202305
  git clone -b edk2-stable202305 https://github.com/tianocore/edk2.git

The tag edk2-stable202305 has been added into the main EDK II Wiki page.
  https://github.com/tianocore/tianocore.github.io/wiki/EDK-II

The quiet period has now ended. Thank you for your cooperation and patience. 
Normal commits can now be resumed.

Next edk2 stable tag (edk2-stable202305) planning has been added into wiki page.
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning.

If you have ideas for features in the next stable tag, please enter a Bugzilla 
for evaluation. Please let me know if there are existing open Bugzilla entries 
that should be targeted at this next stable tag.

Thanks
Liming



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105354): https://edk2.groups.io/g/devel/message/105354
Mute This Topic: https://groups.io/mt/99191720/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] BaseTools: toolsetup.bat always execute PYTHON_HOME

2023-05-26 Thread Guo, Gua
@Rebecca Cran

I update v2 patch on the PR https://github.com/tianocore/edk2/pull/4431

Could you help to check about whether meet your expectation ?

Thanks,
Gua

-Original Message-
From: Rebecca Cran  
Sent: Saturday, May 27, 2023 12:30 AM
To: Guo, Gua ; devel@edk2.groups.io
Cc: Gao, Liming ; Feng, Bob C ; 
Chen, Christine 
Subject: Re: [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME

On 5/25/23 6:09 PM, gua@intel.com wrote:

>   
> -%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py 
> %PYTHON_VER_MAJOR% %PYTHON_VER_MINOR% >NUL 2>NUL -if %ERRORLEVEL% EQU 
> 1 (
> -  echo.
> -  echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer 
> is required.
> -  echo.
> -  goto end
> +  %PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py 
> + %PYTHON_VER_MAJOR% %PYTHON_VER_MINOR% >NUL 2>NUL  if %ERRORLEVEL% EQU 1 (
> +echo.
> +echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer 
> is required.
> +echo.
> +goto end
> +  )
>   )

If PYTHON_COMMAND is already defined we do still want to check it's a version 
we can use. So I don't think this part of the change is correct.


-- 

Rebecca Cran



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




[edk2-devel] [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME

2023-05-25 Thread Guo, Gua
From: Gua Guo 

Ideally behavior is like below order that can support one local build
machine, clone multiple Edk2, some of edk2 repo use old tag and
some of edk2 repo use new tag, they can both support on one machine.

1. if defined PYTHON_COMMAND only
   - use PYTHON_COMMAND = user assigned
2. if not defined PYTHON_COMMAND, auto detect py -3
   - use PYTHON_COMMAND = py -3
3. if defined PYTHON_COMMAND and PYTHON_HOME, use PYTHON_COMMAND
   - use PYTHON_COMMAND = user assigned
4. if defined PYTHON_HOME only,
   - use PYTHON_COMMAND = %PYTHON_HOME%/python.exe

SCRIPT_ERROR should return for paraent batch file to consume
for error handle.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Gua Guo 
---
 BaseTools/toolsetup.bat | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 9521f67c02..8aef28192e 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -313,23 +313,25 @@ if not defined PYTHON_COMMAND (
   )
 )
 
-if defined PYTHON_HOME (
-  if EXIST "%PYTHON_HOME%" (
-set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
-  ) else (
-echo .
-echo !!! ERROR !!!  PYTHON_HOME="%PYTHON_HOME%" does not exist.
-echo .
-goto end
+if not defined PYTHON_COMMAND (
+  if defined PYTHON_HOME (
+if EXIST "%PYTHON_HOME%" (
+  set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
+) else (
+  echo .
+  echo !!! ERROR !!!  PYTHON_HOME="%PYTHON_HOME%" does not exist.
+  echo .
+  goto end
+)
   )
-)
 
-%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR% 
%PYTHON_VER_MINOR% >NUL 2>NUL
-if %ERRORLEVEL% EQU 1 (
-  echo.
-  echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer is 
required.
-  echo.
-  goto end
+  %PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR% 
%PYTHON_VER_MINOR% >NUL 2>NUL
+  if %ERRORLEVEL% EQU 1 (
+echo.
+echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer 
is required.
+echo.
+goto end
+  )
 )
 if %ERRORLEVEL% NEQ 0 (
   echo.
@@ -447,5 +449,4 @@ set VS2015=
 set VSTool=
 set PYTHON_VER_MAJOR=
 set PYTHON_VER_MINOR=
-set SCRIPT_ERROR=
 popd
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105326): https://edk2.groups.io/g/devel/message/105326
Mute This Topic: https://groups.io/mt/99141348/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 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
Thanks for quickly review also update reviewed-by info on the PR.
https://github.com/tianocore/edk2/pull/4416

-Original Message-
From: Ni, Ray  
Sent: Wednesday, May 24, 2023 5:45 PM
To: Guo, Gua ; devel@edk2.groups.io
Cc: Kinney, Michael D 
Subject: RE: [PATCH v4 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct 
IO port by PCD

Reviewed-by: Ray Ni 

> -Original Message-
> From: Guo, Gua 
> Sent: Wednesday, May 24, 2023 4:43 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua ; Ni, Ray ; Kinney, 
> Michael D 
> Subject: [PATCH v4 1/1] PcAtChipsetPkg: RTC Runtime unable to get 
> correct IO port by PCD
> 
> From: Gua Guo 
> 
> RTC runtime is unable to get dynamic PCD value after booting to OS 
> using runtime services.
> 
> Resolution: Cache the dynamic PCD value in RTC driver entry point
> 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Signed-off-by: Gua Guo 
> ---
>  .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 36 ++-
>  .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 14 ++--
>  2 files changed, 31 insertions(+), 19 deletions(-)
> 
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index d8b9fa8376..ff1b019ce2 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -11,9 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
>  #include "PcRtc.h"
> 
> 
> 
> -extern UINTN  mRtcIndexRegister;
> 
> -extern UINTN  mRtcTargetRegister;
> 
> -
> 
> +extern UINTN   mRtcIndexRegister;
> 
> +extern UINTN   mRtcTargetRegister;
> 
> +extern UINT16  mRtcDefaultYear;
> 
> +extern UINT16  mMinimalValidYear;
> 
> +extern UINT16  mMaximalValidYear;
> 
>  //
> 
>  // Days of month.
> 
>  //
> 
> @@ -72,10 +74,10 @@ IoRtcRead (
>)
> 
>  {
> 
>IoWrite8 (
> 
> -PcdGet8 (PcdRtcIndexRegister),
> 
> -(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) &
> 0x80))
> 
> +mRtcIndexRegister,
> 
> +(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
> 
>  );
> 
> -  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
> 
> +  return IoRead8 (mRtcTargetRegister);
> 
>  }
> 
> 
> 
>  /**
> 
> @@ -94,10 +96,10 @@ IoRtcWrite (
>)
> 
>  {
> 
>IoWrite8 (
> 
> -PcdGet8 (PcdRtcIndexRegister),
> 
> -(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) &
> 0x80))
> 
> +mRtcIndexRegister,
> 
> +(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
> 
>  );
> 
> -  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
> 
> +  IoWrite8 (mRtcTargetRegister, Data);
> 
>  }
> 
> 
> 
>  /**
> 
> @@ -317,8 +319,8 @@ PcRtcInit (
>  Time.Hour   = RTC_INIT_HOUR;
> 
>  Time.Day= RTC_INIT_DAY;
> 
>  Time.Month  = RTC_INIT_MONTH;
> 
> -Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16
> (PcdMinimalValidYear));
> 
> -Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
> 
> +Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
> 
> +Time.Year   = MIN (Time.Year, mMaximalValidYear);
> 
>  Time.Nanosecond = 0;
> 
>  Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
> 
>  Time.Daylight   = 0;
> 
> @@ -358,8 +360,8 @@ PcRtcInit (
>Time.Hour   = RTC_INIT_HOUR;
> 
>Time.Day= RTC_INIT_DAY;
> 
>Time.Month  = RTC_INIT_MONTH;
> 
> -  Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16
> (PcdMinimalValidYear));
> 
> -  Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
> 
> +  Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
> 
> +  Time.Year   = MIN (Time.Year, mMaximalValidYear);
> 
>Time.Nanosecond = 0;
> 
>Time.TimeZone   = Global->SavedTimeZone;
> 
>Time.Daylight   = Global->Daylight;
> 
> @@ -1031,8 +1033,8 @@ ConvertRtcTimeToEfiTime (
>//   Century is 19 if RTC year >= 70,
> 
>//   Century is 20 otherwise.
> 
>//
> 
> -  Century = (UINT8)(PcdGet16 (PcdMinimalValidYear) / 100);
> 
> -  if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
> 
> +  Century = (UINT8)(mMinimalValidYear / 100);
> 
> +  if (Time->Year < mMinimalValidYear % 100) {
> 
>  Century++;
> 
>}
> 
> 
> 
> @@ -1114,8 +1116,8 @@ RtcTimeFieldsValid (
>IN EFI_TIME  *Time
> 
>)
> 
>  {
> 
> -  if ((Time->Year < PcdGet16 (

Re: [edk2-devel] [PATCH v4 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
V4 patch can locate all previous comment.

-Original Message-
From: Guo, Gua  
Sent: Wednesday, May 24, 2023 4:43 PM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [PATCH v4 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO 
port by PCD

From: Gua Guo 

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

V4: merge mRtcIndexRegisterIo and mRtcTargetRegisterIo into mRtcIndexRegister 
and mRtcTargetRegister

V3: change UINTN to UINT8 on global data
  mRtcIndexRegisterIo
  mRtcTargetRegisterIo

V2: Add more dynamic PCD for runtime service support instead of taking for 
FixedAtBuild case

V1: After https://bugzilla.tianocore.org/show_bug.cgi?id=4193
RTC Runtime Services unable to get correct RTC time.
Solution: Cache RTC data, update RTC driver not to use PcdGet after driver init.

Gua Guo (1):
  PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 36 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 14 ++--
 2 files changed, 31 insertions(+), 19 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v4 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
From: Gua Guo 

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

V4: merge mRtcIndexRegisterIo and mRtcTargetRegisterIo into mRtcIndexRegister 
and mRtcTargetRegister

V3: change UINTN to UINT8 on global data
  mRtcIndexRegisterIo
  mRtcTargetRegisterIo

V2: Add more dynamic PCD for runtime service support instead of taking for 
FixedAtBuild case

V1: After https://bugzilla.tianocore.org/show_bug.cgi?id=4193
RTC Runtime Services unable to get correct RTC time.
Solution: Cache RTC data, update RTC driver not to use PcdGet after driver init.

Gua Guo (1):
  PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 36 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 14 ++--
 2 files changed, 31 insertions(+), 19 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v4 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
From: Gua Guo 

RTC runtime is unable to get dynamic PCD value after booting to
OS using runtime services.

Resolution: Cache the dynamic PCD value in RTC driver entry point

Cc: Ray Ni 
Cc: Michael D Kinney 
Signed-off-by: Gua Guo 
---
 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 36 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 14 ++--
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index d8b9fa8376..ff1b019ce2 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -11,9 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "PcRtc.h"
 
-extern UINTN  mRtcIndexRegister;
-extern UINTN  mRtcTargetRegister;
-
+extern UINTN   mRtcIndexRegister;
+extern UINTN   mRtcTargetRegister;
+extern UINT16  mRtcDefaultYear;
+extern UINT16  mMinimalValidYear;
+extern UINT16  mMaximalValidYear;
 //
 // Days of month.
 //
@@ -72,10 +74,10 @@ IoRtcRead (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegister,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
 );
-  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
+  return IoRead8 (mRtcTargetRegister);
 }
 
 /**
@@ -94,10 +96,10 @@ IoRtcWrite (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegister,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
 );
-  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
+  IoWrite8 (mRtcTargetRegister, Data);
 }
 
 /**
@@ -317,8 +319,8 @@ PcRtcInit (
 Time.Hour   = RTC_INIT_HOUR;
 Time.Day= RTC_INIT_DAY;
 Time.Month  = RTC_INIT_MONTH;
-Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
-Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
+Time.Year   = MIN (Time.Year, mMaximalValidYear);
 Time.Nanosecond = 0;
 Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
 Time.Daylight   = 0;
@@ -358,8 +360,8 @@ PcRtcInit (
   Time.Hour   = RTC_INIT_HOUR;
   Time.Day= RTC_INIT_DAY;
   Time.Month  = RTC_INIT_MONTH;
-  Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
-  Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+  Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
+  Time.Year   = MIN (Time.Year, mMaximalValidYear);
   Time.Nanosecond = 0;
   Time.TimeZone   = Global->SavedTimeZone;
   Time.Daylight   = Global->Daylight;
@@ -1031,8 +1033,8 @@ ConvertRtcTimeToEfiTime (
   //   Century is 19 if RTC year >= 70,
   //   Century is 20 otherwise.
   //
-  Century = (UINT8)(PcdGet16 (PcdMinimalValidYear) / 100);
-  if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
+  Century = (UINT8)(mMinimalValidYear / 100);
+  if (Time->Year < mMinimalValidYear % 100) {
 Century++;
   }
 
@@ -1114,8 +1116,8 @@ RtcTimeFieldsValid (
   IN EFI_TIME  *Time
   )
 {
-  if ((Time->Year < PcdGet16 (PcdMinimalValidYear)) ||
-  (Time->Year > PcdGet16 (PcdMaximalValidYear)) ||
+  if ((Time->Year < mMinimalValidYear) ||
+  (Time->Year > mMaximalValidYear) ||
   (Time->Month < 1) ||
   (Time->Month > 12) ||
   (!DayValid (Time)) ||
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
index e6e9458d75..b600df4879 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
@@ -16,8 +16,11 @@ EFI_HANDLE  mHandle = NULL;
 
 STATIC EFI_EVENT  mVirtualAddrChangeEvent;
 
-UINTN  mRtcIndexRegister;
-UINTN  mRtcTargetRegister;
+UINTN   mRtcIndexRegister;
+UINTN   mRtcTargetRegister;
+UINT16  mRtcDefaultYear;
+UINT16  mMinimalValidYear;
+UINT16  mMaximalValidYear;
 
 /**
   Returns the current time and date information, and the time-keeping 
capabilities
@@ -164,8 +167,15 @@ InitializePcRtc (
   if (FeaturePcdGet (PcdRtcUseMmio)) {
 mRtcIndexRegister  = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
 mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
+  } else {
+mRtcIndexRegister  = (UINTN)PcdGet8 (PcdRtcIndexRegister);
+mRtcTargetRegister = (UINTN)PcdGet8 (PcdRtcTargetRegister);
   }
 
+  mRtcDefaultYear   = PcdGet16 (PcdRtcDefaultYear);
+  mMinimalValidYear = PcdGet16 (PcdMinimalValidYear);
+  mMaximalValidYear = PcdGet16 (PcdMaximalValidYear);
+
   Status = PcRtcInit ();
   ASSERT_EFI_ERROR (Status);
 
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105221): 

Re: [edk2-devel] [PATCH v2 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
Thank for the review, will update v4 to take care it.

-Original Message-
From: Ni, Ray  
Sent: Wednesday, May 24, 2023 4:14 PM
To: devel@edk2.groups.io; Guo, Gua 
Cc: Kinney, Michael D 
Subject: RE: [edk2-devel] [PATCH v2 1/1] PcAtChipsetPkg: RTC Runtime unable to 
get correct IO port by PCD

> 
> -extern UINTN  mRtcIndexRegister;
> 
> -extern UINTN  mRtcTargetRegister;
> 
> -
> 
> +extern UINTN   mRtcIndexRegister;
> 
> +extern UINTN   mRtcTargetRegister;
> 
> +extern UINTN   mRtcIndexRegisterIo;
> 
> +extern UINTN   mRtcTargetRegisterIo;

Can you avoid adding the mRtcIndexRegisterIo/ mRtcTargetRegisterIo?
Can you just use the old variables mRtcIndexRegister/ mRtcTargetRegister.
 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105218): https://edk2.groups.io/g/devel/message/105218
Mute This Topic: https://groups.io/mt/99063019/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/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
From: Gua Guo 

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

V3: change UINTN to UINT8 on global data
  mRtcIndexRegisterIo
  mRtcTargetRegisterIo

V2: Add more dynamic PCD for runtime service support instead of taking for 
FixedAtBuild case

V1: After https://bugzilla.tianocore.org/show_bug.cgi?id=4193
RTC Runtime Services unable to get correct RTC time.
Solution: Cache RTC data, update RTC driver not to use PcdGet after driver init.

Gua Guo (1):
  PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 38 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 16 +++-
 2 files changed, 35 insertions(+), 19 deletions(-)

--
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105216): https://edk2.groups.io/g/devel/message/105216
Mute This Topic: https://groups.io/mt/99104596/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/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-24 Thread Guo, Gua
From: Gua Guo 

RTC runtime is unable to get dynamic PCD value after booting to
OS using runtime services.

Resolution: Cache the dynamic PCD value in RTC driver entry point

Cc: Ray Ni 
Cc: Michael D Kinney 
Signed-off-by: Gua Guo 
---
 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 38 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 16 +++-
 2 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index d8b9fa8376..f8a1af85fc 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -11,9 +11,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "PcRtc.h"
 
-extern UINTN  mRtcIndexRegister;
-extern UINTN  mRtcTargetRegister;
-
+extern UINTN   mRtcIndexRegister;
+extern UINTN   mRtcTargetRegister;
+extern UINT8   mRtcIndexRegisterIo;
+extern UINT8   mRtcTargetRegisterIo;
+extern UINT16  mRtcDefaultYear;
+extern UINT16  mMinimalValidYear;
+extern UINT16  mMaximalValidYear;
 //
 // Days of month.
 //
@@ -72,10 +76,10 @@ IoRtcRead (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegisterIo,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
 );
-  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
+  return IoRead8 (mRtcTargetRegisterIo);
 }
 
 /**
@@ -94,10 +98,10 @@ IoRtcWrite (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegisterIo,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
 );
-  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
+  IoWrite8 (mRtcTargetRegisterIo, Data);
 }
 
 /**
@@ -317,8 +321,8 @@ PcRtcInit (
 Time.Hour   = RTC_INIT_HOUR;
 Time.Day= RTC_INIT_DAY;
 Time.Month  = RTC_INIT_MONTH;
-Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
-Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
+Time.Year   = MIN (Time.Year, mMaximalValidYear);
 Time.Nanosecond = 0;
 Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
 Time.Daylight   = 0;
@@ -358,8 +362,8 @@ PcRtcInit (
   Time.Hour   = RTC_INIT_HOUR;
   Time.Day= RTC_INIT_DAY;
   Time.Month  = RTC_INIT_MONTH;
-  Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
-  Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+  Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
+  Time.Year   = MIN (Time.Year, mMaximalValidYear);
   Time.Nanosecond = 0;
   Time.TimeZone   = Global->SavedTimeZone;
   Time.Daylight   = Global->Daylight;
@@ -1031,8 +1035,8 @@ ConvertRtcTimeToEfiTime (
   //   Century is 19 if RTC year >= 70,
   //   Century is 20 otherwise.
   //
-  Century = (UINT8)(PcdGet16 (PcdMinimalValidYear) / 100);
-  if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
+  Century = (UINT8)(mMinimalValidYear / 100);
+  if (Time->Year < mMinimalValidYear % 100) {
 Century++;
   }
 
@@ -1114,8 +1118,8 @@ RtcTimeFieldsValid (
   IN EFI_TIME  *Time
   )
 {
-  if ((Time->Year < PcdGet16 (PcdMinimalValidYear)) ||
-  (Time->Year > PcdGet16 (PcdMaximalValidYear)) ||
+  if ((Time->Year < mMinimalValidYear) ||
+  (Time->Year > mMaximalValidYear) ||
   (Time->Month < 1) ||
   (Time->Month > 12) ||
   (!DayValid (Time)) ||
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
index e6e9458d75..f8de12aef5 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
@@ -16,8 +16,13 @@ EFI_HANDLE  mHandle = NULL;
 
 STATIC EFI_EVENT  mVirtualAddrChangeEvent;
 
-UINTN  mRtcIndexRegister;
-UINTN  mRtcTargetRegister;
+UINTN   mRtcIndexRegister;
+UINTN   mRtcTargetRegister;
+UINT8   mRtcIndexRegisterIo;
+UINT8   mRtcTargetRegisterIo;
+UINT16  mRtcDefaultYear;
+UINT16  mMinimalValidYear;
+UINT16  mMaximalValidYear;
 
 /**
   Returns the current time and date information, and the time-keeping 
capabilities
@@ -164,8 +169,15 @@ InitializePcRtc (
   if (FeaturePcdGet (PcdRtcUseMmio)) {
 mRtcIndexRegister  = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
 mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
+  } else {
+mRtcIndexRegisterIo  = (UINTN)PcdGet8 (PcdRtcIndexRegister);
+mRtcTargetRegisterIo = (UINTN)PcdGet8 (PcdRtcTargetRegister);
   }
 
+  mRtcDefaultYear   = PcdGet16 (PcdRtcDefaultYear);
+  mMinimalValidYear = PcdGet16 (PcdMinimalValidYear);
+  mMaximalValidYear = PcdGet16 (PcdMaximalValidYear);
+
   Status = PcRtcInit ();
   ASSERT_EFI_ERROR (Status);
 
-- 

[edk2-devel] [PATCH v2 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

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

RTC runtime is unable to get dynamic PCD value after booting to
OS using runtime services.

Resolution: Cache the dynamic PCD value in RTC driver entry point

Cc: Ray Ni 
Cc: Michael D Kinney 
Signed-off-by: Gua Guo 
---
 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 38 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 16 +++-
 2 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index d8b9fa8376..795ec950a8 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -11,9 +11,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "PcRtc.h"
 
-extern UINTN  mRtcIndexRegister;
-extern UINTN  mRtcTargetRegister;
-
+extern UINTN   mRtcIndexRegister;
+extern UINTN   mRtcTargetRegister;
+extern UINTN   mRtcIndexRegisterIo;
+extern UINTN   mRtcTargetRegisterIo;
+extern UINT16  mRtcDefaultYear;
+extern UINT16  mMinimalValidYear;
+extern UINT16  mMaximalValidYear;
 //
 // Days of month.
 //
@@ -72,10 +76,10 @@ IoRtcRead (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegisterIo,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
 );
-  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
+  return IoRead8 (mRtcTargetRegisterIo);
 }
 
 /**
@@ -94,10 +98,10 @@ IoRtcWrite (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegisterIo,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
 );
-  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
+  IoWrite8 (mRtcTargetRegisterIo, Data);
 }
 
 /**
@@ -317,8 +321,8 @@ PcRtcInit (
 Time.Hour   = RTC_INIT_HOUR;
 Time.Day= RTC_INIT_DAY;
 Time.Month  = RTC_INIT_MONTH;
-Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
-Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
+Time.Year   = MIN (Time.Year, mMaximalValidYear);
 Time.Nanosecond = 0;
 Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
 Time.Daylight   = 0;
@@ -358,8 +362,8 @@ PcRtcInit (
   Time.Hour   = RTC_INIT_HOUR;
   Time.Day= RTC_INIT_DAY;
   Time.Month  = RTC_INIT_MONTH;
-  Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
-  Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+  Time.Year   = MAX (mRtcDefaultYear, mMinimalValidYear);
+  Time.Year   = MIN (Time.Year, mMaximalValidYear);
   Time.Nanosecond = 0;
   Time.TimeZone   = Global->SavedTimeZone;
   Time.Daylight   = Global->Daylight;
@@ -1031,8 +1035,8 @@ ConvertRtcTimeToEfiTime (
   //   Century is 19 if RTC year >= 70,
   //   Century is 20 otherwise.
   //
-  Century = (UINT8)(PcdGet16 (PcdMinimalValidYear) / 100);
-  if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
+  Century = (UINT8)(mMinimalValidYear / 100);
+  if (Time->Year < mMinimalValidYear % 100) {
 Century++;
   }
 
@@ -1114,8 +1118,8 @@ RtcTimeFieldsValid (
   IN EFI_TIME  *Time
   )
 {
-  if ((Time->Year < PcdGet16 (PcdMinimalValidYear)) ||
-  (Time->Year > PcdGet16 (PcdMaximalValidYear)) ||
+  if ((Time->Year < mMinimalValidYear) ||
+  (Time->Year > mMaximalValidYear) ||
   (Time->Month < 1) ||
   (Time->Month > 12) ||
   (!DayValid (Time)) ||
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
index e6e9458d75..ba7e85cdfb 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
@@ -16,8 +16,13 @@ EFI_HANDLE  mHandle = NULL;
 
 STATIC EFI_EVENT  mVirtualAddrChangeEvent;
 
-UINTN  mRtcIndexRegister;
-UINTN  mRtcTargetRegister;
+UINTN   mRtcIndexRegister;
+UINTN   mRtcTargetRegister;
+UINTN   mRtcIndexRegisterIo;
+UINTN   mRtcTargetRegisterIo;
+UINT16  mRtcDefaultYear;
+UINT16  mMinimalValidYear;
+UINT16  mMaximalValidYear;
 
 /**
   Returns the current time and date information, and the time-keeping 
capabilities
@@ -164,8 +169,15 @@ InitializePcRtc (
   if (FeaturePcdGet (PcdRtcUseMmio)) {
 mRtcIndexRegister  = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
 mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
+  } else {
+mRtcIndexRegisterIo  = (UINTN)PcdGet8 (PcdRtcIndexRegister);
+mRtcTargetRegisterIo = (UINTN)PcdGet8 (PcdRtcTargetRegister);
   }
 
+  mRtcDefaultYear   = PcdGet16 (PcdRtcDefaultYear);
+  mMinimalValidYear = PcdGet16 (PcdMinimalValidYear);
+  mMaximalValidYear = PcdGet16 (PcdMaximalValidYear);
+
   Status = PcRtcInit ();
   ASSERT_EFI_ERROR (Status);
 
-- 

[edk2-devel] [PATCH v2 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

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

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

V2: Add more dynamic PCD for runtime service support instead of taking for 
FixedAtBuild case

V1: After https://bugzilla.tianocore.org/show_bug.cgi?id=4193
RTC Runtime Services unable to get correct RTC time.
Solution: Cache RTC data, update RTC driver not to use PcdGet after driver init.

Gua Guo (1):
  PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 38 ++-
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  | 16 +++-
 2 files changed, 35 insertions(+), 19 deletions(-)

--
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105116): https://edk2.groups.io/g/devel/message/105116
Mute This Topic: https://groups.io/mt/99063018/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] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-21 Thread Guo, Gua
From: Gua Guo 

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

V1: After https://bugzilla.tianocore.org/show_bug.cgi?id=4193
RTC Runtime Services unable to get correct RTC time.
Solution: Cache RTC data, update RTC driver not to use PcdGet after driver init.

Gua Guo (1):
  PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 15 ---
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  |  5 +
 2 files changed, 13 insertions(+), 7 deletions(-)

--
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105098): https://edk2.groups.io/g/devel/message/105098
Mute This Topic: https://groups.io/mt/99057516/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] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

2023-05-21 Thread Guo, Gua
From: Gua Guo 

RTC runtime is unable to get dynamic PCD value after booting to
OS using runtime services.

Resolution: Cache the dynamic PCD value in RTC driver entry point

Cc: Ray Ni 
Cc: Michael D Kinney 
Signed-off-by: Gua Guo 
---
 .../PcatRealTimeClockRuntimeDxe/PcRtc.c   | 15 ---
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c  |  5 +
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index d8b9fa8376..3f114dce5d 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -13,7 +13,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 extern UINTN  mRtcIndexRegister;
 extern UINTN  mRtcTargetRegister;
-
+extern UINTN  mRtcIndexRegisterIo;
+extern UINTN  mRtcTargetRegisterIo;
 //
 // Days of month.
 //
@@ -72,10 +73,10 @@ IoRtcRead (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegisterIo,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
 );
-  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
+  return IoRead8 (mRtcTargetRegisterIo);
 }
 
 /**
@@ -94,10 +95,10 @@ IoRtcWrite (
   )
 {
   IoWrite8 (
-PcdGet8 (PcdRtcIndexRegister),
-(UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+mRtcIndexRegisterIo,
+(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
 );
-  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
+  IoWrite8 (mRtcTargetRegisterIo, Data);
 }
 
 /**
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
index e6e9458d75..23e87978bf 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
@@ -18,6 +18,8 @@ STATIC EFI_EVENT  mVirtualAddrChangeEvent;
 
 UINTN  mRtcIndexRegister;
 UINTN  mRtcTargetRegister;
+UINTN  mRtcIndexRegisterIo;
+UINTN  mRtcTargetRegisterIo;
 
 /**
   Returns the current time and date information, and the time-keeping 
capabilities
@@ -164,6 +166,9 @@ InitializePcRtc (
   if (FeaturePcdGet (PcdRtcUseMmio)) {
 mRtcIndexRegister  = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
 mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
+  } else {
+mRtcIndexRegisterIo  = (UINTN)PcdGet8 (PcdRtcIndexRegister);
+mRtcTargetRegisterIo = (UINTN)PcdGet8 (PcdRtcTargetRegister);
   }
 
   Status = PcRtcInit ();
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105099): https://edk2.groups.io/g/devel/message/105099
Mute This Topic: https://groups.io/mt/99057517/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 02/15] UefiPayloadPkg: Add CpuPageTableLib required by PiSmmCpuDxe

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

-Original Message-
From: Tan, Dun  
Sent: Tuesday, May 16, 2023 5:59 PM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Ni, Ray ; Rhodes, Sean 
; Lu, James ; Guo, Gua 

Subject: [Patch V4 02/15] UefiPayloadPkg: Add CpuPageTableLib required by 
PiSmmCpuDxe

Add CpuPageTableLib required by PiSmmCpuDxeSmm in UefiPayloadPkg.dsc.

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

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 998d222909..66ec528ee6 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -206,6 +206,7 @@
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
   HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf
+  
+ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
 
   #
   # UEFI & PI
@@ -345,7 +346,6 @@
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
-  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
 !if $(PERFORMANCE_MEASUREMENT_ENABLE)
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104936): https://edk2.groups.io/g/devel/message/104936
Mute This Topic: https://groups.io/mt/98922926/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 5/5] UefiPayloadPkg: Add CpuPageTableLib required by SecCore & CpuMpPei

2023-05-14 Thread Guo, Gua
UefiPayloadPkg looks good for me. But maybe need to wait hard freeze unlock 
first. Give my RB.
Reviewed-by: Gua Guo 


-Original Message-
From: Wu, Jiaxin  
Sent: Monday, May 15, 2023 10:16 AM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Rhodes, Sean ; Lu, 
James ; Guo, Gua ; Ni, Ray 
; Zeng, Star 
Subject: [PATCH v3 5/5] UefiPayloadPkg: Add CpuPageTableLib required by SecCore 
& CpuMpPei

Add CpuPageTableLib required by SecCore & CpuMpPei in UefiPayloadPkg.

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 998d222909..615c5b4c6d 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -240,10 +240,11 @@
   # CPU
   #
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
+  
+ CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
 
   #
   # Platform
   #
 !if $(CPU_TIMER_LIB_ENABLE) == TRUE && $(UNIVERSAL_PAYLOAD) == TRUE @@ -343,11 
+344,10 @@
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 !if $(SOURCE_DEBUG_ENABLE)
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
-  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
 !if $(PERFORMANCE_MEASUREMENT_ENABLE)
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
 !endif
 
--
2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104845): https://edk2.groups.io/g/devel/message/104845
Mute This Topic: https://groups.io/mt/98895187/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] Maintainers.txt: Update reviewers and maintainer for FdtLib

2023-05-11 Thread Guo, Gua
Hi Liming,

Do you know whether for code freeze also include Maintainers.txt update ?
Or maybe we can submit it once the change approve.

Thanks,
Gua
-Original Message-
From: Guo, Gua  
Sent: Friday, May 12, 2023 10:11 AM
To: devel@edk2.groups.io
Cc: Guo, Gua 
Subject: [PATCH v1 0/1] Maintainers.txt: Update reviewers and maintainer for 
FdtLib

From: Gua Guo 

V1
  PR: https://github.com/tianocore/edk2/pull/4389
  Maintainer: Benny Lin 
  Reviewer: Gua Guo 
  Reviewer: Chasel Chiu 
  Reviewer: James Lu 

Gua Guo (1):
  Maintainers.txt: Update reviewers and maintainers for FdtLib. Update
reviewers and maintainers for FdtLib.

 Maintainers.txt | 8 
 1 file changed, 8 insertions(+)

--
2.39.2.windows.1



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




  1   2   3   >