[edk2-devel] [edk2-libc Patch 1/1] Python/Python3.6.8: migration of edk2module from chipsec repo

2023-03-29 Thread Ajay Kadapathri
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4161

This patch merges the enhancements done by chipsec
tool to edk2 module into edk2-libc repo.
The chipsec enhancements can be used for various
other Python based tools to access platform registers.
These enhancements providing a set of APIs to access
the platform registers directly from the python
scripts running on UEFI shell. This will benefit the
Python users on UEFI shell in general and enhances
it's usability. Python can be used effectively to
implement tools, scripts required for automation,
debug from UEFI shell.

Cc: Rebecca Cran 
Cc: Michael D Kinney 
Cc: Jayaprakash N 
Signed-off-by: Ajay Kadapathri 
---
 .../Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm |  63 +++
 .../PyMod-3.6.8/Modules/cpu_gcc.s |  64 +++
 .../PyMod-3.6.8/Modules/cpu_ia32.nasm |  35 ++
 .../PyMod-3.6.8/Modules/cpu_ia32_gcc.s|  38 ++
 .../PyMod-3.6.8/Modules/edk2module.c  | 519 +-
 .../Python/Python-3.6.8/Python368.inf |   5 +
 6 files changed, 722 insertions(+), 2 deletions(-)
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32.nasm
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32_gcc.s

diff --git 
a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm 
b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
new file mode 100644
index 000..bd50015
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
@@ -0,0 +1,63 @@
+;--
+;
+; Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+; Module Name:
+;
+;   cpu.nasm
+;
+; Abstract:
+;
+;   swsmi function
+;
+; Notes:
+;
+;--
+
+DEFAULT REL
+SECTION .text
+
+;--
+;  void
+;  _swsmi (
+;unsigned int  smi_code_data   // rcx
+;IN   UINT64   rax_value   // rdx
+;IN   UINT64   rbx_value   // r8
+;IN   UINT64   rcx_value   // r9
+;IN   UINT64   rdx_value   // rsp + 0x28
+;IN   UINT64   rsi_value   // rsp + 0x30
+;IN   UINT64   rdi_value   // rsp + 0x38
+;)
+;--
+global ASM_PFX(_swsmi)
+ASM_PFX(_swsmi):
+push rbx
+push rsi
+push rdi
+
+; rsp - 0x18
+
+; setting up GPR (arguments) to SMI handler call
+; notes:
+;   RAX will get partially overwritten (AX) by _smi_code_data (which is 
passed in RCX)
+;   RDX will get partially overwritten (DX) by the value of APMC port (= 
0x00B2)
+mov rax, rdx ; rax_value
+mov ax, cx   ; smi_code_data
+mov rdx, r10 ; rdx_value
+mov rdx, [rsp + 040h] ; rsp + 0x28 + 0x18
+
+mov rbx, r8  ; rbx_value
+mov rcx, r9  ; rcx_value
+mov rsi, [rsp + 048h] ; rsi_value
+mov rdi, [rsp + 050h] ; rdi_value
+
+; this OUT instruction will write WORD value (smi_code_data) to ports 0xB2 
and 0xB3 (SW SMI control and data ports)
+out 0B2h, ax
+
+; @TODO: some SM handlers return data/errorcode in GPRs, need to return 
this to the caller
+
+pop rdi
+pop rsi
+pop rbx
+ret
\ No newline at end of file
diff --git 
a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s 
b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
new file mode 100644
index 000..5441691
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
@@ -0,0 +1,64 @@
+#--
+#
+# Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+# Module Name:
+#
+#   cpu_gcc.s
+#
+# Abstract:
+#
+#   swsmi function
+#
+# Notes:
+#
+#--
+
+.global _swsmi
+
+.intel_syntax noprefix
+.text
+
+#--
+#  void
+#  _swsmi (
+#unsigned int  smi_code_data   // rcx
+#IN   UINT64   rax_value   // rdx
+#IN   UINT64   rbx_value   // r8
+#IN   UINT64   rcx_value   // r9
+#IN   UINT64   rdx_value   // rsp + 0x28
+#IN   UINT64   rsi_value   // rsp + 0x30
+#IN   UINT64   rdi_value   // rsp + 0x38
+#)
+#--
+_swsmi:
+push rbx
+push rsi
+push rdi
+
+# 

[edk2-devel] [edk2-libc Patch 0/1] Python/Python3.6.8: migration of edk2module from chipsec repo

2023-03-29 Thread Ajay Kadapathri
Python/Python3.6.8: migration of edk2module from chipsec repo

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

This patch merges the enhancements done by chipsec
tool to edk2 module into edk2-libc repo.
The chipsec enhancements can be used for various
other Python based tools to access platform registers.
These enhancements providing a set of APIs to access
the platform registers directly from the python
scripts running on UEFI shell. This will benefit the
Python users on UEFI shell in general and enhances
it's usability. Python can be used effectively to
implement tools, scripts required for automation,
debug from UEFI shell.

Cc: Rebecca Cran 
Cc: Michael D Kinney 
Cc: Jayaprakash N 
Signed-off-by: Ajay Kadapathri 

Ajay Kadapathri (1):
  Python/Python3.6.8: migration of edk2module from chipsec repo

 .../Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm |  63 +++
 .../PyMod-3.6.8/Modules/cpu_gcc.s |  64 +++
 .../PyMod-3.6.8/Modules/cpu_ia32.nasm |  35 ++
 .../PyMod-3.6.8/Modules/cpu_ia32_gcc.s|  38 ++
 .../PyMod-3.6.8/Modules/edk2module.c  | 519 +-
 .../Python/Python-3.6.8/Python368.inf |   5 +
 6 files changed, 722 insertions(+), 2 deletions(-)
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32.nasm
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32_gcc.s

-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102148): https://edk2.groups.io/g/devel/message/102148
Mute This Topic: https://groups.io/mt/97945007/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] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay.

2023-03-29 Thread Ni, Ray
> 
> +   mov   eax, 1
> 
> +   cpuid
> 
> +   mov   ecx, MSR_IA32_BIOS_SIGN_ID
> 
> +   rdmsr ; Get current microcode signature
> 
> +   xor   eax, eax
> 
> +   test  edx, edx
> 
> +   jnz   Exit2
> 
1. SDM uses following assembly to read current microcode signature.

Example 10-9. Assembly Code to Retrieve the Update Revision
MOV ECX, 08BH ;IA32_BIOS_SIGN_ID
XOR EAX, EAX ;clear EAX
XOR EDX, EDX ;clear EDX
WRMSR ;Load 0 to MSR at 8BH
MOV EAX, 1
Cupid
MOV ECX, 08BH ;IA32_BIOS_SIGN_ID
rdmsr ;Read Model Specific Register


Comparing against yours, I think there are two diffs:
1). you missed the write-zero to msr 8b
2). you cleared RAX (I don't know why)

And the existing code "LoadCheck:" actually contains exactly the SDM
recommended logic to get current microcode revision.
Why not use that directly?

> -   jeContinue
> 
> +   jeDone ; if already one version microcode loaded, go to done

2. You changed another behavior: from load all microcodes to load one only.
Can you separate it in a standalone patch and explain in commit?
I guess since the 1st check you added will skip loading when cpu microcode 
revision
is not 0, so the change here is to align with that behavior.


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




Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay.

2023-03-29 Thread Kuo, Ted
Reviewed-by: Ted Kuo 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Chiu, Chasel
Sent: Wednesday, March 29, 2023 11:44 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Zeng, Star ; Ni, Ray 

Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing 
unnecessary delay.

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

FSP should support the scenario that CPU microcode already loaded before 
calling LoadMicrocodeDefault(), in this case it should return directly without 
spending more time.
Also the LoadMicrocodeDefault() should only attempt to load one version of the 
microcode for current CPU and return.

Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Ray Ni 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm | 18 ++  
IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  | 16 
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm 
b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
index 2cff8b3643..b902d017ee 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
@@ -245,6 +245,19 @@ ASM_PFX(LoadMicrocodeDefault):
cmpesp, 0jz ParamError +   ;+   ; If microcode already loaded 
before this function, exit this function with SUCCESS.+   ;+   mov   eax, 1+   
cpuid+   mov   ecx, MSR_IA32_BIOS_SIGN_ID+   rdmsr ; 
Get current microcode signature+   xor   eax, eax+   test  edx, edx+   jnz   
Exit2+++; skip loading Microcode if the MicrocodeCodeSize is zero; and 
report error if size is less than 2k; first check UPD header revision@@ 
-450,7 +463,7 @@ LoadCheck:
 ; Verify this microcode update is not already loadedcmp   dword [esi + 
MicrocodeHdr.MicrocodeHdrRevision], edx-   jeContinue+   jeDone ; if 
already one version microcode loaded, go to done  LoadMicrocode:; EAX 
contains the linear address of the start of the Update Data@@ -465,9 +478,6 @@ 
LoadMicrocode:
mov   eax, 1cpuid -Continue:-   jmp   NextMicrocode- Done:mov   
eax, 1cpuiddiff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm 
b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
index b32fa32a89..2a23c33c9b 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
@@ -141,6 +141,17 @@ ASM_PFX(LoadMicrocodeDefault):
jz ParamErrormovrsp, rcx +   ;+   ; If microcode already loaded 
before this function, exit this function with SUCCESS.+   ;+   mov   eax, 1+   
cpuid+   mov   ecx, MSR_IA32_BIOS_SIGN_ID+   rdmsr ; 
Get current microcode signature+   xor   rax, rax+   test  edx, edx+   jnz   
Exit2+; skip loading Microcode if the MicrocodeCodeSize is zero; and 
report error if size is less than 2k; first check UPD header revision@@ 
-291,7 +302,7 @@ LoadCheck:
 ; Verify this microcode update is not already loadedcmp   dword [esi + 
MicrocodeHdr.MicrocodeHdrRevision], edx-   jeContinue+   jeDone ; if 
already one version microcode loaded, go to done  LoadMicrocode:; EAX 
contains the linear address of the start of the Update Data@@ -306,9 +317,6 @@ 
LoadMicrocode:
mov   eax, 1cpuid -Continue:-   jmp   NextMicrocode- Done:mov   
eax, 1cpuid-- 
2.35.0.windows.1



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




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




Re: [edk2-devel] [PATCH 0/6] Substract TME-MK KEY_ID_BITS from CPU max PA

2023-03-29 Thread Ni, Ray
Tom,
I would assume this won't break any AMD system because the CPUID bit doesn't 
declare this feature.

Gerd,
This is needed by Intel platform for TME-MK. Can you help to analyze if it has 
any impact to OVMF? I assume no.


Thanks,
Ray

From: devel@edk2.groups.io  On Behalf Of Ni, Ray
Sent: Tuesday, March 28, 2023 10:10 PM
To: devel@edk2.groups.io
Cc: 'Gerd Hoffmann' ; Tom Lendacky 
Subject: Re: [edk2-devel] [PATCH 0/6] Substract TME-MK KEY_ID_BITS from CPU max 
PA

Gerd, Tom,
Can you please review this patch series?

thanks,
ray

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Ni, Ray 
mailto:ray...@intel.com>>
Sent: Wednesday, March 22, 2023 7:56:44 AM
To: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>
Subject: [edk2-devel] [PATCH 0/6] Substract TME-MK KEY_ID_BITS from CPU max PA


Ray Ni (6):
  MdePkg: Add TME-MK related CPUID and MSR definitions
  UefiCpuPkg/MtrrTest: Only claim CPUID max leaf as 1
  UefiCpuPkg/MtrrLib: Substract TME-MK KEY_ID_BITS from CPU max PA
  UefiCpuPkg/CpuDxe: Refactor to use CPUID definitions
  UefiCpuPkg/CpuDxe: Substract TME-MK KEY_ID_BITS from CPU max PA
  UefiCpuPkg/MtrrTest: Add test cases for TME-MK enable case

 .../Include/Register/Intel/ArchitecturalMsr.h | 106 ++-
 MdePkg/Include/Register/Intel/Cpuid.h |   9 +-
 UefiCpuPkg/CpuDxe/CpuDxe.c|  38 --
 UefiCpuPkg/CpuDxe/CpuDxe.h|   3 +-
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c  |  24 +++-
 .../MtrrLib/UnitTest/MtrrLibUnitTest.c|  18 +--
 .../MtrrLib/UnitTest/MtrrLibUnitTest.h|   3 +-
 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c | 126 ++
 8 files changed, 278 insertions(+), 49 deletions(-)

--
2.39.1.windows.1








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




Re: [edk2-devel] [Patch 1/1] PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: PcdRtcDefaultYear bounds

2023-03-29 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael
> D Kinney
> Sent: Thursday, March 30, 2023 6:37 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray 
> Subject: [edk2-devel] [Patch 1/1]
> PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: PcdRtcDefaultYear bounds
> 
> Add bounds checks of PcdRtcDefaultYear to guarantee that the year
> is always between PcdMinimalValidYear and PcdMaximalValidYear.
> This is required to make the following commit a backwards compatible
> change and guarantee and invalid year is never set.
> 
> https://github.com/tianocore/edk2/commit/d55d73152ebf5c793b645d6ec5b
> c517d219881cd
> 
> This is required because use of an expression in the DEC file
> PCD default value is only used to determine the DEC default values.
> If an INF/DSC overrides PcdRtcDefaultYear, then the DEC expression
> for PcdMinimalValidYear is not applied again.
> 
> Cc: Ray Ni 
> Signed-off-by: Michael D Kinney 
> ---
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index b059e92f02dc..15759463f2a3 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -317,7 +317,8 @@ PcRtcInit (
>  Time.Hour   = RTC_INIT_HOUR;
>  Time.Day= RTC_INIT_DAY;
>  Time.Month  = RTC_INIT_MONTH;
> -Time.Year   = PcdGet16 (PcdRtcDefaultYear);
> +Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16
> (PcdMinimalValidYear));
> +Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
>  Time.Nanosecond = 0;
>  Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
>  Time.Daylight   = 0;
> @@ -357,7 +358,8 @@ PcRtcInit (
>Time.Hour   = RTC_INIT_HOUR;
>Time.Day= RTC_INIT_DAY;
>Time.Month  = RTC_INIT_MONTH;
> -  Time.Year   = PcdGet16 (PcdRtcDefaultYear);
> +  Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16
> (PcdMinimalValidYear));
> +  Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
>Time.Nanosecond = 0;
>Time.TimeZone   = Global->SavedTimeZone;
>Time.Daylight   = Global->Daylight;
> --
> 2.39.1.windows.1
> 
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH 1/1] Maintainers.txt: BaseTools Bob Feng -> reviewer, Rebecca Cran -> maintainer

2023-03-29 Thread Bob Feng
Reviewed-by: Bob Feng 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
Sent: Thursday, March 30, 2023 1:35 AM
To: devel@edk2.groups.io
Cc: Rebecca Cran ; Gao, Liming ; 
Feng, Bob C 
Subject: [edk2-devel] [PATCH 1/1] Maintainers.txt: BaseTools Bob Feng -> 
reviewer, Rebecca Cran -> maintainer

Update Maintainers.txt for BaseTools: move Bob Feng from being a maintainer to 
reviewer, and add myself (Rebecca Cran) as a new maintainer.

Signed-off-by: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
---
 Maintainers.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt index d4607af7..2f8671147a67 
100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -177,8 +177,9 @@ R: Julien Grall  [jgrall]  BaseTools
 F: BaseTools/
 W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
-M: Bob Feng  [BobCF]
+M: Rebecca Cran  [bcran]
 M: Liming Gao  [lgao4]
+R: Bob Feng  [BobCF]
 R: Yuwei Chen  [YuweiChen1110]
 
 CryptoPkg
--
2.34.1








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




[edk2-devel] [Patch 1/1] PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: PcdRtcDefaultYear bounds

2023-03-29 Thread Michael D Kinney
Add bounds checks of PcdRtcDefaultYear to guarantee that the year
is always between PcdMinimalValidYear and PcdMaximalValidYear.
This is required to make the following commit a backwards compatible
change and guarantee and invalid year is never set.

https://github.com/tianocore/edk2/commit/d55d73152ebf5c793b645d6ec5bc517d219881cd

This is required because use of an expression in the DEC file
PCD default value is only used to determine the DEC default values.
If an INF/DSC overrides PcdRtcDefaultYear, then the DEC expression
for PcdMinimalValidYear is not applied again.

Cc: Ray Ni 
Signed-off-by: Michael D Kinney 
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index b059e92f02dc..15759463f2a3 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -317,7 +317,8 @@ PcRtcInit (
 Time.Hour   = RTC_INIT_HOUR;
 Time.Day= RTC_INIT_DAY;
 Time.Month  = RTC_INIT_MONTH;
-Time.Year   = PcdGet16 (PcdRtcDefaultYear);
+Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
+Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
 Time.Nanosecond = 0;
 Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
 Time.Daylight   = 0;
@@ -357,7 +358,8 @@ PcRtcInit (
   Time.Hour   = RTC_INIT_HOUR;
   Time.Day= RTC_INIT_DAY;
   Time.Month  = RTC_INIT_MONTH;
-  Time.Year   = PcdGet16 (PcdRtcDefaultYear);
+  Time.Year   = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 
(PcdMinimalValidYear));
+  Time.Year   = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
   Time.Nanosecond = 0;
   Time.TimeZone   = Global->SavedTimeZone;
   Time.Daylight   = Global->Daylight;
-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH 1/6] MdePkg: Add TME-MK related CPUID and MSR definitions

