Re: [edk2-devel][PATCH v2] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

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

-Original Message-
From: Kuo, Ted  
Sent: Friday, March 11, 2022 3:29 PM
To: devel@edk2.groups.io
Cc: Ni, Ray ; De, Debkumar ; Han, 
Harry ; West, Catharine 
Subject: [edk2-devel][PATCH v2] UefiCpuPkg: Support FFS3 GUID in 
SearchForBfvBase.asm

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3862
The new algorithm searches BFV address with FFS3 GUID first.
If not found, it will search BFV address with FFS2 GUID.

Cc: Ray Ni 
Cc: Debkumar De 
Cc: Harry Han 
Cc: Catharine West 
Signed-off-by: Ted Kuo 
---
 .../Vtf0/Bin/IA32/ResetVector.ia32.port80.raw  | Bin 484 -> 548 bytes
 .../ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw | Bin 468 -> 516 bytes
 .../Vtf0/Bin/IA32/ResetVector.ia32.serial.raw  | Bin 868 -> 932 bytes
 .../Bin/X64/PageTable1G/ResetVector.x64.port80.raw | Bin 12292 -> 12292 bytes
 .../Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw   | Bin 12292 -> 12292 bytes
 .../Bin/X64/PageTable1G/ResetVector.x64.serial.raw | Bin 12292 -> 12292 bytes
 .../Bin/X64/PageTable2M/ResetVector.x64.port80.raw | Bin 28676 -> 28676 bytes
 .../Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw   | Bin 28676 -> 28676 bytes
 .../Bin/X64/PageTable2M/ResetVector.x64.serial.raw | Bin 28676 -> 28676 bytes
 .../ResetVector/Vtf0/Ia32/SearchForBfvBase.asm |  51 +
 10 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw
index 
79b23c047bdc6e552d77d5c9e9aeae21ff04d91d..23254e83bf1a17dee9f38c235fcc9948624a7536
 100644
GIT binary patch
delta 227
zcmaFDyo9BG0uUG;*vZVmz@W<@z`$S)9RYyQbxs@7N`P<5a2DnL~gPkVYw4**r!cFFjcZU?HGY1)}sx(=wS^|0>c
z(xuH6Dh#FbI}bBQD3s24Eoykcv-u}uY2Sto!p|CZ><5C*qp$yU9^J6;8$wu(9TV=}(c8
zUjg)y@_Q48|1M?^0T*VtBLDzE4S>dJ0U!uIkRJe$|NsA!umLp*>x1c7{{R2!
Mtds8n6_W!3A^UepbpQYW

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw
index 
ce7faa502b858e99908bcdb397b776258205e1d5..18562d8f1f58601f66fcb0cbf2f994046ce48fde
 100644
GIT binary patch
delta 225
zcmcb@+`>{n0SF8a>||zOV9;d{U|_HXGX59EHUDHTRcoves5(#_Qu?g1LgcjVDc{n&
zjTI7m^W~3nW7tMv416`-n$r#(HT2Y{+C)y36^7FJorjqt6iR2j7BoEI+5D5Sv~S0L?*04scOHHHuk+|j`-wr}jBh5cDmQQY
zub0NpD4w=MnSsH9U+F;FtK9$p{|hkeaA0F#;8%K(wu6JA??`Yyb-n;_3H
Z0jOYd0;3s6_e+a^|Np<-GkG4P833r5W}5&2

delta 153
zcmZo+xxySY0SF8a=rRZ}FxWCMF#InvZmbZfc-qrb`ns_~#I{Suzw}XKg~UwL
zjTJJjhjlNPUTCgRVJJP-d6+puq4e-;>)Kp!4YKf1O8Px=-v1XZ$kpQMqv4f4ww*
zM)9;A$_xw+{7MJXUZqaXVU!VYn;_3H;s5{tAge)O@^>vc|Nj4fxn=S>Ml%58
CZbm==

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw
index 
6503a988abdac06f9aa88f0a65f2525e12233b0a..e4aa4fc30a32bc3d4d8d0e1726c43fdafef4a374
 100644
GIT binary patch
delta 214
zcmaFDwuF6xY`rV9;enmZ3=9mq3<3-cwm`=JqPXUt%%y6L6#`WUibG1DHCBk6wms!r
zdbhDcVsF0Ow9+e$6*8UAO=gvzeysvjRq?c^r}O|=df9ZChs+p#piKXj+s#*{0
zUM^kQT%p2HI=}NUbA&?ajMssN2Rxg9GM4tG?fT0+F{OjiW8`AFs>J_`LCD8
z@Lz#iWfnVuB+AHPBT}&|oJ`>~_Cj9^Ze*zRte#c}Yu;9;Yrq|zIvi^U${?Gsa
LFE>v%Vm1N**#ci0

delta 146
zcmV;D0B!%I2jm8j9YX~JF~BVV5C8x@00030ax;N=5P0Q`jCJdQcoaQ~98Y!Pfp{31
zHHl$$*@1W*g~Kh=brcl3=nSp^pmqCDm!4}B)UliB;letu_u|lBgKygUvv)3
zNbJp*n^t{?AX75Kkxp|qp$yU9^J6Bj4$8^oS9{Mya%q3`zYTOak(_!-61
zb|^D2IPfbSNPD$!a;u^OyQ4b81EBWFTNEw%UN^ja@b~}!mpT7{gvsPTiV}

delta 259
zcmZokXi3<>rVygbAi%(2%fP_!zsR_;LZISlPfzLV#tISJE*byQM~xK{Gfg`aOK
z$h02Tysxk81Z^i=0z<_Lw-!>@TaY`>8ANp?ZUi48fjh|6GZHF=g
zg9E?PfwWg`llLkr@O!Brcl3=nSp^pmqCDm!4}B)UliB;letu_u|lBgKygUvv)3
zNbJp*n^tq;e#OWC
z|0Nh+`|M`_}ygvDBH^Ya%+q?ID)Jx-M6i?fs%)sEluXG^o)w0RCiZc9u
z>I@fv+9p83MyJRzkL7q|Noc8|A2(?|NsAY0P%kh#bX|dM?DmecyvDa|7^m9
eje;9^6<$hx0&4}@$q*Le#xP;ROJ;}$oEHj+dD

delta 239
zcmZokXi3<>rr@K?Ai%(2%fP_!zsR_;LZISlPfzLV#tISJE*byQM~xK{Gfg`aOK
z$h02Tysxk81Z^i=0z<_Lw-!>>7a><5C*qp$yU9(`Fqxl19OQD^cag(*P}AOHWC
zV0bwdXz(3;+M~E8Tc~^4D}G_Hw|&%0<7X64+o8{
z27aXnX*)O=`fl_c=zGxjqVK|MS9OL7K>5iR6m9ulx4bm?_y7OP8W3SKSw=~Mal%Hy
e54;L5Z+)Bq0zms1!b02_CQNvF7$O1|o$orgJI)

diff --git 
a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw
index 
d9b051ff06d1d30b0dfd585e05e75c98ebd88b03..de97b858ddd03171114aa0efb1929796b1aa5435
 100644
GIT binary patch
delta 259
zcmZokXi3;0t5Cm}+3>(lW(EcZT?PRL23sKGe^FfXPv%m!#tMO|1H~bw)R4PTQXH
zExp@VA+a}KZd#tNCv=O(jCPrp_Hs;YR}(^Gl?sLHlW#=mqsP}NM+`W
zbuX7LZLUyZD4pMVm^nhBbjIsI!vmhpKN(B=(suo2o}8l4!FXWuTZLPUuO^>RoWeM5
za;%aYqwwSrau&;S2V#)%f$8
z>GijlZ2w=H|M~y_rS)GRQMY-&@>gz!m#;og00E$%7{Wr_7$!`3c^M)C7M=hAKvr~s

delta 209
zcmZokXi3;0tKi(rY;
zmfmcvkZC=vd%5<{+>8Z}c%n=HuhhKY6o}tjgcw(}u;w{Ecla!_~#!a58nO}3=aHC2hv`#Otw~z;SW}4DER#U{{$$QJWtt1G~&-|rq|zI
x{`>bb{m=jZFOB~KiL%Y_mA`UNR4`C@x$84nG0>R|VIgh|6DGV|3=x5t0RVO0UcCSS

diff --git 
a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw 

Re: [edk2-devel] [edk2-platforms Patch 3/3] OptionRomPkg: Remove all UGA support

2022-03-10 Thread Ni, Ray
Can you avoid changing the spaces?

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Guomin Jiang
Sent: Friday, March 11, 2022 9:01 AM
To: devel@edk2.groups.io
Cc: Ni, Ray 
Subject: [edk2-devel] [edk2-platforms Patch 3/3] OptionRomPkg: Remove all UGA 
support

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

Remove all UGA support

Cc: Ray Ni 
Signed-off-by: Guomin Jiang 
---
 .../CirrusLogic5430Dxe/CirrusLogic5430.c  | 522 +++---
 .../CirrusLogic5430Dxe/CirrusLogic5430.h  | 136 ++---
 .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf |   9 +-
 .../CirrusLogic5430UgaDraw.c  | 412 --
 Drivers/OptionRomPkg/OptionRomPkg.dec |   3 -
 5 files changed, 271 insertions(+), 811 deletions(-)
 delete mode 100644 
Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c

diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c 
b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
index 4e7830ea94b3..a2f2c2ff60f4 100644
--- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
+++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
@@ -11,7 +11,7 @@
   documentation on UGA for details on how to write a UGA driver that is able
   to function both in the EFI pre-boot environment and from the OS runtime.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -21,7 +21,7 @@
 //
 #include "CirrusLogic5430.h"
 
-EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL  gCirrusLogic5430DriverBinding = {
   CirrusLogic5430ControllerDriverSupported,
   CirrusLogic5430ControllerDriverStart,
   CirrusLogic5430ControllerDriverStop,
@@ -42,21 +42,21 @@ UINT8  AttributeController[21] = {
 ///
 /// Generic Graphics Controller Register Settings
 ///
-UINT8 GraphicsController[9] = {
+UINT8  GraphicsController[9] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, 0xFF
 };
 
 //
 // 640 x 480 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_640_480_256_60[28] = {
+UINT8  Crtc_640_480_256_60[28] = {
   0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,
   0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,
   0xff, 0x00, 0x00, 0x22
 };
 
-UINT16 Seq_640_480_256_60[15] = {
+UINT16  Seq_640_480_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e
 };
@@ -64,14 +64,14 @@ UINT16 Seq_640_480_256_60[15] = {
 //
 // 800 x 600 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_800_600_256_60[28] = {
+UINT8  Crtc_800_600_256_60[28] = {
   0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0,
   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,
   0xFF, 0x00, 0x00, 0x22
 };
 
-UINT16 Seq_800_600_256_60[15] = {
+UINT16  Seq_800_600_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e
 };
@@ -79,14 +79,14 @@ UINT16 Seq_800_600_256_60[15] = {
 //
 // 1024 x 768 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_1024_768_256_60[28] = {
+UINT8  Crtc_1024_768_256_60[28] = {
   0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD,
   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,
   0xFF, 0x4A, 0x00, 0x22
 };
 
-UINT16 Seq_1024_768_256_60[15] = {
+UINT16  Seq_1024_768_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e
 };
@@ -95,12 +95,11 @@ UINT16 Seq_1024_768_256_60[15] = {
 /// Table of supported video modes
 ///
 CIRRUS_LOGIC_5430_VIDEO_MODES  CirrusLogic5430VideoModes[] = {
-  {  640, 480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
-  {  800, 600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
+  { 640,  480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
+  { 800,  600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
   { 1024, 768, 8, 60, Crtc_1024_768_256_60, Seq_1024_768_256_60, 0xef }
 };
 
-
 /**
   CirrusLogic5430ControllerDriverSupported
 
@@ -111,15 +110,15 @@ CIRRUS_LOGIC_5430_VIDEO_MODES  
CirrusLogic5430VideoModes[] = {
 EFI_STATUS
 EFIAPI
 CirrusLogic5430ControllerDriverSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL*This,
-  IN EFI_HANDLE Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE   Controller,
+  IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
   )
 {
-  EFI_STATUS  Status;
-  EFI_PCI_IO_PROTOCOL *PciIo;
-  PCI_TYPE00  Pci;
-  EFI_DEV_PATH*Node;
+  EFI_STATUS   Status;
+  EFI_PCI_IO_PROTOCOL  *PciIo;
+  PCI_TYPE00   Pci;
+  EFI_DEV_PATH *Node;
 
   //
   // 

[edk2-devel][PATCH v2] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

2022-03-10 Thread Kuo, Ted
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3862
The new algorithm searches BFV address with FFS3 GUID first.
If not found, it will search BFV address with FFS2 GUID.

Cc: Ray Ni 
Cc: Debkumar De 
Cc: Harry Han 
Cc: Catharine West 
Signed-off-by: Ted Kuo 
---
 .../Vtf0/Bin/IA32/ResetVector.ia32.port80.raw  | Bin 484 -> 548 bytes
 .../ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw | Bin 468 -> 516 bytes
 .../Vtf0/Bin/IA32/ResetVector.ia32.serial.raw  | Bin 868 -> 932 bytes
 .../Bin/X64/PageTable1G/ResetVector.x64.port80.raw | Bin 12292 -> 12292 bytes
 .../Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw   | Bin 12292 -> 12292 bytes
 .../Bin/X64/PageTable1G/ResetVector.x64.serial.raw | Bin 12292 -> 12292 bytes
 .../Bin/X64/PageTable2M/ResetVector.x64.port80.raw | Bin 28676 -> 28676 bytes
 .../Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw   | Bin 28676 -> 28676 bytes
 .../Bin/X64/PageTable2M/ResetVector.x64.serial.raw | Bin 28676 -> 28676 bytes
 .../ResetVector/Vtf0/Ia32/SearchForBfvBase.asm |  51 +
 10 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw
index 
79b23c047bdc6e552d77d5c9e9aeae21ff04d91d..23254e83bf1a17dee9f38c235fcc9948624a7536
 100644
GIT binary patch
delta 227
zcmaFDyo9BG0uUG;*vZVmz@W<@z`$S)9RYyQbxs@7N`P<5a2DnL~gPkVYw4**r!cFFjcZU?HGY1)}sx(=wS^|0>c
z(xuH6Dh#FbI}bBQD3s24Eoykcv-u}uY2Sto!p|CZ><5C*qp$yU9^J6;8$wu(9TV=}(c8
zUjg)y@_Q48|1M?^0T*VtBLDzE4S>dJ0U!uIkRJe$|NsA!umLp*>x1c7{{R2!
Mtds8n6_W!3A^UepbpQYW

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw
index 
ce7faa502b858e99908bcdb397b776258205e1d5..18562d8f1f58601f66fcb0cbf2f994046ce48fde
 100644
GIT binary patch
delta 225
zcmcb@+`>{n0SF8a>||zOV9;d{U|_HXGX59EHUDHTRcoves5(#_Qu?g1LgcjVDc{n&
zjTI7m^W~3nW7tMv416`-n$r#(HT2Y{+C)y36^7FJorjqt6iR2j7BoEI+5D5Sv~S0L?*04scOHHHuk+|j`-wr}jBh5cDmQQY
zub0NpD4w=MnSsH9U+F;FtK9$p{|hkeaA0F#;8%K(wu6JA??`Yyb-n;_3H
Z0jOYd0;3s6_e+a^|Np<-GkG4P833r5W}5&2

delta 153
zcmZo+xxySY0SF8a=rRZ}FxWCMF#InvZmbZfc-qrb`ns_~#I{Suzw}XKg~UwL
zjTJJjhjlNPUTCgRVJJP-d6+puq4e-;>)Kp!4YKf1O8Px=-v1XZ$kpQMqv4f4ww*
zM)9;A$_xw+{7MJXUZqaXVU!VYn;_3H;s5{tAge)O@^>vc|Nj4fxn=S>Ml%58
CZbm==

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw
index 
6503a988abdac06f9aa88f0a65f2525e12233b0a..e4aa4fc30a32bc3d4d8d0e1726c43fdafef4a374
 100644
GIT binary patch
delta 214
zcmaFDwuF6xY`rV9;enmZ3=9mq3<3-cwm`=JqPXUt%%y6L6#`WUibG1DHCBk6wms!r
zdbhDcVsF0Ow9+e$6*8UAO=gvzeysvjRq?c^r}O|=df9ZChs+p#piKXj+s#*{0
zUM^kQT%p2HI=}NUbA&?ajMssN2Rxg9GM4tG?fT0+F{OjiW8`AFs>J_`LCD8
z@Lz#iWfnVuB+AHPBT}&|oJ`>~_Cj9^Ze*zRte#c}Yu;9;Yrq|zIvi^U${?Gsa
LFE>v%Vm1N**#ci0

delta 146
zcmV;D0B!%I2jm8j9YX~JF~BVV5C8x@00030ax;N=5P0Q`jCJdQcoaQ~98Y!Pfp{31
zHHl$$*@1W*g~Kh=brcl3=nSp^pmqCDm!4}B)UliB;letu_u|lBgKygUvv)3
zNbJp*n^t{?AX75Kkxp|qp$yU9^J6Bj4$8^oS9{Mya%q3`zYTOak(_!-61
zb|^D2IPfbSNPD$!a;u^OyQ4b81EBWFTNEw%UN^ja@b~}!mpT7{gvsPTiV}

delta 259
zcmZokXi3<>rVygbAi%(2%fP_!zsR_;LZISlPfzLV#tISJE*byQM~xK{Gfg`aOK
z$h02Tysxk81Z^i=0z<_Lw-!>@TaY`>8ANp?ZUi48fjh|6GZHF=g
zg9E?PfwWg`llLkr@O!Brcl3=nSp^pmqCDm!4}B)UliB;letu_u|lBgKygUvv)3
zNbJp*n^tq;e#OWC
z|0Nh+`|M`_}ygvDBH^Ya%+q?ID)Jx-M6i?fs%)sEluXG^o)w0RCiZc9u
z>I@fv+9p83MyJRzkL7q|Noc8|A2(?|NsAY0P%kh#bX|dM?DmecyvDa|7^m9
eje;9^6<$hx0&4}@$q*Le#xP;ROJ;}$oEHj+dD

delta 239
zcmZokXi3<>rr@K?Ai%(2%fP_!zsR_;LZISlPfzLV#tISJE*byQM~xK{Gfg`aOK
z$h02Tysxk81Z^i=0z<_Lw-!>>7a><5C*qp$yU9(`Fqxl19OQD^cag(*P}AOHWC
zV0bwdXz(3;+M~E8Tc~^4D}G_Hw|&%0<7X64+o8{
z27aXnX*)O=`fl_c=zGxjqVK|MS9OL7K>5iR6m9ulx4bm?_y7OP8W3SKSw=~Mal%Hy
e54;L5Z+)Bq0zms1!b02_CQNvF7$O1|o$orgJI)

diff --git 
a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw
index 
d9b051ff06d1d30b0dfd585e05e75c98ebd88b03..de97b858ddd03171114aa0efb1929796b1aa5435
 100644