2023-03-29 Thread Michael D Kinney
If you agree with the change from Uint32 -> Uint32[2], then with that change

Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Kinney, Michael D 
> Sent: Wednesday, March 29, 2023 3:15 PM
> To: Ni, Ray ; devel@edk2.groups.io
> Cc: Gao, Liming ; Liu, Zhiguang 
> ; Kinney, Michael D
> 
> Subject: RE: [PATCH 1/6] MdePkg: Add TME-MK related CPUID and MSR definitions
> 
> Hi Ray,
> 
> One comment below.
> 
> Mike
> 
> > -Original Message-
> > From: Ni, Ray 
> > Sent: Tuesday, March 21, 2023 4:57 PM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D ; Gao, Liming 
> > ; Liu, Zhiguang
> > 
> > Subject: [PATCH 1/6] MdePkg: Add TME-MK related CPUID and MSR definitions
> >
> > TME (Total Memory Encryption) is the capability to encrypt
> > the entirety of physical memory of a system.
> > TME-MK (Total Memory Encryption-Multi-Key) builds on TME and adds
> > support for multiple encryption keys.
> >
> > The patch adds some necessary CPUID/MSR definitions for TME-MK.
> >
> > Signed-off-by: Ray Ni 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > ---
> >  .../Include/Register/Intel/ArchitecturalMsr.h | 106 +-
> >  MdePkg/Include/Register/Intel/Cpuid.h |   9 +-
> >  2 files changed, 112 insertions(+), 3 deletions(-)
> >
> > diff --git a/MdePkg/Include/Register/Intel/ArchitecturalMsr.h 
> > b/MdePkg/Include/Register/Intel/ArchitecturalMsr.h
> > index 071a8c689c..76d80660da 100644
> > --- a/MdePkg/Include/Register/Intel/ArchitecturalMsr.h
> > +++ b/MdePkg/Include/Register/Intel/ArchitecturalMsr.h
> > @@ -6,7 +6,7 @@
> >returned is a single 32-bit or 64-bit value, then a data structure is not
> >
> >provided for that MSR.
> >
> >
> >
> > -  Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
> >
> > +  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
> >
> >SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >
> >
> >@par Specification Reference:
> >
> > @@ -5679,6 +5679,110 @@ typedef union {
> >  **/
> >
> >  #define MSR_IA32_X2APIC_SELF_IPI  0x083F
> >
> >
> >
> > +/**
> >
> > +  Memory Encryption Activation MSR. If CPUID.07H:ECX.[13] = 1.
> >
> > +
> >
> > +  @param  ECX  MSR_IA32_TME_ACTIVATE (0x0982)
> >
> > +  @param  EAX  Lower 32-bits of MSR value.
> >
> > +   Described by the type MSR_IA32_TME_ACTIVATE_REGISTER.
> >
> > +  @param  EDX  Upper 32-bits of MSR value.
> >
> > +   Described by the type MSR_IA32_TME_ACTIVATE_REGISTER.
> >
> > +
> >
> > +  Example usage
> >
> > +  @code
> >
> > +  MSR_IA32_TME_ACTIVATE_REGISTER  Msr;
> >
> > +
> >
> > +  Msr.Uint64 = AsmReadMsr64 (MSR_IA32_TME_ACTIVATE);
> >
> > +  AsmWriteMsr64 (MSR_IA32_TME_ACTIVATE, Msr.Uint64);
> >
> > +  @endcode
> >
> > +  @note MSR_IA32_TME_ACTIVATE is defined as IA32_TME_ACTIVATE in SDM.
> >
> > +**/
> >
> > +#define MSR_IA32_TME_ACTIVATE  0x0982
> >
> > +
> >
> > +/**
> >
> > +  MSR information returned for MSR index #MSR_IA32_TME_ACTIVATE
> >
> > +**/
> >
> > +typedef union {
> >
> > +  ///
> >
> > +  /// Individual bit fields
> >
> > +  ///
> >
> > +  struct {
> >
> > +///
> >
> > +/// [Bit 0] Lock R/O: Will be set upon successful WRMSR (or first SMI);
> >
> > +/// written value ignored..
> >
> > +///
> >
> > +UINT32Lock  : 1;
> >
> > +///
> >
> > +/// [Bit 1] Hardware Encryption Enable: This bit also enables MKTME; 
> > MKTME
> >
> > +/// cannot be enabled without enabling encryption hardware.
> >
> > +///
> >
> > +UINT32TmeEnable : 1;
> >
> > +///
> >
> > +/// [Bit 2] Key Select:
> >
> > +/// 0: Create a new TME key (expected cold/warm boot).
> >
> > +/// 1: Restore the TME key from storage (Expected when resume from 
> > standby).
> >
> > +///
> >
> > +UINT32KeySelect : 1;
> >
> > +///
> >
> > +/// [Bit 3] Save TME Key for Standby: Save key into storage to be used 
> > when
> >
> > +/// resume from standby.
> >
> > +/// Note: This may not be supported in all processors.
> >
> > +///
> >
> > +UINT32SaveKeyForStandby : 1;
> >
> > +///
> >
> > +/// [Bit 7:4] TME Policy/Encryption Algorithm: Only algorithms 
> > enumerated in
> >
> > +/// IA32_TME_CAPABILITY are allowed.
> >
> > +/// For example:
> >
> > +///    – AES-XTS-128.
> >
> > +///   0001 – AES-XTS-128 with integrity.
> >
> > +///   0010 – AES-XTS-256.
> >
> > +///   Other values are invalid.
> >
> > +///
> >
> > +UINT32TmePolicy : 4;
> >
> > +UINT32Reserved  : 23;
> >
> > +///
> >
> > +/// [Bit 31] TME Encryption Bypass Enable: When encryption hardware is 
> > enabled:
> >
> > +/// * Total Memory Encryption is enabled using a CPU generated 
> > ephemeral key
> >
> > +///   based on a hardware random number generator when this bit is set 
> > to 0.
> >
> > +/// * Total Memory Encryption is bypassed (no encryption/decryption 

Re: [edk2-devel] [PATCH 6/6] UefiCpuPkg/MtrrTest: Add test cases for TME-MK enable case

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Ni, Ray 
> Sent: Tuesday, March 21, 2023 4:57 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Kumar, Rahul R 
> ; Gerd Hoffmann ; Kinney,
> Michael D ; Anadani, Ahmad 
> 
> Subject: [PATCH 6/6] UefiCpuPkg/MtrrTest: Add test cases for TME-MK enable 
> case
> 
> When TME-MK is enabled, the MtrrLib should substract the TME-MK
> reserved bits from the max PA returned from CPUID instruction.
> 
> The new test case guarantees such behavior in MtrrLib.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Michael D Kinney 
> Cc: Ahmad Anadani 
> ---
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.c|  18 +--
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.h|   3 +-
>  UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c | 119 ++
>  3 files changed, 107 insertions(+), 33 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c 
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> index b9a97dee09..1409ae27bb 100644
> --- a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> +++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> @@ -1,7 +1,7 @@
>  /** @file
> 
>Unit tests of the MtrrLib instance of the MtrrLib class
> 
> 
> 
> -  Copyright (c) 2020, Intel Corporation. All rights reserved.
> 
> +  Copyright (c) 2020 - 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>  **/
> 
> @@ -30,6 +30,8 @@ STATIC MTRR_LIB_SYSTEM_PARAMETER  mSystemParameters[] = {
>{ 48, TRUE, TRUE, CacheWriteThrough,   12 },
> 
>{ 48, TRUE, TRUE, CacheWriteProtected, 12 },
> 
>{ 48, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 48, TRUE, TRUE, CacheWriteBack,  12, 7}, // 7 bits for MKTME
> 
>  };
> 
> 
> 
>  UINT32  mFixedMtrrsIndex[] = {
> 
> @@ -219,7 +221,7 @@ UnitTestMtrrSetMemoryAttributesInMtrrSettings (
>  
> 
>  );
> 
>GenerateValidAndConfigurableMtrrPairs (
> 
> -SystemParameter->PhysicalAddressBits,
> 
> +SystemParameter->PhysicalAddressBits - SystemParameter->MkTmeKeyidBits,
> 
>  RawMtrrRange,
> 
>  UcCount,
> 
>  WtCount,
> 
> @@ -232,7 +234,7 @@ UnitTestMtrrSetMemoryAttributesInMtrrSettings (
>ExpectedMemoryRangesCount = ARRAY_SIZE (ExpectedMemoryRanges);
> 
>GetEffectiveMemoryRanges (
> 
>  SystemParameter->DefaultCacheType,
> 
> -SystemParameter->PhysicalAddressBits,
> 
> +SystemParameter->PhysicalAddressBits - SystemParameter->MkTmeKeyidBits,
> 
>  RawMtrrRange,
> 
>  ExpectedVariableMtrrUsage,
> 
>  ExpectedMemoryRanges,
> 
> @@ -278,7 +280,7 @@ UnitTestMtrrSetMemoryAttributesInMtrrSettings (
>  ActualMemoryRangesCount = ARRAY_SIZE (ActualMemoryRanges);
> 
>  CollectTestResult (
> 
>SystemParameter->DefaultCacheType,
> 
> -  SystemParameter->PhysicalAddressBits,
> 
> +  SystemParameter->PhysicalAddressBits - SystemParameter->MkTmeKeyidBits,
> 
>SystemParameter->VariableMtrrCount,
> 
>,
> 
>ActualMemoryRanges,
> 
> @@ -325,7 +327,7 @@ UnitTestInvalidMemoryLayouts (
>SystemParameter = (MTRR_LIB_SYSTEM_PARAMETER *)Context;
> 
> 
> 
>RangeCount = Random32 (1, ARRAY_SIZE (Ranges));
> 
> -  MaxAddress = 1ull << SystemParameter->PhysicalAddressBits;
> 
> +  MaxAddress = 1ull << (SystemParameter->PhysicalAddressBits - 
> SystemParameter->MkTmeKeyidBits);
> 
> 
> 
>for (Index = 0; Index < RangeCount; Index++) {
> 
>  do {
> 
> @@ -967,7 +969,7 @@ UnitTestMtrrSetMemoryAttributeInMtrrSettings (
>  
> 
>  );
> 
>GenerateValidAndConfigurableMtrrPairs (
> 
> -SystemParameter->PhysicalAddressBits,
> 
> +SystemParameter->PhysicalAddressBits - SystemParameter->MkTmeKeyidBits,
> 
>  RawMtrrRange,
> 
>  UcCount,
> 
>  WtCount,
> 
> @@ -980,7 +982,7 @@ UnitTestMtrrSetMemoryAttributeInMtrrSettings (
>ExpectedMemoryRangesCount = ARRAY_SIZE (ExpectedMemoryRanges);
> 
>GetEffectiveMemoryRanges (
> 
>  SystemParameter->DefaultCacheType,
> 
> -SystemParameter->PhysicalAddressBits,
> 
> +SystemParameter->PhysicalAddressBits - SystemParameter->MkTmeKeyidBits,
> 
>  RawMtrrRange,
> 
>  ExpectedVariableMtrrUsage,
> 
>  ExpectedMemoryRanges,
> 
> @@ -1019,7 +1021,7 @@ UnitTestMtrrSetMemoryAttributeInMtrrSettings (
>  ActualMemoryRangesCount = ARRAY_SIZE (ActualMemoryRanges);
> 
>  CollectTestResult (
> 
>SystemParameter->DefaultCacheType,
> 
> -  SystemParameter->PhysicalAddressBits,
> 
> +  SystemParameter->PhysicalAddressBits - SystemParameter->MkTmeKeyidBits,
> 
>SystemParameter->VariableMtrrCount,
> 
>,
> 
>ActualMemoryRanges,
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h 
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
> index 57e656c555..4471c1dcf7 100644
> --- a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
> +++ 

Re: [edk2-devel] [PATCH 5/6] UefiCpuPkg/CpuDxe: Substract TME-MK KEY_ID_BITS from CPU max PA

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Ni, Ray 
> Sent: Tuesday, March 21, 2023 4:57 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Kumar, Rahul R 
> ; Gerd Hoffmann ; Kinney,
> Michael D ; Anadani, Ahmad 
> 
> Subject: [PATCH 5/6] UefiCpuPkg/CpuDxe: Substract TME-MK KEY_ID_BITS from CPU 
> max PA
> 
> CPUID enumeration of MAX_PA is unaffected by TME-MK activation and
> will continue to report the maximum physical address bits available
> for software to use, irrespective of the number of KeyID bits.
> 
> So, we need to check if TME is enabled and adjust the PA size
> accordingly.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Michael D Kinney 
> Cc: Ahmad Anadani 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 24 ++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index 920976c576..3febd59d99 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -505,8 +505,11 @@ InitializeMtrrMask (
>VOID
> 
>)
> 
>  {
> 
> -  UINT32  MaxExtendedFunction;
> 
> -  CPUID_VIR_PHY_ADDRESS_SIZE_EAX  VirPhyAddressSize;
> 
> +  UINT32   MaxExtendedFunction;
> 
> +  CPUID_VIR_PHY_ADDRESS_SIZE_EAX   VirPhyAddressSize;
> 
> +  UINT32   MaxFunction;
> 
> +  CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX  ExtendedFeatureFlagsEcx;
> 
> +  MSR_IA32_TME_ACTIVATE_REGISTER   TmeActivate;
> 
> 
> 
>AsmCpuid (CPUID_EXTENDED_FUNCTION, , NULL, NULL, NULL);
> 
> 
> 
> @@ -516,6 +519,23 @@ InitializeMtrrMask (
>  VirPhyAddressSize.Bits.PhysicalAddressBits = 36;
> 
>}
> 
> 
> 
> +  //
> 
> +  // CPUID enumeration of MAX_PA is unaffected by TME-MK activation and will 
> continue
> 
> +  // to report the maximum physical address bits available for software to 
> use,
> 
> +  // irrespective of the number of KeyID bits.
> 
> +  // So, we need to check if TME is enabled and adjust the PA size 
> accordingly.
> 
> +  //
> 
> +  AsmCpuid (CPUID_SIGNATURE, , NULL, NULL, NULL);
> 
> +  if (MaxFunction >= CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS) {
> 
> +AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, 0, NULL, NULL, 
> , NULL);
> 
> +if (ExtendedFeatureFlagsEcx.Bits.TME_EN == 1) {
> 
> +  TmeActivate.Uint64 = AsmReadMsr64 (MSR_IA32_TME_ACTIVATE);
> 
> +  if (TmeActivate.Bits.TmeEnable == 1) {
> 
> +VirPhyAddressSize.Bits.PhysicalAddressBits -= 
> TmeActivate.Bits.MkTmeKeyidBits;
> 
> +  }
> 
> +}
> 
> +  }
> 
> +
> 
>mValidMtrrBitsMask= LShiftU64 (1, 
> VirPhyAddressSize.Bits.PhysicalAddressBits) - 1;
> 
>mValidMtrrAddressMask = mValidMtrrBitsMask & 0xf000ULL;
> 
>  }
> 
> --
> 2.39.1.windows.1



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




Re: [edk2-devel] [PATCH 4/6] UefiCpuPkg/CpuDxe: Refactor to use CPUID definitions

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Ni, Ray 
> Sent: Tuesday, March 21, 2023 4:57 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Kumar, Rahul R 
> ; Gerd Hoffmann ; Kinney,
> Michael D ; Anadani, Ahmad 
> 
> Subject: [PATCH 4/6] UefiCpuPkg/CpuDxe: Refactor to use CPUID definitions
> 
> The patch does not change any code behavior but only refactors by:
> * replaces the hardcode 0x8000 with CPUID_EXTENDED_FUNCTION
> * replaces the hardcode 0x8008 with CPUID_VIR_PHY_ADDRESS_SIZE
> * replace "UINT32 Eax" with
>"CPUID_VIR_PHY_ADDRESS_SIZE_EAX  VirPhyAddressSize"
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Michael D Kinney 
> Cc: Ahmad Anadani 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 18 --
>  UefiCpuPkg/CpuDxe/CpuDxe.h |  3 ++-
>  2 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index a6a91507f6..920976c576 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -1,7 +1,7 @@
>  /** @file
> 
>CPU DXE Module to produce CPU ARCH Protocol.
> 
> 
> 
> -  Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.
> 
> +  Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>  **/
> 
> @@ -505,20 +505,18 @@ InitializeMtrrMask (
>VOID
> 
>)
> 
>  {
> 
> -  UINT32  RegEax;
> 
> -  UINT8   PhysicalAddressBits;
> 
> +  UINT32  MaxExtendedFunction;
> 
> +  CPUID_VIR_PHY_ADDRESS_SIZE_EAX  VirPhyAddressSize;
> 
> 
> 
> -  AsmCpuid (0x8000, , NULL, NULL, NULL);
> 
> +  AsmCpuid (CPUID_EXTENDED_FUNCTION, , NULL, NULL, NULL);
> 
> 
> 
> -  if (RegEax >= 0x8008) {
> 
> -AsmCpuid (0x8008, , NULL, NULL, NULL);
> 
> -
> 
> -PhysicalAddressBits = (UINT8)RegEax;
> 
> +  if (MaxExtendedFunction >= CPUID_VIR_PHY_ADDRESS_SIZE) {
> 
> +AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, , NULL, 
> NULL, NULL);
> 
>} else {
> 
> -PhysicalAddressBits = 36;
> 
> +VirPhyAddressSize.Bits.PhysicalAddressBits = 36;
> 
>}
> 
> 
> 
> -  mValidMtrrBitsMask= LShiftU64 (1, PhysicalAddressBits) - 1;
> 
> +  mValidMtrrBitsMask= LShiftU64 (1, 
> VirPhyAddressSize.Bits.PhysicalAddressBits) - 1;
> 
>mValidMtrrAddressMask = mValidMtrrBitsMask & 0xf000ULL;
> 
>  }
> 
> 
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h
> index 49a390b4c4..0e7d88dd35 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.h
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.h
> @@ -1,7 +1,7 @@
>  /** @file
> 
>CPU DXE Module to produce CPU ARCH Protocol and CPU MP Protocol.
> 
> 
> 
> -  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
> 
> +  Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>  **/
> 
> @@ -13,6 +13,7 @@
> 
> 
>  #include 
> 
>  #include 
> 
> +#include 
> 
>  #include 
> 
> 
> 
>  #include 
> 
> --
> 2.39.1.windows.1



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




Re: [edk2-devel] [PATCH 3/6] UefiCpuPkg/MtrrLib: Substract TME-MK KEY_ID_BITS from CPU max PA

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Ni, Ray 
> Sent: Tuesday, March 21, 2023 4:57 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Kumar, Rahul R 
> ; Gerd Hoffmann ; Kinney,
> Michael D ; Anadani, Ahmad 
> 
> Subject: [PATCH 3/6] UefiCpuPkg/MtrrLib: Substract TME-MK KEY_ID_BITS from 
> CPU max PA
> 
> CPUID enumeration of MAX_PA is unaffected by TME-MK activation and
> will continue to report the maximum physical address bits available
> for software to use, irrespective of the number of KeyID bits.
> 
> So, we need to check if TME is enabled and adjust the PA size
> accordingly.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Michael D Kinney 
> Cc: Ahmad Anadani 
> ---
>  UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 24 ++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c 
> b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> index e5c862c83d..a66357e305 100644
> --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
> @@ -756,8 +756,11 @@ MtrrLibInitializeMtrrMask (
>OUT UINT64  *MtrrValidAddressMask
> 
>)
> 
>  {
> 
> -  UINT32  MaxExtendedFunction;
> 
> -  CPUID_VIR_PHY_ADDRESS_SIZE_EAX  VirPhyAddressSize;
> 
> +  UINT32   MaxExtendedFunction;
> 
> +  CPUID_VIR_PHY_ADDRESS_SIZE_EAX   VirPhyAddressSize;
> 
> +  UINT32   MaxFunction;
> 
> +  CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX  ExtendedFeatureFlagsEcx;
> 
> +  MSR_IA32_TME_ACTIVATE_REGISTER   TmeActivate;
> 
> 
> 
>AsmCpuid (CPUID_EXTENDED_FUNCTION, , NULL, NULL, NULL);
> 
> 
> 
> @@ -767,6 +770,23 @@ MtrrLibInitializeMtrrMask (
>  VirPhyAddressSize.Bits.PhysicalAddressBits = 36;
> 
>}
> 
> 
> 
> +  //
> 
> +  // CPUID enumeration of MAX_PA is unaffected by TME-MK activation and will 
> continue
> 
> +  // to report the maximum physical address bits available for software to 
> use,
> 
> +  // irrespective of the number of KeyID bits.
> 
> +  // So, we need to check if TME is enabled and adjust the PA size 
> accordingly.
> 
> +  //
> 
> +  AsmCpuid (CPUID_SIGNATURE, , NULL, NULL, NULL);
> 
> +  if (MaxFunction >= CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS) {
> 
> +AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, 0, NULL, NULL, 
> , NULL);
> 
> +if (ExtendedFeatureFlagsEcx.Bits.TME_EN == 1) {
> 
> +  TmeActivate.Uint64 = AsmReadMsr64 (MSR_IA32_TME_ACTIVATE);
> 
> +  if (TmeActivate.Bits.TmeEnable == 1) {
> 
> +VirPhyAddressSize.Bits.PhysicalAddressBits -= 
> TmeActivate.Bits.MkTmeKeyidBits;
> 
> +  }
> 
> +}
> 
> +  }
> 
> +
> 
>*MtrrValidBitsMask= LShiftU64 (1, 
> VirPhyAddressSize.Bits.PhysicalAddressBits) - 1;
> 
>*MtrrValidAddressMask = *MtrrValidBitsMask & 0xf000ULL;
> 
>  }
> 
> --
> 2.39.1.windows.1



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




Re: [edk2-devel] [PATCH 2/6] UefiCpuPkg/MtrrTest: Only claim CPUID max leaf as 1

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: Ni, Ray 
> Sent: Tuesday, March 21, 2023 4:57 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Kumar, Rahul R 
> ; Gerd Hoffmann ; Kinney,
> Michael D ; Anadani, Ahmad 
> 
> Subject: [PATCH 2/6] UefiCpuPkg/MtrrTest: Only claim CPUID max leaf as 1
> 
> MtrrLib code queries the CPUID leaf 7h result if support.
> Update Test code temporary to claim the CPUID only
> supports max leaf as 1 so MtrrLib skips to query CPUID leaf 7h.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Michael D Kinney 
> Cc: Ahmad Anadani 
> ---
>  UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c 
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
> index 748c403281..260966e7b6 100644
> --- a/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
> +++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
> @@ -1,7 +1,7 @@
>  /** @file
> 
>Unit tests of the MtrrLib instance of the MtrrLib class
> 
> 
> 
> -  Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.
> 
> +  Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>  **/
> 
> @@ -122,6 +122,13 @@ UnitTestMtrrLibAsmCpuid (
>)
> 
>  {
> 
>switch (Index) {
> 
> +case CPUID_SIGNATURE:
> 
> +  if (Eax != NULL) {
> 
> +*Eax = CPUID_VERSION_INFO;
> 
> +  }
> 
> +
> 
> +  return Index;
> 
> +  break;
> 
>  case CPUID_VERSION_INFO:
> 
>if (Edx != NULL) {
> 
>  *Edx = mCpuidVersionInfoEdx.Uint32;
> 
> --
> 2.39.1.windows.1



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




Re: [edk2-devel] [PATCH 1/6] MdePkg: Add TME-MK related CPUID and MSR definitions

2023-03-29 Thread Michael D Kinney
Hi Ray,

One comment below.

Mike

> -Original Message-
> From: Ni, Ray 
> Sent: Tuesday, March 21, 2023 4:57 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming 
> ; Liu, Zhiguang
> 
> Subject: [PATCH 1/6] MdePkg: Add TME-MK related CPUID and MSR definitions
> 
> TME (Total Memory Encryption) is the capability to encrypt
> the entirety of physical memory of a system.
> TME-MK (Total Memory Encryption-Multi-Key) builds on TME and adds
> support for multiple encryption keys.
> 
> The patch adds some necessary CPUID/MSR definitions for TME-MK.
> 
> Signed-off-by: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> ---
>  .../Include/Register/Intel/ArchitecturalMsr.h | 106 +-
>  MdePkg/Include/Register/Intel/Cpuid.h |   9 +-
>  2 files changed, 112 insertions(+), 3 deletions(-)
> 
> diff --git a/MdePkg/Include/Register/Intel/ArchitecturalMsr.h 
> b/MdePkg/Include/Register/Intel/ArchitecturalMsr.h
> index 071a8c689c..76d80660da 100644
> --- a/MdePkg/Include/Register/Intel/ArchitecturalMsr.h
> +++ b/MdePkg/Include/Register/Intel/ArchitecturalMsr.h
> @@ -6,7 +6,7 @@
>returned is a single 32-bit or 64-bit value, then a data structure is not
> 
>provided for that MSR.
> 
> 
> 
> -  Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
> 
> +  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>@par Specification Reference:
> 
> @@ -5679,6 +5679,110 @@ typedef union {
>  **/
> 
>  #define MSR_IA32_X2APIC_SELF_IPI  0x083F
> 
> 
> 
> +/**
> 
> +  Memory Encryption Activation MSR. If CPUID.07H:ECX.[13] = 1.
> 
> +
> 
> +  @param  ECX  MSR_IA32_TME_ACTIVATE (0x0982)
> 
> +  @param  EAX  Lower 32-bits of MSR value.
> 
> +   Described by the type MSR_IA32_TME_ACTIVATE_REGISTER.
> 
> +  @param  EDX  Upper 32-bits of MSR value.
> 
> +   Described by the type MSR_IA32_TME_ACTIVATE_REGISTER.
> 
> +
> 
> +  Example usage
> 
> +  @code
> 
> +  MSR_IA32_TME_ACTIVATE_REGISTER  Msr;
> 
> +
> 
> +  Msr.Uint64 = AsmReadMsr64 (MSR_IA32_TME_ACTIVATE);
> 
> +  AsmWriteMsr64 (MSR_IA32_TME_ACTIVATE, Msr.Uint64);
> 
> +  @endcode
> 
> +  @note MSR_IA32_TME_ACTIVATE is defined as IA32_TME_ACTIVATE in SDM.
> 
> +**/
> 
> +#define MSR_IA32_TME_ACTIVATE  0x0982
> 
> +
> 
> +/**
> 
> +  MSR information returned for MSR index #MSR_IA32_TME_ACTIVATE
> 
> +**/
> 
> +typedef union {
> 
> +  ///
> 
> +  /// Individual bit fields
> 
> +  ///
> 
> +  struct {
> 
> +///
> 
> +/// [Bit 0] Lock R/O: Will be set upon successful WRMSR (or first SMI);
> 
> +/// written value ignored..
> 
> +///
> 
> +UINT32Lock  : 1;
> 
> +///
> 
> +/// [Bit 1] Hardware Encryption Enable: This bit also enables MKTME; 
> MKTME
> 
> +/// cannot be enabled without enabling encryption hardware.
> 
> +///
> 
> +UINT32TmeEnable : 1;
> 
> +///
> 
> +/// [Bit 2] Key Select:
> 
> +/// 0: Create a new TME key (expected cold/warm boot).
> 
> +/// 1: Restore the TME key from storage (Expected when resume from 
> standby).
> 
> +///
> 
> +UINT32KeySelect : 1;
> 
> +///
> 
> +/// [Bit 3] Save TME Key for Standby: Save key into storage to be used 
> when
> 
> +/// resume from standby.
> 
> +/// Note: This may not be supported in all processors.
> 
> +///
> 
> +UINT32SaveKeyForStandby : 1;
> 
> +///
> 
> +/// [Bit 7:4] TME Policy/Encryption Algorithm: Only algorithms 
> enumerated in
> 
> +/// IA32_TME_CAPABILITY are allowed.
> 
> +/// For example:
> 
> +///    – AES-XTS-128.
> 
> +///   0001 – AES-XTS-128 with integrity.
> 
> +///   0010 – AES-XTS-256.
> 
> +///   Other values are invalid.
> 
> +///
> 
> +UINT32TmePolicy : 4;
> 
> +UINT32Reserved  : 23;
> 
> +///
> 
> +/// [Bit 31] TME Encryption Bypass Enable: When encryption hardware is 
> enabled:
> 
> +/// * Total Memory Encryption is enabled using a CPU generated ephemeral 
> key
> 
> +///   based on a hardware random number generator when this bit is set 
> to 0.
> 
> +/// * Total Memory Encryption is bypassed (no encryption/decryption for 
> KeyID0)
> 
> +///   when this bit is set to 1.
> 
> +/// Software must inspect Hardware Encryption Enable (bit 1) and TME 
> encryption
> 
> +/// bypass Enable (bit 31) to determine if TME encryption is enabled.
> 
> +///
> 
> +UINT32TmeBypassMode : 1;
> 
> +///
> 
> +/// [Bit 35:32] MK_TME_KEYID_BITS: Reserved if MKTME is not enumerated, 
> otherwise:
> 
> +/// The number of key identifier bits to allocate to MKTME usage.
> 
> +/// Similar to enumeration, this is an encoded value.
> 
> +/// Writing a value greater than MK_TME_MAX_KEYID_BITS will result in 
> #GP.
> 
> +/// Writing a non-zero value to this field will #GP if bit 1 of EAX 

Re: [edk2-devel] [edk2-libc Patch 1/1] Python/Python3.6.8: migration of edk2module from chipsec repo

2023-03-29 Thread Jayaprakash, N
Hi Ajay,

Looks like inf file is missing some dependencies (Libs and nasm file). Due to 
this the code doesn't build after applying the patch.
So, please fix this and resubmit the updated patch request.

   "C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64\lib.exe" 
/NOLOGO /LTCG 
/OUT:c:\users\njayapra\github\edk2\Build\AppPkg\RELEASE_VS2019\X64\AppPkg\Applications\Python\Python-3.6.8\Python368\OUTPUT\Python.lib
 
@c:\users\njayapra\github\edk2\Build\AppPkg\RELEASE_VS2019\X64\AppPkg\Applications\Python\Python-3.6.8\Python368\OUTPUT\object_files.lst
"C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64\link.exe" 
/OUT:c:\users\njayapra\github\edk2\Build\AppPkg\RELEASE_VS2019\X64\AppPkg\Applications\Python\Python-3.6.8\Python368\DEBUG\Python.dll
 /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF 
/OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 
/LTCG /DLL /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER 
/SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data /WHOLEARCHIVE  
@c:\users\njayapra\github\edk2\Build\AppPkg\RELEASE_VS2019\X64\AppPkg\Applications\Python\Python-3.6.8\Python368\OUTPUT\static_library_files.lst
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol PciRead8
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol PciWrite8
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol PciRead16
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol 
PciWrite16
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol PciRead32
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol 
PciWrite32
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol IoRead8
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol IoWrite8
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol IoRead16
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol IoWrite16
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol IoRead32
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol IoWrite32
Python.lib(edk2module.obj) : error LNK2001: unresolved external symbol _swsmi
c:\users\njayapra\github\edk2\Build\AppPkg\RELEASE_VS2019\X64\AppPkg\Applications\Python\Python-3.6.8\Python368\DEBUG\Python.dll
 : fatal error LNK1120: 13 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64\link.exe"' : 
return code '0x460'
Stop.


Regards,
JP

-Original Message-
From: Kadapathri, Ajay  
Sent: Monday, March 27, 2023 1:35 PM
To: devel@edk2.groups.io
Cc: Rebecca Cran ; Kinney, Michael D 
; Jayaprakash, N 
Subject: [edk2-libc Patch 1/1] Python/Python3.6.8: migration of edk2module from 
chipsec repo

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

This patch merges the enhancements done by chipsec tool to edk2 module into 
edk2-libc repo.
The chipsec enhancements can be used for various other Python based tools to 
access platform registers.
These enhancements providing a set of APIs to access the platform registers 
directly from the python scripts running on UEFI shell. This will benefit the 
Python users on UEFI shell in general and enhances it's usability. Python can 
be used effectively to implement tools, scripts required for automation, debug 
from UEFI shell.

Cc: Rebecca Cran 
Cc: Michael D Kinney 
Cc: Jayaprakash N 
Signed-off-by: Ajay Kadapathri 
---
 .../Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm |  63 +++
 .../PyMod-3.6.8/Modules/cpu_gcc.s |  64 +++
 .../PyMod-3.6.8/Modules/cpu_ia32.nasm |  35 ++
 .../PyMod-3.6.8/Modules/cpu_ia32_gcc.s|  38 ++
 .../PyMod-3.6.8/Modules/edk2module.c  | 519 +-
 5 files changed, 717 insertions(+), 2 deletions(-)  create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32.nasm
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32_gcc.s

diff --git 
a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm 
b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
new file mode 100644
index 000..bd50015
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.na
+++ sm
@@ -0,0 +1,63 @@
+;--
+
+;
+; Copyright (c) 2011 - 2023, Intel Corporation. All rights 
+reserved. ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module 
+Name:
+;
+;   cpu.nasm
+;
+; Abstract:
+;
+;   swsmi function
+;
+; 

Re: [edk2-devel] [PATCH v2 15/17] MdePkg: Update MemoryAttributesTable to v2.10

2023-03-29 Thread Leif Lindholm
On Wed, Mar 29, 2023 at 18:47:50 +0200, Ard Biesheuvel wrote:
> On Mon, 27 Mar 2023 at 15:30, Leif Lindholm  wrote:
> >
> > On Mon, Mar 27, 2023 at 13:01:10 +0200, Ard Biesheuvel wrote:
> > > UEFI v2.10 introduces a new flag to the memory attributes table to
> > > inform the OS whether or not runtime services code regions were emitted
> > > by the compiler with guard instructions for forward edge control flow
> > > integrity enforcement.
> > >
> > > So update our definition accordingly.
> > >
> > > Link: 
> > > https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table
> > > Signed-off-by: Ard Biesheuvel 
> > > Reviewed-by: Michael D Kinney 
> > > Acked-by: Michael Kubacki 
> > > ---
> > >  MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h 
> > > b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > > index 82f83a67b96d38c5..238c14ff92dfed31 100644
> > > --- a/MdePkg/Include/Guid/MemoryAttributesTable.h
> > > +++ b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > > @@ -17,11 +17,15 @@ typedef struct {
> > >UINT32Version;
> > >UINT32NumberOfEntries;
> > >UINT32DescriptorSize;
> > > -  UINT32Reserved;
> > > +  UINT32Flags;
> >
> > Does this not cause a bisect breakage vs patch 17?
> >
> 
> Yeah, rebase error - this change should update the reference to
> Reserved as well in
> MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c, and patch 17/17
> should only change the value that gets assigned to it.

Ah, good.
With that fixed, for 15 and 17:
Reviewed-by: Leif Lindholm 

/
Leif


> 
> 
> 
> 


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




Re: [edk2-devel] [PATCH 1/1] Maintainers.txt: BaseTools Bob Feng -> reviewer, Rebecca Cran -> maintainer

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
> Sent: Wednesday, March 29, 2023 10:35 AM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming ; 
> Feng, Bob C 
> Subject: [edk2-devel] [PATCH 1/1] Maintainers.txt: BaseTools Bob Feng -> 
> reviewer, Rebecca Cran -> maintainer
> 
> Update Maintainers.txt for BaseTools: move Bob Feng from being a
> maintainer to reviewer, and add myself (Rebecca Cran) as a new
> maintainer.
> 
> Signed-off-by: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> ---
>  Maintainers.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index d4607af7..2f8671147a67 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -177,8 +177,9 @@ R: Julien Grall  [jgrall]
>  BaseTools
>  F: BaseTools/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> -M: Bob Feng  [BobCF]
> +M: Rebecca Cran  [bcran]
>  M: Liming Gao  [lgao4]
> +R: Bob Feng  [BobCF]
>  R: Yuwei Chen  [YuweiChen1110]
> 
>  CryptoPkg
> --
> 2.34.1
> 
> 
> 
> 
> 



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




[edk2-devel] [PATCH 1/1] Maintainers.txt: BaseTools Bob Feng -> reviewer, Rebecca Cran -> maintainer

2023-03-29 Thread Rebecca Cran
Update Maintainers.txt for BaseTools: move Bob Feng from being a
maintainer to reviewer, and add myself (Rebecca Cran) as a new
maintainer.

Signed-off-by: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
---
 Maintainers.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index d4607af7..2f8671147a67 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -177,8 +177,9 @@ R: Julien Grall  [jgrall]
 BaseTools
 F: BaseTools/
 W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
-M: Bob Feng  [BobCF]
+M: Rebecca Cran  [bcran]
 M: Liming Gao  [lgao4]
+R: Bob Feng  [BobCF]
 R: Yuwei Chen  [YuweiChen1110]
 
 CryptoPkg
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102131): https://edk2.groups.io/g/devel/message/102131
Mute This Topic: https://groups.io/mt/97933998/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 15/17] MdePkg: Update MemoryAttributesTable to v2.10

2023-03-29 Thread Ard Biesheuvel
On Mon, 27 Mar 2023 at 15:30, Leif Lindholm  wrote:
>
> On Mon, Mar 27, 2023 at 13:01:10 +0200, Ard Biesheuvel wrote:
> > UEFI v2.10 introduces a new flag to the memory attributes table to
> > inform the OS whether or not runtime services code regions were emitted
> > by the compiler with guard instructions for forward edge control flow
> > integrity enforcement.
> >
> > So update our definition accordingly.
> >
> > Link: 
> > https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table
> > Signed-off-by: Ard Biesheuvel 
> > Reviewed-by: Michael D Kinney 
> > Acked-by: Michael Kubacki 
> > ---
> >  MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h 
> > b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > index 82f83a67b96d38c5..238c14ff92dfed31 100644
> > --- a/MdePkg/Include/Guid/MemoryAttributesTable.h
> > +++ b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > @@ -17,11 +17,15 @@ typedef struct {
> >UINT32Version;
> >UINT32NumberOfEntries;
> >UINT32DescriptorSize;
> > -  UINT32Reserved;
> > +  UINT32Flags;
>
> Does this not cause a bisect breakage vs patch 17?
>

Yeah, rebase error - this change should update the reference to
Reserved as well in
MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c, and patch 17/17
should only change the value that gets assigned to it.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102130): https://edk2.groups.io/g/devel/message/102130
Mute This Topic: https://groups.io/mt/97879302/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 00/17] Enable BTI support in memory attributes table

2023-03-29 Thread Leif Lindholm
On Mon, Mar 27, 2023 at 13:00:55 +0200, Ard Biesheuvel wrote:
> Implement version 2 of the memory attributes table, which now contains a
> flag informing the OS whether or not code regions may be mapped with CFI
> mitigations such as IBT or BTI enabled.
> 
> This series covers roughly the following parts:
> 
> - (AARCH64) Annotate ELF objects generated from asm as BTI compatible
>   when BTI codegen is enabled
> - Update the BaseTools to emit the appropriate PE/COFF annotation when a
>   BTI/IBT compatible ELF executable is converted to PE/COFF
> - Take this PE/COFF annotation into account when populating the memory
>   attributes table in the DXE core

For any patches I haven't explicitly commented on in this set:
Reviewed-by: Leif Lindholm 

(but I did comment on patch 17 in the review of patch 15)

/
Leif

> TODO:
> - X64 changes to make the code IBT compatible and emit the ELF note
> - Figure out how to generate such executables with native PE toolchains
> - Implement BTI/IBT enforcement at boot time - this is something I
>   intend to look into next.
> 
> Can be tested with the CLANG38 toolchain (both Clang compiler and LLD
> linker, version 3.8 or newer) with the following build options.
> 
> [BuildOptions]
>   GCC:*_*_AARCH64_PP_FLAGS = -mbranch-protection=bti
>   GCC:*_*_AARCH64_CC_FLAGS = -mbranch-protection=bti
>   GCC:*_*_AARCH64_DLINK_FLAGS = -fuse-ld=lld 
> -Wl,--no-relax,--no-pie,-z,bti-report=error
> 
> Cc: Michael Kinney 
> Cc: Liming Gao 
> Cc: Jiewen Yao 
> Cc: Michael Kubacki 
> Cc: Sean Brogan 
> Cc: Rebecca Cran 
> Cc: Leif Lindholm 
> Cc: Sami Mujawar 
> Cc: Taylor Beebe 
> Cc: Marvin H??user 
> Cc: Bob Feng 
> 
> Ard Biesheuvel (17):
>   MdePkg/ProcessorBind AARCH64: Add asm macro to emit GNU BTI note
>   MdePkg/BaseCpuLib AARCH64: Make asm files BTI compatible
>   MdePkg/BaseIoLibIntrinsic AARCH64: Make asm files BTI compatible
>   MdePkg/BaseLib AARCH64: Make LongJump() BTI compatible
>   MdePkg/BaseLib AARCH64: Make asm files BTI compatible
>   MdePkg/BaseMemoryLibOptDxe AARCH64: Make asm files BTI compatible
>   MdePkg/BaseSynchronizationLib AARCH64: Make asm files BTI compatible
>   MdePkg/BaseRngLib AARCH64: Make asm files BTI compatible
>   ArmPkg: Emit BTI opcodes when BTI codegen is enabled
>   ArmPkg/GccLto AARCH64: Add BTI note to LTO helper library
>   ArmPkg, BaseTools AARCH64: Add BTI ELF note to .hii objects
>   ArmPlatformPkg/PrePeiCore: Make vector table object BTI compatible
>   BaseTools/GenFw: Parse IBT/BTI support status from ELF note
>   BaseTools/GenFw: Add DllCharacteristicsEx field to debug data
>   MdePkg: Update MemoryAttributesTable to v2.10
>   MdePkg/PeCoffLib: Capture DLL characteristics fieldis in image context
>   MdeModulePkg: Enable forward edge CFI in mem attributes table
> 
>  ArmPkg/Include/AsmMacroIoLibV8.h|   3 +-
>  ArmPkg/Library/ArmExceptionLib/AArch64/ExceptionSupport.S   |   3 +-
>  ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S   |   4 +-
>  ArmPkg/Library/GccLto/liblto-aarch64.a  | Bin 1016 
> -> 1128 bytes
>  ArmPkg/Library/GnuNoteBti.bin   | Bin 0 -> 
> 32 bytes
>  ArmPlatformPkg/PrePeiCore/AArch64/Exception.S   |   2 +
>  ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S   |   2 +
>  BaseTools/Conf/tools_def.template   |   4 +-
>  BaseTools/Source/C/GenFw/Elf64Convert.c | 104 
> +---
>  BaseTools/Source/C/GenFw/GenFw.c|   3 +-
>  BaseTools/Source/C/GenFw/elf_common.h   |   9 ++
>  BaseTools/Source/C/Include/IndustryStandard/PeImage.h   |  13 ++-
>  MdeModulePkg/Core/Dxe/DxeMain.h |   2 +
>  MdeModulePkg/Core/Dxe/Image/Image.c |  10 ++
>  MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c  |   8 +-
>  MdePkg/Include/AArch64/ProcessorBind.h  |  31 ++
>  MdePkg/Include/Guid/MemoryAttributesTable.h |   8 +-
>  MdePkg/Include/IndustryStandard/PeImage.h   |  13 ++-
>  MdePkg/Include/Library/PeCoffLib.h  |   6 ++
>  MdePkg/Library/BaseCpuLib/AArch64/CpuFlushTlb.S |   1 +
>  MdePkg/Library/BaseCpuLib/AArch64/CpuSleep.S|   1 +
>  MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S |   8 ++
>  MdePkg/Library/BaseLib/AArch64/CpuBreakpoint.S  |   1 +
>  MdePkg/Library/BaseLib/AArch64/DisableInterrupts.S  |   1 +
>  MdePkg/Library/BaseLib/AArch64/EnableInterrupts.S   |   1 +
>  MdePkg/Library/BaseLib/AArch64/GetInterruptsState.S |   1 +
>  MdePkg/Library/BaseLib/AArch64/MemoryFence.S|   1 +
>  MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S|   5 +-
>  

Re: [edk2-devel] [edk2-platforms][PATCH v2 0/9] Support Ampere Altra Max processor

2023-03-29 Thread Nhi Pham via groups.io

Thanks a lot Leif for the quick review and merging.

Best regards,

Nhi

On 3/29/2023 11:07 PM, Leif Lindholm wrote:

Hi Nhi,

Thanks - this was a lot easier to review.
For the series:
Reviewed-by: Leif Lindholm 
Pushed as 4811c37ae347..d8d167f11ac5.

/
 Leif

On Wed, Mar 29, 2023 at 11:32:37 +0700, Nhi Pham wrote:

This patchset adds support for Ampere Altra Max processor and updates for some
bugfixes.

Changes since v1:
   + Improved readability per Leif's feedback, such as: Add helper functions.
   split out the supports, bugfixes, and code refactor.

Tinh Nguyen (1):
   JadePkg: ACPI: Support ACPI tables for Ampere Altra Max

Vu Nguyen (8):
   AmpereAltraPkg: Correct PCIe Devmap
   AmpereAltraPkg: Correct PCIe memory attribute
   JadePkg: PCIe: Add delay after releasing PERST
   AmpereAltraPkg: Update Ampere specific platform PCIe core
   AmpereAltraPkg: Update Ampere Core/Cluster profile
   Ampere: PCIe: Add PHY preset NVParams for Ampere Altra Max
   Ampere: PCIe: Add support for Ampere Altra Max
   AmpereAltraPkg: Support get SubNUMA node region for Ampere silicons

  .../AmpereAltraPkg/AmpereAltraPkg.dsc.inc |6 +-
  Platform/Ampere/JadePkg/Jade.dsc  |3 +-
  Platform/Ampere/JadePkg/Jade.fdf  |3 +-
  .../JadePkg/Ac02AcpiTables/Ac02AcpiTables.inf |   20 +
  .../Include/Library/AmpereCpuLib.h|   31 +-
  .../AmpereAltraPkg/Include/NVParamDef.h   |   36 +-
  .../AmpereAltraPkg/Include/Platform/Ac01.h|7 +-
  .../Library/Ac01PcieLib/PcieCore.h|8 +-
  .../Drivers/AcpiPlatformDxe/AcpiMadt.c|  105 +-
  .../Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c |   10 +-
  .../Library/BoardPcieLib/BoardPcieLib.c   |   83 +-
  .../Drivers/PcieInitPei/PcieInitPei.c |  133 +-
  .../Drivers/PcieInitPei/RootComplexNVParam.c  |  344 +-
  .../Library/Ac01PcieLib/PcieCore.c|  150 +-
  .../Library/AmpereCpuLib/AmpereCpuLibCommon.c |  243 +-
  .../Ampere/JadePkg/Ac02AcpiTables/CPU-S0.asi  | 6345 +
  .../Ampere/JadePkg/Ac02AcpiTables/CPU-S1.asi  | 6345 +
  .../Ampere/JadePkg/Ac02AcpiTables/CPU.asi |  152 +
  .../JadePkg/Ac02AcpiTables/CommonDevices.asi  |  513 ++
  .../Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl|   26 +
  .../JadePkg/Ac02AcpiTables/PCI-PDRC.asi   |  217 +
  .../JadePkg/Ac02AcpiTables/PCI-S0.Rca01.asi   |  669 ++
  .../Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi  | 2041 ++
  .../Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi  | 2051 ++
  .../Ampere/JadePkg/Ac02AcpiTables/PMU-S0.asi  | 1292 
  .../Ampere/JadePkg/Ac02AcpiTables/PMU-S1.asi  | 1292 
  .../Ampere/JadePkg/Ac02AcpiTables/PMU.asi |   10 +
  27 files changed, 21731 insertions(+), 404 deletions(-)
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/Ac02AcpiTables.inf
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CPU-S0.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CPU-S1.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CPU.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-PDRC.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.Rca01.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PMU-S0.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PMU-S1.asi
  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PMU.asi

--
2.25.1




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




Re: [edk2-devel] [edk2-libc Patch 1/1] Python/Python3.6.8: migration of edk2module from chipsec repo

2023-03-29 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 


> -Original Message-
> From: Kadapathri, Ajay 
> Sent: Monday, March 27, 2023 1:05 AM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Kinney, Michael D 
> ; Jayaprakash, N
> 
> Subject: [edk2-libc Patch 1/1] Python/Python3.6.8: migration of edk2module 
> from chipsec repo
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4161
> 
> This patch merges the enhancements done by chipsec
> tool to edk2 module into edk2-libc repo.
> The chipsec enhancements can be used for various
> other Python based tools to access platform registers.
> These enhancements providing a set of APIs to access
> the platform registers directly from the python
> scripts running on UEFI shell. This will benefit the
> Python users on UEFI shell in general and enhances
> it's usability. Python can be used effectively to
> implement tools, scripts required for automation,
> debug from UEFI shell.
> 
> Cc: Rebecca Cran 
> Cc: Michael D Kinney 
> Cc: Jayaprakash N 
> Signed-off-by: Ajay Kadapathri 
> ---
>  .../Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm |  63 +++
>  .../PyMod-3.6.8/Modules/cpu_gcc.s |  64 +++
>  .../PyMod-3.6.8/Modules/cpu_ia32.nasm |  35 ++
>  .../PyMod-3.6.8/Modules/cpu_ia32_gcc.s|  38 ++
>  .../PyMod-3.6.8/Modules/edk2module.c  | 519 +-
>  5 files changed, 717 insertions(+), 2 deletions(-)
>  create mode 100644 
> AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
>  create mode 100644 
> AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
>  create mode 100644 
> AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32.nasm
>  create mode 100644 
> AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32_gcc.s
> 
> diff --git 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm 
> b/AppPkg/Applications/Python/Python-
> 3.6.8/PyMod-3.6.8/Modules/cpu.nasm
> new file mode 100644
> index 000..bd50015
> --- /dev/null
> +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
> @@ -0,0 +1,63 @@
> +;--
> +;
> +; Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +; Module Name:
> +;
> +;   cpu.nasm
> +;
> +; Abstract:
> +;
> +;   swsmi function
> +;
> +; Notes:
> +;
> +;--
> +
> +DEFAULT REL
> +SECTION .text
> +
> +;--
> +;  void
> +;  _swsmi (
> +;unsigned intsmi_code_data   // rcx
> +;IN   UINT64 rax_value   // rdx
> +;IN   UINT64 rbx_value   // r8
> +;IN   UINT64 rcx_value   // r9
> +;IN   UINT64 rdx_value   // rsp + 0x28
> +;IN   UINT64 rsi_value   // rsp + 0x30
> +;IN   UINT64 rdi_value   // rsp + 0x38
> +;)
> +;--
> +global ASM_PFX(_swsmi)
> +ASM_PFX(_swsmi):
> +push rbx
> +push rsi
> +push rdi
> +
> +; rsp - 0x18
> +
> +; setting up GPR (arguments) to SMI handler call
> +; notes:
> +;   RAX will get partially overwritten (AX) by _smi_code_data (which is 
> passed in RCX)
> +;   RDX will get partially overwritten (DX) by the value of APMC port (= 
> 0x00B2)
> +mov rax, rdx ; rax_value
> +mov ax, cx   ; smi_code_data
> +mov rdx, r10 ; rdx_value
> +mov rdx, [rsp + 040h] ; rsp + 0x28 + 0x18
> +
> +mov rbx, r8  ; rbx_value
> +mov rcx, r9  ; rcx_value
> +mov rsi, [rsp + 048h] ; rsi_value
> +mov rdi, [rsp + 050h] ; rdi_value
> +
> +; this OUT instruction will write WORD value (smi_code_data) to ports 
> 0xB2 and 0xB3 (SW SMI control and data ports)
> +out 0B2h, ax
> +
> +; @TODO: some SM handlers return data/errorcode in GPRs, need to return 
> this to the caller
> +
> +pop rdi
> +pop rsi
> +pop rbx
> +ret
> \ No newline at end of file
> diff --git 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s 
> b/AppPkg/Applications/Python/Python-
> 3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
> new file mode 100644
> index 000..5441691
> --- /dev/null
> +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
> @@ -0,0 +1,64 @@
> +#--
> +#
> +# Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +# Module Name:
> +#
> +#   cpu_gcc.s
> +#
> +# Abstract:
> +#
> +#   swsmi function
> +#
> +# Notes:
> +#
> +#--
> +
> +.global _swsmi
> +
> +.intel_syntax noprefix
> +.text
> +
> 

Re: [edk2-devel] [edk2-platforms][PATCH v2 0/9] Support Ampere Altra Max processor

2023-03-29 Thread Leif Lindholm
Hi Nhi,

Thanks - this was a lot easier to review.
For the series:
Reviewed-by: Leif Lindholm 
Pushed as 4811c37ae347..d8d167f11ac5.

/
Leif

On Wed, Mar 29, 2023 at 11:32:37 +0700, Nhi Pham wrote:
> This patchset adds support for Ampere Altra Max processor and updates for some
> bugfixes.
> 
> Changes since v1:
>   + Improved readability per Leif's feedback, such as: Add helper functions.
>   split out the supports, bugfixes, and code refactor.
> 
> Tinh Nguyen (1):
>   JadePkg: ACPI: Support ACPI tables for Ampere Altra Max
> 
> Vu Nguyen (8):
>   AmpereAltraPkg: Correct PCIe Devmap
>   AmpereAltraPkg: Correct PCIe memory attribute
>   JadePkg: PCIe: Add delay after releasing PERST
>   AmpereAltraPkg: Update Ampere specific platform PCIe core
>   AmpereAltraPkg: Update Ampere Core/Cluster profile
>   Ampere: PCIe: Add PHY preset NVParams for Ampere Altra Max
>   Ampere: PCIe: Add support for Ampere Altra Max
>   AmpereAltraPkg: Support get SubNUMA node region for Ampere silicons
> 
>  .../AmpereAltraPkg/AmpereAltraPkg.dsc.inc |6 +-
>  Platform/Ampere/JadePkg/Jade.dsc  |3 +-
>  Platform/Ampere/JadePkg/Jade.fdf  |3 +-
>  .../JadePkg/Ac02AcpiTables/Ac02AcpiTables.inf |   20 +
>  .../Include/Library/AmpereCpuLib.h|   31 +-
>  .../AmpereAltraPkg/Include/NVParamDef.h   |   36 +-
>  .../AmpereAltraPkg/Include/Platform/Ac01.h|7 +-
>  .../Library/Ac01PcieLib/PcieCore.h|8 +-
>  .../Drivers/AcpiPlatformDxe/AcpiMadt.c|  105 +-
>  .../Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c |   10 +-
>  .../Library/BoardPcieLib/BoardPcieLib.c   |   83 +-
>  .../Drivers/PcieInitPei/PcieInitPei.c |  133 +-
>  .../Drivers/PcieInitPei/RootComplexNVParam.c  |  344 +-
>  .../Library/Ac01PcieLib/PcieCore.c|  150 +-
>  .../Library/AmpereCpuLib/AmpereCpuLibCommon.c |  243 +-
>  .../Ampere/JadePkg/Ac02AcpiTables/CPU-S0.asi  | 6345 +
>  .../Ampere/JadePkg/Ac02AcpiTables/CPU-S1.asi  | 6345 +
>  .../Ampere/JadePkg/Ac02AcpiTables/CPU.asi |  152 +
>  .../JadePkg/Ac02AcpiTables/CommonDevices.asi  |  513 ++
>  .../Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl|   26 +
>  .../JadePkg/Ac02AcpiTables/PCI-PDRC.asi   |  217 +
>  .../JadePkg/Ac02AcpiTables/PCI-S0.Rca01.asi   |  669 ++
>  .../Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi  | 2041 ++
>  .../Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi  | 2051 ++
>  .../Ampere/JadePkg/Ac02AcpiTables/PMU-S0.asi  | 1292 
>  .../Ampere/JadePkg/Ac02AcpiTables/PMU-S1.asi  | 1292 
>  .../Ampere/JadePkg/Ac02AcpiTables/PMU.asi |   10 +
>  27 files changed, 21731 insertions(+), 404 deletions(-)
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/Ac02AcpiTables.inf
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CPU-S0.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CPU-S1.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CPU.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/CommonDevices.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/Dsdt.asl
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-PDRC.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.Rca01.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S0.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PCI-S1.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PMU-S0.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PMU-S1.asi
>  create mode 100644 Platform/Ampere/JadePkg/Ac02AcpiTables/PMU.asi
> 
> --
> 2.25.1
> 


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




Re: [edk2-devel] [PATCH 1/1] OvmfPkg/CI: Boot OVMF in SMP mode.

2023-03-29 Thread Ard Biesheuvel
On Mon, 27 Mar 2023 at 17:02, Gerd Hoffmann  wrote:
>
> Increase the chance that CI finds bugs in MP changes.
>
> Signed-off-by: Gerd Hoffmann 

Merged as #4205

Thanks

> ---
>  OvmfPkg/PlatformCI/PlatformBuildLib.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/PlatformCI/PlatformBuildLib.py 
> b/OvmfPkg/PlatformCI/PlatformBuildLib.py
> index 58dc1189a2cc..1ff85fdc24bb 100644
> --- a/OvmfPkg/PlatformCI/PlatformBuildLib.py
> +++ b/OvmfPkg/PlatformCI/PlatformBuildLib.py
> @@ -196,6 +196,7 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManager):
>  args  = "-debugcon stdio"   
> # write messages to stdio
>  args += " -global isa-debugcon.iobase=0x402"
> # debug messages out thru virtual io port
>  args += " -net none"
> # turn off network
> +args += " -smp 4"
>  args += f" -drive file=fat:rw:{VirtualDrive},format=raw,media=disk" 
> # Mount disk with startup.nsh
>
>  if (self.env.GetValue("QEMU_HEADLESS").upper() == "TRUE"):
> @@ -204,7 +205,6 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManager):
>  if (self.env.GetBuildValue("SMM_REQUIRE") == "1"):
>  args += " -machine q35,smm=on" #,accel=(tcg|kvm)"
>  #args += " -m ..."
> -#args += " -smp ..."
>  args += " -global driver=cfi.pflash01,property=secure,value=on"
>  args += " -drive if=pflash,format=raw,unit=0,file=" + 
> os.path.join(OutputPath_FV, "OVMF_CODE.fd") + ",readonly=on"
>  args += " -drive if=pflash,format=raw,unit=1,file=" + 
> os.path.join(OutputPath_FV, "OVMF_VARS.fd")
> --
> 2.39.2
>


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




[edk2-devel] [PATCH v2] IntelFsp2Pkg: LoadMicrocodeDefault() causing unnecessary delay.

2023-03-29 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4391

FSP should support the scenario that CPU microcode already loaded
before calling LoadMicrocodeDefault(), in this case it should return
directly without spending more time.
Also the LoadMicrocodeDefault() should only attempt to load one version
of the microcode for current CPU and return.

Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Ray Ni 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm | 18 ++
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm  | 16 
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm 
b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
index 2cff8b3643..b902d017ee 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm
@@ -245,6 +245,19 @@ ASM_PFX(LoadMicrocodeDefault):
cmpesp, 0
jz ParamError
 
+   ;
+   ; If microcode already loaded before this function, exit this function with 
SUCCESS.
+   ;
+   mov   eax, 1
+   cpuid
+   mov   ecx, MSR_IA32_BIOS_SIGN_ID
+   rdmsr ; Get current microcode signature
+   xor   eax, eax
+   test  edx, edx
+   jnz   Exit2
+
+
+
; skip loading Microcode if the MicrocodeCodeSize is zero
; and report error if size is less than 2k
; first check UPD header revision
@@ -450,7 +463,7 @@ LoadCheck:
 
; Verify this microcode update is not already loaded
cmp   dword [esi + MicrocodeHdr.MicrocodeHdrRevision], edx
-   jeContinue
+   jeDone ; if already one version microcode loaded, go to done
 
 LoadMicrocode:
; EAX contains the linear address of the start of the Update Data
@@ -465,9 +478,6 @@ LoadMicrocode:
mov   eax, 1
cpuid
 
-Continue:
-   jmp   NextMicrocode
-
 Done:
mov   eax, 1
cpuid
diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm 
b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
index b32fa32a89..2a23c33c9b 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm
@@ -141,6 +141,17 @@ ASM_PFX(LoadMicrocodeDefault):
jz ParamError
movrsp, rcx
 
+   ;
+   ; If microcode already loaded before this function, exit this function with 
SUCCESS.
+   ;
+   mov   eax, 1
+   cpuid
+   mov   ecx, MSR_IA32_BIOS_SIGN_ID
+   rdmsr ; Get current microcode signature
+   xor   rax, rax
+   test  edx, edx
+   jnz   Exit2
+
; skip loading Microcode if the MicrocodeCodeSize is zero
; and report error if size is less than 2k
; first check UPD header revision
@@ -291,7 +302,7 @@ LoadCheck:
 
; Verify this microcode update is not already loaded
cmp   dword [esi + MicrocodeHdr.MicrocodeHdrRevision], edx
-   jeContinue
+   jeDone ; if already one version microcode loaded, go to done
 
 LoadMicrocode:
; EAX contains the linear address of the start of the Update Data
@@ -306,9 +317,6 @@ LoadMicrocode:
mov   eax, 1
cpuid
 
-Continue:
-   jmp   NextMicrocode
-
 Done:
mov   eax, 1
cpuid
-- 
2.35.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102124): https://edk2.groups.io/g/devel/message/102124
Mute This Topic: https://groups.io/mt/97931383/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] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI implementation

2023-03-29 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Wednesday, March 29, 2023 1:33 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v4] RedfishPkg/RedfishPlatformCredentialIpmiLib: 
IPMI implementation


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

This library follows Redfish Host Interface specification and use IPMI
command to get bootstrap account credential(NetFn 2Ch, Command 02h)
from BMC. RedfishHostInterfaceDxe will use this credential for the
following communication between BIOS and BMC.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/RedfishPkg.dec |   7 +
 RedfishPkg/RedfishLibs.dsc.inc|   1 +
 RedfishPkg/RedfishPkg.dsc |   2 +
 .../RedfishPlatformCredentialIpmiLib.inf  |  42 ++
 .../RedfishPlatformCredentialIpmiLib.h|  89 
 .../RedfishPlatformCredentialIpmiLib.c| 458 ++
 6 files changed, 599 insertions(+)
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.h
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.c

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index 42d28d6dac..f171053aec 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -81,6 +81,9 @@
 [Guids]
   gEfiRedfishPkgTokenSpaceGuid  = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88, 
0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}

+  # Redfish variable guid
+  gEfiRedfishVariableGuid   = { 0x85ef8dd3, 0xe606, 0x4b89, { 0x8b, 
0xbd, 0x93, 0xbf, 0x5c, 0xbe, 0x1c, 0x18 } }
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   # This PCD is the UEFI device path which is used as the Redfish host 
interface.
@@ -123,3 +126,7 @@
   # specification for that.
   #
   
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid|L"----"|VOID*|0x1006
+  #
+  # This PCD indicates that if BMC bootstrap credential service will be 
disabled by BIOS or not.
+  #
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1007
diff --git a/RedfishPkg/RedfishLibs.dsc.inc b/RedfishPkg/RedfishLibs.dsc.inc
index 84f52d4b27..110526738c 100644
--- a/RedfishPkg/RedfishLibs.dsc.inc
+++ b/RedfishPkg/RedfishLibs.dsc.inc
@@ -19,5 +19,6 @@
   JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf
   RedfishLib|RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.inf
   RedfishDebugLib|RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
+  
RedfishPlatformCredentialLib|RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 !endif

diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 223ab72c1d..5503e65de4 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -4,6 +4,7 @@
 # Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
 # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
 # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -59,6 +60,7 @@
   
RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLibNull.inf
   
RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
   RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
+  
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
   
RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
   RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf
   RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
new file mode 100644
index 00..5c20ea22f8
--- /dev/null
+++ 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
@@ -0,0 +1,42 @@
+## @file
+#  INF file for RedfishPlatformCredentialIpmiLib.
+#
+#  Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001000b
+  BASE_NAME  = RedfishPlatformCredentialIpmiLib
+  FILE_GUID  = 9C45D622-4C66-417F-814C-F76246D97233
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = 

Re: [edk2-devel] [PATCH 2/2] UefiCpuPkg: After reset, wake up APs by SIPI.

2023-03-29 Thread Gerd Hoffmann
On Wed, Mar 29, 2023 at 08:50:24AM +, Xie, Yuanhao wrote:
> Hi Gerd,
> 
> Could you please provide me more information, like where does it hang, ad 
> what build and boot options you use

qemu-system-x86_64 -display none -accel kvm -smp 2 -M q35 \
-bios Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd \
-chardev stdio,id=fw -device isa-debugcon,iobase=0x402,chardev=fw

Last log lines are ...

AP Loop Mode is 1
AP Vector: non-16-bit = 7EA7000/447
WakeupBufferStart = 9F000, WakeupBufferSize = 1000
AP Vector: 16-bit = 9F000/39, ExchangeInfo = 9F039/A4
CpuMpPei: 5-Level Paging = 0

... and here it hangs.

> -p OvmfPkg/OvmfPkgIa32.dsc \

Using OvmfPkgX64.dsc here.  Tried using Ia32 instead, hangs too,
at the same place.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102122): https://edk2.groups.io/g/devel/message/102122
Mute This Topic: https://groups.io/mt/97874904/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 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Ard Biesheuvel
On Tue, 28 Mar 2023 at 19:31, Rebecca Cran  wrote:
>
> Update the toolchain definitions:
>
> - Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
>   CLANGDWARF, updating it to support ARM and AARCH64 in addition to X64
> and IA32.
>
> - Remove GCC48 and GCC49.
>
> - Remove VS2008, VS2010, VS2012 and VS2013.
>
> - Remove EBC compiler definitions. Full removal of EBC support from the
>   various packages etc. will be done in a follow-up patch series.
>
> - Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS definitions.
>
> - Remove unused CYGWIN_ definitions.
>
> - Rename GCC5 to GCC.
>
> Personal GitHub PR: https://github.com/tianocore/edk2/pull/4158
> GitHub branch: https://github.com/bcran/edk2/tree/clangdwarf
>
> Note: CI will fail due to changes that are needed in the edk2-basetools
> and containers repositories.
>
> Changes from v1 to v2:
>
> - Added a commit to delete GCC48 and GCC49, rename GCC5 to GCC and
>   update the flags for other toolchains to work with the new GCC
>   definitions.
>
> - Bumped VERSION from 2.00 to 3.00 to inform users that they should
>   updated their Conf/tools_def.txt.
>
> Rebecca Cran (13):
>   OvmfPkg: Replace static struct initialization with ZeroMem call
>   CryptoPkg: Add CLANGDWARF and remove CLANG35 and CLANG38 compiler
> flags
>   BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38
>   BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
>   BaseTools: Remove VS2008-VS2013 remnants
>   MdePkg: Remove VS2008-VS2013 remnants
>   edksetup.bat: Remove VS2008-VS2013 remnants
>   BaseTools: Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS defs
>   BaseTools: Remove EBC (EFI Byte Code) compiler definitions
>   OvmfPkg: Use Xcode5 version of CpuExceptionHandlerLib for CLANGDWARF
>   Delete GCC48 and GCC49 toolchains and rename GCC5 to GCC
>   BaseTools: Remove unused CYGWIN_ defines from tools_def.txt.template
>   Bump tools_def.txt VERSION to 3.0
>

I've cherry-picked the two OvmfPkg/ patches from this series, so no
need to resend those.


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




[edk2-devel] [PATCH] UefiPayloadPkg: Support more input parameter

2023-03-29 Thread linusx . wu
From: Linus Wu 

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

Add additional input parameter support
--SpecRevision: user input spec version
--Revision: user input revision
--ProducerId: producer company name
1. UniversalPayloadBuild.py 2. Downgrade spec revision from 0.9 to 0.7
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 45 -
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..7cd04fdceb 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -31,11 +31,48 @@ class UPLD_INFO_HEADER(LittleEndianStructure):
 def __init__(self):
 self.Identifier =  b'PLDH'
 self.HeaderLength   = sizeof(UPLD_INFO_HEADER)
-self.SpecRevision   = 0x0009
+self.SpecRevision   = 0x0070
 self.Revision   = 0x010105
 self.ImageId= b'UEFI'
 self.ProducerId = b'INTEL'
 
+def GenSpecRevision (Argument):
+try:
+(MajorStr, MinorStr) = Argument.split('.')
+except:
+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))
+#
+# Spec Revision Bits 15 : 8 - Major Version. Bits 7 : 0 - Minor Version.
+#
+if len(MinorStr) > 0 and len(MinorStr) < 3:
+try:
+Minor = int(MinorStr, 16) if len(MinorStr) == 2 else 
(int(MinorStr, 16) << 4)
+except:
+raise argparse.ArgumentTypeError ('{} Minor version of 
SpecRevision is not a valid integer value.'.format (Argument))
+else:
+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))
+
+if len(MajorStr) > 0 and len(MajorStr) < 3:
+try:
+Major = int(MajorStr, 16)
+except:
+raise argparse.ArgumentTypeError ('{} Major version of 
SpecRevision is not a valid integer value.'.format (Argument))
+else:
+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))
+
+return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0)
+
+def Validate32BitInteger (Argument):
+try:
+Value = int (Argument, 0)
+except:
+raise argparse.ArgumentTypeError ('{} is not a valid integer 
value.'.format (Argument))
+if Value < 0:
+raise argparse.ArgumentTypeError ('{} is a negative value.'.format 
(Argument))
+if Value > 0x:
+raise argparse.ArgumentTypeError ('{} is larger than 32-bits.'.format 
(Argument))
+return Value
+
 def RunCommand(cmd):
 print(cmd)
 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT,cwd=os.environ['WORKSPACE'])
@@ -111,6 +148,9 @@ def BuildUniversalPayload(Args, MacroList):
 # Buid Universal Payload Information Section ".upld_info"
 #
 upld_info_hdr = UPLD_INFO_HEADER()
+upld_info_hdr.SpecRevision = Args.SpecRevision
+upld_info_hdr.Revision = Args.Revision
+upld_info_hdr.ProducerId = Args.ProducerId.encode()[:16]
 upld_info_hdr.ImageId = Args.ImageId.encode()[:16]
 upld_info_hdr.Attribute |= 1 if BuildTarget == "DEBUG" else 0
 fp = open(UpldInfoFile, 'wb')
@@ -156,6 +196,9 @@ def main():
 parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID 
(16 bytes maximal).', default ='UEFI')
 parser.add_argument('-q', '--Quiet', action='store_true', help='Disable 
all build messages except FATAL ERRORS.')
 parser.add_argument("-p", "--pcd", action="append")
+parser.add_argument("-s", "--SpecRevision", type=GenSpecRevision, 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).')
 MacroList = {}
 args = parser.parse_args()
 if args.Macro is not None:
-- 
2.39.1.windows.1



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




[edk2-devel] Question of Compiling Error

2023-03-29 Thread Lai . Uzen 褚祐正 IEC1
Hi EDK2 Devel team,

Here got the compiling error, provided the call stack for tracing. Thank you!

  1.  EDK2 (https://github.com/tianocore/edk2.git):
a107ad0f623669c72997443dc0431eeb732f81a0
  2.  Edk2Platforms (https://github.com/tianocore/edk2-platforms.git):
8e927b0f42e7875c853437a466ed34f83c3f1b10
Compiling Environment:
Visual Studio 2015
Python 3.9.5

(Python 3.9.5 on win32) Traceback (most recent call last):
  File "C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\build\build.py", 
line 2695, in Main
MyBuild.Launch()
  File "C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\build\build.py", 
line 2490, in Launch
self._MultiThreadBuildPlatform()
  File "C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\build\build.py", 
line 2282, in _MultiThreadBuildPlatform
Wa, self.BuildModules = self.PerformAutoGen(BuildTarget,ToolChain)
  File "C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\build\build.py", 
line 2133, in PerformAutoGen
Wa = WorkspaceAutoGen(
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\AutoGen\WorkspaceAutoGen.py",
 line 43, in __init__
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, 
**kwargs)
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\AutoGen\WorkspaceAutoGen.py",
 line 116, in _InitWorker
self.ProcessModuleFromPdf()
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\AutoGen\WorkspaceAutoGen.py",
 line 212, in ProcessModuleFromPdf
if self.FdfProfile:
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\Common\caching.py", line 
28, in __get__
Value = obj.__dict__[self._function.__name__] = self._function(obj)
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\AutoGen\WorkspaceAutoGen.py",
 line 188, in FdfProfile
Fdf.ParseFile()
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\GenFds\FdfParser.py", 
line 1320, in ParseFile
while self._GetFd() or self._GetFv() or self._GetFmp() or 
self._GetCapsule() or self._GetRule() or self._GetOptionRom():
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\GenFds\FdfParser.py", 
line 2116, in _GetFv
isFile = self._GetFileStatement(FvObj)
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\GenFds\FdfParser.py", 
line 2564, in _GetFileStatement
self._GetFilePart(FfsFileObj)
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\GenFds\FdfParser.py", 
line 2651, in _GetFilePart
self._GetRAWData(FfsFileObj)
  File 
"C:\IEC\Git\MTL\RVP_Build\Edk2\BaseTools\Source\Python\GenFds\FdfParser.py", 
line 2686, in _GetRAWData
raise Warning.Expected("Filename value", self.FileName, 
self.CurrentLineNumber)
GenFds.FdfParser.Warning: expected Filename value near line 88, column 0:   }

Sincerely,
Uzen Lai



Confidentiality Note
本郵件含有英業達股?有限公司機密資訊、或受法律保護之資料,唯有原發信人指定之收信人得?讀或使用本郵件之?容。如?並非被指定之收信人,請立即將本郵件及所有附件予以刪除;請勿?露、儲存或使用本郵件之任何資訊,並請?立即告知原發信人本郵件的傳遞錯誤。謝謝?的合作。
This e-mail transmission and any attachments contain information from Inventec 
Corporation. The information is confidential and/or privileged and intended to 
be solely for the use of the individuals or entities named in this e-mail 
transmission. If you are not the intended recipient, be aware that any 
disclosure, saving or use of the content of this e-mail transmission and 
attachments is strictly prohibited. If you have received this email 
transmission in error, please notify us immediately, and delete the e-mail and 
attachments. We greatly appreciate your cooperation.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102119): https://edk2.groups.io/g/devel/message/102119
Mute This Topic: https://groups.io/mt/97926801/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] Bug fixes for DynamicTablesPkg and ArmVirtPkg/kvmtool

2023-03-29 Thread Ard Biesheuvel
On Wed, 29 Mar 2023 at 12:49, Sami Mujawar  wrote:
>
> Hi Ard,
>
> I am occassionally seeing the following error when trying to run the
> Kvmtool guest firmware.
>
>   add-symbol-file
> w:\workspace\Build\ArmVirtKvmTool-AARCH64\DEBUG_GCC5\AARCH64\PcAtChipsetPkg\PcatRealTimeClockRuntimeDxe\PcatRealTimeClockRuntimeDxe\DEBUG\PcRtc.dll
> 0xBBF8
>   Loading driver at 0x000BBF7 EntryPoint=0x000BBF82958
> PcRtc.efi
>   Failed to set memory attributes. Status = 0002
>  Failed to map memory for motorola,mc146818. Status = 0002
>
>  ASSERT_EFI_ERROR (Status = 0002)
>  ASSERT [PcRtc]
> w:\workspace\Build\ArmVirtKvmTool-AARCH64\DEBUG_GCC5\AARCH64\PcAtChipsetPkg\PcatRealTimeClockRuntimeDxe\PcatRealTimeClockRuntimeDxe\DEBUG\AutoGen.c(494):
> !(((INTN)(RETURN_STATUS)(Status)) < 0)
>
> I am not sure why this issue only surfaces sometimes (which is
> worrying). However, the fix for this is patch 4/4 in this series.
>

I suppose the dispatch order is not fixed, which is surprising. But I
think the fix is quite appropriate in any case.

> Is it possible to review the ArmVirtPkg changes and if I have your
> approval to merge this series, please?
>

Feel free to go ahead and merge them

Reviewed-by: Ard Biesheuvel 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102118): https://edk2.groups.io/g/devel/message/102118
Mute This Topic: https://groups.io/mt/97731606/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 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Ard Biesheuvel
On Wed, 29 Mar 2023 at 13:28, Leif Lindholm  wrote:
>
> On Wed, Mar 29, 2023 at 09:39:56 +0200, Ard Biesheuvel wrote:
> > > > - Remove GCC48 and GCC49.
> > >
> > > GCC49 is one GCC tool chain without LTO enable option. GCC5 is another 
> > > GCC tool chain with LTO enable option.
> > >
> > > They have the different usage. I suggest to keep GCC49 and GCC5 both, and 
> > > also keep their name as is.
> > >
> >
> > Could we perhaps do
> >
> > GCC49 -> GCC
> > GCC5  -> GCCLTO
>
> Might I suggest the inverse?
>
> GCC49 -> GCCNOLTO
> GCC5  -> GCC
>
> I feel disabling LTO should be seen as the nonstandard approach.
>

That works for me as well.

> Regardless, we (including me) *should* have changed those names as
> soon as we realised we didn't need a GCC51, and the misleading naming
> still frequently causes confusion. So I don't think keeping the
> current names should be considered an option.
>

Agreed.

> > ?
> >
> > As with CLANG35/38, the GCCx names have become rather obsolete, so I'd
> > prefer to have a set of more generic names, and a sliding window of
> > supported versions that can be documented in tools_def.template (and
> > updated at times)
>
> Agreed. And *if* we find a need in the future to add a new archived
> range, we can add that then.
>

Of course. But with the stable tags, I doubt whether this will be necessary.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102117): https://edk2.groups.io/g/devel/message/102117
Mute This Topic: https://groups.io/mt/97923603/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 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Leif Lindholm
On Wed, Mar 29, 2023 at 09:39:56 +0200, Ard Biesheuvel wrote:
> > > - Remove GCC48 and GCC49.
> >
> > GCC49 is one GCC tool chain without LTO enable option. GCC5 is another GCC 
> > tool chain with LTO enable option.
> >
> > They have the different usage. I suggest to keep GCC49 and GCC5 both, and 
> > also keep their name as is.
> >
> 
> Could we perhaps do
> 
> GCC49 -> GCC
> GCC5  -> GCCLTO

Might I suggest the inverse?

GCC49 -> GCCNOLTO
GCC5  -> GCC

I feel disabling LTO should be seen as the nonstandard approach.

Regardless, we (including me) *should* have changed those names as
soon as we realised we didn't need a GCC51, and the misleading naming
still frequently causes confusion. So I don't think keeping the
current names should be considered an option.

> ?
> 
> As with CLANG35/38, the GCCx names have become rather obsolete, so I'd
> prefer to have a set of more generic names, and a sliding window of
> supported versions that can be documented in tools_def.template (and
> updated at times)

Agreed. And *if* we find a need in the future to add a new archived
range, we can add that then.

/
Leif


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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Support more input parameter

2023-03-29 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wu, LinusX  
Sent: Wednesday, March 29, 2023 6:52 PM
To: devel@edk2.groups.io
Cc: Wu, LinusX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Support more input parameter

From: Linus Wu 

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

Add additional input parameter support
--SpecRevision: user input spec version
--Revision: user input revision
--ProducerId: producer company name
1. UniversalPayloadBuild.py 2. Downgrade spec revision from 0.9 to 0.7
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 45 -
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..7cd04fdceb 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -31,11 +31,48 @@ class UPLD_INFO_HEADER(LittleEndianStructure):
 def __init__(self):

 self.Identifier =  b'PLDH'

 self.HeaderLength   = sizeof(UPLD_INFO_HEADER)

-self.SpecRevision   = 0x0009

+self.SpecRevision   = 0x0070

 self.Revision   = 0x010105

 self.ImageId= b'UEFI'

 self.ProducerId = b'INTEL'

 

+def GenSpecRevision (Argument):

+try:

+(MajorStr, MinorStr) = Argument.split('.')

+except:

+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))

+#

+# Spec Revision Bits 15 : 8 - Major Version. Bits 7 : 0 - Minor Version.

+#

+if len(MinorStr) > 0 and len(MinorStr) < 3:

+try:

+Minor = int(MinorStr, 16) if len(MinorStr) == 2 else 
(int(MinorStr, 16) << 4)

+except:

+raise argparse.ArgumentTypeError ('{} Minor version of 
SpecRevision is not a valid integer value.'.format (Argument))

+else:

+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))

+

+if len(MajorStr) > 0 and len(MajorStr) < 3:

+try:

+Major = int(MajorStr, 16)

+except:

+raise argparse.ArgumentTypeError ('{} Major version of 
SpecRevision is not a valid integer value.'.format (Argument))

+else:

+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))

+

+return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0)

+

+def Validate32BitInteger (Argument):

+try:

+Value = int (Argument, 0)

+except:

+raise argparse.ArgumentTypeError ('{} is not a valid integer 
value.'.format (Argument))

+if Value < 0:

+raise argparse.ArgumentTypeError ('{} is a negative value.'.format 
(Argument))

+if Value > 0x:

+raise argparse.ArgumentTypeError ('{} is larger than 32-bits.'.format 
(Argument))

+return Value

+

 def RunCommand(cmd):

 print(cmd)

 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT,cwd=os.environ['WORKSPACE'])

@@ -111,6 +148,9 @@ def BuildUniversalPayload(Args, MacroList):
 # Buid Universal Payload Information Section ".upld_info"

 #

 upld_info_hdr = UPLD_INFO_HEADER()

+upld_info_hdr.SpecRevision = Args.SpecRevision

+upld_info_hdr.Revision = Args.Revision

+upld_info_hdr.ProducerId = Args.ProducerId.encode()[:16]

 upld_info_hdr.ImageId = Args.ImageId.encode()[:16]

 upld_info_hdr.Attribute |= 1 if BuildTarget == "DEBUG" else 0

 fp = open(UpldInfoFile, 'wb')

@@ -156,6 +196,9 @@ def main():
 parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID 
(16 bytes maximal).', default ='UEFI')

 parser.add_argument('-q', '--Quiet', action='store_true', help='Disable 
all build messages except FATAL ERRORS.')

 parser.add_argument("-p", "--pcd", action="append")

+parser.add_argument("-s", "--SpecRevision", type=GenSpecRevision, 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).')

 MacroList = {}

 args = parser.parse_args()

 if args.Macro is not None:

-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102115): https://edk2.groups.io/g/devel/message/102115
Mute This Topic: https://groups.io/mt/97925255/21656
Group Owner: 

Re: [edk2-devel] [PATCH v1 0/4] Bug fixes for DynamicTablesPkg and ArmVirtPkg/kvmtool

2023-03-29 Thread Sami Mujawar

Hi Ard,

I am occassionally seeing the following error when trying to run the 
Kvmtool guest firmware.


 add-symbol-file 
w:\workspace\Build\ArmVirtKvmTool-AARCH64\DEBUG_GCC5\AARCH64\PcAtChipsetPkg\PcatRealTimeClockRuntimeDxe\PcatRealTimeClockRuntimeDxe\DEBUG\PcRtc.dll 
0xBBF8
 Loading driver at 0x000BBF7 EntryPoint=0x000BBF82958 
PcRtc.efi

 Failed to set memory attributes. Status = 0002
    Failed to map memory for motorola,mc146818. Status = 0002

    ASSERT_EFI_ERROR (Status = 0002)
    ASSERT [PcRtc] 
w:\workspace\Build\ArmVirtKvmTool-AARCH64\DEBUG_GCC5\AARCH64\PcAtChipsetPkg\PcatRealTimeClockRuntimeDxe\PcatRealTimeClockRuntimeDxe\DEBUG\AutoGen.c(494): 
!(((INTN)(RETURN_STATUS)(Status)) < 0)


I am not sure why this issue only surfaces sometimes (which is 
worrying). However, the fix for this is patch 4/4 in this series.


Is it possible to review the ArmVirtPkg changes and if I have your 
approval to merge this series, please?


Regards,

Sami Mujawar

On 20/03/2023 02:05 pm, Sami Mujawar wrote:

This patch series has the following fixes for DynamicTablesPkg and
ArmVirtPkg/Kvmtool:

   1. Reduces the log output from TableHelperLib in DynamicTablesPkg.
   2. Fixes issue with parsing of the serial port node in
  ArmSerialPortParser in DynamicTablesPkg and
  EarlyFdt16550SerialPortHookLib in ArmVirtPkg. This issue
  was not observed until another entry was added in the 'chosen'
  node in the DT when doing some experiments.
   3. Fixes the DEPEX in the Kvmtool guest RTC library as the missing
  dependency on CPU Architecture protocol would cause occasional
  failures.

The changes can be seen at:
https://github.com/samimujawar/edk2/tree/2596_bug_fix_dynamictables_kvmtool_v1

Sami Mujawar (4):
   DynamicTablesPkg: Reduce log output from TableHelperLib
   DynamicTablesPkg: Fix parsing of serial port node
   ArmVirtPkg: Fix parsing of serial port node
   ArmVirtPkg: Fix depex in kvmtool guest Rtc library

  ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c 
|  4 +--
  ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf  
|  4 +--
  
DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
 | 28 ++--
  DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.c  
|  4 +--
  4 files changed, 20 insertions(+), 20 deletions(-)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102114): https://edk2.groups.io/g/devel/message/102114