GIT binary patch
delta 259
zcmZokXi3;0t5Cm}+3>(lW(EcZT?PRL23sKGe^FfXPv%m!#tMO|1H~bw)R4PTQXH
zExp@VA+a}KZd#tNCv=O(jCPrp_Hs;YR}(^Gl?sLHlW#=mqsP}NM+`W
zbuX7LZLUyZD4pMVm^nhBbjIsI!vmhpKN(B=(suo2o}8l4!FXWuTZLPUuO^>RoWeM5
za;%aYqwwSrau&;S2V#)%f$8
z>GijlZ2w=H|M~y_rS)GRQMY-&@>gz!m#;og00E$%7{Wr_7$!`3c^M)C7M=hAKvr~s

delta 209
zcmZokXi3;0tKi(rY;
zmfmcvkZC=vd%5<{+>8Z}c%n=HuhhKY6o}tjgcw(}u;w{Ecla!_~#!a58nO}3=aHC2hv`#Otw~z;SW}4DER#U{{$$QJWtt1G~&-|rq|zI
x{`>bb{m=jZFOB~KiL%Y_mA`UNR4`C@x$84nG0>R|VIgh|6DGV|3=x5t0RVO0UcCSS

diff --git 
a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw 
b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw
index 
0e53a574fab74db6973d7ea41a6a495266a4d0ae..23c58501b5a48448ffcd2757310442ef33f45fa0
 100644
GIT binary patch
delta 291
zcmZp9z}WJDaRXaI{Z3{E1_oUQ0R{$JAme{gT=P%nQnkhkfvN+=A*Ih6D@0D)p7Jfd
z+gKs7H(zdA>6OL`na<}Xvr13DRspK2c-qrbdH|@(woAspbURShOw-Q9(se*pt%r3l

Re: [edk2-devel] [edk2-platforms Patch 1/3] PurleyOpenBoardPkg: Remove All UGA support

2022-03-10 Thread Ni, Ray
can you avoid the unnecessary changes (e.g.: spacing)?

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Guomin Jiang
Sent: Friday, March 11, 2022 9:01 AM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Chiu, Chasel 

Subject: [edk2-devel] [edk2-platforms Patch 1/3] PurleyOpenBoardPkg: Remove All 
UGA support

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

Remove all UGA support in PurleyOpenBoardPkg

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Guomin Jiang 
---
 .../Library/BoardBdsHookLib/BoardBdsHook.h| 70 +--
 1 file changed, 33 insertions(+), 37 deletions(-)

diff --git 
a/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
 
b/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
index fd943b3ca793..05e0a3f8920f 100644
--- 
a/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
+++ 
b/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for BDS Hook Library
 
-Copyright (c) 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -55,13 +54,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 ///
 /// ConnectType
 ///
-#define CONSOLE_OUT 0x0001
-#define STD_ERROR   0x0002
-#define CONSOLE_IN  0x0004
-#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
+#define CONSOLE_OUT  0x0001
+#define STD_ERROR0x0002
+#define CONSOLE_IN   0x0004
+#define CONSOLE_ALL  (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
 
-extern EFI_GUID  gUefiShellFileGuid;
-extern EFI_BOOT_MODE gBootMode;
+extern EFI_GUID   gUefiShellFileGuid;
+extern EFI_BOOT_MODE  gBootMode;
 
 #define gPciRootBridge \
   { \
@@ -83,67 +82,66 @@ extern EFI_BOOT_MODE gBootMode;
   }
 
 typedef struct {
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  UINTN ConnectType;
+  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
+  UINTN   ConnectType;
 } BDS_CONSOLE_CONNECT_ENTRY;
 
 //
 // Platform Root Bridge
 //
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_ROOT_BRIDGE_DEVICE_PATH;
 
 //
 // Below is the platform console device path
 //
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   IsaBridge;
-  ACPI_HID_DEVICE_PATH  Keyboard;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH IsaBridge;
+  ACPI_HID_DEVICE_PATHKeyboard;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_KEYBOARD_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH PciDevice;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_ONBOARD_CONTROLLER_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   Pci0Device;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH Pci0Device;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_PEG_ROOT_CONTROLLER_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciBridge;
-  PCI_DEVICE_PATH   PciDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH PciBridge;
+  PCI_DEVICE_PATH PciDevice;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_PCI_CONTROLLER_DEVICE_PATH;
 
 //
 // Below is the boot option device path
 //
 
-#define CLASS_HID   3
-#define SUBCLASS_BOOT   1
-#define PROTOCOL_KEYBOARD   1
+#define CLASS_HID  3
+#define SUBCLASS_BOOT  1
+#define PROTOCOL_KEYBOARD  1
 
 typedef struct {
-  USB_CLASS_DEVICE_PATH   UsbClass;
-  EFI_DEVICE_PATH_PROTOCOLEnd;
+  USB_CLASS_DEVICE_PATH   UsbClass;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } USB_CLASS_FORMAT_DEVICE_PATH;
 
-extern USB_CLASS_FORMAT_DEVICE_PATH  gUsbClassKeyboardDevicePath;
+extern USB_CLASS_FORMAT_DEVICE_PATH  gUsbClassKeyboardDevicePath;
 
 //
 // Platform BDS Functions
 //
 
-
 /**
   Perform the memory test base on the memory test intensive level,
   and update the memory resource.
@@ -156,7 +154,7 @@ extern USB_CLASS_FORMAT_DEVICE_PATH  
gUsbClassKeyboardDevicePath;
 **/
 EFI_STATUS
 

Re: [edk2-devel] [PATCH V7 00/37] Enable Intel TDX in OvmfPkg (Config-A)

2022-03-10 Thread Min Xu
On March 11, 2022 11:20 AM, Gao Liming wrote:
> Min:
>  I have one minor comment for TdxLib.h. This header file doesn't need to 
> include
> below header files. Other patches in MdePkg are good to me. Reviewed-by:
> Liming Gao 
> 
> #include 
> #include 
> #include 
> #include 
> 
Thanks for the reminder. They will be deleted in the next version.

Thanks
Min


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




Re: [edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue

2022-03-10 Thread Abner Chang
Hi Wenyi,
Please add my RB in the commit message and create the PR against edk2, let me 
know the link to PR as well.

Thanks,
Abner

From: Chang, Abner (HPS SW/FW Technologist)
Sent: Friday, March 11, 2022 1:48 PM
To: Wenyi Xie ; devel@edk2.groups.io 
; Wang, Nickle (Server BIOS) 
Cc: songdongku...@huawei.com 
Subject: RE: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue

Thanks for catching this.

Reviewed-by: Abner Chang 

> -Original Message-
> From: Wenyi Xie 
> Sent: Thursday, March 10, 2022 7:26 PM
> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
> ; Wang, Nickle (Server BIOS)
> 
> Cc: songdongku...@huawei.com; xiewen...@huawei.com
> Subject: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
>
> The calloc memory is not free when function collectionEvalOp
> return in the halfway.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Signed-off-by: Wenyi Xie 
> ---
>  RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16
> +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git
> a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> index 3f2b83e834d0..6c6e2246abe3 100644
> --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> @@ -620,6 +620,7 @@ collectionEvalOp (
>if (((*StatusCode == NULL) && (members == NULL)) ||
>((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) ||
> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
>{
> +free (valid);
>  return members;
>}
>
> @@ -633,6 +634,7 @@ collectionEvalOp (
>  if (((*StatusCode == NULL) && (tmp == NULL)) ||
>  ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) ||
> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
>  {
> +  free (valid);
>return tmp;
>  }
>
> @@ -658,19 +660,15 @@ collectionEvalOp (
>
>cleanupPayload (members);
>if (validCount == 0) {
> -free (valid);
> -return NULL;
> -  }
> -
> -  if (validCount == 1) {
> +ret = NULL;
> +  } else if (validCount == 1) {
>  ret = valid[0];
> -free (valid);
> -return ret;
>} else {
>  ret = createCollection (payload->service, validCount, valid);
> -free (valid);
> -return ret;
>}
> +
> +  free (valid);
> +  return ret;
>  }
>
>  static redfishPayload *
> --
> 2.20.1.windows.1



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




[edk2-devel] [edk2][PATCH V1 1/1] ArmPkg: Handle warm reboot request correctly

2022-03-10 Thread Pranav Madhu
The warm reboot requests are mapped to cold reboot as the power control
module was not capable of handling the warm reboot requests in the
legacy implementation. The support for warm reboot support is added into
the power control module. To support warm reset, update
ArmPsciResetSystemLib, and there by invoke the PSCI call with parameters
for warm reboot.

Signed-off-by: Pranav Madhu 
---
 ArmPkg/Include/IndustryStandard/ArmStdSmc.h  | 1 +
 ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c | 7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

Changes since V1:
- Addressed comments from Ard

Link to github branch for this patch -
https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot

diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h 
b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
index 655edc21b205..90123efcbd56 100644
--- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
+++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
@@ -93,6 +93,7 @@
 #define ARM_SMC_ID_PSCI_MIGRATE_AARCH320x8405
 #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x8408
 #define ARM_SMC_ID_PSCI_SYSTEM_RESET   0x8409
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH32  0x8412
 
 /* The current PSCI version is:  0.2 */
 #define ARM_SMC_PSCI_VERSION_MAJOR  0
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c 
b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
index 7bcd34849507..211941c57938 100644
--- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
@@ -45,10 +45,13 @@ LibResetSystem (
   ARM_SMC_ARGS  ArmSmcArgs;
 
   switch (ResetType) {
+case EfiResetWarm:
+  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH32;
+  ArmSmcArgs.Arg1 = 0;
+  ArmSmcArgs.Arg2 = 0;
+  break;
 case EfiResetPlatformSpecific:
 // Map the platform specific reset as reboot
-case EfiResetWarm:
-// Map a warm reset into a cold reset
 case EfiResetCold:
   // Send a PSCI 0.2 SYSTEM_RESET command
   ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87454): https://edk2.groups.io/g/devel/message/87454
Mute This Topic: https://groups.io/mt/89685482/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] ArmPkg: Handle warm reboot request correctly

2022-03-10 Thread Pranav Madhu
Hi Ard,

Thanks for your suggestions. Please find my reply inline.

Regards,
Pranav

> -Original Message-
> From: Ard Biesheuvel 
> Sent: Thursday, March 10, 2022 8:56 PM
> To: Pranav Madhu 
> Cc: edk2-devel-groups-io ; Ard Biesheuvel
> ; Sami Mujawar 
> Subject: Re: [edk2][PATCH V1 1/1] ArmPkg: Handle warm reboot request
> correctly
> 
> On Thu, 10 Mar 2022 at 14:10, Pranav Madhu 
> wrote:
> >
> > The warm reboot requests are mapped to cold reboot as the power
> > control module was not capable of handling the warm reboot requests in
> > the legacy implementation. The support for warm reboot support is
> > added into the power control module. To support warm reset, update
> > ArmPsciResetSystemLib, and there by invoke the PSCI call with
> > parameters for warm reboot.
> >
> > Signed-off-by: Pranav Madhu 
> 
> What happens on 32-bit platforms with this change?

Will change this to PSCI_SYSTEM_RESET2_AARCH32, as this is compatible with 
AARCH64 as well.

> 
> What happens if the firmware does not implement
> ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64?

As per PSCI 1.1 specification, what I understood is before invoking 
SYSTEM_RESET2, the OS should query the PSCI capabilities using PSCI_FEATURES 
for SYSTEM_RESET2 support. The OS should invoke RESET2 only if PSCI_FEATURES 
returns 0. If the OS is invoking this call without querying the features, PSCI 
will return UNSUPPORTED.

> 
> > ---
> >  ArmPkg/Include/IndustryStandard/ArmStdSmc.h  | 1 +
> >  ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c | 7
> > +--
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > Link to github branch for this patch -
> > https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot
> >
> > diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > index 655edc21b205..c9059dead6e9 100644
> > --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > @@ -93,6 +93,7 @@
> >  #define ARM_SMC_ID_PSCI_MIGRATE_AARCH320x8405
> >  #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x8408
> >  #define ARM_SMC_ID_PSCI_SYSTEM_RESET   0x8409
> > +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64  0xc412
> >
> >  /* The current PSCI version is:  0.2 */  #define
> > ARM_SMC_PSCI_VERSION_MAJOR  0 diff --git
> > a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > index 7bcd34849507..27e048ba0f7a 100644
> > --- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > +++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > @@ -45,10 +45,13 @@ LibResetSystem (
> >ARM_SMC_ARGS  ArmSmcArgs;
> >
> >switch (ResetType) {
> > +case EfiResetWarm:
> > +  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
> > +  ArmSmcArgs.Arg1 = 0;
> > +  ArmSmcArgs.Arg2 = 0;
> > +  break;
> >  case EfiResetPlatformSpecific:
> >  // Map the platform specific reset as reboot
> > -case EfiResetWarm:
> > -// Map a warm reset into a cold reset
> >  case EfiResetCold:
> >// Send a PSCI 0.2 SYSTEM_RESET command
> >ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
> > --
> > 2.17.1
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87453): https://edk2.groups.io/g/devel/message/87453
Mute This Topic: https://groups.io/mt/89685482/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] ArmPkg: Handle warm reboot request correctly

2022-03-10 Thread Pranav Madhu
Hi Sami,

Thanks for your comments. Please find my reply inline.

Regards,
Pranav

> -Original Message-
> From: Sami Mujawar 
> Sent: Thursday, March 10, 2022 9:01 PM
> To: Pranav Madhu ; devel@edk2.groups.io
> Cc: Ard Biesheuvel ; nd 
> Subject: Re: [edk2][PATCH V1 1/1] ArmPkg: Handle warm reboot request
> correctly
> 
> Hi Pranav,
> 
> Thank you for this patch.
> 
> Please find my response inline marked [SAMI].
> 
> Regards,
> 
> Sami Mujawar
> 
> 
> On 10/03/2022 01:10 PM, Pranav Madhu wrote:
> > The warm reboot requests are mapped to cold reboot as the power
> > control module was not capable of handling the warm reboot requests in
> > the legacy implementation. The support for warm reboot support is
> > added into the power control module. To support warm reset, update
> > ArmPsciResetSystemLib, and there by invoke the PSCI call with
> > parameters for warm reboot.
> >
> > Signed-off-by: Pranav Madhu 
> > ---
> >   ArmPkg/Include/IndustryStandard/ArmStdSmc.h  | 1 +
> >   ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c | 7
> +--
> >   2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > Link to github branch for this patch -
> > https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot
> >
> > diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > index 655edc21b205..c9059dead6e9 100644
> > --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> > @@ -93,6 +93,7 @@
> >   #define ARM_SMC_ID_PSCI_MIGRATE_AARCH320x8405
> >   #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x8408
> >   #define ARM_SMC_ID_PSCI_SYSTEM_RESET   0x8409
> > +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64  0xc412
> >
> >   /* The current PSCI version is:  0.2 */
> >   #define ARM_SMC_PSCI_VERSION_MAJOR  0 diff --git
> > a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > index 7bcd34849507..27e048ba0f7a 100644
> > --- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > +++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> > @@ -45,10 +45,13 @@ LibResetSystem (
> > ARM_SMC_ARGS  ArmSmcArgs;
> >
> > switch (ResetType) {
> > +case EfiResetWarm:
> > +  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
> > +  ArmSmcArgs.Arg1 = 0;
> > +  ArmSmcArgs.Arg2 = 0;
> > +  break;
> [SAMI] SYSTEM_RESET2 is an optional feature and if not supported would
> return NOT_SUPPORTED. So, if a platform does not support SYSTEM_RESET2,
> should the code here fall back to SYSTEM_RESET?
> According to the PSCI specification, it is the responsibility of the OS to 
> check
> that SYSTEM_RESET2 is supported before calling SYSTEM_RESET2 (I believe this
> is applicable for the case where UEFI is not used to boot the OS). However, if
> the runtime service ResetSystem() is invoked by the OS requesting a warm
> reset, is it not the firmware's responsibility to ensure that SYSTEM_RESET2 is
> supported? Any thoughts?

Right, from PSCI specification, what I understood is before invoking 
SYSTEM_RESET2, the OS should query the PSCI capabilities using PSCI_FEATURES 
for SYSTEM_RESET2. The OS should invoke RESET2 only if PSCI_FEATURES returns 0. 
From spec, what I understood is it is not the responsibility of firmware. If OS 
issue RESET2 without querying FEATURES, the only option for firmware is to 
return NOT_SUPPORTED.

> [/SAMI]
> >   case EfiResetPlatformSpecific:
> >   // Map the platform specific reset as reboot
> > -case EfiResetWarm:
> > -// Map a warm reset into a cold reset
> >   case EfiResetCold:
> > // Send a PSCI 0.2 SYSTEM_RESET command
> > ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;



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




Re: [edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue

2022-03-10 Thread Abner Chang
Thanks for catching this.

Reviewed-by: Abner Chang 

> -Original Message-
> From: Wenyi Xie 
> Sent: Thursday, March 10, 2022 7:26 PM
> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
> ; Wang, Nickle (Server BIOS)
> 
> Cc: songdongku...@huawei.com; xiewen...@huawei.com
> Subject: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
> 
> The calloc memory is not free when function collectionEvalOp
> return in the halfway.
> 
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Signed-off-by: Wenyi Xie 
> ---
>  RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16
> +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git
> a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> index 3f2b83e834d0..6c6e2246abe3 100644
> --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
> @@ -620,6 +620,7 @@ collectionEvalOp (
>if (((*StatusCode == NULL) && (members == NULL)) ||
>((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) ||
> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
>{
> +free (valid);
>  return members;
>}
> 
> @@ -633,6 +634,7 @@ collectionEvalOp (
>  if (((*StatusCode == NULL) && (tmp == NULL)) ||
>  ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) ||
> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
>  {
> +  free (valid);
>return tmp;
>  }
> 
> @@ -658,19 +660,15 @@ collectionEvalOp (
> 
>cleanupPayload (members);
>if (validCount == 0) {
> -free (valid);
> -return NULL;
> -  }
> -
> -  if (validCount == 1) {
> +ret = NULL;
> +  } else if (validCount == 1) {
>  ret = valid[0];
> -free (valid);
> -return ret;
>} else {
>  ret = createCollection (payload->service, validCount, valid);
> -free (valid);
> -return ret;
>}
> +
> +  free (valid);
> +  return ret;
>  }
> 
>  static redfishPayload *
> --
> 2.20.1.windows.1



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




[edk2-devel] [PATCH v2 5/6] OvmfPkg/VirtioGpuDxe: move code to GopInitialize

2022-03-10 Thread Gerd Hoffmann
Add new function to initialize the GOP, move over setup code.  Handle
initialization first, specifically before calling GopQueryMode(), so
GopQueryMode is never called before GopInitialize() did complete.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/VirtioGpuDxe/Gop.c | 47 ++
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 337a7e19bffa..05daefcbfbc8 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -192,6 +192,32 @@ STATIC CONST GOP_RESOLUTION  mGopResolutions[] = {
 #define VGPU_GOP_FROM_GOP(GopPointer) \
   CR (GopPointer, VGPU_GOP, Gop, VGPU_GOP_SIG)
 
+STATIC
+VOID
+EFIAPI
+GopInitialize (
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL  *This
+  )
+{
+  VGPU_GOP  *VgpuGop;
+
+  VgpuGop = VGPU_GOP_FROM_GOP (This);
+
+  //
+  // Set up the Gop -> GopMode -> GopModeInfo pointer chain, and the other
+  // (nonzero) constant fields.
+  //
+  // No direct framebuffer access is supported, only Blt() is.
+  //
+  VgpuGop->Gop.Mode = >GopMode;
+
+  VgpuGop->GopMode.MaxMode= (UINT32)(ARRAY_SIZE (mGopResolutions));
+  VgpuGop->GopMode.Info   = >GopModeInfo;
+  VgpuGop->GopMode.SizeOfInfo = sizeof VgpuGop->GopModeInfo;
+
+  VgpuGop->GopModeInfo.PixelFormat = PixelBltOnly;
+}
+
 //
 // EFI_GRAPHICS_OUTPUT_PROTOCOL member functions.
 //
@@ -207,7 +233,7 @@ GopQueryMode (
 {
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopModeInfo;
 
-  if (ModeNumber >= ARRAY_SIZE (mGopResolutions)) {
+  if (ModeNumber >= This->Mode->MaxMode) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -247,6 +273,11 @@ GopSetMode (
   EFI_STATUS  Status;
   EFI_STATUS  Status2;
 
+  if (!This->Mode) {
+// SetMode() call in InitVgpuGop() triggers this.
+GopInitialize (This);
+  }
+
   Status = GopQueryMode (This, ModeNumber, , );
   if (Status != EFI_SUCCESS) {
 return Status;
@@ -259,20 +290,6 @@ GopSetMode (
   // calls.
   //
   if (VgpuGop->ResourceId == 0) {
-//
-// Set up the Gop -> GopMode -> GopModeInfo pointer chain, and the other
-// (nonzero) constant fields.
-//
-// No direct framebuffer access is supported, only Blt() is.
-//
-VgpuGop->Gop.Mode = >GopMode;
-
-VgpuGop->GopMode.MaxMode= (UINT32)(ARRAY_SIZE (mGopResolutions));
-VgpuGop->GopMode.Info   = >GopModeInfo;
-VgpuGop->GopMode.SizeOfInfo = sizeof VgpuGop->GopModeInfo;
-
-VgpuGop->GopModeInfo.PixelFormat = PixelBltOnly;
-
 //
 // This is the first time we create a host side resource.
 //
-- 
2.35.1



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




[edk2-devel] [PATCH v2 6/6] OvmfPkg/VirtioGpuDxe: query native display resolution from host

2022-03-10 Thread Gerd Hoffmann
Try query native display resolution from the host.  When successfull
setup PcdVideoHorizontalResolution and PcdVideoVerticalResolution
accordingly and add the video mode to the GOP mode list if needed.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/VirtioGpuDxe/VirtioGpu.inf |  6 ++
 OvmfPkg/VirtioGpuDxe/VirtioGpu.h   |  6 ++
 OvmfPkg/VirtioGpuDxe/Gop.c | 92 --
 3 files changed, 99 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf 
b/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
index 9e66bcd4b97f..d88c87e129f0 100644
--- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
+++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
@@ -25,6 +25,7 @@ [Sources]
 
 [Packages]
   MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
@@ -43,3 +44,8 @@ [Protocols]
   gEfiGraphicsOutputProtocolGuid ## BY_START
   gEfiPciIoProtocolGuid  ## TO_START
   gVirtioDeviceProtocolGuid  ## TO_START
+
+[Pcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution
diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
index 1d781088bb3f..45da56415297 100644
--- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
+++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
@@ -151,6 +151,12 @@ struct VGPU_GOP_STRUCT {
   // BackingStore is non-NULL.
   //
   VOID*BackingStoreMap;
+
+  //
+  // native display resolution
+  //
+  UINT32  NativeXRes;
+  UINT32  NativeYRes;
 };
 
 //
diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 05daefcbfbc8..70a81c10c8b5 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -9,6 +9,7 @@
 **/
 
 #include 
+#include 
 
 #include "VirtioGpu.h"
 
@@ -192,6 +193,47 @@ STATIC CONST GOP_RESOLUTION  mGopResolutions[] = {
 #define VGPU_GOP_FROM_GOP(GopPointer) \
   CR (GopPointer, VGPU_GOP, Gop, VGPU_GOP_SIG)
 
+STATIC
+VOID
+EFIAPI
+GopNativeResolution (
+  IN  VGPU_GOP  *VgpuGop,
+  OUT UINT32*XRes,
+  OUT UINT32*YRes
+  )
+{
+  volatile VIRTIO_GPU_RESP_DISPLAY_INFO  DisplayInfo;
+  EFI_STATUS Status;
+  UINTN  Index;
+
+  Status = VirtioGpuGetDisplayInfo (VgpuGop->ParentBus, );
+  if (Status != EFI_SUCCESS) {
+return;
+  }
+
+  for (Index = 0; Index < VIRTIO_GPU_MAX_SCANOUTS; Index++) {
+if (!DisplayInfo.Pmodes[Index].Enabled ||
+!DisplayInfo.Pmodes[Index].Rectangle.Width ||
+!DisplayInfo.Pmodes[Index].Rectangle.Height)
+{
+  continue;
+}
+
+DEBUG ((
+  DEBUG_INFO,
+  "%a: #%d: %dx%d\n",
+  __FUNCTION__,
+  Index,
+  DisplayInfo.Pmodes[Index].Rectangle.Width,
+  DisplayInfo.Pmodes[Index].Rectangle.Height
+  ));
+if ((*XRes == 0) || (*YRes == 0)) {
+  *XRes = DisplayInfo.Pmodes[Index].Rectangle.Width;
+  *YRes = DisplayInfo.Pmodes[Index].Rectangle.Height;
+}
+  }
+}
+
 STATIC
 VOID
 EFIAPI
@@ -199,7 +241,9 @@ GopInitialize (
   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL  *This
   )
 {
-  VGPU_GOP  *VgpuGop;
+  VGPU_GOP*VgpuGop;
+  EFI_STATUS  Status;
+  UINT32  XRes = 0, YRes = 0, Index;
 
   VgpuGop = VGPU_GOP_FROM_GOP (This);
 
@@ -216,6 +260,37 @@ GopInitialize (
   VgpuGop->GopMode.SizeOfInfo = sizeof VgpuGop->GopModeInfo;
 
   VgpuGop->GopModeInfo.PixelFormat = PixelBltOnly;
+
+  //
+  // query host for display resolution
+  //
+  GopNativeResolution (VgpuGop, , );
+  if ((XRes == 0) || (YRes == 0)) {
+return;
+  }
+
+  if (PcdGet8 (PcdVideoResolutionSource) == 0) {
+Status = PcdSet32S (PcdVideoHorizontalResolution, XRes);
+ASSERT_RETURN_ERROR (Status);
+Status = PcdSet32S (PcdVideoVerticalResolution, YRes);
+ASSERT_RETURN_ERROR (Status);
+Status = PcdSet8S (PcdVideoResolutionSource, 2);
+ASSERT_RETURN_ERROR (Status);
+  }
+
+  VgpuGop->NativeXRes = XRes;
+  VgpuGop->NativeYRes = YRes;
+  for (Index = 0; Index < ARRAY_SIZE (mGopResolutions); Index++) {
+if ((mGopResolutions[Index].Width == XRes) &&
+(mGopResolutions[Index].Height == YRes))
+{
+  // native resolution already is in mode list
+  return;
+}
+  }
+
+  // add to mode list
+  VgpuGop->GopMode.MaxMode++;
 }
 
 //
@@ -242,10 +317,17 @@ GopQueryMode (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  GopModeInfo->HorizontalResolution = mGopResolutions[ModeNumber].Width;
-  GopModeInfo->VerticalResolution   = mGopResolutions[ModeNumber].Height;
-  GopModeInfo->PixelFormat  = PixelBltOnly;
-  GopModeInfo->PixelsPerScanLine= mGopResolutions[ModeNumber].Width;
+  if (ModeNumber < ARRAY_SIZE (mGopResolutions)) {
+GopModeInfo->HorizontalResolution = mGopResolutions[ModeNumber].Width;
+GopModeInfo->VerticalResolution   = mGopResolutions[ModeNumber].Height;
+  } else {
+VGPU_GOP  *VgpuGop = 

[edk2-devel] [PATCH v2 4/6] OvmfPkg/VirtioGpuDxe: use GopQueryMode in GopSetMode

2022-03-10 Thread Gerd Hoffmann
Call GopQueryMode() in GopSetMode(), use the ModeInfo returned when
setting the mode.  This is needed to properly handle modes which are
not on the static mGopResolutions list.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/VirtioGpuDxe/Gop.c | 60 --
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 2c15d542e3b1..337a7e19bffa 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -234,19 +234,22 @@ GopSetMode (
   IN  UINT32ModeNumber
   )
 {
-  VGPU_GOP  *VgpuGop;
-  UINT32NewResourceId;
-  UINTN NewNumberOfBytes;
-  UINTN NewNumberOfPages;
-  VOID  *NewBackingStore;
-  EFI_PHYSICAL_ADDRESS  NewBackingStoreDeviceAddress;
-  VOID  *NewBackingStoreMap;
+  VGPU_GOP  *VgpuGop;
+  UINT32NewResourceId;
+  UINTN NewNumberOfBytes;
+  UINTN NewNumberOfPages;
+  VOID  *NewBackingStore;
+  EFI_PHYSICAL_ADDRESS  NewBackingStoreDeviceAddress;
+  VOID  *NewBackingStoreMap;
+  UINTN SizeOfInfo;
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopModeInfo;
 
   EFI_STATUS  Status;
   EFI_STATUS  Status2;
 
-  if (ModeNumber >= ARRAY_SIZE (mGopResolutions)) {
-return EFI_UNSUPPORTED;
+  Status = GopQueryMode (This, ModeNumber, , );
+  if (Status != EFI_SUCCESS) {
+return Status;
   }
 
   VgpuGop = VGPU_GOP_FROM_GOP (This);
@@ -292,8 +295,8 @@ GopSetMode (
  VgpuGop->ParentBus,// VgpuDev
  NewResourceId, // ResourceId
  VirtioGpuFormatB8G8R8X8Unorm,  // Format
- mGopResolutions[ModeNumber].Width, // Width
- mGopResolutions[ModeNumber].Height // Height
+ GopModeInfo->HorizontalResolution, // Width
+ GopModeInfo->VerticalResolution// Height
  );
   if (EFI_ERROR (Status)) {
 return Status;
@@ -303,8 +306,8 @@ GopSetMode (
   // Allocate, zero and map guest backing store, for bus master common buffer
   // operation.
   //
-  NewNumberOfBytes = mGopResolutions[ModeNumber].Width *
- mGopResolutions[ModeNumber].Height * sizeof (UINT32);
+  NewNumberOfBytes = GopModeInfo->HorizontalResolution *
+ GopModeInfo->VerticalResolution * sizeof (UINT32);
   NewNumberOfPages = EFI_SIZE_TO_PAGES (NewNumberOfBytes);
   Status   = VirtioGpuAllocateZeroAndMapBackingStore (
VgpuGop->ParentBus,// VgpuDev
@@ -337,8 +340,8 @@ GopSetMode (
  VgpuGop->ParentBus, // VgpuDev
  0,  // X
  0,  // Y
- mGopResolutions[ModeNumber].Width,  // Width
- mGopResolutions[ModeNumber].Height, // Height
+ GopModeInfo->HorizontalResolution,  // Width
+ GopModeInfo->VerticalResolution,// Height
  0,  // ScanoutId
  NewResourceId   // ResourceId
  );
@@ -356,8 +359,8 @@ GopSetMode (
VgpuGop->ParentBus, // VgpuDev
0,  // X
0,  // Y
-   mGopResolutions[ModeNumber].Width,  // Width
-   mGopResolutions[ModeNumber].Height, // Height
+   GopModeInfo->HorizontalResolution,  // Width
+   GopModeInfo->VerticalResolution,// Height
NewResourceId   // ResourceId
);
 if (EFI_ERROR (Status)) {
@@ -367,13 +370,13 @@ GopSetMode (
   // therefore non-recoverable.
   //
   Status2 = VirtioGpuSetScanout (
-  VgpuGop->ParentBus,   // VgpuDev
-  0,// X
-  0,// Y
-  mGopResolutions[This->Mode->Mode].Width,  // Width
-  mGopResolutions[This->Mode->Mode].Height, // Height
-  0,// ScanoutId
-  VgpuGop->ResourceId   // ResourceId
+  VgpuGop->ParentBus,// VgpuDev
+  0, // X
+  0, // Y
+  VgpuGop->GopModeInfo.HorizontalResolution, // Width
+  VgpuGop->GopModeInfo.VerticalResolution,   // Height
+  0,  

[edk2-devel] [PATCH v2 3/6] OvmfPkg/VirtioGpuDxe: add VirtioGpuGetDisplayInfo

2022-03-10 Thread Gerd Hoffmann
Add support for sending a GetDisplayInfo command.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/VirtioGpuDxe/VirtioGpu.h |  6 ++
 OvmfPkg/VirtioGpuDxe/Commands.c  | 20 
 2 files changed, 26 insertions(+)

diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
index 2155b261d43e..1d781088bb3f 100644
--- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
+++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h
@@ -366,6 +366,12 @@ VirtioGpuResourceFlush (
   IN UINT32ResourceId
   );
 
+EFI_STATUS
+VirtioGpuGetDisplayInfo (
+  IN OUT VGPU_DEV*VgpuDev,
+  volatile VIRTIO_GPU_RESP_DISPLAY_INFO  *Response
+  );
+
 /**
   Release guest-side and host-side resources that are related to an initialized
   VGPU_GOP.Gop.
diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Commands.c
index b9a3ea923021..4318d3d771c5 100644
--- a/OvmfPkg/VirtioGpuDxe/Commands.c
+++ b/OvmfPkg/VirtioGpuDxe/Commands.c
@@ -828,3 +828,23 @@ VirtioGpuResourceFlush (
sizeof Request
);
 }
+
+EFI_STATUS
+VirtioGpuGetDisplayInfo (
+  IN OUT VGPU_DEV*VgpuDev,
+  volatile VIRTIO_GPU_RESP_DISPLAY_INFO  *Response
+  )
+{
+  volatile VIRTIO_GPU_CONTROL_HEADER  Request;
+
+  return VirtioGpuSendCommandWithReply (
+   VgpuDev,
+   VirtioGpuCmdGetDisplayInfo,
+   FALSE, // Fence
+   ,
+   sizeof Request,
+   VirtioGpuRespOkDisplayInfo,
+   >Header,
+   sizeof *Response
+   );
+}
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87447): https://edk2.groups.io/g/devel/message/87447
Mute This Topic: https://groups.io/mt/89705199/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/6] OvmfPkg/VirtioGpuDxe: add GetDisplayInfo to virtio-gpu spec header.

2022-03-10 Thread Gerd Hoffmann
Add GetDisplayInfo command, reply and data struct to the
virtio-gpu specification header file.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/Include/IndustryStandard/VirtioGpu.h | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Include/IndustryStandard/VirtioGpu.h 
b/OvmfPkg/Include/IndustryStandard/VirtioGpu.h
index 12559ccef5b1..13f719d4c0f2 100644
--- a/OvmfPkg/Include/IndustryStandard/VirtioGpu.h
+++ b/OvmfPkg/Include/IndustryStandard/VirtioGpu.h
@@ -37,6 +37,7 @@ typedef enum {
   //
   // - create/release a host-side 2D resource,
   //
+  VirtioGpuCmdGetDisplayInfo   = 0x0100,
   VirtioGpuCmdResourceCreate2d = 0x0101,
   VirtioGpuCmdResourceUnref= 0x0102,
   //
@@ -64,7 +65,8 @@ typedef enum {
   //
   // Success code for all of the above commands.
   //
-  VirtioGpuRespOkNodata = 0x1100,
+  VirtioGpuRespOkNodata  = 0x1100,
+  VirtioGpuRespOkDisplayInfo = 0x1101,
 } VIRTIO_GPU_CONTROL_TYPE;
 
 //
@@ -207,4 +209,19 @@ typedef struct {
 } VIRTIO_GPU_RESOURCE_FLUSH;
 #pragma pack ()
 
+//
+// Response structure for VirtioGpuCmdGetDisplayInfo
+//
+#define VIRTIO_GPU_MAX_SCANOUTS  16
+#pragma pack (1)
+typedef struct {
+  VIRTIO_GPU_CONTROL_HEADERHeader;
+  struct {
+VIRTIO_GPU_RECTANGLERectangle;
+UINT32  Enabled;
+UINT32  Flags;
+  } Pmodes[VIRTIO_GPU_MAX_SCANOUTS];
+} VIRTIO_GPU_RESP_DISPLAY_INFO;
+#pragma pack ()
+
 #endif // _VIRTIO_GPU_H_
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87446): https://edk2.groups.io/g/devel/message/87446
Mute This Topic: https://groups.io/mt/89705198/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/6] OvmfPkg/VirtioGpuDxe: use host display resolution

2022-03-10 Thread Gerd Hoffmann
QemuVideoDxe recently got support for picking up
display resolution configuration from the host.
This series does the same for VirtioGpuDxe.

Gerd Hoffmann (6):
  OvmfPkg/VirtioGpuDxe: add VirtioGpuSendCommandWithReply
  OvmfPkg/VirtioGpuDxe: add GetDisplayInfo to virtio-gpu spec header.
  OvmfPkg/VirtioGpuDxe: add VirtioGpuGetDisplayInfo
  OvmfPkg/VirtioGpuDxe: use GopQueryMode in GopSetMode
  OvmfPkg/VirtioGpuDxe: move code to GopInitialize
  OvmfPkg/VirtioGpuDxe: query native display resolution from host

 OvmfPkg/VirtioGpuDxe/VirtioGpu.inf   |   6 +
 OvmfPkg/Include/IndustryStandard/VirtioGpu.h |  19 +-
 OvmfPkg/VirtioGpuDxe/VirtioGpu.h |  12 ++
 OvmfPkg/VirtioGpuDxe/Commands.c  |  95 +++--
 OvmfPkg/VirtioGpuDxe/Gop.c   | 197 ++-
 5 files changed, 262 insertions(+), 67 deletions(-)

-- 
2.35.1



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




[edk2-devel] [PATCH v2 1/6] OvmfPkg/VirtioGpuDxe: add VirtioGpuSendCommandWithReply

2022-03-10 Thread Gerd Hoffmann
Extend VirtioGpuSendCommand() to support commands which return data,
rename the function to VirtioGpuSendCommandWithReply() to indicate that.

Add a new VirtioGpuSendCommand() function which is just a thin wrapper
around VirtioGpuSendCommandWithReply() so existing code continues to
work without changes.

Signed-off-by: Gerd Hoffmann 
---
 OvmfPkg/VirtioGpuDxe/Commands.c | 75 +
 1 file changed, 57 insertions(+), 18 deletions(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Commands.c
index 873a71656700..b9a3ea923021 100644
--- a/OvmfPkg/VirtioGpuDxe/Commands.c
+++ b/OvmfPkg/VirtioGpuDxe/Commands.c
@@ -393,6 +393,14 @@ VirtioGpuExitBoot (
   @param[in] RequestSize  Size of the entire caller-allocated request object,
   including the leading VIRTIO_GPU_CONTROL_HEADER.
 
+  @param[in] ResponseType The type of the response (VirtioGpuResp*).
+
+  @param[in,out] Response Pointer to the caller-allocated response object. The
+  request must start with VIRTIO_GPU_CONTROL_HEADER.
+
+  @param[in] ResponseSize Size of the entire caller-allocated response object,
+  including the leading VIRTIO_GPU_CONTROL_HEADER.
+
   @retval EFI_SUCCESSOperation successful.
 
   @retval EFI_DEVICE_ERROR   The host rejected the request. The host error
@@ -404,22 +412,24 @@ VirtioGpuExitBoot (
 **/
 STATIC
 EFI_STATUS
-VirtioGpuSendCommand (
+VirtioGpuSendCommandWithReply (
   IN OUT VGPU_DEV*VgpuDev,
   IN VIRTIO_GPU_CONTROL_TYPE RequestType,
   IN BOOLEAN Fence,
   IN OUT volatile VIRTIO_GPU_CONTROL_HEADER  *Header,
-  IN UINTN   RequestSize
+  IN UINTN   RequestSize,
+  IN VIRTIO_GPU_CONTROL_TYPE ResponseType,
+  IN OUT volatile VIRTIO_GPU_CONTROL_HEADER  *Response,
+  IN UINTN   ResponseSize
   )
 {
-  DESC_INDICESIndices;
-  volatile VIRTIO_GPU_CONTROL_HEADER  Response;
-  EFI_STATUS  Status;
-  UINT32  ResponseSize;
-  EFI_PHYSICAL_ADDRESSRequestDeviceAddress;
-  VOID*RequestMap;
-  EFI_PHYSICAL_ADDRESSResponseDeviceAddress;
-  VOID*ResponseMap;
+  DESC_INDICES  Indices;
+  EFI_STATUSStatus;
+  UINT32ResponseSizeRet;
+  EFI_PHYSICAL_ADDRESS  RequestDeviceAddress;
+  VOID  *RequestMap;
+  EFI_PHYSICAL_ADDRESS  ResponseDeviceAddress;
+  VOID  *ResponseMap;
 
   //
   // Initialize Header.
@@ -457,8 +467,8 @@ VirtioGpuSendCommand (
   Status = VirtioMapAllBytesInSharedBuffer (
  VgpuDev->VirtIo,
  VirtioOperationBusMasterWrite,
- (VOID *),
- sizeof Response,
+ (VOID *)Response,
+ ResponseSize,
  ,
  
  );
@@ -480,7 +490,7 @@ VirtioGpuSendCommand (
   VirtioAppendDesc (
 >Ring,
 ResponseDeviceAddress,
-(UINT32)sizeof Response,
+(UINT32)ResponseSize,
 VRING_DESC_F_WRITE,
 
 );
@@ -493,7 +503,7 @@ VirtioGpuSendCommand (
  VIRTIO_GPU_CONTROL_QUEUE,
  >Ring,
  ,
- 
+ 
  );
   if (EFI_ERROR (Status)) {
 goto UnmapResponse;
@@ -502,7 +512,7 @@ VirtioGpuSendCommand (
   //
   // Verify response size.
   //
-  if (ResponseSize != sizeof Response) {
+  if (ResponseSize != ResponseSizeRet) {
 DEBUG ((
   DEBUG_ERROR,
   "%a: malformed response to Request=0x%x\n",
@@ -531,16 +541,17 @@ VirtioGpuSendCommand (
   //
   // Parse the response.
   //
-  if (Response.Type == VirtioGpuRespOkNodata) {
+  if (Response->Type == (UINT32)ResponseType) {
 return EFI_SUCCESS;
   }
 
   DEBUG ((
 DEBUG_ERROR,
-"%a: Request=0x%x Response=0x%x\n",
+"%a: Request=0x%x Response=0x%x (expected 0x%x)\n",
 __FUNCTION__,
 (UINT32)RequestType,
-Response.Type
+Response->Type,
+ResponseType
 ));
   return EFI_DEVICE_ERROR;
 
@@ -553,6 +564,34 @@ VirtioGpuSendCommand (
   return Status;
 }
 
+/**
+  Simplified version of VirtioGpuSendCommandWithReply() for commands
+  which do not send back any data.
+**/
+STATIC
+EFI_STATUS
+VirtioGpuSendCommand (
+  IN OUT VGPU_DEV*VgpuDev,
+  IN VIRTIO_GPU_CONTROL_TYPE RequestType,
+  IN BOOLEAN Fence,
+  IN OUT volatile VIRTIO_GPU_CONTROL_HEADER  *Header,
+  IN UINTN   RequestSize
+  )
+{
+  volatile VIRTIO_GPU_CONTROL_HEADER  Response;
+
+  return VirtioGpuSendCommandWithReply (
+   VgpuDev,
+   RequestType,
+   Fence,
+   Header,
+   RequestSize,
+   

回复: [edk2-devel] [PATCH V7 00/37] Enable Intel TDX in OvmfPkg (Config-A)

2022-03-10 Thread gaoliming
Min:
 I have one minor comment for TdxLib.h. This header file doesn't need to 
include below header files. Other patches in MdePkg are good to me. 
Reviewed-by: Liming Gao 

#include 
#include 
#include 
#include 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Min Xu
> 发送时间: 2022年3月10日 14:21
> 收件人: devel@edk2.groups.io; Gao, Liming 
> 抄送: 'Brijesh Singh' ; Dong, Eric
> ; Aktas, Erdem ; Wu, Hao
> A ; Wang, Jian J ; 'James
> Bottomley' ; Yao, Jiewen ;
> Kinney, Michael D ; Ni, Ray ;
> Kumar, Rahul1 ; 'Tom Lendacky'
> ; Liu, Zhiguang ;
> 'Gerd Hoffmann' 
> 主题: Re: [edk2-devel] [PATCH V7 00/37] Enable Intel TDX in OvmfPkg
> (Config-A)
> 
> Hi, Lingming
> Besides below 2 comments in MdePkg, what's your opinion about below
> patches in MdePkg?
> Patch 01  includes the Intel Trust Domain Extension definitions.
> Patch 07-10 is about the BaseIoLibIntrinsic
> Patch 12 add macros CC_GUEST_IS_SEV / CC_GUEST_IS_TDX to check SEV /
> TDX guest.
> 
> I am looking forward your comments about Patch 07 - 10.
> 
> 01-MdePkg-Add-Tdx.h.patch
>   - https://edk2.groups.io/g/devel/message/87049
> 03-MdePkg-Add-TdxLib-to-wrap-Tdx-operations.patch
>   - https://edk2.groups.io/g/devel/message/87051
> 
> 07-MdePkg-Add-helper-functions-for-Tdx-guest-in-BaseIoL.patch
>   - https://edk2.groups.io/g/devel/message/87055
> 08-MdePkg-Support-mmio-for-Tdx-guest-in-BaseIoLibIntrin.patch
>   - https://edk2.groups.io/g/devel/message/87056
> 09-MdePkg-Support-IoFifo-for-Tdx-guest-in-BaseIoLibIntr.patch
>   - https://edk2.groups.io/g/devel/message/87057
> 10-MdePkg-Support-IoRead-IoWrite-for-Tdx-guest-in-BaseI.patch
>   - https://edk2.groups.io/g/devel/message/87058
> 
> 12-MdePkg-Add-macro-to-check-SEV-TDX-guest.patch
>   - https://edk2.groups.io/g/devel/message/87060
> 
> Thanks much!
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of
> gaoliming
> > Sent: Tuesday, March 1, 2022 10:20 AM
> > To: devel@edk2.groups.io; Xu, Min M 
> > Cc: 'Brijesh Singh' ; Dong, Eric
> > ; Aktas, Erdem ; Wu, Hao
> A
> > ; Wang, Jian J ; 'James
> > Bottomley' ; Yao, Jiewen ;
> > Kinney, Michael D ; Ni, Ray
> ;
> > Kumar, Rahul1 ; 'Tom Lendacky'
> > ; Liu, Zhiguang ;
> 'Gerd
> > Hoffmann' 
> > Subject: 回复: [edk2-devel] [PATCH V7 00/37] Enable Intel TDX in OvmfPkg
> > (Config-A)
> >
> > Min:
> >   I have two comments in MdePkg. The changes in MdeModulePkg are
> good to
> > me.
> > 1. Seemly, new APIs (TdCall, TdVmCall, TdIsEnabled) in BaseLib are X86
> specific.
> > How about define them in #if defined (MDE_CPU_IA32) || defined
> > (MDE_CPU_X64) in BaseLib.h?
> > 2. I don't find new resource attribute
> EFI_RESOURCE_ATTRIBUTE_ENCRYPTED in
> > the latest PI PI_Spec_1_7_A_final_May1.pdf. Can you let me know which
> spec
> > defines it?
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Min Xu
> > > 发送时间: 2022年2月28日 15:21
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Min Xu ; Brijesh Singh
> > > ; Eric Dong ; Erdem
> Aktas
> > > ; Hao A Wu ; Jian J
> Wang
> > > ; James Bottomley ;
> Jiewen
> > > Yao ; Liming Gao ;
> > > Michael D Kinney ; Ray Ni
> > > ; Rahul Kumar ; Tom
> Lendacky
> > > ; Zhiguang Liu ;
> Gerd
> > > Hoffmann 
> > > 主题: [edk2-devel] [PATCH V7 00/37] Enable Intel TDX in OvmfPkg
> > > (Config-A)
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3249
> > >
> > > Intel's Trust Domain Extensions (Intel TDX) refers to an Intel
> > > technology that extends Virtual Machines Extensions (VMX) and
> > > Multi-Key Total Memory Encryption (MKTME) with a new kind of virutal
> > > machines guest called a Trust Domain (TD). A TD is desinged to run in
> > > a CPU mode that protects the confidentiality of TD memory contents and
> > > the TD's CPU state from other software, including the hosting
> > > Virtual-Machine Monitor (VMM), unless explicitly shared by the TD itself.
> > >
> > > There are 2 configurations for TDVF to upstream. See below link for
> > > the definitions of the 2 configurations.
> > > https://edk2.groups.io/g/devel/message/76367
> > >
> > > This patch-set is to enable Config-A in OvmfPkg.
> > >  - Merge the *basic* TDVF feature to existing OvmfX64Pkg.dsc. (Align
> > >with existing SEV)
> > >  - Threat model: VMM is NOT out of TCB. (We don’t make things worse.)
> > >  - The OvmfX64Pkg.dsc includes SEV/TDX/normal OVMF basic boot
> capability.
> > >The final binary can run on SEV/TDX/normal OVMF
> > >  - No changes to existing OvmfPkgX64 image layout.
> > >  - No need to add additional security features if they do not exist
> > > today
> > >  - No need to remove features if they exist today.
> > >  - RTMR is not supported
> > >  - PEI phase is NOT skipped in either Td or Non-Td
> > >
> > > Patch 01 - 23 are changes in SEC phase. Also some libraries in these
> > > patches are workable in SEC/PEI/DXE.
> > >
> > > Patch 17 - 20 extract the common codes from OvmfPkg/PlatformPei to a
> > > new PlatformInitLib. Then OvmfPkg/PlatformPei is refactored with this lib.
> 

回复: [edk2-devel] [PATCH] Pkg-Module: MdePkg/Include/Protocol/PxeBaseCodeCallBack.h

2022-03-10 Thread gaoliming
Brent:

Please update commit title as MdePkg Include: Update Protocol
PxeBaseCodeCallBack.h

With this change, Reviewed-by: Liming Gao   

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表
> brentholtsclaw
> 发送时间: 2022年3月9日 7:19
> 收件人: devel@edk2.groups.io
> 抄送: brentholtsclaw 
> 主题: [edk2-devel] [PATCH] Pkg-Module:
> MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3849
> 
> PxeBaseCodeCallBack.h lacks definition for EFI_PXE_BASE_CODE_PACKET
> 
> +  #include 
> 
> ///
> 
> Signed-off-by: brentholtsclaw 
> ---
>  MdePkg/Include/Protocol/PxeBaseCodeCallBack.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
> b/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
> index 65b3220698..ac7269cf78 100644
> --- a/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
> +++ b/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
> @@ -13,6 +13,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #ifndef _PXE_BASE_CODE_CALLBACK_H_
>  #define _PXE_BASE_CODE_CALLBACK_H_
> 
> +#include 
> +
>  ///
>  /// Call Back Definitions.
>  ///
> --
> 2.27.0.windows.1
> 
> 
> 
> 
> 







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




Re: [edk2-devel][edk2-platforms][PATCH V1 0/9] Add Whitley AcpiPlatform driver

2022-03-10 Thread Nate DeSimone
For the series...

Reviewed-by: Nate DeSimone 

-Original Message-
From: Oram, Isaac W  
Sent: Thursday, March 10, 2022 2:41 PM
To: devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Chiu, Chasel 

Subject: [edk2-devel][edk2-platforms][PATCH V1 0/9] Add Whitley AcpiPlatform 
driver

This series converts the AcpiPlatform driver for Whitley ICX to open source.
The driver requires libraries providing:
16-bit CRC service
A library to update the tables based on boot time data.
A board hook library to control publishing individual tables and to modify 
tables.
A library to build MADT and SRAT tables during boot.
A Universal Board Abstraction library to translate UBA data.

The driver consumes the AcpiTables data file and the AML opcode patching table 
From StaticSkuDataDxe driver.

This code does not support the CooperCity hardware at present.
The code depends on additional DynamicSiLibraryProtocol2 and updated 
WhitleyFspBinPkg content.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 

Isaac Oram (9):
  WhitleyOpenBoardPkg: Add definitions needed for AcpiPlatform driver
  WhitleySiliconPkg: Add definitions used in ACPI subsystem
  WhitleyOpenBoardPkg/BaseCrcLib: Add library for CRC16
  WhitleyOpenBoardPkg: Add UbaPlatLib Library
  WhitleyOpenBoardPkg/PlatformSpecificAcpiTableLib: Add library
  WhitleyOpenBoardPkg/BuildAcpiTablesLib: Add lib for building MADT and
SRAT
  WhitleyOpenBoardPkg/AcpiTablesLib: Add library for AcpiPlatform driver
  WhitleyOpenBoardPkg/AcpiPlatform: Add driver for publishing ACPI
tables
  WhitleyOpenBoardPkg/Build: Remove confusing build options

 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.c   
  |  754 +
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.h   
  |  117 ++
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.inf 
  |  107 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformHooks.c
|  384 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformHooks.h
|   51 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformUtils.c
|  133 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformUtils.h
|   66 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformVTDHooks.c
 | 1762 
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
  |1 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf 
 |1 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Madt.h 
  |  118 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Slit.h 
  |   75 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Srat.h 
  |   53 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/amlresrc.h 
  |  542 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc
  |   18 +-
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/AcpiPlatformLib.h   
  |  107 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/BuildAcpiTablesLib.h
  |  111 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
  |   42 +
 
Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformSpecificAcpiTableLib.h
|  129 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformStatusCodes.h   
  |  364 
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/UbaFpkConfigLib.h   
  |   55 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/UbaSmbiosUpdateLib.h
  |  275 +++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLib.c
|  534 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLib.inf
  |  127 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibApic.c
|  735 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibBdat.c
| 1574 +
 

[edk2-devel] [edk2-platforms Patch 3/3] OptionRomPkg: Remove all UGA support

2022-03-10 Thread Guomin Jiang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368

Remove all UGA support

Cc: Ray Ni 
Signed-off-by: Guomin Jiang 
---
 .../CirrusLogic5430Dxe/CirrusLogic5430.c  | 522 +++---
 .../CirrusLogic5430Dxe/CirrusLogic5430.h  | 136 ++---
 .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf |   9 +-
 .../CirrusLogic5430UgaDraw.c  | 412 --
 Drivers/OptionRomPkg/OptionRomPkg.dec |   3 -
 5 files changed, 271 insertions(+), 811 deletions(-)
 delete mode 100644 
Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c

diff --git a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c 
b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
index 4e7830ea94b3..a2f2c2ff60f4 100644
--- a/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
+++ b/Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
@@ -11,7 +11,7 @@
   documentation on UGA for details on how to write a UGA driver that is able
   to function both in the EFI pre-boot environment and from the OS runtime.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -21,7 +21,7 @@
 //
 #include "CirrusLogic5430.h"
 
-EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL  gCirrusLogic5430DriverBinding = {
   CirrusLogic5430ControllerDriverSupported,
   CirrusLogic5430ControllerDriverStart,
   CirrusLogic5430ControllerDriverStop,
@@ -42,21 +42,21 @@ UINT8  AttributeController[21] = {
 ///
 /// Generic Graphics Controller Register Settings
 ///
-UINT8 GraphicsController[9] = {
+UINT8  GraphicsController[9] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, 0xFF
 };
 
 //
 // 640 x 480 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_640_480_256_60[28] = {
+UINT8  Crtc_640_480_256_60[28] = {
   0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,
   0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,
   0xff, 0x00, 0x00, 0x22
 };
 
-UINT16 Seq_640_480_256_60[15] = {
+UINT16  Seq_640_480_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e
 };
@@ -64,14 +64,14 @@ UINT16 Seq_640_480_256_60[15] = {
 //
 // 800 x 600 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_800_600_256_60[28] = {
+UINT8  Crtc_800_600_256_60[28] = {
   0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0,
   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,
   0xFF, 0x00, 0x00, 0x22
 };
 
-UINT16 Seq_800_600_256_60[15] = {
+UINT16  Seq_800_600_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e
 };
@@ -79,14 +79,14 @@ UINT16 Seq_800_600_256_60[15] = {
 //
 // 1024 x 768 x 256 color @ 60 Hertz
 //
-UINT8 Crtc_1024_768_256_60[28] = {
+UINT8  Crtc_1024_768_256_60[28] = {
   0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD,
   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,
   0xFF, 0x4A, 0x00, 0x22
 };
 
-UINT16 Seq_1024_768_256_60[15] = {
+UINT16  Seq_1024_768_256_60[15] = {
   0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
   0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e
 };
@@ -95,12 +95,11 @@ UINT16 Seq_1024_768_256_60[15] = {
 /// Table of supported video modes
 ///
 CIRRUS_LOGIC_5430_VIDEO_MODES  CirrusLogic5430VideoModes[] = {
-  {  640, 480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
-  {  800, 600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
+  { 640,  480, 8, 60, Crtc_640_480_256_60,  Seq_640_480_256_60,  0xe3 },
+  { 800,  600, 8, 60, Crtc_800_600_256_60,  Seq_800_600_256_60,  0xef },
   { 1024, 768, 8, 60, Crtc_1024_768_256_60, Seq_1024_768_256_60, 0xef }
 };
 
-
 /**
   CirrusLogic5430ControllerDriverSupported
 
@@ -111,15 +110,15 @@ CIRRUS_LOGIC_5430_VIDEO_MODES  
CirrusLogic5430VideoModes[] = {
 EFI_STATUS
 EFIAPI
 CirrusLogic5430ControllerDriverSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL*This,
-  IN EFI_HANDLE Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE   Controller,
+  IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
   )
 {
-  EFI_STATUS  Status;
-  EFI_PCI_IO_PROTOCOL *PciIo;
-  PCI_TYPE00  Pci;
-  EFI_DEV_PATH*Node;
+  EFI_STATUS   Status;
+  EFI_PCI_IO_PROTOCOL  *PciIo;
+  PCI_TYPE00   Pci;
+  EFI_DEV_PATH *Node;
 
   //
   // Open the PCI I/O Protocol
@@ -127,7 +126,7 @@ CirrusLogic5430ControllerDriverSupported (
   Status = gBS->OpenProtocol (
   Controller,
   ,
-  (VOID **) ,
+  (VOID **),
   This->DriverBindingHandle,
   

[edk2-devel] [edk2-platforms Patch 1/3] PurleyOpenBoardPkg: Remove All UGA support

2022-03-10 Thread Guomin Jiang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368

Remove all UGA support in PurleyOpenBoardPkg

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Guomin Jiang 
---
 .../Library/BoardBdsHookLib/BoardBdsHook.h| 70 +--
 1 file changed, 33 insertions(+), 37 deletions(-)

diff --git 
a/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
 
b/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
index fd943b3ca793..05e0a3f8920f 100644
--- 
a/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
+++ 
b/Platform/Intel/PurleyOpenBoardPkg/Override/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for BDS Hook Library
 
-Copyright (c) 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -55,13 +54,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 ///
 /// ConnectType
 ///
-#define CONSOLE_OUT 0x0001
-#define STD_ERROR   0x0002
-#define CONSOLE_IN  0x0004
-#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
+#define CONSOLE_OUT  0x0001
+#define STD_ERROR0x0002
+#define CONSOLE_IN   0x0004
+#define CONSOLE_ALL  (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
 
-extern EFI_GUID  gUefiShellFileGuid;
-extern EFI_BOOT_MODE gBootMode;
+extern EFI_GUID   gUefiShellFileGuid;
+extern EFI_BOOT_MODE  gBootMode;
 
 #define gPciRootBridge \
   { \
@@ -83,67 +82,66 @@ extern EFI_BOOT_MODE gBootMode;
   }
 
 typedef struct {
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  UINTN ConnectType;
+  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
+  UINTN   ConnectType;
 } BDS_CONSOLE_CONNECT_ENTRY;
 
 //
 // Platform Root Bridge
 //
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_ROOT_BRIDGE_DEVICE_PATH;
 
 //
 // Below is the platform console device path
 //
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   IsaBridge;
-  ACPI_HID_DEVICE_PATH  Keyboard;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH IsaBridge;
+  ACPI_HID_DEVICE_PATHKeyboard;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_KEYBOARD_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH PciDevice;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_ONBOARD_CONTROLLER_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   Pci0Device;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH Pci0Device;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_PEG_ROOT_CONTROLLER_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciBridge;
-  PCI_DEVICE_PATH   PciDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH PciBridge;
+  PCI_DEVICE_PATH PciDevice;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_PCI_CONTROLLER_DEVICE_PATH;
 
 //
 // Below is the boot option device path
 //
 
-#define CLASS_HID   3
-#define SUBCLASS_BOOT   1
-#define PROTOCOL_KEYBOARD   1
+#define CLASS_HID  3
+#define SUBCLASS_BOOT  1
+#define PROTOCOL_KEYBOARD  1
 
 typedef struct {
-  USB_CLASS_DEVICE_PATH   UsbClass;
-  EFI_DEVICE_PATH_PROTOCOLEnd;
+  USB_CLASS_DEVICE_PATH   UsbClass;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } USB_CLASS_FORMAT_DEVICE_PATH;
 
-extern USB_CLASS_FORMAT_DEVICE_PATH  gUsbClassKeyboardDevicePath;
+extern USB_CLASS_FORMAT_DEVICE_PATH  gUsbClassKeyboardDevicePath;
 
 //
 // Platform BDS Functions
 //
 
-
 /**
   Perform the memory test base on the memory test intensive level,
   and update the memory resource.
@@ -156,7 +154,7 @@ extern USB_CLASS_FORMAT_DEVICE_PATH  
gUsbClassKeyboardDevicePath;
 **/
 EFI_STATUS
 MemoryTest (
-  IN EXTENDMEM_COVERAGE_LEVEL Level
+  IN EXTENDMEM_COVERAGE_LEVEL  Level
   );
 
 /**
@@ -167,10 +165,9 @@ MemoryTest (
 **/
 VOID
 ConnectSequence (
-  IN EFI_BOOT_MODE  BootMode
+  IN EFI_BOOT_MODE  BootMode
   );
 
-
 /**
Compares boot priorities of two boot options
 
@@ -195,7 +192,6 @@ 

[edk2-devel] [edk2-platforms Patch 2/3] BoardModulePkg: Remove all UGA support

2022-03-10 Thread Guomin Jiang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368

Remove all UGA support

Cc: Eric Dong 
Cc: Liming Gao 
Signed-off-by: Guomin Jiang 
---
 .../Library/BoardBdsHookLib/BoardBdsHook.h| 70 +--
 1 file changed, 33 insertions(+), 37 deletions(-)

diff --git 
a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h 
b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
index fd943b3ca793..05e0a3f8920f 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for BDS Hook Library
 
-Copyright (c) 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -55,13 +54,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 ///
 /// ConnectType
 ///
-#define CONSOLE_OUT 0x0001
-#define STD_ERROR   0x0002
-#define CONSOLE_IN  0x0004
-#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
+#define CONSOLE_OUT  0x0001
+#define STD_ERROR0x0002
+#define CONSOLE_IN   0x0004
+#define CONSOLE_ALL  (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
 
-extern EFI_GUID  gUefiShellFileGuid;
-extern EFI_BOOT_MODE gBootMode;
+extern EFI_GUID   gUefiShellFileGuid;
+extern EFI_BOOT_MODE  gBootMode;
 
 #define gPciRootBridge \
   { \
@@ -83,67 +82,66 @@ extern EFI_BOOT_MODE gBootMode;
   }
 
 typedef struct {
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  UINTN ConnectType;
+  EFI_DEVICE_PATH_PROTOCOL*DevicePath;
+  UINTN   ConnectType;
 } BDS_CONSOLE_CONNECT_ENTRY;
 
 //
 // Platform Root Bridge
 //
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_ROOT_BRIDGE_DEVICE_PATH;
 
 //
 // Below is the platform console device path
 //
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   IsaBridge;
-  ACPI_HID_DEVICE_PATH  Keyboard;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH IsaBridge;
+  ACPI_HID_DEVICE_PATHKeyboard;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_KEYBOARD_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH PciDevice;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_ONBOARD_CONTROLLER_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   Pci0Device;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH Pci0Device;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_PEG_ROOT_CONTROLLER_DEVICE_PATH;
 
 typedef struct {
-  ACPI_HID_DEVICE_PATH  PciRootBridge;
-  PCI_DEVICE_PATH   PciBridge;
-  PCI_DEVICE_PATH   PciDevice;
-  EFI_DEVICE_PATH_PROTOCOL  End;
+  ACPI_HID_DEVICE_PATHPciRootBridge;
+  PCI_DEVICE_PATH PciBridge;
+  PCI_DEVICE_PATH PciDevice;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } PLATFORM_PCI_CONTROLLER_DEVICE_PATH;
 
 //
 // Below is the boot option device path
 //
 
-#define CLASS_HID   3
-#define SUBCLASS_BOOT   1
-#define PROTOCOL_KEYBOARD   1
+#define CLASS_HID  3
+#define SUBCLASS_BOOT  1
+#define PROTOCOL_KEYBOARD  1
 
 typedef struct {
-  USB_CLASS_DEVICE_PATH   UsbClass;
-  EFI_DEVICE_PATH_PROTOCOLEnd;
+  USB_CLASS_DEVICE_PATH   UsbClass;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
 } USB_CLASS_FORMAT_DEVICE_PATH;
 
-extern USB_CLASS_FORMAT_DEVICE_PATH  gUsbClassKeyboardDevicePath;
+extern USB_CLASS_FORMAT_DEVICE_PATH  gUsbClassKeyboardDevicePath;
 
 //
 // Platform BDS Functions
 //
 
-
 /**
   Perform the memory test base on the memory test intensive level,
   and update the memory resource.
@@ -156,7 +154,7 @@ extern USB_CLASS_FORMAT_DEVICE_PATH  
gUsbClassKeyboardDevicePath;
 **/
 EFI_STATUS
 MemoryTest (
-  IN EXTENDMEM_COVERAGE_LEVEL Level
+  IN EXTENDMEM_COVERAGE_LEVEL  Level
   );
 
 /**
@@ -167,10 +165,9 @@ MemoryTest (
 **/
 VOID
 ConnectSequence (
-  IN EFI_BOOT_MODE  BootMode
+  IN EFI_BOOT_MODE  BootMode
   );
 
-
 /**
Compares boot priorities of two boot options
 
@@ -195,7 +192,6 @@ RegisterStaticHotkey (
   VOID
   );
 
-
 /**
   Registers/Unregisters boot option hotkey
 
-- 
2.35.1.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

[edk2-devel] [edk2-platforms Patch 0/3] Remove all UGA support

2022-03-10 Thread Guomin Jiang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2368

Remove all UGA support

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Cc: Eric Dong 
Cc: Liming Gao 
Cc: Ray Ni 

Guomin Jiang (3):
  PurleyOpenBoardPkg: Remove All UGA support
  BoardModulePkg: Remove all UGA support
  OptionRomPkg: Remove all UGA support

 .../CirrusLogic5430Dxe/CirrusLogic5430.c  | 522 +++---
 .../CirrusLogic5430Dxe/CirrusLogic5430.h  | 136 ++---
 .../CirrusLogic5430Dxe/CirrusLogic5430Dxe.inf |   9 +-
 .../CirrusLogic5430UgaDraw.c  | 412 --
 Drivers/OptionRomPkg/OptionRomPkg.dec |   3 -
 .../Library/BoardBdsHookLib/BoardBdsHook.h|  70 ++-
 .../Library/BoardBdsHookLib/BoardBdsHook.h|  70 ++-
 7 files changed, 337 insertions(+), 885 deletions(-)
 delete mode 100644 
Drivers/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430UgaDraw.c

-- 
2.35.1.windows.2



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




回复: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-10 Thread gaoliming
Yu and Ray:
  I review UefiCpuLib. I think they are generic enough (X86 arch) to be
placed in MdePkg.

Mike:
  What's your comments for this proposal?

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Pu, Yu
> 发送时间: 2022年3月10日 16:47
> 收件人: Ni, Ray ; Kinney, Michael D
> ; Gao, Liming 
> 抄送: Wang, Jian J ; Gao, Liming
> ; devel@edk2.groups.io
> 主题: Re: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke
> GetPhysicalAddressBits() and remove the duplicated code
> 
> Hi, Mike, Liming,
> 
> This patch makes MdeModulePkg depend on UefiCpuPkg.
> Ray and me would like to move the UefiCpuLib from UefiCpuPkg to MdePkg,
> do you agree with it ?
> 
> Thanks,
> Yu
> 
> -Original Message-
> From: Ni, Ray 
> Sent: Monday, March 7, 2022 11:55 AM
> To: Kinney, Michael D ; Gao, Liming
> 
> Cc: Wang, Jian J ; Gao, Liming
> ; devel@edk2.groups.io; Pu, Yu
> 
> Subject: RE: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke
> GetPhysicalAddressBits() and remove the duplicated code
> 
> Mike, Liming,
> This patch makes MdeModulePkg depend on UefiCpuPkg.
> But according to
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModul
> ePkg.ci.yaml#L49, such dependency is not allowed.
> 
> Do you agree to move the UefiCpuLib from UefiCpuPkg to MdePkg? The
> library header and instance are in following paths:
> 
> https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Include/Library
> /UefiCpuLib.h
> 
> https://github.com/tianocore/edk2/tree/master/UefiCpuPkg/Library/BaseUe
> fiCpuLib
> 
> Thanks,
> Ray
> 
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yu Pu
> Sent: Wednesday, March 2, 2022 5:19 PM
> To: devel@edk2.groups.io
> Cc: Pu, Yu ; Wang, Jian J ; Gao,
> Liming 
> Subject: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke
> GetPhysicalAddressBits() and remove the duplicated code
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394
> 
> Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical
> address mask calculation and remove the duplicated code in MdeModulePkg.
> 
> Cc: Jian J Wang 
> Cc: Liming Gao 
> 
> Signed-off-by: Yu Pu 
> ---
>  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> |  9 ++---
>  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
> | 14 ++
>  MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> | 14 ++
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
> |  2 ++
>  MdeModulePkg/MdeModulePkg.dsc
> |  1 +
> 
> MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDx
> e.inf |  2 ++
>  MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
> |  2 ++
>  7 files changed, 13 insertions(+), 31 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> index 0700f310b203..78e91e6e9024 100644
> --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> @@ -22,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
>  **/
> 
> 
> 
> +#include 
> 
>  #include 
> 
>  #include "DxeIpl.h"
> 
>  #include "VirtualMemory.h"
> 
> @@ -733,13 +734,7 @@ CreateIdentityMappingPageTables (
>if (Hob != NULL) {
> 
>  PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
> 
>} else {
> 
> -AsmCpuid (0x8000, , NULL, NULL, NULL);
> 
> -if (RegEax >= 0x8008) {
> 
> -  AsmCpuid (0x8008, , NULL, NULL, NULL);
> 
> -  PhysicalAddressBits = (UINT8)RegEax;
> 
> -} else {
> 
> -  PhysicalAddressBits = 36;
> 
> -}
> 
> +PhysicalAddressBits = GetPhysicalAddressBits(NULL, NULL);
> 
>}
> 
> 
> 
>Page5LevelSupport = FALSE;
> 
> diff --git
> a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
> b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
> index 6b44f50bac70..367bf8cdd1e6 100644
> ---
> a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
> +++
> b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.
> +++ c
> @@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights
> reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>  **/
> 
> +#include 
> 
>  #include "ScriptExecute.h"
> 
> 
> 
>  //
> 
> @@ -51,20 +52,9 @@ HookPageFaultHandler (
>IN IA32_IDT_GATE_DESCRIPTOR  *IdtEntry
> 
>)
> 
>  {
> 
> -  UINT32  RegEax;
> 
> -  UINT8   PhysicalAddressBits;
> 
>UINTN   PageFaultHandlerHookAddress;
> 
> 
> 
> -  AsmCpuid (0x8000, , NULL, NULL, NULL);
> 
> -  if (RegEax >= 0x8008) {
> 
> -AsmCpuid (0x8008, , NULL, NULL, NULL);
> 
> -PhysicalAddressBits = (UINT8)RegEax;
> 
> -  } else {
> 
> -PhysicalAddressBits = 36;
> 
> -  }
> 
> -
> 
> -  mPhyMask  = LShiftU64 (1, PhysicalAddressBits) - 1;
> 
> -  mPhyMask &= (1ull << 48) - SIZE_4KB;
> 
> +  GetPhysicalAddressBits(NULL, );
> 
> 
> 
>//
> 
>// Set Page Fault entry to catch >4G access
> 
> diff --git 

Re: [edk2-devel][edk2-platforms][PATCH V1 3/9] WhitleyOpenBoardPkg/BaseCrcLib: Add library for CRC16

2022-03-10 Thread Oram, Isaac W
Pedro,

It sounds good to me.  I am exposing our formerly proprietary code without much 
refactoring.  But I see no reason to have CRC related code in multiple 
libraries.

Regards,
Isaac

From: Pedro Falcato 
Sent: Thursday, March 10, 2022 3:19 PM
To: edk2-devel-groups-io ; Oram, Isaac W 

Cc: Desimone, Nathaniel L ; Chiu, Chasel 

Subject: Re: [edk2-devel][edk2-platforms][PATCH V1 3/9] 
WhitleyOpenBoardPkg/BaseCrcLib: Add library for CRC16

Hi,

I've just noticed this patch adds CRC16, which I've already added to my Ext4Pkg 
(https://github.com/tianocore/edk2-platforms/blob/master/Features/Ext4Pkg/Ext4Dxe/Crc16.c).
I suggest we add CRC16 (and possibly CRC32C, which I already have in my package 
as well) to MdePkg, as to de-duplicate code which might be useful in other 
places.
What do you think? If it sounds good to you, I'll open a bugzilla and work on 
that.

Best regards,
Pedro

On Thu, Mar 10, 2022 at 10:41 PM Oram, Isaac W 
mailto:isaac.w.o...@intel.com>> wrote:
Core only supports CRC32, this library adds CRC16 support.

Cc: Nate DeSimone 
mailto:nathaniel.l.desim...@intel.com>>
Cc: Chasel Chiu mailto:chasel.c...@intel.com>>
Signed-off-by: Isaac Oram 
mailto:isaac.w.o...@intel.com>>
---
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h  | 42 

 Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c   | 71 

 Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf | 23 
+++
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc   |  1 +
 4 files changed, 137 insertions(+)

diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
new file mode 100644
index 00..7ca3b7cabb
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
@@ -0,0 +1,42 @@
+/** @file
+  Interface header file for the CRC library class.
+
+  @copyright
+  Copyright 2016 - 2018 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _CRC_LIB_H_
+#define _CRC_LIB_H_
+
+#include 
+
+/**
+  Calculate a 16-bit CRC.
+
+  The algorithm used is MSB-first form of the ITU-T Recommendation V.41, which
+  uses an initial value of 0x and a polynomial of 0x1021. It is the same
+  algorithm used by XMODEM.
+
+  The output CRC location is not updated until the calculation is finished, so
+  it is possible to pass a structure as the data, and the CRC field of the same
+  structure as the output location for the calculated CRC. The CRC field should
+  be set to zero before calling this function. Once the CRC field is updated by
+  this function, running it again over the structure produces a CRC of zero.
+
+  @param[in]  Data  A pointer to the target data.
+  @param[in]  DataSize  The target data size.
+  @param[out] CrcOutA pointer to the return location of the CRC.
+
+  @retval EFI_SUCCESS   The CRC was calculated successfully.
+  @retval EFI_INVALID_PARAMETER A null pointer was provided.
+**/
+EFI_STATUS
+CalculateCrc16 (
+  IN  VOID*Data,
+  IN  UINTN   DataSize,
+  OUT UINT16  *CrcOut
+  );
+
+#endif  // _CRC_LIB_H_
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
new file mode 100644
index 00..3e8fa402ad
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
@@ -0,0 +1,71 @@
+/** @file
+  Base implementation of the CRC library class.
+
+  @copyright
+  Copyright 2016 - 2018 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+
+/**
+  Calculate a 16-bit CRC.
+
+  The algorithm used is MSB-first form of the ITU-T Recommendation V.41, which
+  uses an initial value of 0x and a polynomial of 0x1021. It is the same
+  algorithm used by XMODEM.
+
+  The output CRC location is not updated until the calculation is finished, so
+  it is possible to pass a structure as the data, and the CRC field of the same
+  structure as the output location for the calculated CRC. The CRC field should
+  be set to zero before calling this function. Once the CRC field is updated by
+  this function, running it again over the structure produces a CRC of zero.
+
+  @param[in]  Data  A pointer to the target data.
+  @param[in]  DataSize  The target data size.
+  @param[out] CrcOutA pointer to the return location of the CRC.
+
+  @retval EFI_SUCCESS   The CRC was calculated successfully.
+  @retval EFI_INVALID_PARAMETER A null pointer was provided.
+**/
+EFI_STATUS
+CalculateCrc16 (
+  IN  VOID*Data,
+  IN  UINTN   DataSize,
+  OUT UINT16  *CrcOut
+  )
+{
+  UINT32  Crc;
+  UINTN   Index;
+  UINT8   *Byte;
+
+  if (Data == NULL || CrcOut == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  Crc = 0x;
+  for (Byte = (UINT8 *) Data; Byte < (UINT8 *) Data + 

Re: [edk2-devel][edk2-platforms][PATCH V1 3/9] WhitleyOpenBoardPkg/BaseCrcLib: Add library for CRC16

2022-03-10 Thread Pedro Falcato
Hi,

I've just noticed this patch adds CRC16, which I've already added to my
Ext4Pkg (
https://github.com/tianocore/edk2-platforms/blob/master/Features/Ext4Pkg/Ext4Dxe/Crc16.c
).
I suggest we add CRC16 (and possibly CRC32C, which I already have in my
package as well) to MdePkg, as to de-duplicate code which might be useful
in other places.
What do you think? If it sounds good to you, I'll open a bugzilla and work
on that.

Best regards,
Pedro

On Thu, Mar 10, 2022 at 10:41 PM Oram, Isaac W 
wrote:

> Core only supports CRC32, this library adds CRC16 support.
>
> Cc: Nate DeSimone 
> Cc: Chasel Chiu 
> Signed-off-by: Isaac Oram 
> ---
>  Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h  | 42
> 
>  Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c   | 71
> 
>  Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf | 23
> +++
>  Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc   |  1
> +
>  4 files changed, 137 insertions(+)
>
> diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
> b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
> new file mode 100644
> index 00..7ca3b7cabb
> --- /dev/null
> +++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
> @@ -0,0 +1,42 @@
> +/** @file
> +  Interface header file for the CRC library class.
> +
> +  @copyright
> +  Copyright 2016 - 2018 Intel Corporation. 
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#ifndef _CRC_LIB_H_
> +#define _CRC_LIB_H_
> +
> +#include 
> +
> +/**
> +  Calculate a 16-bit CRC.
> +
> +  The algorithm used is MSB-first form of the ITU-T Recommendation V.41,
> which
> +  uses an initial value of 0x and a polynomial of 0x1021. It is the
> same
> +  algorithm used by XMODEM.
> +
> +  The output CRC location is not updated until the calculation is
> finished, so
> +  it is possible to pass a structure as the data, and the CRC field of
> the same
> +  structure as the output location for the calculated CRC. The CRC field
> should
> +  be set to zero before calling this function. Once the CRC field is
> updated by
> +  this function, running it again over the structure produces a CRC of
> zero.
> +
> +  @param[in]  Data  A pointer to the target data.
> +  @param[in]  DataSize  The target data size.
> +  @param[out] CrcOutA pointer to the return location of the
> CRC.
> +
> +  @retval EFI_SUCCESS   The CRC was calculated successfully.
> +  @retval EFI_INVALID_PARAMETER A null pointer was provided.
> +**/
> +EFI_STATUS
> +CalculateCrc16 (
> +  IN  VOID*Data,
> +  IN  UINTN   DataSize,
> +  OUT UINT16  *CrcOut
> +  );
> +
> +#endif  // _CRC_LIB_H_
> diff --git
> a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
> b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
> new file mode 100644
> index 00..3e8fa402ad
> --- /dev/null
> +++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
> @@ -0,0 +1,71 @@
> +/** @file
> +  Base implementation of the CRC library class.
> +
> +  @copyright
> +  Copyright 2016 - 2018 Intel Corporation. 
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include 
> +#include 
> +
> +/**
> +  Calculate a 16-bit CRC.
> +
> +  The algorithm used is MSB-first form of the ITU-T Recommendation V.41,
> which
> +  uses an initial value of 0x and a polynomial of 0x1021. It is the
> same
> +  algorithm used by XMODEM.
> +
> +  The output CRC location is not updated until the calculation is
> finished, so
> +  it is possible to pass a structure as the data, and the CRC field of
> the same
> +  structure as the output location for the calculated CRC. The CRC field
> should
> +  be set to zero before calling this function. Once the CRC field is
> updated by
> +  this function, running it again over the structure produces a CRC of
> zero.
> +
> +  @param[in]  Data  A pointer to the target data.
> +  @param[in]  DataSize  The target data size.
> +  @param[out] CrcOutA pointer to the return location of the
> CRC.
> +
> +  @retval EFI_SUCCESS   The CRC was calculated successfully.
> +  @retval EFI_INVALID_PARAMETER A null pointer was provided.
> +**/
> +EFI_STATUS
> +CalculateCrc16 (
> +  IN  VOID*Data,
> +  IN  UINTN   DataSize,
> +  OUT UINT16  *CrcOut
> +  )
> +{
> +  UINT32  Crc;
> +  UINTN   Index;
> +  UINT8   *Byte;
> +
> +  if (Data == NULL || CrcOut == NULL) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  Crc = 0x;
> +  for (Byte = (UINT8 *) Data; Byte < (UINT8 *) Data + DataSize; Byte++) {
> +//
> +// XOR the next data byte into the CRC.
> +//
> +Crc ^= (UINT16) *Byte << 8;
> +//
> +// Shift out eight bits, feeding back based on the polynomial
> whenever a
> +// 1 is shifted out of bit 15.
> +//
> +for (Index = 0; Index < 8; Index++) {
> +  

[edk2-devel][edk2-platforms][PATCH V1 3/9] WhitleyOpenBoardPkg/BaseCrcLib: Add library for CRC16

2022-03-10 Thread Oram, Isaac W
Core only supports CRC32, this library adds CRC16 support.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h  | 42 

 Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c   | 71 

 Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf | 23 
+++
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc   |  1 +
 4 files changed, 137 insertions(+)

diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
new file mode 100644
index 00..7ca3b7cabb
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
@@ -0,0 +1,42 @@
+/** @file
+  Interface header file for the CRC library class.
+
+  @copyright
+  Copyright 2016 - 2018 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _CRC_LIB_H_
+#define _CRC_LIB_H_
+
+#include 
+
+/**
+  Calculate a 16-bit CRC.
+
+  The algorithm used is MSB-first form of the ITU-T Recommendation V.41, which
+  uses an initial value of 0x and a polynomial of 0x1021. It is the same
+  algorithm used by XMODEM.
+
+  The output CRC location is not updated until the calculation is finished, so
+  it is possible to pass a structure as the data, and the CRC field of the same
+  structure as the output location for the calculated CRC. The CRC field should
+  be set to zero before calling this function. Once the CRC field is updated by
+  this function, running it again over the structure produces a CRC of zero.
+
+  @param[in]  Data  A pointer to the target data.
+  @param[in]  DataSize  The target data size.
+  @param[out] CrcOutA pointer to the return location of the CRC.
+
+  @retval EFI_SUCCESS   The CRC was calculated successfully.
+  @retval EFI_INVALID_PARAMETER A null pointer was provided.
+**/
+EFI_STATUS
+CalculateCrc16 (
+  IN  VOID*Data,
+  IN  UINTN   DataSize,
+  OUT UINT16  *CrcOut
+  );
+
+#endif  // _CRC_LIB_H_
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
new file mode 100644
index 00..3e8fa402ad
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.c
@@ -0,0 +1,71 @@
+/** @file
+  Base implementation of the CRC library class.
+
+  @copyright
+  Copyright 2016 - 2018 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+
+/**
+  Calculate a 16-bit CRC.
+
+  The algorithm used is MSB-first form of the ITU-T Recommendation V.41, which
+  uses an initial value of 0x and a polynomial of 0x1021. It is the same
+  algorithm used by XMODEM.
+
+  The output CRC location is not updated until the calculation is finished, so
+  it is possible to pass a structure as the data, and the CRC field of the same
+  structure as the output location for the calculated CRC. The CRC field should
+  be set to zero before calling this function. Once the CRC field is updated by
+  this function, running it again over the structure produces a CRC of zero.
+
+  @param[in]  Data  A pointer to the target data.
+  @param[in]  DataSize  The target data size.
+  @param[out] CrcOutA pointer to the return location of the CRC.
+
+  @retval EFI_SUCCESS   The CRC was calculated successfully.
+  @retval EFI_INVALID_PARAMETER A null pointer was provided.
+**/
+EFI_STATUS
+CalculateCrc16 (
+  IN  VOID*Data,
+  IN  UINTN   DataSize,
+  OUT UINT16  *CrcOut
+  )
+{
+  UINT32  Crc;
+  UINTN   Index;
+  UINT8   *Byte;
+
+  if (Data == NULL || CrcOut == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  Crc = 0x;
+  for (Byte = (UINT8 *) Data; Byte < (UINT8 *) Data + DataSize; Byte++) {
+//
+// XOR the next data byte into the CRC.
+//
+Crc ^= (UINT16) *Byte << 8;
+//
+// Shift out eight bits, feeding back based on the polynomial whenever a
+// 1 is shifted out of bit 15.
+//
+for (Index = 0; Index < 8; Index++) {
+  Crc <<= 1;
+  if (Crc & BIT16) {
+Crc ^= 0x1021;
+  }
+}
+  }
+
+  //
+  // Mask and return the 16-bit CRC.
+  //
+  *CrcOut = (UINT16) (Crc & 0x);
+  return EFI_SUCCESS;
+}
diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf
new file mode 100644
index 00..6b404e1259
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/BaseCrcLib/BaseCrcLib.inf
@@ -0,0 +1,23 @@
+## @file
+# Base implementation of the CRC library class.
+#
+# @copyright
+# Copyright 2016 Intel Corporation. 
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION   = 0x00010019
+  BASE_NAME = BaseCrcLib
+  FILE_GUID 

[edk2-devel][edk2-platforms][PATCH V1 9/9] WhitleyOpenBoardPkg/Build: Remove confusing build options

2022-03-10 Thread Oram, Isaac W
There is an unnecessary inheritance of a SKX build option that has
confused the build settings.

Removed unused IE_ENABLE, PCH_PKG_OPTIONS, and SECURITY_OPTIONS

Fix a bug where changes in PlatformPkgConfig.dsc were not
taking effect because of missing [Defines] context.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc| 12 

 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc |  8 

 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkgConfig.dsc   |  7 
+--
 Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaDxeRpBoards.fdf  |  6 
--
 Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaRpBoards.dsc |  6 
--
 Silicon/Intel/WhitleySiliconPkg/Product/Whitley/SiliconPkg10nmPcds.dsc |  4 
++--
 6 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc
index 1a85a26e25..068ca195bf 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc
@@ -55,20 +55,16 @@ DEFINE NVDIMM_OPTIONS =
 
 !if $(CPUTARGET) == "ICX"
   DEFINE CPU_TYPE_OPTIONS  = -D ICX_HOST -D A0_HOST -D B0_HOST
+  DEFINE MAX_IMC_CH_OPTIONS = -D MAX_IMC=4 -D MAX_MC_CH=2
 !elseif $(CPUTARGET) == "CPX"
   DEFINE CPU_TYPE_OPTIONS  = -D SKX_HOST -D CLX_HOST -D CPX_HOST -D A0_HOST -D 
B0_HOST
+  DEFINE MAX_IMC_CH_OPTIONS = -D MAX_IMC=2 -D MAX_MC_CH=3
 !endif
 
 DEFINE MAX_SOCKET_CORE_THREAD_OPTIONS = -D MAX_SOCKET=$(MAX_SOCKET) -D 
MAX_CORE=$(MAX_CORE) -D MAX_THREAD=$(MAX_THREAD)
 
 DEFINE MRC_OPTIONS = -D LRDIMM_SUPPORT -D DDRT_SUPPORT
 
-!if $(CPU_SKX_ONLY_SUPPORT) == FALSE
-  DEFINE MAX_IMC_CH_OPTIONS = -D MAX_IMC=4 -D MAX_MC_CH=2
-!else
-  DEFINE MAX_IMC_CH_OPTIONS = -D MAX_IMC=2 -D MAX_MC_CH=3
-!endif
-
 DEFINE MAX_SAD_RULE_OPTION = -D MAX_SAD_RULES=24 -D MAX_DRAM_CLUSTERS=1
 
 DEFINE LT_BUILD_OPTIONS = -D LT_FLAG
@@ -88,9 +84,9 @@ DEFINE IIO_STACK_OPTIONS = -D MAX_IIO_STACK=6 -D 
MAX_LOGIC_IIO_STACK=8
 
 DEFINE PCH_BIOS_BUILD_OPTIONS = $(PCH_BUILD_OPTION) $(SC_PATH) 
$(SERVER_BUILD_OPTION)
 
-DEFINE EDKII_DSC_FEATURE_BUILD_OPTIONS = $(CRB_EDKII_BUILD_OPTIONS) 
$(EDKII_DEBUG_BUILD_OPTIONS) $(PCH_BIOS_BUILD_OPTIONS) $(PCH_PKG_OPTIONS) 
$(MAX_SOCKET_CORE_THREAD_OPTIONS) $(MAX_IMC_CH_OPTIONS) $(MAX_SAD_RULE_OPTION) 
$(KTI_OPTIONS) $(IIO_STACK_OPTIONS) $(LT_BUILD_OPTIONS) $(SECURITY_OPTIONS) 
$(SPARING_SCRATCHPAD_OPTION) $(SCRATCHPAD_DEBUG_OPTION) $(NVDIMM_OPTIONS) -D 
EFI_PCI_IOV_SUPPORT -D WHEA_SUPPORT $(CPU_TYPE_OPTIONS) -D 
MMCFG_BASE_ADDRESS=0x8000 -D DISABLE_NEW_DEPRECATED_INTERFACES 
$(MRC_OPTIONS) $(FSP_BUILD_OPTIONS)
+DEFINE EDKII_DSC_FEATURE_BUILD_OPTIONS = $(CRB_EDKII_BUILD_OPTIONS) 
$(EDKII_DEBUG_BUILD_OPTIONS) $(PCH_BIOS_BUILD_OPTIONS) 
$(MAX_SOCKET_CORE_THREAD_OPTIONS) $(MAX_IMC_CH_OPTIONS) $(MAX_SAD_RULE_OPTION) 
$(KTI_OPTIONS) $(IIO_STACK_OPTIONS) $(LT_BUILD_OPTIONS) 
$(SPARING_SCRATCHPAD_OPTION) $(SCRATCHPAD_DEBUG_OPTION) $(NVDIMM_OPTIONS) -D 
EFI_PCI_IOV_SUPPORT -D WHEA_SUPPORT $(CPU_TYPE_OPTIONS) -D 
MMCFG_BASE_ADDRESS=0x8000 -D DISABLE_NEW_DEPRECATED_INTERFACES 
$(MRC_OPTIONS) $(FSP_BUILD_OPTIONS)
 
-DEFINE IE_OPTIONS = $(IE_PATH) -DIE_SUPPORT=0
+DEFINE IE_OPTIONS = $(IE_PATH)
 
 !if $(LINUX_GCC_BUILD) == TRUE
   DEFINE EDK2_LINUX_BUILD_OPTIONS = -D EDK2_CTE_BUILD
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc 
b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
index 042c27c709..8c4b9cf6ce 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
+++ b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
@@ -169,7 +169,7 @@
   ## This PCD specifies whether FPGA routine will be active
   gSocketPkgFpgaGuid.PcdSktFpgaActive|TRUE
 
-!if $(CPU_SKX_ONLY_SUPPORT) == TRUE
+!if $(CPUTARGET) == "CPX"
   gEfiCpRcPkgTokenSpaceGuid.PerBitMargin|FALSE
   gEfiCpRcPkgTokenSpaceGuid.PcdSeparateCwlAdj|TRUE
 !endif
@@ -343,7 +343,7 @@
   # Disable Fast Warm Boot for Whitley Openboard Package
   gEfiCpRcPkgTokenSpaceGuid.PcdMrcFastBootDefault|FALSE
 
-!if $(CPU_SKX_ONLY_SUPPORT) == FALSE
+!if $(CPUTARGET) == "ICX"
   gCpuUncoreTokenSpaceGuid.PcdWaSerializationEn|FALSE
   gEfiCpRcPkgTokenSpaceGuid.PcdMrcCmdVrefCenteringTrainingEnable|FALSE
 !endif
@@ -426,7 +426,7 @@
   #
 
   gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 # 
Enable status codes for debug, progress, and errors
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8042   # 
Displayed messages:  Error, Info, warn
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8047   # 
Displayed messages:  Error, Info, warn
 
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x8000
   gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs|0
@@ -856,7 +856,7 @@
   DEFINE CPU_CPX_SUPPORT = FALSE
 !endif
 

[edk2-devel][edk2-platforms][PATCH V1 4/9] WhitleyOpenBoardPkg: Add UbaPlatLib Library

2022-03-10 Thread Oram, Isaac W
UbaPlatLib is required by AcpiTablesLib used by AcpiPlatform driver.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 
Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaGpioPlatformConfigLib.c
 | 388 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaSystemBoardInfoLib.c
|  62 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaSystemConfigUpdateLib.c
 |  60 ++
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaUsbOcUpdateLib.c   
 |  61 ++
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaAcpiUpdateLib.c   
 |  59 ++
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaFpkConfigLib.c
 |  57 ++
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaIioConfigLib.c
 | 132 
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaOpromUpdateLib.c  
 | 221 +++
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaPlatLib.inf   
 |  62 ++
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaSlotUpdateLib.c   
 | 114 
 Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/UbaSmbiosUpdateLib.c 
 | 663 
 Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaCommon.dsc   
 |   3 +
 12 files changed, 1882 insertions(+)

diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaGpioPlatformConfigLib.c
 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaGpioPlatformConfigLib.c
new file mode 100644
index 00..d03f0f9957
--- /dev/null
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/UbaPlatLib/DxeUbaGpioPlatformConfigLib.c
@@ -0,0 +1,388 @@
+/** @file
+
+  @copyright
+  Copyright 2012 - 2017 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+//
+// UBA and GPIO headers
+//
+
+#include 
+#include 
+
+STATIC PLATFORM_GPIO_CONFIG_TABLE mGpioParams;
+DYNAMIC_SI_LIBARY_PROTOCOL*mDynamicSiLibraryProtocol = 
NULL;
+
+/**
+  The library constructor call. Gets required protocols and stores for later 
usage
+  This also applies for SMM mode usage
+
+  @param[in]  None
+
+  @retval EFI_SUCCESS The function completed successfully
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeDxeUbaPlatLib (
+  IN  EFI_HANDLEImageHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUSStatus;
+  UBA_CONFIG_DATABASE_PROTOCOL  *UbaConfigProtocol = NULL;
+  UINTN TableSize;
+
+  Status = gBS->LocateProtocol (, NULL, 
);
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+return EFI_NOT_FOUND;
+  }
+
+Status = gBS->LocateProtocol (
+,
+NULL,
+
+);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+
+  TableSize = sizeof (PLATFORM_GPIO_CONFIG_TABLE);
+  Status = UbaConfigProtocol->GetData (
+UbaConfigProtocol,
+,
+,
+
+);
+
+  return Status;
+
+}
+
+/**
+  Reads GPIO pin to get DFX jumper status
+
+  @param[out] DfxJumper - The pointer to the DFX jumper input
+
+  @retval Status - Success if GPIO's are read properly
+
+**/
+EFI_STATUS
+GpioGetDfxPadVal (
+  OUT UINT32 *DfxJumper
+  )
+{
+  EFI_STATUS   Status;
+
+  if (mGpioParams.ReservedM == UNUSED_GPIO) {
+return EFI_UNSUPPORTED;
+  }
+
+  Status = mDynamicSiLibraryProtocol->GpioGetInputValue 
(mGpioParams.ReservedM, DfxJumper);
+  return Status;
+}
+
+/**
+  Reads GPIO pin to get recovery jumper status
+
+  @param[out] RcvJumper - The pointer to the Recovery jumper input
+
+  @retval Status - Success if GPIO's are read properly
+
+**/
+EFI_STATUS
+GpioGetRcvPadVal (
+  OUT UINT32 *RcvJumper
+  )
+{
+  EFI_STATUS   Status;
+
+  if (mGpioParams.RcvJumper == UNUSED_GPIO) {
+return EFI_UNSUPPORTED;
+  }
+
+  Status = mDynamicSiLibraryProtocol->GpioGetInputValue 
(mGpioParams.RcvJumper, RcvJumper);
+  return Status;
+}
+
+/**
+  Reads GPIO pin to get FM ADR trigger pin
+
+  @param[out] FmAdrTrigger - The pointer to the ADR trigger input
+
+  @retval Status - Success if GPIO's are read properly
+
+**/
+EFI_STATUS
+GpioGetFmAdrTriggerPadVal (
+  OUT UINT32 *FmAdrTrigger
+  )
+{
+  EFI_STATUS   Status;
+
+  if (mGpioParams.FmAdrTrigger == UNUSED_GPIO) {
+return EFI_UNSUPPORTED;
+  }
+
+  Status = mDynamicSiLibraryProtocol->GpioGetInputValue 
(mGpioParams.FmAdrTrigger, FmAdrTrigger);
+  return Status;
+}
+
+/**
+  Sets GPIO pin to enable ADR on the board
+
+  @param Set[in] - If TRUE means the pas should go 'high', otherwise 'low'
+
+  @retval Status - Success if GPIO set properly
+

[edk2-devel][edk2-platforms][PATCH V1 5/9] WhitleyOpenBoardPkg/PlatformSpecificAcpiTableLib: Add library

2022-03-10 Thread Oram, Isaac W
Enables boards to modify the AcpiPlatform driver behaviors.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 
Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformSpecificAcpiTableLib.h
| 129 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/AcpiPlatformLibSpcrNull.c
|  23 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/PlatformSpecificAcpiTableLibNull.c
   |  50 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/PlatformSpecificAcpiTableLibNull.inf
 |  27 
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc 
  |   1 +
 5 files changed, 230 insertions(+)

diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformSpecificAcpiTableLib.h
 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformSpecificAcpiTableLib.h
new file mode 100644
index 00..a260703274
--- /dev/null
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformSpecificAcpiTableLib.h
@@ -0,0 +1,129 @@
+/** @file
+  This library provides a set of platform only ACPI tables and functions.
+
+  @copyright
+  Copyright 2012 - 2020 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _PLATFORM_SPECIFIC_ACPI_TABLE_LIB_H_
+#define _PLATFORM_SPECIFIC_ACPI_TABLE_LIB_H_
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  This function will check ACPI Table is active or not active.
+  This allows boards to prevent publication of unused tables.
+
+  @param Table  -  The table to check
+
+  @retval EFI_SUCCESS  -  The Table is active.
+
+**/
+EFI_STATUS
+PlatformAcpiReportHooksTableIsActive (
+  IN OUT EFI_ACPI_COMMON_HEADER *Table
+  );
+
+/**
+  This function will patch to update platform ACPI Table information.
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI_SUCCESS  -  The function completed successfully.
+
+**/
+EFI_STATUS
+PatchPlatformSpecificAcpiTableHooks (
+  IN OUT EFI_ACPI_COMMON_HEADER *Table
+  );
+
+/**
+  This function will patch to update SPCR Table information.
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI_SUCCESS  -  The function completed successfully.
+
+**/
+EFI_STATUS
+PatchSpcrAcpiTable (
+  IN OUT  EFI_ACPI_COMMON_HEADER  *Table
+  );
+
+/**
+  Update the HMAT table.
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI SUCCESS   Procedure returned successfully.
+**/
+EFI_STATUS
+PatchHmatAcpiTable (
+  IN OUT  EFI_ACPI_COMMON_HEADER  *Table
+  );
+
+/**
+  Update the PMTT ACPI table
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI_SUCCESS -  Returns Success
+
+**/
+EFI_STATUS
+PatchPlatformMemoryTopologyTable (
+  IN OUT   EFI_ACPI_COMMON_HEADER  *Table
+  );
+
+/**
+  Update the MSCT ACPI table
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI_SUCCESS -  Returns Success
+
+**/
+EFI_STATUS
+PatchMsctAcpiTable (
+  IN OUT   EFI_ACPI_COMMON_HEADER   *Table
+  );
+
+/**
+
+  Update the MIGT ACPI table
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI_SUCCESS -  Returns Success
+
+**/
+EFI_STATUS
+PatchMigtAcpiTable (
+  IN OUT   EFI_ACPI_COMMON_HEADER   *Table
+  );
+
+/**
+  Update the BDAT ACPI table: Multiple instances of the BDAT DATA HOB are 
placed into one contiguos memory range
+
+  @param [in, out]  Table   The table to be udated.
+
+  @retval EFI_SUCCESS -  Returns Success
+
+**/
+EFI_STATUS
+PatchBdatAcpiTable (
+  IN OUT  EFI_ACPI_COMMON_HEADER  *Table
+  );
+
+#endif
diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/AcpiPlatformLibSpcrNull.c
 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/AcpiPlatformLibSpcrNull.c
new file mode 100644
index 00..0f4ffcf86f
--- /dev/null
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/AcpiPlatformLibSpcrNull.c
@@ -0,0 +1,23 @@
+/** @file
+  ACPI Platform Driver Hooks
+
+  @copyright
+  Copyright 1996 - 2016 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+//
+// Statements that include other files
+//
+#include 
+
+EFI_STATUS
+PatchSpcrAcpiTable (
+  IN OUT  EFI_ACPI_COMMON_HEADER  *Table
+  )
+{
+  EFI_STATUSStatus = EFI_SUCCESS;
+
+  return Status;
+}
diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/PlatformSpecificAcpiTableLibNull.c
 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/PlatformSpecificAcpiTableLibNull.c
new file mode 100644
index 00..74bce3141d
--- /dev/null
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Library/PlatformSpecificAcpiTableLibNull/PlatformSpecificAcpiTableLibNull.c
@@ 

[edk2-devel][edk2-platforms][PATCH V1 1/9] WhitleyOpenBoardPkg: Add definitions needed for AcpiPlatform driver

2022-03-10 Thread Oram, Isaac W
Adds various definitions needed to move the AcpiPlatform driver from
FvLateOpenBoard binary to open source.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
 |   1 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf 
|   1 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Madt.h 
 | 118 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Slit.h 
 |  75 +++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Srat.h 
 |  53 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/amlresrc.h 
 | 542 
 Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc
 |   6 +-
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/AcpiPlatformLib.h   
 | 107 
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformStatusCodes.h   
 | 364 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/UbaFpkConfigLib.h   
 |  55 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/UbaSmbiosUpdateLib.h
 | 275 ++
 Platform/Intel/WhitleyOpenBoardPkg/Library/BoardInitLib/BoardInitDxeLib.inf
 |   1 +
 12 files changed, 1597 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
 
b/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
index faea9726f7..80a4288895 100644
--- 
a/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
@@ -34,6 +34,7 @@
   WhitleySiliconPkg/CpRcPkg.dec
   WhitleySiliconPkg/Cpu/CpuRcPkg.dec
   WhitleyOpenBoardPkg/PlatformPkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
   UefiDriverEntryPoint
diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf
 
b/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf
index 4121ea8982..cf5148b135 100644
--- 
a/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf
@@ -32,6 +32,7 @@
   WhitleySiliconPkg/CpRcPkg.dec
   WhitleySiliconPkg/Cpu/CpuRcPkg.dec
   WhitleyOpenBoardPkg/PlatformPkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
   UefiDriverEntryPoint
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Madt.h 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Madt.h
new file mode 100644
index 00..1860e1104d
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Madt.h
@@ -0,0 +1,118 @@
+/** @file
+  This file describes the contents of the ACPI Multiple APIC Description
+  Table (MADT).  Some additional ACPI values are defined in Acpi1_0.h and
+  Acpi2_0.h.
+  To make changes to the MADT, it is necessary to update the count for the
+  APIC structure being updated, and to modify table found in Madt.c.
+
+  @copyright
+  Copyright 1996 - 2014 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _MADT_H
+#define _MADT_H
+
+//
+// Statements that include other files
+//
+#include 
+#include "Platform.h"
+
+//
+// MADT Definitions
+//
+#define EFI_ACPI_OEM_MADT_REVISION  0x
+//
+// Multiple APIC Flags are defined in AcpiX.0.h
+//
+#define EFI_ACPI_6_2_MULTIPLE_APIC_FLAGS  (EFI_ACPI_6_2_PCAT_COMPAT)
+
+//
+// Local APIC address
+//
+#define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE0
+//
+// Define the number of each table type.
+// This is where the table layout is modified.
+//
+#define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT   MAX_CPU_NUM
+#define EFI_ACPI_LOCAL_APIC_NMI_COUNT MAX_CPU_NUM
+#define EFI_ACPI_PROCESSOR_LOCAL_X2APIC_COUNT MAX_CPU_NUM
+#define EFI_ACPI_LOCAL_X2APIC_NMI_COUNT   MAX_CPU_NUM
+#define EFI_ACPI_IO_APIC_COUNT32 + 1  // IIO I/O APIC 
(PCH) +  I/O APIC (PC00-PC31)
+#define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT  2
+#define EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT  0
+#define EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT0
+#define EFI_ACPI_IO_SAPIC_COUNT   0
+#define EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT  0
+#define EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT 0
+
+//
+// MADT structure
+//
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+//
+// ACPI 4.0 Table structure
+//
+typedef struct {
+  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+
+#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0  // Type 0x00
+  EFI_ACPI_6_2_PROCESSOR_LOCAL_APIC_STRUCTURE   
LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
+#endif
+
+#if EFI_ACPI_IO_APIC_COUNT > 0 

[edk2-devel][edk2-platforms][PATCH V1 8/9] WhitleyOpenBoardPkg/AcpiPlatform: Add driver for publishing ACPI tables

2022-03-10 Thread Oram, Isaac W
AcpiPlatform DXE driver loads and patches ACPI tables before publishing.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.c   
  |  754 +
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.h   
  |  117 ++
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.inf 
  |  107 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformHooks.c
|  384 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformHooks.h
|   51 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformUtils.c
|  133 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformUtils.h
|   66 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformVTDHooks.c
 | 1762 
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dec 
  |   11 +-
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc 
  |3 +
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.fdf 
  |3 +
 Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaMain/StaticSkuDataDxe/Readme.md  
  |1 +
 Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets/AmlOffsets.inf 
  |2 +-
 13 files changed, 3388 insertions(+), 6 deletions(-)

diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.c 
b/Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.c
new file mode 100644
index 00..1648029bd1
--- /dev/null
+++ 
b/Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.c
@@ -0,0 +1,754 @@
+/** @file
+  ACPI Platform Driver
+
+  @copyright
+  Copyright 1999 - 2020 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include "AcpiPlatform.h"
+#include "AcpiPlatformUtils.h"
+#include "AcpiPlatformHooks.h"
+#include 
+#include 
+#include 
+#include 
+
+
+#ifndef __GNUC__
+#pragma optimize("", off)
+#endif  //__GNUC__
+
+extern SOCKET_IIO_CONFIGURATION   mSocketIioConfiguration;
+extern SOCKET_POWERMANAGEMENT_CONFIGURATION   
mSocketPowermanagementConfiguration;
+extern SOCKET_PROCESSORCORE_CONFIGURATION 
mSocketProcessorCoreConfiguration;
+extern EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE *mSpcrTable;
+extern EFI_GUID   gEfiGlobalVariableGuid;
+extern EFI_GUID   
gEfiPmSsdtTableStorageGuid;
+
+BIOS_ACPI_PARAM   *mAcpiParameter = NULL;
+BOOLEAN   mFirstNotify;
+SYSTEM_CONFIGURATION  mSystemConfiguration;
+PCH_SETUP mPchSetup;
+
+UINT8   mKBPresent = 0;
+UINT8   mMousePresent = 0;
+EFI_IIO_UDS_PROTOCOL*mIioUds2 = NULL;
+extern CPU_CSR_ACCESS_VAR   *mCpuCsrAccessVarPtr;
+UINT8   mPStateEnable = 0;
+
+
+VOID
+EFIAPI
+AcpiOnPciEnumCmplCallback (
+  IN EFI_EVENT  Event,
+  IN VOID  *Context
+  )
+{
+  EFI_STATUSStatus;
+
+  Status = gBS->LocateProtocol (, NULL, 
);
+  if (EFI_ERROR (Status)) {
+//
+// Skip the first dummy event signal.
+//
+return;
+  }
+  gBS->CloseEvent (Event);
+
+  DEBUG ((DEBUG_INFO, "[ACPI] %a\n", __FUNCTION__));
+  AcpiVtdTablesInstall ();
+}
+
+
+VOID
+EFIAPI
+AcpiOnEndOfDxeCallback (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  DEBUG ((DEBUG_INFO, "[ACPI] %a\n", __FUNCTION__));
+  //
+  // Installing ACPI Tables: NFIT, PCAT
+  //
+  InstallAndPatchAcpiTable (NVDIMM_FW_INTERFACE_TABLE_SIGNATURE);
+  InstallAndPatchAcpiTable (NVDIMM_PLATFORM_CONFIG_ATTRIBUTE_TABLE_SIGNATURE);
+}
+
+
+//
+// Enable SCI for ACPI aware OS at ExitBootServices
+//
+VOID
+EFIAPI
+AcpiOnExitBootServicesCallback (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  UINT16Pm1Cnt;
+
+  gBS->CloseEvent (Event);
+
+  DEBUG ((DEBUG_INFO, "[ACPI] %a\n", __FUNCTION__));
+  //
+  // Enable SCI
+  //
+  Pm1Cnt = IoRead16 (mAcpiParameter->PmBase + R_ACPI_IO_PM1_CNT);
+  Pm1Cnt |= B_ACPI_IO_PM1_CNT_SCI_EN;
+  IoWrite16 (mAcpiParameter->PmBase + R_ACPI_IO_PM1_CNT, Pm1Cnt);
+}
+
+/**
+  Disables the SW SMI Timer.
+  ACPI events are disabled and ACPI event status is cleared.
+  SCI mode is then enabled.
+
+  Disable SW SMI Timer
+
+  Clear all ACPI event status and disable all ACPI events
+  Disable PM sources except power button
+  Clear status bits
+
+  Disable GPE0 sources
+  Clear status bits
+
+  Disable GPE1 sources
+  Clear status bits
+
+  Guarantee day-of-month alarm is invalid (ACPI 1.0 section 4.7.2.4)
+
+  Enable SCI
+
+  @param Event   - not used
+  @param Context - not used
+
+  @retval None
+**/
+STATIC
+VOID
+AcpiEnableAtReadyToBoot (
+  VOID
+  )
+{
+  UINT32  SmiEn;
+  UINT8   Data8;
+  UINT16  Pm1En;
+
+  

[edk2-devel][edk2-platforms][PATCH V1 6/9] WhitleyOpenBoardPkg/BuildAcpiTablesLib: Add lib for building MADT and SRAT

2022-03-10 Thread Oram, Isaac W
Library for building tables during the boot.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/BuildAcpiTablesLib.h
 | 111 +
 
Platform/Intel/WhitleyOpenBoardPkg/Library/BuildAcpiTablesLib/DxeBuildAcpiTablesLib.c
   | 470 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/BuildAcpiTablesLib/DxeBuildAcpiTablesLib.inf
 |  40 ++
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc 
 |   1 +
 4 files changed, 622 insertions(+)

diff --git 
a/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/BuildAcpiTablesLib.h 
b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/BuildAcpiTablesLib.h
new file mode 100644
index 00..99aa1c02f7
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Include/Library/BuildAcpiTablesLib.h
@@ -0,0 +1,111 @@
+/** @file
+  Library for building ACPI Tables.
+
+  @copyright
+  Copyright 2016 - 2019 Intel Corporation. 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _BUILD_ACPI_TABLES_LIB_H_
+#define _BUILD_ACPI_TABLES_LIB_H_
+
+#include 
+
+/** Structure of a MADT and SRAT sub-structure header.
+
+  This structure contains the type and length fields, which are common to every
+  sub-structure of the MADT and SRAT tables. A pointer to any structure can be 
cast as this.
+**/
+typedef struct {
+  UINT8 Type;
+  UINT8 Length;
+} STRUCTURE_HEADER;
+
+/**
+  Initialize the MADT header.
+
+  This function fills in the MADT's standard table header with correct values,
+  except for the length and checksum fields, which are filled in when building
+  the whole table.
+
+  @param[in,out]  MadtHeaderPointer to the MADT header structure.
+
+  @retval EFI_SUCCESS   Successfully initialized the MADT header.
+  @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+**/
+EFI_STATUS
+InitializeMadtHeader (
+  IN OUT EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *MadtHeader
+  );
+
+/**
+  Initialize the SRAT header.
+
+  This function fills in the SRAT's standard table header with correct values,
+  except for the length and checksum fields, which are filled in when building
+  the whole table.
+
+  @param[in,out]  SratHeaderPointer to the SRAT header structure.
+
+  @retval EFI_SUCCESS   Successfully initialized the SRAT header.
+  @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+**/
+EFI_STATUS
+InitializeSratHeader (
+  IN OUT EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *SratHeader
+  );
+
+/**
+  Copy an ACPI sub-structure; MADT and SRAT supported
+
+  This function validates the structure type and size of a sub-structure
+  and returns a newly allocated copy of it.
+
+  @param[in]  HeaderPointer to the header of the table.
+  @param[in]  Structure Pointer to the structure to copy.
+  @param[in]  NewStructure  Newly allocated copy of the structure.
+
+  @retval EFI_SUCCESS   Successfully copied the structure.
+  @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+  @retval EFI_INVALID_PARAMETER Structure type was unknown.
+  @retval EFI_INVALID_PARAMETER Structure length was wrong for its type.
+  @retval EFI_UNSUPPORTED   Header passed in is not supported.
+**/
+EFI_STATUS
+CopyStructure (
+  IN  EFI_ACPI_DESCRIPTION_HEADER *Header,
+  IN  STRUCTURE_HEADER *Structure,
+  OUT STRUCTURE_HEADER **NewStructure
+  );
+
+/**
+  Build ACPI Table. MADT and SRAT tables supported.
+
+  This function builds the ACPI table from the header plus the list of 
sub-structures
+  passed in. The table returned by this function is ready to be installed using
+  the ACPI table protocol's InstallAcpiTable function, which copies it into
+  ACPI memory. After that, the caller should free the memory returned by this
+  function.
+
+  @param[in]  AcpiHeader Pointer to the header structure.
+  @param[in]  TableSpecificHdrLength Size of the table specific header, not 
the ACPI standard header size.
+  @param[in]  Structures Pointer to an array of sub-structure 
pointers.
+  @param[in]  StructureCount Number of structure pointers in the array.
+  @param[out] NewTable   Newly allocated and initialized pointer 
to the ACPI Table.
+
+  @retval EFI_SUCCESS   Successfully built the ACPI table.
+  @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+  @retval EFI_INVALID_PARAMETER Header parameter had the wrong signature.
+  @retval EFI_OUT_OF_RESOURCES  Space for the ACPI Table could not be 
allocated.
+**/
+EFI_STATUS
+BuildAcpiTable (
+  IN  EFI_ACPI_DESCRIPTION_HEADER  *AcpiHeader,
+  IN  UINTNTableSpecificHdrLength,
+  IN  STRUCTURE_HEADER **Structures,
+  IN  UINTNStructureCount,
+  OUT UINT8**NewTable
+  );
+
+#endif // _BUILD_ACPI_TABLES_LIB_H_
diff --git 

[edk2-devel][edk2-platforms][PATCH V1 0/9] Add Whitley AcpiPlatform driver

2022-03-10 Thread Oram, Isaac W
This series converts the AcpiPlatform driver for Whitley ICX to open source.
The driver requires libraries providing:
16-bit CRC service
A library to update the tables based on boot time data.
A board hook library to control publishing individual tables and to modify 
tables.
A library to build MADT and SRAT tables during boot.
A Universal Board Abstraction library to translate UBA data.

The driver consumes the AcpiTables data file and the AML opcode patching table 
From
StaticSkuDataDxe driver.

This code does not support the CooperCity hardware at present.
The code depends on additional DynamicSiLibraryProtocol2 and updated 
WhitleyFspBinPkg content.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 

Isaac Oram (9):
  WhitleyOpenBoardPkg: Add definitions needed for AcpiPlatform driver
  WhitleySiliconPkg: Add definitions used in ACPI subsystem
  WhitleyOpenBoardPkg/BaseCrcLib: Add library for CRC16
  WhitleyOpenBoardPkg: Add UbaPlatLib Library
  WhitleyOpenBoardPkg/PlatformSpecificAcpiTableLib: Add library
  WhitleyOpenBoardPkg/BuildAcpiTablesLib: Add lib for building MADT and
SRAT
  WhitleyOpenBoardPkg/AcpiTablesLib: Add library for AcpiPlatform driver
  WhitleyOpenBoardPkg/AcpiPlatform: Add driver for publishing ACPI
tables
  WhitleyOpenBoardPkg/Build: Remove confusing build options

 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.c   
  |  754 +
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.h   
  |  117 ++
 Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.inf 
  |  107 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformHooks.c
|  384 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformHooks.h
|   51 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformUtils.c
|  133 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformUtils.h
|   66 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatformVTDHooks.c
 | 1762 
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciHostBridge/PciHostBridge.inf
  |1 +
 
Platform/Intel/WhitleyOpenBoardPkg/Features/Pci/Dxe/PciPlatform/PciPlatform.inf 
 |1 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Madt.h 
  |  118 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Slit.h 
  |   75 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/Srat.h 
  |   53 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Acpi/amlresrc.h 
  |  542 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Dsc/BuildOptions.dsc
  |   18 +-
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/AcpiPlatformLib.h   
  |  107 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/BuildAcpiTablesLib.h
  |  111 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/CrcLib.h
  |   42 +
 
Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformSpecificAcpiTableLib.h
|  129 ++
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/PlatformStatusCodes.h   
  |  364 
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/UbaFpkConfigLib.h   
  |   55 +
 Platform/Intel/WhitleyOpenBoardPkg/Include/Library/UbaSmbiosUpdateLib.h
  |  275 +++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLib.c
|  534 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLib.inf
  |  127 ++
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibApic.c
|  735 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibBdat.c
| 1574 +
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibDsdt.c
|  673 
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibFadt.c
|   75 +
 
Platform/Intel/WhitleyOpenBoardPkg/Library/AcpiPlatformTableLib/AcpiPlatformLibHmat.c

[edk2-devel][edk2-platforms][PATCH V1 2/9] WhitleySiliconPkg: Add definitions used in ACPI subsystem

2022-03-10 Thread Oram, Isaac W
Needed to convert FvLateOpenBoard ACPI binary drivers to open source.

Cc: Nate DeSimone 
Cc: Chasel Chiu 
Signed-off-by: Isaac Oram 
---
 Silicon/Intel/WhitleySiliconPkg/CpRcPkg.dec
 |   3 +
 Silicon/Intel/WhitleySiliconPkg/Cpu/Include/CpuDataStruct.h
 |   7 +
 Silicon/Intel/WhitleySiliconPkg/Cpu/Include/Library/CpuConfigLib.h 
 |  82 
 Silicon/Intel/WhitleySiliconPkg/Include/BackCompatible.h   
 |   3 +
 Silicon/Intel/WhitleySiliconPkg/Include/BdatSchema.h   
 | 301 
 Silicon/Intel/WhitleySiliconPkg/Include/Guid/MemoryMapData.h   
 |   2 +
 Silicon/Intel/WhitleySiliconPkg/Include/IioRegs.h  
 |  74 ++-
 Silicon/Intel/WhitleySiliconPkg/Include/Library/EnhancedWarningLogLib.h
 | 494 
 Silicon/Intel/WhitleySiliconPkg/Include/Library/SpdAccessLib.h 
 |  32 ++
 Silicon/Intel/WhitleySiliconPkg/Include/MemCommon.h
 |   7 +
 Silicon/Intel/WhitleySiliconPkg/Include/Platform.h 
 |   7 +
 Silicon/Intel/WhitleySiliconPkg/Include/Ppi/MemoryPolicyPpi.h  
 |   2 +-
 Silicon/Intel/WhitleySiliconPkg/Include/Protocol/AcpiPlatformProtocol.h
 |  51 ++
 Silicon/Intel/WhitleySiliconPkg/Include/Protocol/CpuCsrAccess.h
 | 254 ++
 Silicon/Intel/WhitleySiliconPkg/Include/Protocol/DynamicSiLibraryProtocol.h
 |  43 +-
 Silicon/Intel/WhitleySiliconPkg/Include/Protocol/DynamicSiLibraryProtocol2.h   
 | 255 ++
 Silicon/Intel/WhitleySiliconPkg/Include/Protocol/NfitTableUpdateProtocol.h 
 |  27 ++
 Silicon/Intel/WhitleySiliconPkg/Include/Protocol/SmbiosMemInfo.h   
 |  87 
 
Silicon/Intel/WhitleySiliconPkg/Library/BaseMemoryCoreLib/Core/Include/MemRegs.h
|   2 +
 
Silicon/Intel/WhitleySiliconPkg/Library/BaseMemoryCoreLib/Core/Include/MrcCommonTypes.h
 |  25 +
 
Silicon/Intel/WhitleySiliconPkg/Library/BaseMemoryCoreLib/Core/Include/SysHost.h
|  34 +-
 
Silicon/Intel/WhitleySiliconPkg/Library/BaseMemoryCoreLib/Platform/MemDefaults.h
|   7 +
 Silicon/Intel/WhitleySiliconPkg/Pch/SouthClusterLbg/Include/PchInfoHob.h   
 |  50 ++
 Silicon/Intel/WhitleySiliconPkg/WhitleySiliconPkg.dec  
 |   1 +
 24 files changed, 1783 insertions(+), 67 deletions(-)

diff --git a/Silicon/Intel/WhitleySiliconPkg/CpRcPkg.dec 
b/Silicon/Intel/WhitleySiliconPkg/CpRcPkg.dec
index 902abd30f8..2ccdbffa35 100644
--- a/Silicon/Intel/WhitleySiliconPkg/CpRcPkg.dec
+++ b/Silicon/Intel/WhitleySiliconPkg/CpRcPkg.dec
@@ -82,6 +82,9 @@
   gRcSimBiosIdFileGuid= { 0xf0c51ad5, 0x44f0, 0x4622, { 0x95, 
0x15, 0xe2, 0x7, 0x71, 0xf0, 0xe0, 0xf2 }}
   gSystemTopologyGuid = { 0x743e5992, 0xf2a0, 0x4c9f, { 0xa5, 
0xf5, 0x3b, 0x24, 0xad, 0xe8, 0x7f, 0x4d }}
 
+[Protocols]
+  gEfiCpuCsrAccessGuid= { 0x0067835f, 0x9a50, 0x433a, { 0x8c, 
0xbb, 0x85, 0x20, 0x78, 0x19, 0x78, 0x14 }}
+
 [PPIs]
   ## Include/Ppi/MemorySetupPolicyPpi.h
   gMemoryPolicyPpiGuid = { 0x731b6dbc, 0x18ac, 0x4cc3, { 0x9e, 
0xe2, 0x9e, 0x5f, 0x33, 0x39, 0x68, 0x81 }}
diff --git a/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/CpuDataStruct.h 
b/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/CpuDataStruct.h
index aaabf032f9..e1416a0d1c 100644
--- a/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/CpuDataStruct.h
+++ b/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/CpuDataStruct.h
@@ -24,4 +24,11 @@
 //
 #define CONFIG_TDP_TOTAL_LEVEL  5
 
+typedef struct {
+  UINT32  RegEax;
+  UINT32  RegEbx;
+  UINT32  RegEcx;
+  UINT32  RegEdx;
+} EFI_CPUID_REGISTER;
+
 #endif
diff --git a/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/Library/CpuConfigLib.h 
b/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/Library/CpuConfigLib.h
index 298fe08624..805f2ac6c8 100644
--- a/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/Library/CpuConfigLib.h
+++ b/Silicon/Intel/WhitleySiliconPkg/Cpu/Include/Library/CpuConfigLib.h
@@ -19,6 +19,88 @@
 #define C0_ENABLE   0x00
 #define C6_ENABLE   0x03
 
+//
+// Structure for collected CPUID data.
+//
+typedef struct {
+  EFI_CPUID_REGISTER *CpuIdLeaf;
+  UINTN  NumberOfBasicCpuidLeafs;
+  UINTN  NumberOfExtendedCpuidLeafs;
+  UINTN  NumberOfCacheAndTlbCpuidLeafs;
+  UINTN  NumberOfDeterministicCacheParametersCpuidLeafs;
+  UINTN  NumberOfExtendedTopologyEnumerationLeafs;
+} CPU_CPUID_DATA;
+
+typedef struct {
+  UINTNRatio;
+  UINTNVid;
+  UINTNPower;
+  UINTNTransitionLatency;
+  UINTNBusMasterLatency;
+} FVID_ENTRY;
+
+typedef struct {
+  VOID 

Re: [edk2-devel] [PATCH] UefiPayloadPkg: Provide option to use Boot Splash

2022-03-10 Thread Guo Dong
Yes, if you do it only when you could locate gEdkiiPlatformLogoProtocolGuid. 
This way you don’t need a PCD and the build option is only used for logo module 
built-in or not.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87423): https://edk2.groups.io/g/devel/message/87423
Mute This Topic: https://groups.io/mt/89281295/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: Provide option to use Boot Splash

2022-03-10 Thread Sean Rhodes
Do you mean check if the protocol exist in PlatformBootManager.c? i.e.
if (gEdkiiPlatformLogoProtocolGuid ) {
gST->ConOut->ClearScreen (gST->ConOut);

If not, can I ask the reasoning, as if I understand it, that would be a complex 
solution for saving one PCD


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




[edk2-devel] [PATCH v1 1/1] DynamicTablesPkg: Fix serial port namespace path in DBG2

2022-03-10 Thread Sami Mujawar
According to the Debug Port Table 2 (DBG2) specification,
February 17, 2021, the NamespaceString is a NULL terminated
ASCII string that consists of a fully qualified reference
to the object that represents the serial port device in the
ACPI namespace.

The DBG2 table generator did not populate the full device
path for the serial port device, and this results in a FWTS
test failure.

Therefore, populate the full namespace device path for the
serial port in DBG2 table.

Signed-off-by: Sami Mujawar 
---
The changes can be seen at:
https://github.com/samimujawar/edk2/tree/2105_dbg2_generator_namestring_issue_v1

 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 10 
+++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 
3d513dbd1fbe8c47d270a9e639b2797098201d91..f6dfb3d94c10980a0e7712ce9427648b69974061
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -1,7 +1,7 @@
 /** @file
   DBG2 Table Generator
 
-  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -55,13 +55,17 @@ Requirements:
 */
 #define NAME_STR_DBG_PORT0  "COM0"
 
+/** A string representing the full path name of the debug port 0.
+*/
+#define NAMESPACE_STR_DBG_PORT0  "\\_SB_.COM0"
+
 /** An UID representing the debug port 0.
 */
 #define UID_DBG_PORT0  0
 
 /** The length of the namespace string.
 */
-#define DBG2_NAMESPACESTRING_FIELD_SIZE  sizeof (NAME_STR_DBG_PORT0)
+#define DBG2_NAMESPACESTRING_FIELD_SIZE  sizeof (NAMESPACE_STR_DBG_PORT0)
 
 /** The PL011 UART address range length.
 */
@@ -166,7 +170,7 @@ DBG2_TABLE  AcpiDbg2 = {
   0,// {Template}: Serial Port Subtype
   0,// {Template}: Serial Port Base Address
   PL011_UART_LENGTH,
-  NAME_STR_DBG_PORT0
+  NAMESPACE_STR_DBG_PORT0
   )
   }
 };
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




Re: [edk2-devel] [PATCH] MdeModulePkg/ScsiDisk: Change TPL to NOTIFY

2022-03-10 Thread Jeff Brasen via groups.io
Resuming this PATCH to see if there are any additional thoughts on this.

In response to the query about DXE/BDS services we have some internal 
connection logic that runs in DXE to connect the devices that are needed for 
arch services that have to be connected prior the end of dxe.

Thanks,
Jeff


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




Re: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-10 Thread Pu, Yu
Hi, Mike, Liming,

This patch makes MdeModulePkg depend on UefiCpuPkg.
Ray and me would like to move the UefiCpuLib from UefiCpuPkg to MdePkg, do you 
agree with it ?

Thanks,
Yu

-Original Message-
From: Ni, Ray 
Sent: Monday, March 7, 2022 11:55 AM
To: Kinney, Michael D ; Gao, Liming 

Cc: Wang, Jian J ; Gao, Liming 
; devel@edk2.groups.io; Pu, Yu 
Subject: RE: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke 
GetPhysicalAddressBits() and remove the duplicated code

Mike, Liming,
This patch makes MdeModulePkg depend on UefiCpuPkg.
But according to 
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModulePkg.ci.yaml#L49,
 such dependency is not allowed.

Do you agree to move the UefiCpuLib from UefiCpuPkg to MdePkg? The library 
header and instance are in following paths:

https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Include/Library/UefiCpuLib.h

https://github.com/tianocore/edk2/tree/master/UefiCpuPkg/Library/BaseUefiCpuLib

Thanks,
Ray


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Yu Pu
Sent: Wednesday, March 2, 2022 5:19 PM
To: devel@edk2.groups.io
Cc: Pu, Yu ; Wang, Jian J ; Gao, Liming 

Subject: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke 
GetPhysicalAddressBits() and remove the duplicated code

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

Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical address 
mask calculation and remove the duplicated code in MdeModulePkg.

Cc: Jian J Wang 
Cc: Liming Gao 

Signed-off-by: Yu Pu 
---
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c|  
9 ++---
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c | 
14 ++
 MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c| 
14 ++
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf |  
2 ++
 MdeModulePkg/MdeModulePkg.dsc   |  
1 +
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf |  
2 ++
 MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf|  
2 ++
 7 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 0700f310b203..78e91e6e9024 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -22,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent


 **/



+#include 

 #include 

 #include "DxeIpl.h"

 #include "VirtualMemory.h"

@@ -733,13 +734,7 @@ CreateIdentityMappingPageTables (
   if (Hob != NULL) {

 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;

   } else {

-AsmCpuid (0x8000, , NULL, NULL, NULL);

-if (RegEax >= 0x8008) {

-  AsmCpuid (0x8008, , NULL, NULL, NULL);

-  PhysicalAddressBits = (UINT8)RegEax;

-} else {

-  PhysicalAddressBits = 36;

-}

+PhysicalAddressBits = GetPhysicalAddressBits(NULL, NULL);

   }



   Page5LevelSupport = FALSE;

diff --git 
a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c 
b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
index 6b44f50bac70..367bf8cdd1e6 100644
--- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
+++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.
+++ c
@@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent



 **/

+#include 

 #include "ScriptExecute.h"



 //

@@ -51,20 +52,9 @@ HookPageFaultHandler (
   IN IA32_IDT_GATE_DESCRIPTOR  *IdtEntry

   )

 {

-  UINT32  RegEax;

-  UINT8   PhysicalAddressBits;

   UINTN   PageFaultHandlerHookAddress;



-  AsmCpuid (0x8000, , NULL, NULL, NULL);

-  if (RegEax >= 0x8008) {

-AsmCpuid (0x8008, , NULL, NULL, NULL);

-PhysicalAddressBits = (UINT8)RegEax;

-  } else {

-PhysicalAddressBits = 36;

-  }

-

-  mPhyMask  = LShiftU64 (1, PhysicalAddressBits) - 1;

-  mPhyMask &= (1ull << 48) - SIZE_4KB;

+  GetPhysicalAddressBits(NULL, );



   //

   // Set Page Fault entry to catch >4G access

diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c 
b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
index 05941f9f8d56..06d6129c5e6d 100644
--- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
+++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
@@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include 


 #include 

 #include 

+#include 

 #include "CommonHeader.h"



 #define EXCEPTION_VECTOR_NUMBER  0x22

@@ -61,20 +62,9 @@ HookPageFaultHandler (
   IN OUT PAGE_FAULT_CONTEXT*PageFaultContext

   )

 {

-  UINT32  RegEax;

-  UINT8   PhysicalAddressBits;

   UINTN   PageFaultHandlerHookAddress;



-  AsmCpuid (0x8000, , NULL, NULL, NULL);

-  if 

Re: [edk2-devel] [edk2][PATCH V1 1/1] ArmPkg: Handle warm reboot request correctly

2022-03-10 Thread Sami Mujawar

Hi Pranav,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar


On 10/03/2022 01:10 PM, Pranav Madhu wrote:

The warm reboot requests are mapped to cold reboot as the power control
module was not capable of handling the warm reboot requests in the
legacy implementation. The support for warm reboot support is added into
the power control module. To support warm reset, update
ArmPsciResetSystemLib, and there by invoke the PSCI call with parameters
for warm reboot.

Signed-off-by: Pranav Madhu 
---
  ArmPkg/Include/IndustryStandard/ArmStdSmc.h  | 1 +
  ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c | 7 +--
  2 files changed, 6 insertions(+), 2 deletions(-)

Link to github branch for this patch -
https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot

diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h 
b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
index 655edc21b205..c9059dead6e9 100644
--- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
+++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
@@ -93,6 +93,7 @@
  #define ARM_SMC_ID_PSCI_MIGRATE_AARCH320x8405
  #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x8408
  #define ARM_SMC_ID_PSCI_SYSTEM_RESET   0x8409
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64  0xc412
  
  /* The current PSCI version is:  0.2 */

  #define ARM_SMC_PSCI_VERSION_MAJOR  0
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c 
b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
index 7bcd34849507..27e048ba0f7a 100644
--- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
@@ -45,10 +45,13 @@ LibResetSystem (
ARM_SMC_ARGS  ArmSmcArgs;
  
switch (ResetType) {

+case EfiResetWarm:
+  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
+  ArmSmcArgs.Arg1 = 0;
+  ArmSmcArgs.Arg2 = 0;
+  break;
[SAMI] SYSTEM_RESET2 is an optional feature and if not supported would 
return NOT_SUPPORTED. So, if a platform does not support SYSTEM_RESET2, 
should the code here fall back to SYSTEM_RESET?
According to the PSCI specification, it is the responsibility of the OS 
to check that SYSTEM_RESET2 is supported before calling SYSTEM_RESET2 (I 
believe this is applicable for the case where UEFI is not used to boot 
the OS). However, if the runtime service ResetSystem() is invoked by the 
OS requesting a warm reset, is it not the firmware's responsibility to 
ensure that SYSTEM_RESET2 is supported? Any thoughts?

[/SAMI]

  case EfiResetPlatformSpecific:
  // Map the platform specific reset as reboot
-case EfiResetWarm:
-// Map a warm reset into a cold reset
  case EfiResetCold:
// Send a PSCI 0.2 SYSTEM_RESET command
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87418): https://edk2.groups.io/g/devel/message/87418
Mute This Topic: https://groups.io/mt/89685482/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] ArmPkg: Handle warm reboot request correctly

2022-03-10 Thread Ard Biesheuvel
On Thu, 10 Mar 2022 at 14:10, Pranav Madhu  wrote:
>
> The warm reboot requests are mapped to cold reboot as the power control
> module was not capable of handling the warm reboot requests in the
> legacy implementation. The support for warm reboot support is added into
> the power control module. To support warm reset, update
> ArmPsciResetSystemLib, and there by invoke the PSCI call with parameters
> for warm reboot.
>
> Signed-off-by: Pranav Madhu 

What happens on 32-bit platforms with this change?

What happens if the firmware does not implement
ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64?

> ---
>  ArmPkg/Include/IndustryStandard/ArmStdSmc.h  | 1 +
>  ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c | 7 +--
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> Link to github branch for this patch -
> https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot
>
> diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h 
> b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> index 655edc21b205..c9059dead6e9 100644
> --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> @@ -93,6 +93,7 @@
>  #define ARM_SMC_ID_PSCI_MIGRATE_AARCH320x8405
>  #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x8408
>  #define ARM_SMC_ID_PSCI_SYSTEM_RESET   0x8409
> +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64  0xc412
>
>  /* The current PSCI version is:  0.2 */
>  #define ARM_SMC_PSCI_VERSION_MAJOR  0
> diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c 
> b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> index 7bcd34849507..27e048ba0f7a 100644
> --- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> +++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
> @@ -45,10 +45,13 @@ LibResetSystem (
>ARM_SMC_ARGS  ArmSmcArgs;
>
>switch (ResetType) {
> +case EfiResetWarm:
> +  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
> +  ArmSmcArgs.Arg1 = 0;
> +  ArmSmcArgs.Arg2 = 0;
> +  break;
>  case EfiResetPlatformSpecific:
>  // Map the platform specific reset as reboot
> -case EfiResetWarm:
> -// Map a warm reset into a cold reset
>  case EfiResetCold:
>// Send a PSCI 0.2 SYSTEM_RESET command
>ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
> --
> 2.17.1
>


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




[edk2-devel] [edk2][PATCH V1 1/1] ArmPkg: Handle warm reboot request correctly

2022-03-10 Thread Pranav Madhu
The warm reboot requests are mapped to cold reboot as the power control
module was not capable of handling the warm reboot requests in the
legacy implementation. The support for warm reboot support is added into
the power control module. To support warm reset, update
ArmPsciResetSystemLib, and there by invoke the PSCI call with parameters
for warm reboot.

Signed-off-by: Pranav Madhu 
---
 ArmPkg/Include/IndustryStandard/ArmStdSmc.h  | 1 +
 ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c | 7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

Link to github branch for this patch -
https://github.com/Pranav-Madhu/edk2/tree/topics/warm_reboot

diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h 
b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
index 655edc21b205..c9059dead6e9 100644
--- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
+++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
@@ -93,6 +93,7 @@
 #define ARM_SMC_ID_PSCI_MIGRATE_AARCH320x8405
 #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x8408
 #define ARM_SMC_ID_PSCI_SYSTEM_RESET   0x8409
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64  0xc412
 
 /* The current PSCI version is:  0.2 */
 #define ARM_SMC_PSCI_VERSION_MAJOR  0
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c 
b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
index 7bcd34849507..27e048ba0f7a 100644
--- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
@@ -45,10 +45,13 @@ LibResetSystem (
   ARM_SMC_ARGS  ArmSmcArgs;
 
   switch (ResetType) {
+case EfiResetWarm:
+  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
+  ArmSmcArgs.Arg1 = 0;
+  ArmSmcArgs.Arg2 = 0;
+  break;
 case EfiResetPlatformSpecific:
 // Map the platform specific reset as reboot
-case EfiResetWarm:
-// Map a warm reset into a cold reset
 case EfiResetCold:
   // Send a PSCI 0.2 SYSTEM_RESET command
   ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
-- 
2.17.1



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




[edk2-devel] [edk2-platforms][PATCH V1 9/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-N2-Cfg1 platform

2022-03-10 Thread Pranav Madhu
Update the Rd-N2-Cfg1 platform specific ACPI tables to ACPI version
v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1/Madt.aslc | 112 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1/Pptt.aslc |  80 +++---
 2 files changed, 97 insertions(+), 95 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1/Madt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1/Madt.aslc
index c6bb29a25c61..65926027eadf 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1/Madt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN2Cfg1/Madt.aslc
@@ -1,23 +1,22 @@
 /** @file
-* Multiple APIC Description Table (MADT) for RD-N2-Cfg1 platform
-*
-* This file lists all the processors available on the platform that the OSPM
-* can enumerate and boot. It also lists all the interrupt controllers available
-* in the system.
-*
-* Copyright (c) 2021, Arm Ltd. All rights reserved.
-*
-* SPDX-License-Identifier: BSD-2-Clause-Patent
-*
-* @par Specification Reference:
-*   - ACPI 6.3, Chapter 5, Section 5.2.12, Multiple APIC Description Table
+  Multiple APIC Description Table (MADT) for RD-N2-Cfg1 platform
+
+  The MADT table provides OSPM with information necessary for operation on
+  systems with Generic interrupt controller (GIC). The information about the 
GIC
+  CPU interface, redistributor, distributor and ITS blocks on the Rd-N2-Cfg1
+  platform is included in this table.
+
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.12, Multiple APIC Description Table
 **/
 
 #include 
 #include 
 #include 
-#include 
-
 #include "SgiAcpiHeader.h"
 #include "SgiPlatform.h"
 
@@ -28,69 +27,70 @@
 #pragma pack (1)
 
 typedef struct {
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-  EFI_ACPI_6_2_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
-  EFI_ACPI_6_2_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
-  EFI_ACPI_6_2_GICR_STRUCTURE   GicRedistributor;
-  EFI_ACPI_6_2_GIC_ITS_STRUCTUREGicIts[3];
-} EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE;
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+  EFI_ACPI_6_4_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
+  EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
+  EFI_ACPI_6_4_GICR_STRUCTURE   GicRedistributor;
+  EFI_ACPI_6_4_GIC_ITS_STRUCTUREGicIts[3];
+} EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE;
 
 #pragma pack ()
 
-STATIC EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+STATIC EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
 ),
 // MADT specific fields
 0, // LocalApicAddress
 0  // Flags
   },
   {
-// Format: EFI_ACPI_6_2_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
+// Format: EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
 //  PmuIrq, GicBase, GicVBase,
 //  GicHBase, GsivId, GicRBase,
-//  Efficiency)
+//  Efficiency,
+//  SpeOverflowInterrupt)
 // Note: The GIC Structure of the primary CPU must be the first entry
-// (see note in 5.2.12.14 GICC Structure of ACPI v6.2).
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core0
-  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core1
-  0, 1, GET_MPID(0x100, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core2
-  0, 2, GET_MPID(0x200, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core3
-  0, 3, GET_MPID(0x300, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core4
-  0, 4, GET_MPID(0x400, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core5
-  0, 5, GET_MPID(0x500, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core6
-  0, 6, GET_MPID(0x600, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
-  0, 0, 0, 25, 0, 0),
-

[edk2-devel] [edk2-platforms][PATCH V1 8/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-N2 platform

2022-03-10 Thread Pranav Madhu
Update the Rd-N2 platform specific ACPI tables to ACPI version v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdN2/Madt.aslc | 163 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdN2/Pptt.aslc |  84 +-
 2 files changed, 128 insertions(+), 119 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN2/Madt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdN2/Madt.aslc
index dbb23683113a..cdf8b3f2e953 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN2/Madt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN2/Madt.aslc
@@ -1,18 +1,24 @@
 /** @file
-*  Multiple APIC Description Table (MADT)
-*
-*  Copyright (c) 2020, Arm Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Multiple APIC Description Table (MADT)
+
+  The MADT table provides OSPM with information necessary for operation on
+  systems with Generic interrupt controller (GIC). The information about the 
GIC
+  CPU interface, redistributor, distributor and ITS blocks on the Rd-N2 
platform
+  is included in this table.
+
+  Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.12, Multiple APIC Description Table
 **/
 
-#include "SgiPlatform.h"
-#include "SgiAcpiHeader.h"
 #include 
 #include 
 #include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CORE_CNT   (FixedPcdGet32 (PcdClusterCount) * \
   FixedPcdGet32 (PcdCoreCount))
@@ -21,112 +27,113 @@
 #pragma pack (1)
 
 typedef struct {
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-  EFI_ACPI_6_2_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
-  EFI_ACPI_6_2_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
-  EFI_ACPI_6_2_GICR_STRUCTURE   GicRedistributor;
-  EFI_ACPI_6_2_GIC_ITS_STRUCTUREGicIts[6];
-} EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE;
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+  EFI_ACPI_6_4_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
+  EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
+  EFI_ACPI_6_4_GICR_STRUCTURE   GicRedistributor;
+  EFI_ACPI_6_4_GIC_ITS_STRUCTUREGicIts[6];
+} EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE;
 
 #pragma pack ()
 
-STATIC EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+STATIC EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
 ),
 // MADT specific fields
 0, // LocalApicAddress
 0  // Flags
   },
   {
-// Format: EFI_ACPI_6_2_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
+// Format: EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
 //  PmuIrq, GicBase, GicVBase,
 //  GicHBase, GsivId, GicRBase,
-//  Efficiency)
+//  Efficiency,
+//  SpeOverflowInterrupt)
 // Note: The GIC Structure of the primary CPU must be the first entry
-// (see note in 5.2.12.14 GICC Structure of ACPI v6.2).
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core0
-  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+// (see note in 5.2.12.14 GICC Structure of ACPI v6.4).
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Neoverse N2 core0
+  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core1
-  0, 1, GET_MPID(0x100, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Neoverse N2 core1
+  0, 1, GET_MPID(0x100, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse N2 core2
-  0, 2, GET_MPID(0x200, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Neoverse N2 core2
+  0, 2, GET_MPID(0x200, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-

[edk2-devel] [edk2-platforms][PATCH V1 7/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-V1-MC platform

2022-03-10 Thread Pranav Madhu
Update the Rd-V1 multichip platform specific ACPI tables to ACPI version
v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Hmat.aslc |  64 
 Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Madt.aslc | 165 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Pptt.aslc |  88 ++-
 Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Srat.aslc |  82 +-
 4 files changed, 211 insertions(+), 188 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Hmat.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Hmat.aslc
index c2dad0e137d5..b8485cd98ea4 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Hmat.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdV1Mc/Hmat.aslc
@@ -1,17 +1,25 @@
 /** @file
-*  Heterogeneous Memory Attribute Table (HMAT)
-*
-*  Copyright (c) 2020-2021, ARM Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Heterogeneous Memory Attribute Table (HMAT)
+
+  The (HMAT) describes the memory attributes, such as memory side cache
+  attributes and bandwidth and latency details, related to Memory Proximity
+  Domains. The software is expected to use this information as a hint for
+  optimization, or when the system has heterogeneous memory. The attributes of
+  the memory connected to the two chips on this platform are listed in this
+  table.
+
+  Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.27, Heterogeneous Memory Attribute Table
 **/
 
-#include 
 #include 
 #include 
-#include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CHIP_CNT  FixedPcdGet32 (PcdChipCount)
 #define INITATOR_PROXIMITY_DOMAIN_CNT 4
@@ -29,14 +37,14 @@ typedef struct InitiatorTargetProximityMatrix {
 } INITIATOR_TARGET_PROXIMITY_MATRIX;
 
 typedef struct {
-  EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_HEADER
Header;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES  
Proximity[CHIP_CNT];
-  EFI_ACPI_6_3_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO  
LatencyInfo;
+  EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_HEADER
Header;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES  
Proximity[CHIP_CNT];
+  EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO  
LatencyInfo;
   INITIATOR_TARGET_PROXIMITY_MATRIX   
Matrix;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache0;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache1;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache2;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache3;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache0;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache1;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache2;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache3;
 } EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE;
 
 #pragma pack ()
@@ -45,9 +53,9 @@ EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat = {
   // Header
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE,
   EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE,
-  EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_REVISION
+  EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_REVISION
   ),
 {
   EFI_ACPI_RESERVED_BYTE,
@@ -59,19 +67,19 @@ EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat = {
 
   // Memory Proximity Domain
   {
-EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
+EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
   1, 0x0, 0x0),
-EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
+EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
   1, 0x1, 0x1),
-EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
+EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
   1, 0x2, 0x2),
-EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
+EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
   1, 0x3, 0x3),
},
 
   // Latency Info
-  EFI_ACPI_6_3_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_INIT (
-0, 0, INITATOR_PROXIMITY_DOMAIN_CNT, TARGET_PROXIMITY_DOMAIN_CNT, 100),
+  EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_INIT (
+0, 0, 0, INITATOR_PROXIMITY_DOMAIN_CNT, TARGET_PROXIMITY_DOMAIN_CNT, 100),
   {
 {0, 1, 2, 3},
  

[edk2-devel] [edk2-platforms][PATCH V1 6/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-V1 platform

2022-03-10 Thread Pranav Madhu
Update the Rd-V1 platform specific ACPI tables to ACPI version v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdV1/Madt.aslc | 159 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdV1/Pptt.aslc |  84 ++-
 2 files changed, 126 insertions(+), 117 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdV1/Madt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdV1/Madt.aslc
index c4551e92c0f2..374b0e2bddbf 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdV1/Madt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdV1/Madt.aslc
@@ -1,18 +1,24 @@
 /** @file
-*  Multiple APIC Description Table (MADT)
-*
-*  Copyright (c) 2020, Arm Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Multiple APIC Description Table (MADT)
+
+  The MADT table provides OSPM with information necessary  for operation on
+  systems with Generic interrupt controller (GIC). The information about the 
GIC
+  CPU interface, redistributor, distributor and ITS blocks on the Rd-V1 
platform
+  is included in this table.
+
+  Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.12, Multiple APIC Description Table
 **/
 
-#include "SgiPlatform.h"
-#include "SgiAcpiHeader.h"
 #include 
 #include 
 #include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CORE_CNT   (FixedPcdGet32 (PcdClusterCount) * \
   FixedPcdGet32 (PcdCoreCount))
@@ -21,110 +27,111 @@
 #pragma pack (1)
 
 typedef struct {
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-  EFI_ACPI_6_2_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
-  EFI_ACPI_6_2_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
-  EFI_ACPI_6_2_GICR_STRUCTURE   GicRedistributor;
-  EFI_ACPI_6_2_GIC_ITS_STRUCTUREGicIts[4];
-} EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE;
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+  EFI_ACPI_6_4_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
+  EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
+  EFI_ACPI_6_4_GICR_STRUCTURE   GicRedistributor;
+  EFI_ACPI_6_4_GIC_ITS_STRUCTUREGicIts[4];
+} EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE;
 
 #pragma pack ()
 
-STATIC EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+STATIC EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
 ),
 // MADT specific fields
 0, // LocalApicAddress
 0  // Flags
   },
   {
-// Format: EFI_ACPI_6_2_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
+// Format: EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
 //  PmuIrq, GicBase, GicVBase,
 //  GicHBase, GsivId, GicRBase,
-//  Efficiency)
+//  Efficiency,
+//  SpeOverflowInterrupt)
 // Note: The GIC Structure of the primary CPU must be the first entry
-// (see note in 5.2.12.14 GICC Structure of ACPI v6.2).
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Zeus core0
-  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+// (see note in 5.2.12.14 GICC Structure of ACPI v6.4).
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Zeus core0
+  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Zeus core1
-  0, 1, GET_MPID(0x100, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Zeus core1
+  0, 1, GET_MPID(0x100, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Zeus core2
-  0, 2, GET_MPID(0x200, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Zeus core2
+  0, 2, GET_MPID(0x200, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Zeus core3
-  0, 3, 

[edk2-devel] [edk2-platforms][PATCH V1 5/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-E1-Edge platform

2022-03-10 Thread Pranav Madhu
Update the Rd-E1-Edge platform specific ACPI tables to ACPI version
v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdE1Edge/Madt.aslc | 247 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdE1Edge/Pptt.aslc | 115 -
 2 files changed, 186 insertions(+), 176 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdE1Edge/Madt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdE1Edge/Madt.aslc
index cb70394bfe91..0b2bba575bf5 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdE1Edge/Madt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdE1Edge/Madt.aslc
@@ -1,18 +1,24 @@
 /** @file
-*  Multiple APIC Description Table (MADT)
-*
-*  Copyright (c) 2018-2020, ARM Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Multiple APIC Description Table (MADT)
+
+  The MADT table provides OSPM with information necessary for operation on
+  systems with Generic interrupt controller (GIC). The information about the 
GIC
+  CPU interface, redistributor, distributor and ITS blocks on the Rd-E1-Edge
+  platform is included in this table.
+
+  Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.12, Multiple APIC Description Table
 **/
 
-#include "SgiPlatform.h"
-#include "SgiAcpiHeader.h"
 #include 
 #include 
 #include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CORE_CNT   (FixedPcdGet32 (PcdClusterCount) * \
 FixedPcdGet32 (PcdCoreCount))
@@ -21,173 +27,174 @@
 #pragma pack (1)
 
 typedef struct {
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-  EFI_ACPI_6_2_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
-  EFI_ACPI_6_2_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
-  EFI_ACPI_6_2_GICR_STRUCTURE   GicRedistributor;
-  EFI_ACPI_6_2_GIC_ITS_STRUCTUREGicIts;
-} EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE;
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+  EFI_ACPI_6_4_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
+  EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
+  EFI_ACPI_6_4_GICR_STRUCTURE   GicRedistributor;
+  EFI_ACPI_6_4_GIC_ITS_STRUCTUREGicIts;
+} EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE;
 
 #pragma pack ()
 
-STATIC EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+STATIC EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
 ),
 // MADT specific fields
 0, // LocalApicAddress
 0  // Flags
   },
   {
-// Format: EFI_ACPI_6_2_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
+// Format: EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
 //  PmuIrq, GicBase, GicVBase,
 //  GicHBase, GsivId, GicRBase,
-//  Efficiency)
+//  Efficiency,
+//  SpeOverflowInterrupt)
 // Note: The GIC Structure of the primary CPU must be the first entry
 // (see note in 5.2.12.14 GICC Structure of ACPI v6.2).
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Core-0 Thread-0
-  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Core-0 Thread-0
+  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Core-1 Thread-1
-  0, 1, GET_MPID(0x0, 0x1), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Core-1 Thread-1
+  0, 1, GET_MPID(0x0, 0x1), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Core-1 Thread-0
-  0, 2, GET_MPID(0x0, 0x100), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Core-1 Thread-0
+  0, 2, GET_MPID(0x0, 0x100), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Core-1 Thread-1
-  0, 3, GET_MPID(0x0, 

[edk2-devel] [edk2-platforms][PATCH V1 4/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-N1-Edge-X2 platform

2022-03-10 Thread Pranav Madhu
Update the Rd-N1-Edge multichip platform specific ACPI tables to ACPI
version v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Hmat.aslc |  52 ---
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Madt.aslc | 151 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Pptt.aslc | 101 ++---
 Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Srat.aslc |  74 +-
 4 files changed, 201 insertions(+), 177 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Hmat.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Hmat.aslc
index 704708f94baf..4a55c33396b6 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Hmat.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2/Hmat.aslc
@@ -1,17 +1,25 @@
 /** @file
-*  Heterogeneous Memory Attribute Table (HMAT)
-*
-*  Copyright (c) 2020-2021, ARM Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Heterogeneous Memory Attribute Table (HMAT)
+
+  The (HMAT) describes the memory attributes, such as memory side cache
+  attributes and bandwidth and latency details, related to Memory Proximity
+  Domains. The software is expected to use this information as a hint for
+  optimization, or when the system has heterogeneous memory. The attributes of
+  the memory connected to the two chips on this platform are listed in this
+  table.
+
+  Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.27, Heterogeneous Memory Attribute Table
 **/
 
-#include 
 #include 
 #include 
-#include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CHIP_CNT  FixedPcdGet32 (PcdChipCount)
 #define INITATOR_PROXIMITY_DOMAIN_CNT 2
@@ -29,12 +37,12 @@ typedef struct InitiatorTargetProximityMatrix {
 } INITIATOR_TARGET_PROXIMITY_MATRIX;
 
 typedef struct {
-  EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_HEADER
Header;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES  
Proximity[CHIP_CNT];
-  EFI_ACPI_6_3_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO  
LatencyInfo;
+  EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_HEADER
Header;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES  
Proximity[CHIP_CNT];
+  EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO  
LatencyInfo;
   INITIATOR_TARGET_PROXIMITY_MATRIX   
Matrix;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache0;
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache1;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache0;
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO  
MemSideCache1;
 } EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE;
 
 #pragma pack ()
@@ -43,9 +51,9 @@ EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat = {
   // Header
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE,
   EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE,
-  EFI_ACPI_6_3_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_REVISION
+  EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_REVISION
   ),
 {
   EFI_ACPI_RESERVED_BYTE,
@@ -57,15 +65,15 @@ EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat = {
 
   // Memory Proximity Domain
   {
-EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
+EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
   1, 0x0, 0x0),
-EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
+EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT (
   1, 0x1, 0x1),
},
 
   // Latency Info
-  EFI_ACPI_6_3_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_INIT (
-0, 0, INITATOR_PROXIMITY_DOMAIN_CNT, TARGET_PROXIMITY_DOMAIN_CNT, 100),
+  EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_INIT (
+0, 0, 0, INITATOR_PROXIMITY_DOMAIN_CNT, TARGET_PROXIMITY_DOMAIN_CNT, 100),
   {
 {0, 1},
 {0, 1},
@@ -82,7 +90,7 @@ EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat = {
   },
 
   // Memory Side Cache
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_INIT (
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_INIT (
 0x0,
 SIZE_8MB,
 HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES_INIT (
@@ -94,7 +102,7 @@ EFI_ACPI_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE Hmat = {
   ),
 0),
 
-  EFI_ACPI_6_3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_INIT (
+  EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_INIT (
 0x1,
 SIZE_8MB,
 HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES_INIT (
diff --git 

[edk2-devel] [edk2-platforms][PATCH V1 3/9] Platform/Sgi: Update ACPI version to v6.4 for Rd-N1-Edge platform

2022-03-10 Thread Pranav Madhu
Update the Rd-N1-Edge platform specific ACPI tables to ACPI version
v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/RdN1Edge/Madt.aslc | 105 +++-
 Platform/ARM/SgiPkg/AcpiTables/RdN1Edge/Pptt.aslc |  97 +-
 2 files changed, 106 insertions(+), 96 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1Edge/Madt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/RdN1Edge/Madt.aslc
index 05eb78c5616a..df2576e1d9b7 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1Edge/Madt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1Edge/Madt.aslc
@@ -1,18 +1,24 @@
 /** @file
-*  Multiple APIC Description Table (MADT)
-*
-*  Copyright (c) 2018-2020, ARM Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Multiple APIC Description Table (MADT)
+
+  The MADT table provides OSPM with information necessary for operation on
+  systems with Generic interrupt controller (GIC). The information about the 
GIC
+  CPU interface, redistributor, distributor and ITS blocks on the Rd-N1-Edge
+  platform is included in this table.
+
+  Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.12, Multiple APIC Description Table
 **/
 
-#include "SgiPlatform.h"
-#include "SgiAcpiHeader.h"
 #include 
 #include 
 #include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CORE_CNT   (FixedPcdGet32 (PcdClusterCount) * \
 FixedPcdGet32 (PcdCoreCount))
@@ -21,75 +27,76 @@
 #pragma pack (1)
 
 typedef struct {
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-  EFI_ACPI_6_2_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
-  EFI_ACPI_6_2_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
-  EFI_ACPI_6_2_GICR_STRUCTURE   GicRedistributor;
-  EFI_ACPI_6_2_GIC_ITS_STRUCTUREGicIts;
-} EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE;
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+  EFI_ACPI_6_4_GIC_STRUCTURE
GicInterfaces[CORE_CNT];
+  EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
+  EFI_ACPI_6_4_GICR_STRUCTURE   GicRedistributor;
+  EFI_ACPI_6_4_GIC_ITS_STRUCTUREGicIts;
+} EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE;
 
 #pragma pack ()
 
-STATIC EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+STATIC EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
 ),
 // MADT specific fields
 0, // LocalApicAddress
 0  // Flags
   },
   {
-// Format: EFI_ACPI_6_2_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
+// Format: EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
 //  PmuIrq, GicBase, GicVBase,
 //  GicHBase, GsivId, GicRBase,
-//  Efficiency)
+//  Efficiency,
+//  SpeOverflowInterrupt)
 // Note: The GIC Structure of the primary CPU must be the first entry
-// (see note in 5.2.12.14 GICC Structure of ACPI v6.2).
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse-N1-0
-  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+// (see note in 5.2.12.14 GICC Structure of ACPI v6.4).
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Neoverse-N1-0
+  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse-N1-1
-  0, 1, GET_MPID(0x0, 0x100), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Neoverse-N1-1
+  0, 1, GET_MPID(0x0, 0x100), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // Neoverse-N1-2
-  0, 2, GET_MPID(0x0, 0x200), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // Neoverse-N1-2
+  0, 2, GET_MPID(0x0, 0x200), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-

[edk2-devel] [edk2-platforms][PATCH V1 2/9] Platform/Sgi: Update ACPI version to v6.4 for SGI-575 platform

2022-03-10 Thread Pranav Madhu
Update the SGI-575 platform specific ACPI tables to ACPI version v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc | 105 +++-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Pptt.aslc |  86 
 2 files changed, 100 insertions(+), 91 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
index f04b77929d71..d3d7d946655f 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc
@@ -1,18 +1,24 @@
 /** @file
-*  Multiple APIC Description Table (MADT)
-*
-*  Copyright (c) 2018, ARM Limited. All rights reserved.
-*
-*  SPDX-License-Identifier: BSD-2-Clause-Patent
-*
+  Multiple APIC Description Table (MADT)
+
+  The MADT table provides OSPM with information necessary for operation on
+  systems with Generic interrupt controller (GIC). The information about the 
GIC
+  CPU interface, redistributor, distributor and ITS blocks on the SGI-575
+  platform is included in this table.
+
+  Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+- ACPI 6.4, Chapter 5, Section 5.2.12, Multiple APIC Description Table
 **/
 
-#include "SgiPlatform.h"
-#include "SgiAcpiHeader.h"
 #include 
 #include 
 #include 
-#include 
+#include "SgiAcpiHeader.h"
+#include "SgiPlatform.h"
 
 #define CORES   (FixedPcdGet32 (PcdClusterCount) * \
  FixedPcdGet32 (PcdCoreCount))
@@ -21,75 +27,76 @@
 #pragma pack (1)
 
 typedef struct {
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-  EFI_ACPI_6_2_GIC_STRUCTUREGicInterfaces[CORES];
-  EFI_ACPI_6_2_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
-  EFI_ACPI_6_2_GICR_STRUCTURE   GicRedistributor;
-  EFI_ACPI_6_2_GIC_ITS_STRUCTUREGicIts;
-} EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE;
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
+  EFI_ACPI_6_4_GIC_STRUCTUREGicInterfaces[CORES];
+  EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTUREGicDistributor;
+  EFI_ACPI_6_4_GICR_STRUCTURE   GicRedistributor;
+  EFI_ACPI_6_4_GIC_ITS_STRUCTUREGicIts;
+} EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE;
 
 #pragma pack ()
 
-STATIC EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+STATIC EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE,
-  EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE,
+  EFI_ACPI_6_4_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
 ),
 // MADT specific fields
 0, // LocalApicAddress
 0, // Flags
   },
   {
-// Format: EFI_ACPI_6_2_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
+// Format: EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, 
Flags,
 //  PmuIrq, GicBase, GicVBase,
 //  GicHBase, GsivId, GicRBase,
-//  Efficiency)
+//  Efficiency,
+//  SpeOverflowInterrupt)
 // Note: The GIC Structure of the primary CPU must be the first entry
-// (see note in 5.2.12.14 GICC Structure of ACPI v6.2).
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // A75-0
-  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_2_GIC_ENABLED, 23,
+// (see note in 5.2.12.14 GICC Structure of ACPI v6.4).
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // A75-0
+  0, 0, GET_MPID(0x0, 0x0), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // A75-1
-  0, 1, GET_MPID(0x0, 0x100), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // A75-1
+  0, 1, GET_MPID(0x0, 0x100), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // A75-2
-  0, 2, GET_MPID(0x0, 0x200), EFI_ACPI_6_2_GIC_ENABLED, 23,
+  0x2c02, 0x2c01, 25, 0, 0, 0),
+EFI_ACPI_6_4_GICC_STRUCTURE_INIT( // A75-2
+  0, 2, GET_MPID(0x0, 0x200), EFI_ACPI_6_4_GIC_ENABLED, 23,
   FixedPcdGet32 (PcdGicDistributorBase),
-  0x2c02, 0x2c01, 25, 0 /* GicRBase */, 0 /* Efficiency */),
-EFI_ACPI_6_2_GICC_STRUCTURE_INIT( // A75-3
-  0, 3, GET_MPID(0x0, 0x300), EFI_ACPI_6_2_GIC_ENABLED, 23,

[edk2-devel] [edk2-platforms][PATCH V1 1/9] Platform/Sgi: Update ACPI version to v6.4

2022-03-10 Thread Pranav Madhu
Update the common ACPI tables used by all the Neoverse Reference Design
platforms to ACPI version v6.4.

Signed-off-by: Pranav Madhu 
---
 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h | 221 ++--
 Platform/ARM/SgiPkg/AcpiTables/Dbg2.aslc|  30 +--
 Platform/ARM/SgiPkg/AcpiTables/Fadt.aslc|  38 ++--
 Platform/ARM/SgiPkg/AcpiTables/Gtdt.aslc|  69 +++---
 Platform/ARM/SgiPkg/AcpiTables/Mcfg.aslc|  26 +--
 Platform/ARM/SgiPkg/AcpiTables/Spcr.aslc|  29 ++-
 6 files changed, 220 insertions(+), 193 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h 
b/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
index d75d54055436..69af1df276a8 100644
--- a/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
+++ b/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2018-2021, ARM Limited. All rights reserved.
+*  Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.
 *
 *  SPDX-License-Identifier: BSD-2-Clause-Patent
 *
@@ -44,133 +44,134 @@
 #pragma pack(1)
 // PPTT processor core structure
 typedef struct {
-  EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR  Core;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR  Core;
   UINT32 ResourceOffset[2];
-  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE  DCache;
-  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE  ICache;
-  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE  L2Cache;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE  DCache;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE  ICache;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE  L2Cache;
 } RD_PPTT_CORE;
 
 // PPTT processor cluster structure
 typedef struct {
-  EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR  Cluster;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR  Cluster;
   UINT32 ResourceOffset;
-  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE  L3Cache;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE  L3Cache;
   RD_PPTT_CORE   Core[CORE_COUNT];
 } RD_PPTT_CLUSTER;
 
 // PPTT processor cluster structure without cache
 typedef struct {
-  EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR  Cluster;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR  Cluster;
   RD_PPTT_CORE   Core[CORE_COUNT];
 } RD_PPTT_MINIMAL_CLUSTER;
 
 // PPTT processor package structure
 typedef struct {
-  EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR  Package;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR  Package;
   UINT32 ResourceOffset;
-  EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE  Slc;
+  EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE  Slc;
   RD_PPTT_MINIMAL_CLUSTERCluster[CLUSTER_COUNT];
 } RD_PPTT_SLC_PACKAGE;
 #pragma pack ()
 
 //
 // PPTT processor structure flags for different SoC components as defined in
-// ACPI 6.3 specification
+// ACPI 6.4 specification
 //
 
 // Processor structure flags for SoC package
 #define PPTT_PROCESSOR_PACKAGE_FLAGS   
\
   {
\
-EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL,
\
-EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID,
\
-EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD, 
\
-EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF,
\
-EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL 
\
+EFI_ACPI_6_4_PPTT_PACKAGE_PHYSICAL,
\
+EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID,
\
+EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, 
\
+EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF,
\
+EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL 
\
   }
 
 // Processor structure flags for cluster
 #define PPTT_PROCESSOR_CLUSTER_FLAGS   
\
   {
\
-EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
\
-EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,  
\
-EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD, 
\
-EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF,
\
-EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL 
\
+EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL,
\
+EFI_ACPI_6_4_PPTT_PROCESSOR_ID_VALID,  
\
+EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, 
\
+EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF,
\
+EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL 
\
   }
 
 // Processor structure flags for cluster with multi-thread core
 #define PPTT_PROCESSOR_CLUSTER_THREADED_FLAGS

[edk2-devel] [edk2-platforms][PATCH V1 0/9] Upadate the ACPI tables for RD platforms

2022-03-10 Thread Pranav Madhu
Arm infrastructure reference design platforms uses ACPI tables to
provide the hardware information to the operating system. Currently the
ACPI tables are aligned with ACPI v6.2 and v6.3 specification. This
patch series update the tables to ACPI v6.4 specificaion.

The first patch in this series update the generic tables which are
common for all platfoms. The subsequent patches in this series update
platform specific ACPI tables to v6.4 for the respective platform.

This patch series also update the headers in the .aslc files to match
the coding style as per edk2 coding guidelines.

Link to github branch with the patches in this series -
https://github.com/Pranav-Madhu/edk2-platforms/tree/topics/acpi64_for_rd_platforms

Pranav Madhu (9):
  Platform/Sgi: Update ACPI version to v6.4
  Platform/Sgi: Update ACPI version to v6.4 for SGI-575 platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-N1-Edge platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-N1-Edge-X2 platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-E1-Edge platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-V1 platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-V1-MC platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-N2 platform
  Platform/Sgi: Update ACPI version to v6.4 for Rd-N2-Cfg1 platform

 Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h   | 221 
 Platform/ARM/SgiPkg/AcpiTables/Dbg2.aslc  |  30 ++-
 Platform/ARM/SgiPkg/AcpiTables/Fadt.aslc  |  38 +--
 Platform/ARM/SgiPkg/AcpiTables/Gtdt.aslc  |  69 ++---
 Platform/ARM/SgiPkg/AcpiTables/Mcfg.aslc  |  26 +-
 .../ARM/SgiPkg/AcpiTables/RdE1Edge/Madt.aslc  | 247 +-
 .../ARM/SgiPkg/AcpiTables/RdE1Edge/Pptt.aslc  | 115 
 .../ARM/SgiPkg/AcpiTables/RdN1Edge/Madt.aslc  | 105 
 .../ARM/SgiPkg/AcpiTables/RdN1Edge/Pptt.aslc  |  97 +++
 .../SgiPkg/AcpiTables/RdN1EdgeX2/Hmat.aslc|  52 ++--
 .../SgiPkg/AcpiTables/RdN1EdgeX2/Madt.aslc| 151 ++-
 .../SgiPkg/AcpiTables/RdN1EdgeX2/Pptt.aslc| 101 +++
 .../SgiPkg/AcpiTables/RdN1EdgeX2/Srat.aslc|  74 +++---
 Platform/ARM/SgiPkg/AcpiTables/RdN2/Madt.aslc | 163 ++--
 Platform/ARM/SgiPkg/AcpiTables/RdN2/Pptt.aslc |  84 +++---
 .../ARM/SgiPkg/AcpiTables/RdN2Cfg1/Madt.aslc  | 112 
 .../ARM/SgiPkg/AcpiTables/RdN2Cfg1/Pptt.aslc  |  80 +++---
 Platform/ARM/SgiPkg/AcpiTables/RdV1/Madt.aslc | 159 +--
 Platform/ARM/SgiPkg/AcpiTables/RdV1/Pptt.aslc |  84 +++---
 .../ARM/SgiPkg/AcpiTables/RdV1Mc/Hmat.aslc|  64 +++--
 .../ARM/SgiPkg/AcpiTables/RdV1Mc/Madt.aslc| 165 ++--
 .../ARM/SgiPkg/AcpiTables/RdV1Mc/Pptt.aslc|  88 ---
 .../ARM/SgiPkg/AcpiTables/RdV1Mc/Srat.aslc|  82 +++---
 .../ARM/SgiPkg/AcpiTables/Sgi575/Madt.aslc| 105 
 .../ARM/SgiPkg/AcpiTables/Sgi575/Pptt.aslc|  86 +++---
 Platform/ARM/SgiPkg/AcpiTables/Spcr.aslc  |  29 +-
 26 files changed, 1375 insertions(+), 1252 deletions(-)

-- 
2.17.1



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




Re: [edk2-devel][PATCH] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

2022-03-10 Thread Kuo, Ted
Hi Ray,

Please find my inline comments with [Ted].

Thanks,
Ted

-Original Message-
From: Ni, Ray  
Sent: Thursday, March 10, 2022 12:15 PM
To: Kuo, Ted ; devel@edk2.groups.io
Cc: De, Debkumar ; Han, Harry ; 
West, Catharine 
Subject: RE: [edk2-devel][PATCH] UefiCpuPkg: Support FFS3 GUID in 
SearchForBfvBase.asm

3 comments starting with "[Ray]".

 ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \  ;  { 0x8c8ce578, 0x8a3d, 0x4f1c, { 
0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } } -%define FFS_GUID_DWORD0 
0x8c8ce578 -%define FFS_GUID_DWORD1 0x4f1c8a3d -%define FFS_GUID_DWORD2 
0x61893599 -%define FFS_GUID_DWORD3 0xd32dc385
+%define FFS2_GUID_DWORD0 0x8c8ce578
+%define FFS2_GUID_DWORD1 0x4f1c8a3d
+%define FFS2_GUID_DWORD2 0x61893599
+%define FFS2_GUID_DWORD3 0xd32dc385
+
+;#define EFI_FIRMWARE_FILE_SYSTEM3_GUID \ ;  { 0x8c8ce578, 0x3dcb, 
+0x4dca, { 0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a } } %define 
+FFS3_GUID_DWORD0 0x5473c07a %define FFS3_GUID_DWORD1 0x4dca3dcb %define 
+FFS3_GUID_DWORD2 0x961e6fbd %define FFS3_GUID_DWORD3 0x9a34e789

[Ray] 1. I am not sure if it's the best representation of GUID in NASM? I am 
not the NASM expert. If there is no recommendation, I am ok with this.
[Ted] Somehow the diff doesn't reflect the actual representation in my editor. 
I'll check and update the patch.
 
 BITS32
 
@@ -25,6 +32,7 @@ BITS32
 Flat32SearchForBfvBase:
 
 xor eax, eax
+mov ecx, 2 ; 2: FFS3 GUID, 1: FFS2 GUID, 0: Not Found

[Ray] 2. Can you map ECX 2 to FFS2 GUID, ECX 3 to FFS3 GUID?
[Ted] Yes, will update in next patch.

 searchingForBfvHeaderLoop:
 ;
 ; We check for a firmware volume at every 4KB address in the top 16MB @@ 
-32,20 +40,37 @@ searchingForBfvHeaderLoop:
 ;
 sub eax, 0x1000
 cmp eax, 0xff00
-jb  searchedForBfvHeaderButNotFound
+jb  searchingForBfvWithOtherFfsGuid
+cmp ecx, 2
+jne searchingForFfs2Guid
 
 ;
-; Check FFS GUID
+; Check FFS3 GUID
 ;
-cmp dword [eax + 0x10], FFS_GUID_DWORD0
+cmp dword [eax + 0x10], FFS3_GUID_DWORD0
 jne searchingForBfvHeaderLoop
-cmp dword [eax + 0x14], FFS_GUID_DWORD1
+cmp dword [eax + 0x14], FFS3_GUID_DWORD1
 jne searchingForBfvHeaderLoop
-cmp dword [eax + 0x18], FFS_GUID_DWORD2
+cmp dword [eax + 0x18], FFS3_GUID_DWORD2
 jne searchingForBfvHeaderLoop
-cmp dword [eax + 0x1c], FFS_GUID_DWORD3
+cmp dword [eax + 0x1c], FFS3_GUID_DWORD3
 jne searchingForBfvHeaderLoop
+jmp checkingFvLength
 
+searchingForFfs2Guid:
+;
+; Check FFS2 GUID
+;
+cmp dword [eax + 0x10], FFS2_GUID_DWORD0
+jne searchingForBfvHeaderLoop
+cmp dword [eax + 0x14], FFS2_GUID_DWORD1
+jne searchingForBfvHeaderLoop
+cmp dword [eax + 0x18], FFS2_GUID_DWORD2
+jne searchingForBfvHeaderLoop
+cmp dword [eax + 0x1c], FFS2_GUID_DWORD3
+jne searchingForBfvHeaderLoop
+
+checkingFvLength:

[Ray] 3. Why is this label added?
[Ted] You meant searchingForBfvWithOtherFfsGuid? This is used to restart a new 
search with a new target guid before reaching the end of the supported ffs guid 
list.

 ;
 ; Check FV Length
 ;
@@ -57,6 +82,12 @@ searchingForBfvHeaderLoop:
 
 jmp searchedForBfvHeaderAndItWasFound
 
+searchingForBfvWithOtherFfsGuid:
+xor eax, eax
+dec ecx
+cmp ecx, 0
+jne searchingForBfvHeaderLoop
+
 searchedForBfvHeaderButNotFound:
 ;
 ; Hang if the SEC entry point was not found
--
2.16.2.windows.1



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




[edk2-devel] [PATCH EDK2 v1 0/1] RedfishPkg: fix memory leak issue

2022-03-10 Thread wenyi,xie via groups.io
Main Changes :
1.free the allocated memory when function collectionEvalOp return.
2.optimeze the code, no functional change.

Wenyi Xie (1):
  RedfishPkg: fix memory leak issue

 RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 
+++-
 1 file changed, 7 insertions(+), 9 deletions(-)

-- 
2.20.1.windows.1



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




[edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue

2022-03-10 Thread wenyi,xie via groups.io
The calloc memory is not free when function collectionEvalOp
return in the halfway.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Wenyi Xie 
---
 RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 
+++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c 
b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
index 3f2b83e834d0..6c6e2246abe3 100644
--- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
+++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
@@ -620,6 +620,7 @@ collectionEvalOp (
   if (((*StatusCode == NULL) && (members == NULL)) ||
   ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || 
(**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
   {
+free (valid);
 return members;
   }
 
@@ -633,6 +634,7 @@ collectionEvalOp (
 if (((*StatusCode == NULL) && (tmp == NULL)) ||
 ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || 
(**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
 {
+  free (valid);
   return tmp;
 }
 
@@ -658,19 +660,15 @@ collectionEvalOp (
 
   cleanupPayload (members);
   if (validCount == 0) {
-free (valid);
-return NULL;
-  }
-
-  if (validCount == 1) {
+ret = NULL;
+  } else if (validCount == 1) {
 ret = valid[0];
-free (valid);
-return ret;
   } else {
 ret = createCollection (payload->service, validCount, valid);
-free (valid);
-return ret;
   }
+
+  free (valid);
+  return ret;
 }
 
 static redfishPayload *
-- 
2.20.1.windows.1



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




Re: [edk2-devel] [PATCH 5/8] MdePkg: Define CC Measure EventLog ACPI Table

2022-03-10 Thread Sami Mujawar
Hi Jiewen,

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 10/03/2022, 05:49, "Yao, Jiewen"  wrote:

HI Sami
I think it is OK to update signature to `CCEL`. That means it will be 
applicable for other CC, right?
[SAMI] Yes, the same table can then be used by other CC. 

Then, I recommend we add CcType there.

typedef struct {
  EFI_ACPI_DESCRIPTION_HEADERHeader;
  EFI_CC_TYPE   CcType; <== new field.
  UINT16 Rsvd;
  UINT64 Laml;
  UINT64 Lasa;
} EFI_CC_EVENTLOG_ACPI_TABLE;

Do you agree?
[SAMI] Agree, the above suggestion looks good to me. 

Thank you
Yao Jiewen

> -Original Message-
> From: Sami Mujawar 
> Sent: Wednesday, March 9, 2022 11:35 PM
> To: Xu, Min M ; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming
> ; Liu, Zhiguang ; Yao,
> Jiewen ; Wang, Jian J ; Lu, 
Ken
> ; Gerd Hoffmann ; nd ;
> Samer El-Haj-Mahmoud ;
> thanu.rangara...@arm.com
> Subject: Re: [PATCH 5/8] MdePkg: Define CC Measure EventLog ACPI Table
> 
> Hi Min,
> 
> Thank you for this patch.
> 
> Please find my response inline marked [SAMI].
> 
> Regards,
> 
> Sami Mujawar
> 
> 
> On 02/03/2022 12:28 AM, Min Xu wrote:
> > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3853
> >
> > TDVF set up an ACPI table (EFI_CC_EVENTLOG_ACPI_TABLE) to pass the
> > event-log information. The event log created by the TD owner contains
> > the hashes to reconstruct the MRTD and RTMR registers.
> >
> > Please refer to Sec 4.3.3 in blow link:
> > https://www.intel.com/content/dam/develop/external/us/en/documents/
> > intel-tdx-guest-hypervisor-communication-interface-1.0-344426-002.pdf
> >
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > Cc: Jiewen Yao 
> > Cc: Jian J Wang 
> > Cc: Ken Lu 
> > Cc: Sami Mujawar 
> > Cc: Gerd Hoffmann 
> > Signed-off-by: Min Xu 
> > ---
> >   MdePkg/Include/Protocol/CcMeasurement.h | 20 
> >   1 file changed, 20 insertions(+)
> >
> > diff --git a/MdePkg/Include/Protocol/CcMeasurement.h
> b/MdePkg/Include/Protocol/CcMeasurement.h
> > index 83eaafaf10a6..86de226c1d82 100644
> > --- a/MdePkg/Include/Protocol/CcMeasurement.h
> > +++ b/MdePkg/Include/Protocol/CcMeasurement.h
> > @@ -307,4 +307,24 @@ extern EFI_GUID  gEfiCcFinalEventsTableGuid;
> >
> >   extern EFI_GUID  gCcEventEntryHobGuid;
> >
> > +//
> > +// Define the CC Measure EventLog ACPI Table
> > +//
> > +#pragma pack(1)
> > +
> > +typedef struct {
> > +  EFI_ACPI_DESCRIPTION_HEADERHeader;
> > +  UINT32 Rsvd;
> > +  UINT64 Laml;
> > +  UINT64 Lasa;
> > +} EFI_CC_EVENTLOG_ACPI_TABLE;
> > +
> > +#pragma pack()
> > +
> > +//
> > +// Define the signature and revision of CC Measurement EventLog ACPI 
Table
> for Td guest
> > +//
> > +#define EFI_CC_EVENTLOG_ACPI_TABLE_TD_SIGNATURE  SIGNATURE_32('T',
> 'D', 'E', 'L')
> > +#define EFI_CC_EVENTLOG_ACPI_TABLE_TD_REVISION   1
> [SAMI] I can see that the above macros have the _TD_ infix. Is the
> intention here that each architecture shall define its own signature and
> revision?
> Would it be possible to make the signature generic across architectures,
> e.g. "SIGNATURE_32('C', 'C', 'E', 'L')" ?
> [/SAMI]
> > +
> >   #endif




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




[edk2-devel] [PATCH EDK2 v1 1/1] UefiCpuPkg/MpInitLib:remove optional in declaration

2022-03-10 Thread wenyi,xie via groups.io
To keep the declaration same with definition, remove the last optional
in declaration of WakeUpAP.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Wenyi Xie 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 7d84a56fbc51..f8c52426dd5f 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -477,7 +477,7 @@ WakeUpAP (
   IN UINTN ProcessorNumber,
   IN EFI_AP_PROCEDURE  Procedure   OPTIONAL,
   IN VOID  *ProcedureArgument  OPTIONAL,
-  IN BOOLEAN   WakeUpDisabledAps   OPTIONAL
+  IN BOOLEAN   WakeUpDisabledAps
   );
 
 /**
-- 
2.20.1.windows.1



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




[edk2-devel] [PATCH EDK2 v1 0/1] UefiCpuPkg/MpInitLib:remove optional in declaration

2022-03-10 Thread wenyi,xie via groups.io
Main Changes :
1.Remove suffix optional in declaration of WakeUpAP to keep declaration same 
with definition.

Wenyi Xie (1):
  UefiCpuPkg/MpInitLib:remove optional in declaration

 UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1.windows.1



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