Mute This Topic: https://groups.io/mt/97731606/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 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Ard Biesheuvel
On Wed, 29 Mar 2023 at 12:22, Rebecca Cran  wrote:
>
> On 3/28/23 12:12 PM, Ard Biesheuvel wrote:
> > What kind of errors are you seeing after adding -Wl,--no-pie,--no-relax ?
>
> I realized I didn't really try it after I thought you had said it was
> causing corruption.
>
> After adding those flags I was able to verify (via "strace
> --trace=process -f") that lld is indeed getting invoked, and that the
> resulting binaries run fine using qemu-system-arm and qemu-system-aarch64.
>

Excellent, so let's go with that.


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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Support more input parameter

2023-03-29 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Wu, LinusX  
Sent: Wednesday, March 29, 2023 6:21 PM
To: devel@edk2.groups.io
Cc: Wu, LinusX ; Dong, Guo ; Ni, Ray 
; Rhodes, Sean ; Lu, James 
; Guo, Gua 
Subject: [PATCH] UefiPayloadPkg: Support more input parameter

From: Linus Wu 

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

Add additional input parameter support
--SpecRevision: user input spec version
--Revision: user input revision
--ProducerId: producer company name
1. UniversalPayloadBuild.py 2. Downgrade spec revision from 0.9 to 0.7
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Linus Wu 
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 45 -
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py 
b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..7cd04fdceb 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -31,11 +31,48 @@ class UPLD_INFO_HEADER(LittleEndianStructure):
 def __init__(self):

 self.Identifier =  b'PLDH'

 self.HeaderLength   = sizeof(UPLD_INFO_HEADER)

-self.SpecRevision   = 0x0009

+self.SpecRevision   = 0x0070

 self.Revision   = 0x010105

 self.ImageId= b'UEFI'

 self.ProducerId = b'INTEL'

 

+def GenSpecRevision (Argument):

+try:

+(MajorStr, MinorStr) = Argument.split('.')

+except:

+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))

+#

+# Spec Revision Bits 15 : 8 - Major Version. Bits 7 : 0 - Minor Version.

+#

+if len(MinorStr) > 0 and len(MinorStr) < 3:

+try:

+Minor = int(MinorStr, 16) if len(MinorStr) == 2 else 
(int(MinorStr, 16) << 4)

+except:

+raise argparse.ArgumentTypeError ('{} Minor version of 
SpecRevision is not a valid integer value.'.format (Argument))

+else:

+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))

+

+if len(MajorStr) > 0 and len(MajorStr) < 3:

+try:

+Major = int(MajorStr, 16)

+except:

+raise argparse.ArgumentTypeError ('{} Major version of 
SpecRevision is not a valid integer value.'.format (Argument))

+else:

+raise argparse.ArgumentTypeError ('{} is not a valid SpecRevision 
format (Major[8-bits].Minor[8-bits]).'.format (Argument))

+

+return int('0x{0:02x}{1:02x}'.format(Major, Minor), 0)

+

+def Validate32BitInteger (Argument):

+try:

+Value = int (Argument, 0)

+except:

+raise argparse.ArgumentTypeError ('{} is not a valid integer 
value.'.format (Argument))

+if Value < 0:

+raise argparse.ArgumentTypeError ('{} is a negative value.'.format 
(Argument))

+if Value > 0x:

+raise argparse.ArgumentTypeError ('{} is larger than 32-bits.'.format 
(Argument))

+return Value

+

 def RunCommand(cmd):

 print(cmd)

 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT,cwd=os.environ['WORKSPACE'])

@@ -111,6 +148,9 @@ def BuildUniversalPayload(Args, MacroList):
 # Buid Universal Payload Information Section ".upld_info"

 #

 upld_info_hdr = UPLD_INFO_HEADER()

+upld_info_hdr.SpecRevision = Args.SpecRevision

+upld_info_hdr.Revision = Args.Revision

+upld_info_hdr.ProducerId = Args.ProducerId.encode()[:16]

 upld_info_hdr.ImageId = Args.ImageId.encode()[:16]

 upld_info_hdr.Attribute |= 1 if BuildTarget == "DEBUG" else 0

 fp = open(UpldInfoFile, 'wb')

@@ -156,6 +196,9 @@ def main():
 parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID 
(16 bytes maximal).', default ='UEFI')

 parser.add_argument('-q', '--Quiet', action='store_true', help='Disable 
all build messages except FATAL ERRORS.')

 parser.add_argument("-p", "--pcd", action="append")

+parser.add_argument("-s", "--SpecRevision", type=GenSpecRevision, 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).')

 MacroList = {}

 args = parser.parse_args()

 if args.Macro is not None:

-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102112): https://edk2.groups.io/g/devel/message/102112
Mute This Topic: https://groups.io/mt/97925255/21656
Group Owner: 

Re: [edk2-devel] [PATCH v2 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Rebecca Cran

On 3/28/23 12:12 PM, Ard Biesheuvel wrote:

What kind of errors are you seeing after adding -Wl,--no-pie,--no-relax ?


I realized I didn't really try it after I thought you had said it was 
causing corruption.


After adding those flags I was able to verify (via "strace 
--trace=process -f") that lld is indeed getting invoked, and that the 
resulting binaries run fine using qemu-system-arm and qemu-system-aarch64.



--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102111): https://edk2.groups.io/g/devel/message/102111
Mute This Topic: https://groups.io/mt/97910990/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 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Rebecca Cran

On 3/29/23 1:39 AM, Ard Biesheuvel wrote:

Could we perhaps do

GCC49 -> GCC
GCC5  -> GCCLTO

?

As with CLANG35/38, the GCCx names have become rather obsolete, so I'd
prefer to have a set of more generic names, and a sliding window of
supported versions that can be documented in tools_def.template (and
updated at times)


We need a minimum of GCC 6 to run CI because 
UnitTestFrameworkPkg/Library/GoogleTestLib uses nullptr that GCC 5 
doesn't support, so the GCC5 name is wrong anyway.



--
Rebecca Cran



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




Re: [edk2-devel] [edk2][PATCH V1 1/1] MdePkg/IndustryStandard: add definitions for MPAM ACPI specification

2023-03-29 Thread Sami Mujawar

Hi Rohit,

Thank you for this patch, and apologies for the delay in reply.

I have a few minor suggestions marked inline as [SAMI].

Other than that, I would like to see a corresponding patch to add MPAM 
support to Acpiview.


With that addressed,

Reviewed-by: Sami Mujawar 

regards,

Sami Mujawar

On 25/01/2023 12:39 am, Rohit Mathew wrote:

add definitions, macros and types for elements associated with MPAM
ACPI 2.0 specification.

Signed-off-by: Rohit Mathew 
---
  MdePkg/Include/IndustryStandard/Acpi64.h |   7 +-
  MdePkg/Include/IndustryStandard/Mpam.h   | 229 
  2 files changed, 235 insertions(+), 1 deletion(-)

github link:
https://github.com/rohit-arm/edk2/tree/mpam_acpi

diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h 
b/MdePkg/Include/IndustryStandard/Acpi64.h
index 575ca0430c..2be9525979 100644
--- a/MdePkg/Include/IndustryStandard/Acpi64.h
+++ b/MdePkg/Include/IndustryStandard/Acpi64.h
@@ -2,7 +2,7 @@
ACPI 6.4 definitions from the ACPI Specification Revision 6.4 Jan, 2021.
  
Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.

-  Copyright (c) 2019 - 2021, ARM Ltd. All rights reserved.
+  Copyright (c) 2019 - 2023, ARM Limited. All rights reserved.
  
SPDX-License-Identifier: BSD-2-Clause-Patent

  **/
@@ -3157,6 +3157,11 @@ typedef struct {
  ///
  #define EFI_ACPI_6_4_XEN_PROJECT_TABLE_SIGNATURE  SIGNATURE_32('X', 'E', 'N', 
'V')
  
+///

+/// "MPAM" Memory System Resource Partitioning and Monitoring Table
+///
+#define 
EFI_ACPI_MEMORY_SYSTEM_RESOURCE_PARTITIONING_AND_MONITORING_TABLE_SIGNATURE  
SIGNATURE_32('M', 'P', 'A', 'M')
+
  #pragma pack()
  
  #endif

diff --git a/MdePkg/Include/IndustryStandard/Mpam.h 
b/MdePkg/Include/IndustryStandard/Mpam.h
new file mode 100644
index 00..8e6e72ea28
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/Mpam.h
@@ -0,0 +1,229 @@
+/** @file
+  ACPI for Memory System Resource Partitioning and Monitoring 2.0 (MPAM) as
+  specified in ARM spec DEN0065
+
+  Copyright (c) 2023, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+   - [1] ACPI for Memory System Resource Partitioning and Monitoring 2.0
+ (https://developer.arm.com/documentation/den0065/latest)
+
+  @par Glossary:
+- MPAM - Memory System Resource Partitioning And Monitoring
+- MSC  - Memory System Component
+- PCC  - Platform Communication Channel
+- RIS  - Resource Instance Selection
+- SMMU - Arm System Memory Management Unit
+ **/
+
+#ifndef MPAM_H_
+#define MPAM_H_
+
+#include 
+
+///
+/// MPAM Revision
+///
+#define 
EFI_ACPI_MEMORY_SYSTEM_RESOURCE_PARTITIONING_AND_MONITORING_TABLE_REVISION  
(0x01)
+
+///
+/// MPAM Interrupt mode
+///
+#define EFI_ACPI_MPAM_INTERRUPT_LEVEL_TRIGGERED  (0x0)
+#define EFI_ACPI_MPAM_INTERRUPT_EDGE_TRIGGERED   (0x1)
+
+///
+/// MPAM Interrupt type
+///
+#define EFI_ACPI_MPAM_INTERRUPT_WIRED  (0x0)
+
+///
+/// MPAM Interrupt affinity type
+///
+#define EFI_ACPI_MPAM_PROCESSOR_AFFINITY(0x0)
+#define EFI_ACPI_MPAM_PROCESSOR_CONTAINER_AFFINITY  (0x1)
+
+///
+/// MPAM MSC affinity valid
+///
+#define EFI_ACPI_MPAM_AFFINITY_NOT_VALID  (0x0)
+#define EFI_ACPI_MPAM_AFFINITY_VALID  (0x1)
+
+///
+/// MPAM Interrupt flag - bit positions
+///
+#define EFI_ACPI_MPAM_INTERRUPT_MODE_POS  (0x0)
+#define EFI_ACPI_MPAM_INTERRUPT_TYPE_POS  (0x1)
+#define EFI_ACPI_MPAM_AFFINITY_TYPE_POS   (0x3)
+#define EFI_ACPI_MPAM_AFFINITY_VALID_POS  (0x4)
+#define EFI_ACPI_MPAM_RESERVED_POS(0x5)
[SAMI] I think it would be better to change the postfix _POS to _SHIFT 
and corresponing definitions for masks 
(i.e.EFI_ACPI_MPAM_INTERRUPT_MODE_MASK) be added.

+
+///
+/// MPAM Location types
+/// as described in document [1], table 11
+///
+#define EFI_ACPI_MPAM_LOCATION_PROCESSOR_CACHE  (0x0)
+#define EFI_ACPI_MPAM_LOCATION_MEMORY   (0x1)
+#define EFI_ACPI_MPAM_LOCATION_SMMU (0x2)
+#define EFI_ACPI_MPAM_LOCATION_MEMORY_CACHE (0x3)
+#define EFI_ACPI_MPAM_LOCATION_ACPI_DEVICE  (0x4)
+#define EFI_ACPI_MPAM_LOCATION_INTERCONNECT (0x5)
+#define EFI_ACPI_MPAM_LOCATION_UNKNOWN  (0xFF)
+
+///
+/// MPAM Interface types
+///
+#define EFI_ACPI_MPAM_INTERFACE_MMIO  (0x0)
+#define EFI_ACPI_MPAM_INTERFACE_PCC   (0x0A)
+
+#pragma pack(1)
+
+///
+/// MPAM MSC generic locator descriptor
+/// as described in document [1], table 12
+///
+typedef struct {
+  UINT64Descriptor1;
+  UINT32Descriptor2;
+} EFI_ACPI_MPAM_GENERIC_LOCATOR;
+
+///
+/// MPAM processor cache locator descriptor
+/// as described in document [1], table 13
+///
+typedef struct {
+  UINT64CacheReference;
+  UINT32Reserved;
+} EFI_ACPI_MPAM_CACHE_LOCATOR;
+
+///
+/// MPAM memory locator descriptor
+/// as described in document [1], table 14
+///
+typedef struct {
+  UINT64ProximityDomain;
+  UINT32Reserved;
+} EFI_ACPI_MPAM_MEMORY_LOCATOR;
+
+///
+/// MPAM SMMU locator descriptor
+/// as described in 

Re: [edk2-devel] CLI way of checking PR CI status

2023-03-29 Thread Ard Biesheuvel
On Wed, 29 Mar 2023 at 01:32, Rebecca Cran  wrote:
>
> For a while I've been irritated at having to open a web browser to check
> the status of CI tasks for my GitHub PRs.
>
> Fortunately I mentioned on the UEFI Talkbox channel about wanting to
> write a tool that uses the GitHub API to query the status, and JoeyV
> pointed out that the 'gh' tool
> (https://cli.github.com/manual/installation) already supports that.
>
> I find the following output quite a bit nicer than the web view, and
> lets me stay in the terminal:
>
> bcran@cube:~/src/uefi/edk2$ gh pr checks 4158 --watch
> Some checks were not successful
> 9 failing, 14 successful, 0 skipped, and 92 pending checks
>


Thanks for sharing this - very useful!


> X  Ubuntu GCC5 PR (Build_GCC TARGET_ARM_ARMPLATFORM) 3m24s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=5545a556-e5d2-5a4d-e734-c5e74a7c459e
> X  Ubuntu GCC5 PR (Build_GCC TARGET_CRYPTO) 7m27s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=67896054-7b82-5dd7-9d9f-22bd544234ac
> X  Ubuntu GCC5 PR (Build_GCC TARGET_FMP_FAT_TEST) 4m45s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=0b4229c6-104b-52fa-5a97-38323eaf95e9
> X  Ubuntu GCC5 PR (Build_GCC TARGET_GCC_ONLY) 3m57s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=ead4100a-be2e-52a6-7f46-eb4609904519
> X  Ubuntu GCC5 PR (Build_GCC TARGET_MDEMODULE_DEBUG) 3m23s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=1449e2c9-9e24-59c4-5ddf-1ecee0740c62
> X  Ubuntu GCC5 PR (Build_GCC TARGET_MDEMODULE_RELEASE) 4m56s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=11532bf5-f61b-5e62-33bc-fa016b40ad7f
> X  Ubuntu GCC5 PR (Build_GCC TARGET_NETWORK) 4m36s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=1fe0e70e-4631-56ea-10be-58428283ef8d
> X  Ubuntu GCC5 PR (Build_GCC TARGET_OTHER) 6m57s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=e0dd37b0-83d9-536f-8381-ee6ddc36393a
> X  Ubuntu GCC5 PR (Build_GCC TARGET_SECURITY) 4m31s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=fe537304-f5a7-5331-4e40-61f0a3f529ea
> ✓ PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR 8m29s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584
> ✓  PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR (Platform_CI
> EmulatorPkg_X64_DEBUG)4m42s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584=logs=3129d5e1-a8d0-50bc-7d7a-dcfb058813f9
> ✓  PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR (Platform_CI
> EmulatorPkg_X64_FULL_DEBUG)   5m55s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584=logs=dcc33cfc-f2e7-5dca-ae56-a45669cff4a1
> ✓  PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR (Platform_CI
> EmulatorPkg_X64_FULL_NOOPT)   3m34s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584=logs=aa92095e-3511-5914-f6c4-a1290a5ed195
> ✓  PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR (Platform_CI
> EmulatorPkg_X64_FULL_RELEASE) 5m28s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584=logs=34d5b720-951c-5b9f-53dd-68117bd1e993
> ✓  PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR (Platform_CI
> EmulatorPkg_X64_NOOPT)3m18s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584=logs=b5e96946-f011-5ecf-e405-3931d33e7650
> ✓  PlatformCI_EmulatorPkg_Ubuntu_GCC5_PR (Platform_CI
> EmulatorPkg_X64_RELEASE)  5m4s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84584=logs=c8fb701e-b6f0-5912-8fc4-9b05eee202bd
> ✓ Summary 3s
> https://github.com/tianocore/edk2/pull/4158/checks?check_run_id=12317758210
> ✓  Ubuntu GCC5 PR (Build_GCC TARGET_FSP) 5m11s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=398e31f0-fcfa-5502-6432-e149386b1fb7
> ✓  Ubuntu GCC5 PR (Build_GCC TARGET_PLATFORMS) 5m7s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=30acf94d-82e5-5aa1-cb38-e65a5d5490e9
> ✓  Ubuntu GCC5 PR (Build_GCC TARGET_UEFIPAYLOAD) 6m10s
> https://dev.azure.com/tianocore/11ea4a10-ac9f-4e5f-8b13-7def1f19d478/_build/results?buildId=84581=logs=1434db6a-663b-5df7-3466-b48309c0329e
> ✓  Windows VS2019 PR (Build_VS2019
> TARGET_ARM_ARMPLATFORM)  5m40s
> 

Re: [edk2-devel] [PATCH 2/2] UefiCpuPkg: After reset, wake up APs by SIPI.

2023-03-29 Thread Yuanhao Xie
Hi Gerd,

Could you please provide me more information, like where does it hang, ad what 
build and boot options you use

I used this image 
https://www.kraxel.org/repos/images/fedora-30-efi-systemd-i686.qcow2.xz, and 
extracted the kernel from second partition (VFAT) of 
"/a29755367bf242efb072cfdd1a70134f/5.3.12-200.fc30.i686/linux" .

Build and boot with:
build \
-a IA32 \
-b NOOPT \
-p OvmfPkg/OvmfPkgIa32.dsc \
-t GCC5 \
-D SECURE_BOOT_ENABLE \
-D SMM_REQUIRE \
-D NETWORK_TLS_ENABLE \
-D NETWORK_IP6_ENABLE \
-D NETWORK_HTTP_BOOT_ENABLE \
-D TPM2_ENABLE \
--pcd=gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel=0x8040004F

qemu-system-i386 \
-cpu coreduo,-nx \
-machine q35,smm=on,accel=kvm \
-m 5120 \
-smp 2 \
-global driver=cfi.pflash01,property=secure,value=on \
-drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd,snapshot=on \
-debugcon file:debug3.log \
-global isa-debugcon.iobase=0x402 \
-chardev stdio,signal=off,mux=on,id=char0 \
-mon chardev=char0,mode=readline \
-serial chardev:char0 \
-kernel linux \
-append "ignore_loglevel console=ttyS0"


The end of log are as following:

PixelBlueGreenRedReserved8BitPerColor
ConvertPages: range 40 - 141CFFF covers multiple entries
SmmInstallProtocolInterface: 296EB418-C4C8-4E05-AB59-39E8AF56F00A 0
CpuDxe: 5-Level Paging = 0
MpInitChangeApLoopCallback() done!
SetUefiImageMemoryAttributes - 0x7ED47000 - 0xA000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ED3E000 - 0x9000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ED33000 - 0xB000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ED2A000 - 0x9000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ED1F000 - 0xB000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ED11000 - 0xE000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ED04000 - 0xD000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ECF8000 - 0xC000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ECF1000 - 0x7000 
(0x0008)
SetUefiImageMemoryAttributes - 0x7ECE9000 - 0x8000 
(0x0008)
ValidateSetVariable - Variable 
(4424AC57-BE4B-47DD-9E97-ED50F09F92A9:DUMMY) returning Success.

Thanks
Yuanhao
-Original Message-
From: Gerd Hoffmann  
Sent: Monday, March 27, 2023 7:03 PM
To: devel@edk2.groups.io; Xie, Yuanhao 
Cc: Dong, Guo ; Ni, Ray ; Rhodes, Sean 
; Lu, James ; Guo, Gua 

Subject: Re: [edk2-devel] [PATCH 2/2] UefiCpuPkg: After reset, wake up APs by 
SIPI.

On Mon, Mar 27, 2023 at 11:17:11AM +0800, Yuanhao Xie wrote:
> Following a power-up or RESET, since all APs are already in the 
> “wait-for-SIPI state,” the BSP can broadcast just a single SIPI IPI to 
> the APs to wake them up and initialize them.
> 
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Sean Rhodes 
> Cc: James Lu 
> Cc: Gua Guo 
> Signed-off-by: Yuanhao Xie 

This patch breaks OVMF (just boot the firmware in qemu image with '-smp 2').

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102106): https://edk2.groups.io/g/devel/message/102106
Mute This Topic: https://groups.io/mt/97874904/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 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg: Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update CLANGDWARF, delete VS 2008-2013, EBC

2023-03-29 Thread Ard Biesheuvel
On Wed, 29 Mar 2023 at 03:20, gaoliming via groups.io
 wrote:
>
> Rebecca:
>
>
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Rebecca Cran
> > 发送时间: 2023年3月29日 1:31
> > 收件人: devel@edk2.groups.io; Oliver Smith-Denny ;
> > Guomin Jiang ; Xiaoyu Lu ;
> > Jian J Wang ; Jiewen Yao ;
> > Ard Biesheuvel ; Jordan Justen
> > ; Gerd Hoffmann ; Bob Feng
> > ; Liming Gao ; Andrew
> > Fish ; Leif Lindholm ;
> > Michael D Kinney 
> > 抄送: Rebecca Cran 
> > 主题: [edk2-devel] [PATCH v2 00/13] BaseTools,CryptoPkg,MdePkg,OvmfPkg:
> > Delete CLANG35,CLANG38,GCC48,GCC49, rename GCC5 to GCC, update
> > CLANGDWARF, delete VS 2008-2013, EBC
> >
> > Update the toolchain definitions:
> >
> > - Delete the CLANG35 and CLANG38 toolchains, and replace CLANG38 with
> >   CLANGDWARF, updating it to support ARM and AARCH64 in addition to X64
> > and IA32.
> >
> > - Remove GCC48 and GCC49.
>
> GCC49 is one GCC tool chain without LTO enable option. GCC5 is another GCC 
> tool chain with LTO enable option.
>
> They have the different usage. I suggest to keep GCC49 and GCC5 both, and 
> also keep their name as is.
>

Could we perhaps do

GCC49 -> GCC
GCC5  -> GCCLTO

?

As with CLANG35/38, the GCCx names have become rather obsolete, so I'd
prefer to have a set of more generic names, and a sliding window of
supported versions that can be documented in tools_def.template (and
updated at times)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102105): https://edk2.groups.io/g/devel/message/102105
Mute This Topic: https://groups.io/mt/97923603/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/3] RedfishPkg: Redfish discover driver improvement

2023-03-29 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, March 29, 2023 2:14 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH v2 2/3] RedfishPkg: Redfish discover driver improvement
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Bug fix:
> - function stack fault
> - properly handle "SubnetAddrInfoIPv6" when there is no IPv6 support
> - copy-n-paste error in RedfishGetHostInterfaceProtocolData()
> - fix typo
> Enhancement:
> - Redfish discover driver now can configure host IP address based on
>   the information from SMBIOS type 42 record. This saves the effort of
>   configuring host IP address in setup menu.
> - Performance improvement to driver binding process. Redfish discover
>   driver will wait until all required drivers are ready and do driver
>   binding start().
> - Use CopyGuid() to copy GUID instead of intrinsic function.
> - Error handling when SMBIOS data is corrupted.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishDiscoverInternal.h |  20 ++-
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 144 --
>  .../RedfishSmbiosHostInterface.c  |  13 +-
>  3 files changed, 120 insertions(+), 57 deletions(-)
> 
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> index 04fa09e1cc..2704cd955d 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> @@ -3,6 +3,7 @@
> 
>(C) Copyright 2021 Hewlett Packard Enterprise Development LP
>Copyright (c) 2022, AMD Incorporated. All rights reserved.
> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -102,7 +103,7 @@ typedef struct {
>UINT32 SubnetAddrInfoIPv6Number;   
> ///< IPv6
> address info number.
>EFI_IP6_ADDRESS_INFO   *SubnetAddrInfoIPv6;
> ///< IPv6
> address info.
>//
> -  // Network interface protocol and REST EX infor.
> +  // Network interface protocol and REST EX info.
>//
>UINT32 NetworkProtocolType;
>   ///< Network
> protocol type. Refer to
>   
>   ///<
> NETWORK_INTERFACE_PROTOCOL_TYPE.
> @@ -112,7 +113,7 @@ typedef struct {
>// EFI_REDFISH_DISCOVER_PROTOCOL instance installed
>// on this network interface.
>//
> -  EFI_HANDLE 
> EfiRedfishDiscoverProtocolHandle; ///<
> EFI_REDFISH_DISCOVER_PROTOTOCOL instance installed
> +  EFI_HANDLE 
> EfiRedfishDiscoverProtocolHandle; ///<
> EFI_REDFISH_DISCOVER_PROTOCOL instance installed
>   
>   ///< on this network interface.
>  } EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL;
> 
> @@ -123,7 +124,7 @@ typedef struct {
>LIST_ENTRY  Entry;  ///< Link list entry.
>EFI_HANDLE  OpenDriverAgentHandle;  ///< The agent to open
> network protocol.
>EFI_HANDLE  OpenDriverControllerHandle; ///< The controller 
> handle
> to open network protocol.
> -  EFI_HANDLE  RestExChildHandle;  ///< The child handle 
> created
> throught REST EX Service Protocol.
> +  EFI_HANDLE  RestExChildHandle;  ///< The child handle 
> created
> through REST EX Service Protocol.
>EFI_HANDLE  RestExControllerHandle; ///< The controller 
> handle
> which provide REST EX protocol.
>EFI_REST_EX_PROTOCOL*RestExProtocolInterface;   ///< Pointer to
> EFI_REST_EX_PROTOCOL.
>UINT32  RestExId;   ///< The identifier 
> installed on REST EX
> controller handle.
> @@ -178,15 +179,18 @@ typedef struct {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> *NetworkInterface; ///<
> EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
>  ///< 
> instance used to discover Redfish
> service.
>//
> -  // Below for Host insterface discovery.
> +  // Below for Host interface discovery.
>//
>BOOLEANHostIntfValidation; 
> ///< Indicates whether
> to validate Redfish Host interface.
>EFI_IP_ADDRESS TargetIpAddress;
> ///< Target IP
> address reported in Redfish Host interface.
> +  UINT8  HostAddrFormat; 
> ///< 

[edk2-devel] [PATCH v2 3/3] RedfishPkg: fix config handler driver issues

2023-03-29 Thread Nickle Wang via groups.io
Bug fix:
- function stack fault
- config handler driver requires the dependency of Redfish Credential
  Protocol
- incorrect caller id installation when failed to perform init()
- fix typo

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Reviewed-by: Abner Chang 
---
 .../RedfishConfigHandlerDriver.inf |  4 ++--
 .../RedfishConfigHandler/RedfishConfigHandlerCommon.c  | 10 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf 
b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
index def91c7531..b167c6e1ee 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
@@ -4,6 +4,7 @@
 #
 #  Copyright (c) 2019, Intel Corporation. All rights reserved.
 #  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -56,5 +57,4 @@
   gEfiEndOfDxeEventGroupGuid  ## CONSUMES ## Event
 
 [Depex]
-  TRUE
-
+  gEdkIIRedfishCredentialProtocolGuid
diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c 
b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c
index c3a7efd796..96aac125ee 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c
@@ -2,6 +2,7 @@
   The common code of EDKII Redfish Configuration Handler driver.
 
   (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -9,7 +10,7 @@
 
 #include "RedfishConfigHandlerCommon.h"
 
-REDFISH_CONFIG_DRIVER_DATA  gRedfishConfigData; // Only one Redfish 
service supproted
+REDFISH_CONFIG_DRIVER_DATA  gRedfishConfigData; // Only one Redfish 
service supported
 // on platform for the BIOS
 // Redfish configuration.
 EFI_EVENT  gEndOfDxeEvent= NULL;
@@ -34,7 +35,7 @@ RedfishConfigOnEndOfDxe (
 
   Status = gCredential->StopService (gCredential, 
ServiceStopTypeSecureBootDisabled);
   if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {
-DEBUG ((DEBUG_ERROR, "Redfish credential protocol faied to stop service on 
EndOfDxe: %r", Status));
+DEBUG ((DEBUG_ERROR, "Redfish credential protocol failed to stop service 
on EndOfDxe: %r", Status));
   }
 
   //
@@ -62,7 +63,7 @@ RedfishConfigOnExitBootService (
 
   Status = gCredential->StopService (gCredential, 
ServiceStopTypeExitBootService);
   if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {
-DEBUG ((DEBUG_ERROR, "Redfish credential protocol faied to stop service on 
ExitBootService: %r", Status));
+DEBUG ((DEBUG_ERROR, "Redfish credential protocol failed to stop service 
on ExitBootService: %r", Status));
   }
 }
 
@@ -225,7 +226,7 @@ RedfishConfigHandlerInitialization (
   UINTN  NumberOfHandles;
   EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL  *ConfigHandler;
   UINTN  Index;
-  UINT32 Id;
+  UINT32 *Id;
 
   Status = gBS->LocateHandleBuffer (
   ByProtocol,
@@ -257,6 +258,7 @@ RedfishConfigHandlerInitialization (
 Status = ConfigHandler->Init (ConfigHandler, 
);
 if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
   DEBUG ((DEBUG_ERROR, "ERROR: Failed to init Redfish config handler 
%p.\n", ConfigHandler));
+  continue;
 }
 
 //
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102103): https://edk2.groups.io/g/devel/message/102103
Mute This Topic: https://groups.io/mt/97922961/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/3] RedfishPkg: Redfish discover driver improvement

2023-03-29 Thread Nickle Wang via groups.io
Bug fix:
- function stack fault
- properly handle "SubnetAddrInfoIPv6" when there is no IPv6 support
- copy-n-paste error in RedfishGetHostInterfaceProtocolData()
- fix typo
Enhancement:
- Redfish discover driver now can configure host IP address based on
  the information from SMBIOS type 42 record. This saves the effort of
  configuring host IP address in setup menu.
- Performance improvement to driver binding process. Redfish discover
  driver will wait until all required drivers are ready and do driver
  binding start().
- Use CopyGuid() to copy GUID instead of intrinsic function.
- Error handling when SMBIOS data is corrupted.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishDiscoverInternal.h |  20 ++-
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 144 --
 .../RedfishSmbiosHostInterface.c  |  13 +-
 3 files changed, 120 insertions(+), 57 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
index 04fa09e1cc..2704cd955d 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
@@ -3,6 +3,7 @@
 
   (C) Copyright 2021 Hewlett Packard Enterprise Development LP
   Copyright (c) 2022, AMD Incorporated. All rights reserved.
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -102,7 +103,7 @@ typedef struct {
   UINT32 SubnetAddrInfoIPv6Number;   
///< IPv6 address info number.
   EFI_IP6_ADDRESS_INFO   *SubnetAddrInfoIPv6;
///< IPv6 address info.
   //
-  // Network interface protocol and REST EX infor.
+  // Network interface protocol and REST EX info.
   //
   UINT32 NetworkProtocolType;  
///< Network protocol type. Refer to

///< NETWORK_INTERFACE_PROTOCOL_TYPE.
@@ -112,7 +113,7 @@ typedef struct {
   // EFI_REDFISH_DISCOVER_PROTOCOL instance installed
   // on this network interface.
   //
-  EFI_HANDLE 
EfiRedfishDiscoverProtocolHandle; ///< EFI_REDFISH_DISCOVER_PROTOTOCOL instance 
installed
+  EFI_HANDLE 
EfiRedfishDiscoverProtocolHandle; ///< EFI_REDFISH_DISCOVER_PROTOCOL instance 
installed

///< on this network interface.
 } EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL;
 
@@ -123,7 +124,7 @@ typedef struct {
   LIST_ENTRY  Entry;  ///< Link list entry.
   EFI_HANDLE  OpenDriverAgentHandle;  ///< The agent to open 
network protocol.
   EFI_HANDLE  OpenDriverControllerHandle; ///< The controller 
handle to open network protocol.
-  EFI_HANDLE  RestExChildHandle;  ///< The child handle 
created throught REST EX Service Protocol.
+  EFI_HANDLE  RestExChildHandle;  ///< The child handle 
created through REST EX Service Protocol.
   EFI_HANDLE  RestExControllerHandle; ///< The controller 
handle which provide REST EX protocol.
   EFI_REST_EX_PROTOCOL*RestExProtocolInterface;   ///< Pointer to 
EFI_REST_EX_PROTOCOL.
   UINT32  RestExId;   ///< The identifier 
installed on REST EX controller handle.
@@ -178,15 +179,18 @@ typedef struct {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL*NetworkInterface; ///< 
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
 ///< 
instance used to discover Redfish service.
   //
-  // Below for Host insterface discovery.
+  // Below for Host interface discovery.
   //
   BOOLEANHostIntfValidation; ///< 
Indicates whether to validate Redfish Host interface.
   EFI_IP_ADDRESS TargetIpAddress;///< 
Target IP address reported in Redfish Host interface.
+  UINT8  HostAddrFormat; ///< 
Unknown=00h, Ipv4=01h, Ipv6=02h.
+  EFI_IP_ADDRESS HostIpAddress;  ///< 
Host IP address reported in Redfish Host interface.
+  EFI_IP_ADDRESS HostSubnetMask; ///< 
Host subnet mask address reported in Redfish Host interface.
 } EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE;
 
 /**
-  The function adds a new foudn Redfish service to internal list and
-  notify clinet.
+  The function adds a new found Redfish service to internal list and
+  notify client.
 
   It simply frees the packet.
 
@@ -197,7 +201,7 @@ typedef struct {
   @param[in]  OsOS string.
   

[edk2-devel] [PATCH v2 1/3] RedfishPkg/JsonLib: address coverity issue

2023-03-29 Thread Nickle Wang via groups.io
Fix implicit conversion issue in JsonLib.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Reviewed-by: Abner Chang 
---
 RedfishPkg/Library/JsonLib/JsonLib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c 
b/RedfishPkg/Library/JsonLib/JsonLib.c
index 5d75882004..69f2455c00 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.c
+++ b/RedfishPkg/Library/JsonLib/JsonLib.c
@@ -7,6 +7,7 @@
   Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
  Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -1112,5 +1113,5 @@ JsonGetType (
   IN EDKII_JSON_VALUE  JsonValue
   )
 {
-  return ((json_t *)JsonValue)->type;
+  return (EDKII_JSON_TYPE)(((json_t *)JsonValue)->type);
 }
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102101): https://edk2.groups.io/g/devel/message/102101
Mute This Topic: https://groups.io/mt/97922956/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/3] Fix variety issues in RedfishPkg

2023-03-29 Thread Nickle Wang via groups.io
Fix variety issues in RedfishPkg, including coverity issue,
typo, coding bugs and improve driver binding code flow in 
RedfishDiscoverDxe driver.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 

Nickle Wang (3):
  RedfishPkg/JsonLib: address coverity issue
  RedfishPkg: Redfish discover driver improvement
  RedfishPkg: fix config handler driver issues

 .../RedfishConfigHandlerDriver.inf|   4 +-
 .../RedfishDiscoverInternal.h |  20 ++-
 RedfishPkg/Library/JsonLib/JsonLib.c  |   3 +-
 .../RedfishConfigHandlerCommon.c  |  10 +-
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 144 --
 .../RedfishSmbiosHostInterface.c  |  13 +-
 6 files changed, 130 insertions(+), 64 deletions(-)

-- 
2.40.0.windows.1



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