Date   

[PATCH V3 01/12] ArmVirtPkg/FdtClintDxe: Move FdtClientDxe to EmbeddedPkg

Abner Chang
 

This is one of the series patches to restructure the location of modules under
ArmVirtPkg for RiscVVirtPkg. RiscVVirtPkg leverage FDT Client protocol to
parse FDT nodes.

Signed-off-by: Abner Chang <abner.chang@...>
Cc: Ard Biesheuvel <ardb+tianocore@...>
Cc: Leif Lindholm <leif@...>
Cc: Sami Mujawar <sami.mujawar@...>
Cc: Gerd Hoffmann <kraxel@...>
Cc: Daniel Schaefer <daniel.schaefer@...>
Cc: Sunil V L <sunilvl@...>
---
ArmVirtPkg/ArmVirtPkg.dec | 3 ---
EmbeddedPkg/EmbeddedPkg.dec | 1 +
ArmVirtPkg/ArmVirtCloudHv.dsc | 2 +-
ArmVirtPkg/ArmVirtKvmTool.dsc | 2 +-
ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
ArmVirtPkg/ArmVirtXen.dsc | 2 +-
EmbeddedPkg/EmbeddedPkg.dsc | 1 +
ArmVirtPkg/ArmVirtCloudHv.fdf | 2 +-
ArmVirtPkg/ArmVirtKvmTool.fdf | 2 +-
ArmVirtPkg/ArmVirtXen.fdf | 2 +-
ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 2 +-
ArmVirtPkg/HighMemDxe/HighMemDxe.inf | 1 +
ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf | 1 +
.../ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf | 1 +
.../ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf | 1 +
.../ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf | 1 +
ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf | 1 +
.../Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf | 1 +
.../Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf | 1 +
ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf | 1 +
ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf | 1 +
ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf | 1 +
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf | 1 +
ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf | 1 +
ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf | 1 +
.../Drivers}/FdtClientDxe/FdtClientDxe.inf | 1 -
{ArmVirtPkg => EmbeddedPkg}/Include/Protocol/FdtClient.h | 0
.../Drivers}/FdtClientDxe/FdtClientDxe.c | 0
29 files changed, 25 insertions(+), 13 deletions(-)
rename {ArmVirtPkg => EmbeddedPkg/Drivers}/FdtClientDxe/FdtClientDxe.inf (92%)
rename {ArmVirtPkg => EmbeddedPkg}/Include/Protocol/FdtClient.h (100%)
rename {ArmVirtPkg => EmbeddedPkg/Drivers}/FdtClientDxe/FdtClientDxe.c (100%)

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index 4e4d758015..4e165f6cd8 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -35,9 +35,6 @@

gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }

-[Protocols]
- gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
-
[PcdsFeatureFlag]
#
# Feature Flag PCD that defines whether TPM2 support is enabled
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 7638aaaade..637888e0fd 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -79,6 +79,7 @@
gPlatformGpioProtocolGuid = { 0x52ce9845, 0x5af4, 0x43e2, {0xba, 0xfd, 0x23, 0x08, 0x12, 0x54, 0x7a, 0xc2 }}
gPlatformVirtualKeyboardProtocolGuid = { 0x0e3606d2, 0x1dc3, 0x4e6f, { 0xbe, 0x65, 0x39, 0x49, 0x82, 0xa2, 0x65, 0x47 }}
gAndroidBootImgProtocolGuid = { 0x9859bb19, 0x407c, 0x4f8b, {0xbc, 0xe1, 0xf8, 0xda, 0x65, 0x65, 0xf4, 0xa5 }}
+ gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }

[Ppis]
gEdkiiEmbeddedGpioPpiGuid = { 0x21c3b115, 0x4e0b, 0x470c, { 0x85, 0xc7, 0xe1, 0x05, 0xa5, 0x75, 0xc9, 0x7b }}
diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
index f292ba6079..07313e1e67 100644
--- a/ArmVirtPkg/ArmVirtCloudHv.dsc
+++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
@@ -293,7 +293,7 @@
# Platform Driver
#
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index 3bd1cc72a1..745eae347b 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -292,7 +292,7 @@
#
ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 97539edef7..5030174fe3 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -404,7 +404,7 @@
# Platform Driver
#
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 28064199c8..5e0a2ee0c6 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -340,7 +340,7 @@
# Platform Driver
#
ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
ArmVirtPkg/HighMemDxe/HighMemDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 2b07a5ba19..73b4a90f3e 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -196,7 +196,7 @@
# Platform Driver
#
ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
- ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf

#
# FAT filesystem + GPT/MBR partitioning + UDF filesystem
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index c41864e8a5..f7ed61545c 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -238,6 +238,7 @@

EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf
EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
+ EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf

EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf {
<LibraryClasses>
diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf
index 13fe8061c3..1bb452ebb8 100644
--- a/ArmVirtPkg/ArmVirtCloudHv.fdf
+++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
@@ -106,7 +106,7 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Core/Dxe/DxeMain.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf

#
diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf
index 152453dc4b..1dac8b7880 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.fdf
+++ b/ArmVirtPkg/ArmVirtKvmTool.fdf
@@ -120,7 +120,7 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Core/Dxe/DxeMain.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
INF ArmVirtPkg/KvmtoolPlatformDxe/KvmtoolPlatformDxe.inf
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf

diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index 9597465cf5..132480f030 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -139,7 +139,7 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Core/Dxe/DxeMain.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
- INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf

#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 26f13f6a21..e9518dd273 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -41,7 +41,7 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Core/Dxe/DxeMain.inf
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
- INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+ INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf

#
diff --git a/ArmVirtPkg/HighMemDxe/HighMemDxe.inf b/ArmVirtPkg/HighMemDxe/HighMemDxe.inf
index e510880b0d..168fc90d2a 100644
--- a/ArmVirtPkg/HighMemDxe/HighMemDxe.inf
+++ b/ArmVirtPkg/HighMemDxe/HighMemDxe.inf
@@ -20,6 +20,7 @@
HighMemDxe.c

[Packages]
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
ArmPkg/ArmPkg.dec
diff --git a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf
index 43fcb0b73b..23cc64ab93 100644
--- a/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf
@@ -30,6 +30,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec

[Protocols]
diff --git a/ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf b/ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
index 52027d5101..2cfb2b6af5 100644
--- a/ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
@@ -22,6 +22,7 @@
[Packages]
ArmPlatformPkg/ArmPlatformPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec

[LibraryClasses]
diff --git a/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf b/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
index 954a6ac8a6..4fde5e443f 100644
--- a/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtPsciResetSystemLib/ArmVirtPsciResetSystemLib.inf
@@ -24,6 +24,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec

diff --git a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
index 382e3004e1..9e6f6f63a5 100644
--- a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
+++ b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
@@ -23,6 +23,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec

[LibraryClasses]
diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
index b813a0851d..1549f9d884 100644
--- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
@@ -29,6 +29,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
diff --git a/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf b/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
index 337a5488fc..bb055a5beb 100644
--- a/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+++ b/ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
@@ -22,6 +22,7 @@
[Packages]
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec

diff --git a/ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf b/ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf
index deb3bf635c..f0a7c19ca5 100644
--- a/ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf
+++ b/ArmVirtPkg/Library/KvmtoolRtcFdtClientLib/KvmtoolRtcFdtClientLib.inf
@@ -21,6 +21,7 @@

[Packages]
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
PcAtChipsetPkg/PcAtChipsetPkg.dec

diff --git a/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf b/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
index 95e4ba89a4..04d6723295 100644
--- a/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
+++ b/ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf
@@ -22,6 +22,7 @@
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec

diff --git a/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf b/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
index 9aad84ca6d..4c3683bf5d 100644
--- a/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
+++ b/ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
@@ -24,6 +24,7 @@
ArmPlatformPkg/ArmPlatformPkg.dec
ArmPkg/ArmPkg.dec
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec

[LibraryClasses]
BaseLib
diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
index feceed5f93..f3cc827907 100644
--- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
@@ -32,6 +32,7 @@
[Packages]
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
ArmVirtPkg/ArmVirtPkg.dec

[LibraryClasses]
diff --git a/ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf b/ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
index 8fd92f17df..9d5ae7b12f 100644
--- a/ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
+++ b/ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
@@ -21,6 +21,7 @@

[Packages]
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec

diff --git a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index 5881d6b515..9bd31790ca 100644
--- a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
+++ b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -26,6 +26,7 @@

[Packages]
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec

diff --git a/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
index 59e53cad80..10038d5625 100644
--- a/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
+++ b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf
@@ -21,6 +21,7 @@

[Packages]
ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec

diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
similarity index 92%
rename from ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
rename to EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
index d7ba17a0c9..ff80ed8b6a 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+++ b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf
@@ -19,7 +19,6 @@
FdtClientDxe.c

[Packages]
- ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
diff --git a/ArmVirtPkg/Include/Protocol/FdtClient.h b/EmbeddedPkg/Include/Protocol/FdtClient.h
similarity index 100%
rename from ArmVirtPkg/Include/Protocol/FdtClient.h
rename to EmbeddedPkg/Include/Protocol/FdtClient.h
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
similarity index 100%
rename from ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
rename to EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
--
2.17.1


回复: [edk2-devel] [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

gaoliming
 

Dun:
I understand this test is to make sure Edk2 change doesn't break
WhiskeylakeOpenBoard build. It is still for edk2 change.

Thanks
Liming
-----邮件原件-----
发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 duntan
发送时间: 2021年9月30日 9:15
收件人: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
抄送: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Kinney, Michael D
<michael.d.kinney@...>; Liming Gao <gaoliming@...>
主题: Re: [edk2-devel] [PATCH] .azurepipelines: Enable CI for
WhiskeylakeOpenBoard in Edk2platforms

Hi Ray,
The CI is in edk2. The edk2 pull request which contains changes in
specified
folders of edk2 will trigger the ci to pull the latest code of
edk2-platforms,
intel/FSP and edk2-non-osi and build WhiskeyLakeOpenBoard.

Thanks,
Dun
-----Original Message-----
From: Ni, Ray <ray.ni@...>
Sent: Wednesday, September 29, 2021 10:17 PM
To: Tan, Dun <dun.tan@...>; devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Kinney, Michael D
<michael.d.kinney@...>; Liming Gao <gaoliming@...>
Subject: RE: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard
in
Edk2platforms

Is this a patch to enable CI in edk2-platforms?

Package maintainers can directly check in changes to edk2-platforms. Then
how the CI is triggered?

Will the CI run because of a edk2 pull request?

Thanks,
Ray

-----Original Message-----
From: Tan, Dun <dun.tan@...>
Sent: Wednesday, September 29, 2021 2:38 PM
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Kinney, Michael D
<michael.d.kinney@...>; Liming Gao <gaoliming@...>;
Ni, Ray <ray.ni@...>
Subject: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard
in Edk2platforms

The edk2-platforms.yml contains the necessary github repo that will be
checked out, the platform name to build and the folders in edk2 which
will trigger the CI. The edk2platforms-run-steps.yml contains the main
steps to build WhiskeylakeOpenBoard.

Cc: Sean Brogan <sean.brogan@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Ray Ni <ray.ni@...>

Signed-off-by: Dun Tan <dun.tan@...>
---
.azurepipelines/edk2-platforms.yml | 71
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++
.azurepipelines/edk2platforms-run-steps.yml | 72
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++
2 files changed, 143 insertions(+)

diff --git a/.azurepipelines/edk2-platforms.yml
b/.azurepipelines/edk2-platforms.yml
new file mode 100644
index 0000000000..5d47e213ad
--- /dev/null
+++ b/.azurepipelines/edk2-platforms.yml
@@ -0,0 +1,71 @@
+## @file
+# Azure Pipeline build file for WhiskeylakeOpenBoard in Edk2platforms
+on windows and ubuntu # # Copyright (c) 2021, Intel Corporation. All
+rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+ - master
+ - stable/*
+pr:
+ branches:
+ include:
+ - master
+ - stable/*
+ paths:
+ include:
+ - BaseTools
+ - CryptoPkg
+ - FatPkg
+ - IntelFsp2WrapperPkg
+ - MdeModulePkg
+ - MdePkg
+ - NetworkPkg
+ - PcAtChipsetPkg
+ - SecurityPkg
+ - ShellPkg
+ - UefiCpuPkg
+
+resources:
+ repositories:
+ - repository: edk2-platforms
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-platforms
+ - repository: edk2-non-osi
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-non-osi
+ - repository: FSP
+ type: github
+ endpoint: tianocore
+ name: intel/FSP
+
+jobs:
+ - job: Edk2Platforms_CI_Windows
+ pool:
+ vmImage: 'windows-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ WhiskeylakeOpenBoard_UpXtreme:
+ Board.Name: "UpXtreme"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'windows-latest'
+
+ - job: Edk2Platforms_CI_Linux
+ pool:
+ vmImage: 'ubuntu-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'ubuntu-latest'
diff --git a/.azurepipelines/edk2platforms-run-steps.yml
b/.azurepipelines/edk2platforms-run-steps.yml
new file mode 100644
index 0000000000..04b5d40fd8
--- /dev/null
+++ b/.azurepipelines/edk2platforms-run-steps.yml
@@ -0,0 +1,72 @@
+## @file
+# File templates/edk2platforms-run-steps.yml
+#
+# template file containing the steps to build # # Copyright (c) 2021,
+Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent ##
+parameters:
+- name: board_name
+ type: string
+ default: ''
+- name: pool_name
+ type: string
+ default: ''
+
+steps:
+- checkout: self
+ submodules: true
+- checkout: edk2-non-osi
+- checkout: FSP
+- checkout: edk2-platforms
+
+- task: UsePythonVersion@0
+ inputs:
+ versionSpec: "3.8.x"
+ architecture: "x64"
+
+- ${{ if contains(parameters.pool_name, 'ubuntu') }}:
+ - bash: |
+ sudo apt-get update
+ sudo apt-get install gcc g++ make uuid-dev nasm iasl
+ displayName: Update apt and Install required tools
+ - script: |
+ source edksetup.sh
+ echo "##vso[task.setvariable variable=PATH;]$PATH"
+ displayName: Set env Path
+ workingDirectory: edk2/
+
+- ${{ if contains(parameters.pool_name, 'windows') }}:
+ - powershell: |
+ choco install iasl -y --version=2017.11.10
+ echo "##vso[task.setvariable variable=IASL_PREFIX;]C:\tools\ASL\"
+ choco install nasm -y
+ echo "##vso[task.setvariable variable=NASM_PREFIX;]C:\Program
Files\NASM\"
+ displayName: Windows EDK II Prerequisites
+
+# Build WhiskeylakeOpenBoard in edk2platforms
+- script: python build_bios.py --platform ${{ parameters.board_name}}
+ displayName: Build platform ${{ parameters.board_name}}
+ workingDirectory: edk2-platforms/Platform/Intel
+
+# Copy the build logs to the artifact staging directory
+- task: CopyFiles@2
+ displayName: "Copy build logs"
+ inputs:
+ targetFolder: "$(Build.ArtifactStagingDirectory)"
+ SourceFolder:
+ contents: |
+ Build.log
+ BuildReport.log
+ flattenFolders: true
+ condition: succeededOrFailed()
+
+# Publish build artifacts to Azure Artifacts/TFS or a file share
+- task: PublishBuildArtifacts@1
+ continueOnError: true
+ displayName: "Publish build logs"
+ inputs:
+ pathtoPublish: "$(Build.ArtifactStagingDirectory)"
+ artifactName: "Build Logs $(System.JobName)"
+ condition: succeededOrFailed()
--
2.31.1.windows.1




Re: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

duntan
 

Hi Ray,
The CI is in edk2. The edk2 pull request which contains changes in specified folders of edk2 will trigger the ci to pull the latest code of edk2-platforms, intel/FSP and edk2-non-osi and build WhiskeyLakeOpenBoard.

Thanks,
Dun

-----Original Message-----
From: Ni, Ray <ray.ni@...>
Sent: Wednesday, September 29, 2021 10:17 PM
To: Tan, Dun <dun.tan@...>; devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew <Bret.Barkelew@...>; Kinney, Michael D <michael.d.kinney@...>; Liming Gao <gaoliming@...>
Subject: RE: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

Is this a patch to enable CI in edk2-platforms?

Package maintainers can directly check in changes to edk2-platforms. Then how the CI is triggered?

Will the CI run because of a edk2 pull request?

Thanks,
Ray

-----Original Message-----
From: Tan, Dun <dun.tan@...>
Sent: Wednesday, September 29, 2021 2:38 PM
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Kinney, Michael D
<michael.d.kinney@...>; Liming Gao <gaoliming@...>;
Ni, Ray <ray.ni@...>
Subject: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard
in Edk2platforms

The edk2-platforms.yml contains the necessary github repo that will be
checked out, the platform name to build and the folders in edk2 which
will trigger the CI. The edk2platforms-run-steps.yml contains the main
steps to build WhiskeylakeOpenBoard.

Cc: Sean Brogan <sean.brogan@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Ray Ni <ray.ni@...>

Signed-off-by: Dun Tan <dun.tan@...>
---
.azurepipelines/edk2-platforms.yml | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.azurepipelines/edk2platforms-run-steps.yml | 72
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+)

diff --git a/.azurepipelines/edk2-platforms.yml
b/.azurepipelines/edk2-platforms.yml
new file mode 100644
index 0000000000..5d47e213ad
--- /dev/null
+++ b/.azurepipelines/edk2-platforms.yml
@@ -0,0 +1,71 @@
+## @file
+# Azure Pipeline build file for WhiskeylakeOpenBoard in Edk2platforms
+on windows and ubuntu # # Copyright (c) 2021, Intel Corporation. All
+rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+ - master
+ - stable/*
+pr:
+ branches:
+ include:
+ - master
+ - stable/*
+ paths:
+ include:
+ - BaseTools
+ - CryptoPkg
+ - FatPkg
+ - IntelFsp2WrapperPkg
+ - MdeModulePkg
+ - MdePkg
+ - NetworkPkg
+ - PcAtChipsetPkg
+ - SecurityPkg
+ - ShellPkg
+ - UefiCpuPkg
+
+resources:
+ repositories:
+ - repository: edk2-platforms
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-platforms
+ - repository: edk2-non-osi
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-non-osi
+ - repository: FSP
+ type: github
+ endpoint: tianocore
+ name: intel/FSP
+
+jobs:
+ - job: Edk2Platforms_CI_Windows
+ pool:
+ vmImage: 'windows-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ WhiskeylakeOpenBoard_UpXtreme:
+ Board.Name: "UpXtreme"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'windows-latest'
+
+ - job: Edk2Platforms_CI_Linux
+ pool:
+ vmImage: 'ubuntu-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'ubuntu-latest'
diff --git a/.azurepipelines/edk2platforms-run-steps.yml
b/.azurepipelines/edk2platforms-run-steps.yml
new file mode 100644
index 0000000000..04b5d40fd8
--- /dev/null
+++ b/.azurepipelines/edk2platforms-run-steps.yml
@@ -0,0 +1,72 @@
+## @file
+# File templates/edk2platforms-run-steps.yml
+#
+# template file containing the steps to build # # Copyright (c) 2021,
+Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent ##
+parameters:
+- name: board_name
+ type: string
+ default: ''
+- name: pool_name
+ type: string
+ default: ''
+
+steps:
+- checkout: self
+ submodules: true
+- checkout: edk2-non-osi
+- checkout: FSP
+- checkout: edk2-platforms
+
+- task: UsePythonVersion@0
+ inputs:
+ versionSpec: "3.8.x"
+ architecture: "x64"
+
+- ${{ if contains(parameters.pool_name, 'ubuntu') }}:
+ - bash: |
+ sudo apt-get update
+ sudo apt-get install gcc g++ make uuid-dev nasm iasl
+ displayName: Update apt and Install required tools
+ - script: |
+ source edksetup.sh
+ echo "##vso[task.setvariable variable=PATH;]$PATH"
+ displayName: Set env Path
+ workingDirectory: edk2/
+
+- ${{ if contains(parameters.pool_name, 'windows') }}:
+ - powershell: |
+ choco install iasl -y --version=2017.11.10
+ echo "##vso[task.setvariable variable=IASL_PREFIX;]C:\tools\ASL\"
+ choco install nasm -y
+ echo "##vso[task.setvariable variable=NASM_PREFIX;]C:\Program Files\NASM\"
+ displayName: Windows EDK II Prerequisites
+
+# Build WhiskeylakeOpenBoard in edk2platforms
+- script: python build_bios.py --platform ${{ parameters.board_name}}
+ displayName: Build platform ${{ parameters.board_name}}
+ workingDirectory: edk2-platforms/Platform/Intel
+
+# Copy the build logs to the artifact staging directory
+- task: CopyFiles@2
+ displayName: "Copy build logs"
+ inputs:
+ targetFolder: "$(Build.ArtifactStagingDirectory)"
+ SourceFolder:
+ contents: |
+ Build.log
+ BuildReport.log
+ flattenFolders: true
+ condition: succeededOrFailed()
+
+# Publish build artifacts to Azure Artifacts/TFS or a file share
+- task: PublishBuildArtifacts@1
+ continueOnError: true
+ displayName: "Publish build logs"
+ inputs:
+ pathtoPublish: "$(Build.ArtifactStagingDirectory)"
+ artifactName: "Build Logs $(System.JobName)"
+ condition: succeededOrFailed()
--
2.31.1.windows.1


Re: [`edk2-devel][PATCH 0/8] Add SMM variable support for UEFI payload

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Dong, Guo <guo.dong@...>
Sent: Sunday, September 26, 2021 7:05 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Ma, Maurice <maurice.ma@...>; You, Benjamin <benjamin.you@...>; Dong, Guo
<guo.dong@...>
Subject: [`edk2-devel][PATCH 0/8] Add SMM variable support for UEFI payload

From: Guo Dong <guo.dong@...>

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

Currently UEFI payload uses emulated variable driver. So it could
not support secureboot and measured boot since both need NV variable
support.

EDKII already has SMM modules and variable modules. And modern Intel
platform supports SPI flash hardware sequence to operate flash. So it
is possible to have a common SPI module for Intel platforms.

This patch enhances UEFI payload to support SMM variable with a
common SPI library for Intel platforms. To avoid impact existing
usage, all the new modules are included under SMM_ENABLE and
VARIABLE_SUPPORT and by default SMM variable is not be enabled.

SMM variable could be enabled only when UNIVERSAL_PAYLOAD is set
since non-universal payload need update ParseLib to provide SMM
variable related infromation which is not in the plan.

Signed-off-by: Guo Dong <guo.dong@...>

Guo Dong (8):
UefiPayloadPkg: Add a common SmmAccessDxe module
UefiPayloadPkg: Add a common SMM control Runtime DXE module
UefiPayloadPkg: Add bootloader SMM support module
UefiPayloadPkg: Add SpiFlashLib
UefiPayloadPkg: Add FlashDeviceLib
UefiPayloadPkg: Add a common FVB SMM module
UefiPayloadPkg: Add a SMM dispatch module
UefiPayloadPkg: Add SMM support and SMM variable support

UefiPayloadPkg/BlSupportSmm/BlSupportSmm.c | 409 +++++++
UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h | 41 +
UefiPayloadPkg/BlSupportSmm/BlSupportSmm.inf | 49 +
UefiPayloadPkg/FvbRuntimeDxe/FvbInfo.c | 143 +++
UefiPayloadPkg/FvbRuntimeDxe/FvbService.c | 1085 +++++++++++++++++
UefiPayloadPkg/FvbRuntimeDxe/FvbService.h | 187 +++
UefiPayloadPkg/FvbRuntimeDxe/FvbServiceSmm.c | 139 +++
UefiPayloadPkg/FvbRuntimeDxe/FvbSmm.inf | 71 ++
UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h | 69 ++
.../Include/Guid/NvVariableInfoGuid.h | 30 +
.../Include/Guid/SmmRegisterInfoGuid.h | 48 +
.../Include/Guid/SmmS3CommunicationInfoGuid.h | 54 +
.../Include/Guid/SpiFlashInfoGuid.h | 38 +
.../Include/Library/FlashDeviceLib.h | 108 ++
UefiPayloadPkg/Include/Library/SpiFlashLib.h | 215 ++++
.../Library/FlashDeviceLib/FlashDeviceLib.c | 165 +++
.../Library/FlashDeviceLib/FlashDeviceLib.inf | 38 +
UefiPayloadPkg/Library/SpiFlashLib/PchSpi.c | 180 +++
UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h | 129 ++
.../Library/SpiFlashLib/SpiCommon.h | 208 ++++
.../Library/SpiFlashLib/SpiFlashLib.c | 857 +++++++++++++
.../Library/SpiFlashLib/SpiFlashLib.inf | 47 +
.../PchSmiDispatchSmm/PchSmiDispatchSmm.c | 455 +++++++
.../PchSmiDispatchSmm/PchSmiDispatchSmm.h | 39 +
.../PchSmiDispatchSmm/PchSmiDispatchSmm.inf | 51 +
UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.c | 254 ++++
UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h | 38 +
UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.inf | 51 +
.../SmmControlRuntimeDxe.c | 252 ++++
.../SmmControlRuntimeDxe.inf | 50 +
UefiPayloadPkg/UefiPayloadPkg.dec | 10 +
UefiPayloadPkg/UefiPayloadPkg.dsc | 101 +-
UefiPayloadPkg/UefiPayloadPkg.fdf | 38 +-
33 files changed, 5638 insertions(+), 11 deletions(-)
create mode 100644 UefiPayloadPkg/BlSupportSmm/BlSupportSmm.c
create mode 100644 UefiPayloadPkg/BlSupportSmm/BlSupportSmm.h
create mode 100644 UefiPayloadPkg/BlSupportSmm/BlSupportSmm.inf
create mode 100644 UefiPayloadPkg/FvbRuntimeDxe/FvbInfo.c
create mode 100644 UefiPayloadPkg/FvbRuntimeDxe/FvbService.c
create mode 100644 UefiPayloadPkg/FvbRuntimeDxe/FvbService.h
create mode 100644 UefiPayloadPkg/FvbRuntimeDxe/FvbServiceSmm.c
create mode 100644 UefiPayloadPkg/FvbRuntimeDxe/FvbSmm.inf
create mode 100644 UefiPayloadPkg/FvbRuntimeDxe/FvbSmmCommon.h
create mode 100644 UefiPayloadPkg/Include/Guid/NvVariableInfoGuid.h
create mode 100644 UefiPayloadPkg/Include/Guid/SmmRegisterInfoGuid.h
create mode 100644 UefiPayloadPkg/Include/Guid/SmmS3CommunicationInfoGuid.h
create mode 100644 UefiPayloadPkg/Include/Guid/SpiFlashInfoGuid.h
create mode 100644 UefiPayloadPkg/Include/Library/FlashDeviceLib.h
create mode 100644 UefiPayloadPkg/Include/Library/SpiFlashLib.h
create mode 100644 UefiPayloadPkg/Library/FlashDeviceLib/FlashDeviceLib.c
create mode 100644 UefiPayloadPkg/Library/FlashDeviceLib/FlashDeviceLib.inf
create mode 100644 UefiPayloadPkg/Library/SpiFlashLib/PchSpi.c
create mode 100644 UefiPayloadPkg/Library/SpiFlashLib/RegsSpi.h
create mode 100644 UefiPayloadPkg/Library/SpiFlashLib/SpiCommon.h
create mode 100644 UefiPayloadPkg/Library/SpiFlashLib/SpiFlashLib.c
create mode 100644 UefiPayloadPkg/Library/SpiFlashLib/SpiFlashLib.inf
create mode 100644 UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.c
create mode 100644 UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.h
create mode 100644 UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.inf
create mode 100644 UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.c
create mode 100644 UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.h
create mode 100644 UefiPayloadPkg/SmmAccessDxe/SmmAccessDxe.inf
create mode 100644 UefiPayloadPkg/SmmControlRuntimeDxe/SmmControlRuntimeDxe.c
create mode 100644 UefiPayloadPkg/SmmControlRuntimeDxe/SmmControlRuntimeDxe.inf

--
2.32.0.windows.2


Re: [PATCH v2 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy

Yao, Jiewen
 

Yes. Merged.
499c4608b13df0738213329722cdcb0ac838f3ad.. bd298d75934a7a0cf6b9e2863a5e4975e9714285

-----Original Message-----
From: Stefan Berger <stefanb@...>
Sent: Thursday, September 30, 2021 3:15 AM
To: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@...>
Cc: mhaeuser@...; spbrogan@...;
marcandre.lureau@...; kraxel@...
Subject: Re: [edk2-devel] [PATCH v2 0/4] OvmfPkg: Disable the TPM 2 platform
hierarchy


On 9/14/21 6:26 PM, Yao, Jiewen wrote:
Reviewed-by: Jiewen Yao <Jiewen.yao@...>

I will wait for a week, to see if there is any feedback from AMD or Bhyve
reviewer.

I didn't see any more comments to v3
(https://listman.redhat.com/archives/edk2-devel-archive/2021-
September/msg00641.html)
So maybe you can apply it to the repo.


   Stefan



Thank you
Yao Jiewen


-----Original Message-----
From: Stefan Berger <stefanb@...>
Sent: Tuesday, September 14, 2021 10:18 PM
To: devel@edk2.groups.io
Cc: mhaeuser@...; spbrogan@...;
marcandre.lureau@...; kraxel@...; Yao, Jiewen
<jiewen.yao@...>; Stefan Berger <stefanb@...>
Subject: [PATCH v2 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy

This series of patches adds support for disabling the TPM 2 platform
hierarchy to Ovmf. To be able to do this we have to handle TPM 2
physical presence interface (PPI) opcodes before the TPM 2 platform
hierarchy is disabled otherwise TPM 2 commands that are sent due to the
PPI opcodes may fail if the platform hierarchy is already disabled.
Therefore, we need to invoke the handler function
Tcg2PhysicalPresenceLibProcessRequest from within
PlatformBootManagerBeforeConsole. Since handling of PPI opcodes may
require
interaction with the user, we also move PlatformInitializeConsole
to before the handling of PPI codes so that the keyboard is available
when needed. The PPI handling code will activate the default consoles
only if it requires user interaction.

Regards,
Stefan

v2:
- 1/4: Added missing link library
- 2/4: Modified other BdsPlatform.c files as well
- Added Yao's comments to 1/2 and 2/2

Stefan Berger (4):
OvmfPkg/TPM PPI: Connect default consoles for user interaction
OvmfPkg: Handle TPM 2 physical presence opcodes much earlier
OvmfPkg: Reference new Tcg2PlatformDxe in the build system for
compilation
OvmfPkg: Reference new Tcg2PlatformPei in the build system

OvmfPkg/AmdSev/AmdSevX64.dsc | 8 ++++++++
OvmfPkg/AmdSev/AmdSevX64.fdf | 2 ++
.../PlatformBootManagerLib/BdsPlatform.c | 19 +++++++++++--------
.../PlatformBootManagerLibBhyve/BdsPlatform.c | 16 +++++++++-------
.../PlatformBootManagerLibGrub/BdsPlatform.c | 16 +++++++++-------
.../DxeTcg2PhysicalPresenceLib.c | 5 +++++
.../DxeTcg2PhysicalPresenceLib.inf | 1 +
OvmfPkg/OvmfPkgIa32.dsc | 8 ++++++++
OvmfPkg/OvmfPkgIa32.fdf | 2 ++
OvmfPkg/OvmfPkgIa32X64.dsc | 8 ++++++++
OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
OvmfPkg/OvmfPkgX64.dsc | 8 ++++++++
OvmfPkg/OvmfPkgX64.fdf | 2 ++
13 files changed, 75 insertions(+), 22 deletions(-)

--
2.31.1




Re: [PATCH v3 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

Guo Dong
 

Hi ChengChieh,

You could directly build from this branch for the test.
https://github.com/gdong1/edk2/pull/new/for_linux_bootloader_test

Thanks,
Guo

-----Original Message-----
From: Dong, Guo
Sent: Wednesday, September 29, 2021 12:02 PM
To: devel@edk2.groups.io; chengchieh@...
Cc: Ni, Ray <ray.ni@...>; Ma, Maurice <maurice.ma@...>; You, Benjamin <benjamin.you@...>
Subject: RE: [edk2-devel] [PATCH v3 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload


Hi ChengChieh,

Here is the update to this patch series:

1. UefiPayloadPkg: Add LINUXBOOT payload target
a) Ray asked to update commit message
b) There are still some coding style issues
I know it is a little difficult to fully follow EDKII coding style. I will help update this patch and send it out for review.
It would be great if you could have a test to double check with the new patch.

2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
I had approved this patch. We could merged this one after the first patch got merged.

3. UefiPayloadPkg: Update maximum logic processor to 256
It was merged.

4. UefiPayloadPkg: Reserve Payload config in runtime services data
This patch should be not required when patch https://github.com/tianocore/edk2/pull/2028 (under code review) is merged.

Thanks,
Guo

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Cheng-Chieh Huang via groups.io
Sent: Sunday, August 22, 2021 11:33 PM
To: devel@edk2.groups.io
Cc: Cheng-Chieh Huang <chengchieh@...>
Subject: [edk2-devel] [PATCH v3 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

These are necessary patches to Support LinuxBoot in UefiPayload.
With these paches, we can boot to ESXi and Windows from a linux in QEMU.

Third parse: address formating comments.

LinuxBoot README:
https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md

v3 PR to tianocore:
https://github.com/tianocore/edk2/pull/1873

Cheng-Chieh Huang (4):
UefiPayloadPkg: Add LINUXBOOT payload target
UefiPayloadPkg: Use legacy timer in Linuxboot payload
UefiPayloadPkg: Update maximum logic processor to 256
UefiPayloadPkg: Reserve Payload config in runtime services data

UefiPayloadPkg/UefiPayloadPkg.dsc | 24 ++-
UefiPayloadPkg/UefiPayloadPkg.fdf | 5 +
.../Library/LbParseLib/LbParseLib.inf | 39 ++++
UefiPayloadPkg/Library/LbParseLib/Linuxboot.h | 47 +++++
.../Library/LbParseLib/LbParseLib.c | 187 ++++++++++++++++++
.../PciHostBridgeLib/PciHostBridgeSupport.c | 6 +-
.../UefiPayloadEntry/UefiPayloadEntry.c | 4 +
7 files changed, 304 insertions(+), 8 deletions(-) create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

--
2.33.0.rc2.250.ged5fa647cd-goog


Re: [PATCH v2 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy

Stefan Berger
 

On 9/14/21 6:26 PM, Yao, Jiewen wrote:
Reviewed-by: Jiewen Yao <Jiewen.yao@...>

I will wait for a week, to see if there is any feedback from AMD or Bhyve reviewer.
I didn't see any more comments to v3 (https://listman.redhat.com/archives/edk2-devel-archive/2021-September/msg00641.html) So maybe you can apply it to the repo.


   Stefan



Thank you
Yao Jiewen


-----Original Message-----
From: Stefan Berger <stefanb@...>
Sent: Tuesday, September 14, 2021 10:18 PM
To: devel@edk2.groups.io
Cc: mhaeuser@...; spbrogan@...;
marcandre.lureau@...; kraxel@...; Yao, Jiewen
<jiewen.yao@...>; Stefan Berger <stefanb@...>
Subject: [PATCH v2 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy

This series of patches adds support for disabling the TPM 2 platform
hierarchy to Ovmf. To be able to do this we have to handle TPM 2
physical presence interface (PPI) opcodes before the TPM 2 platform
hierarchy is disabled otherwise TPM 2 commands that are sent due to the
PPI opcodes may fail if the platform hierarchy is already disabled.
Therefore, we need to invoke the handler function
Tcg2PhysicalPresenceLibProcessRequest from within
PlatformBootManagerBeforeConsole. Since handling of PPI opcodes may
require
interaction with the user, we also move PlatformInitializeConsole
to before the handling of PPI codes so that the keyboard is available
when needed. The PPI handling code will activate the default consoles
only if it requires user interaction.

Regards,
Stefan

v2:
- 1/4: Added missing link library
- 2/4: Modified other BdsPlatform.c files as well
- Added Yao's comments to 1/2 and 2/2

Stefan Berger (4):
OvmfPkg/TPM PPI: Connect default consoles for user interaction
OvmfPkg: Handle TPM 2 physical presence opcodes much earlier
OvmfPkg: Reference new Tcg2PlatformDxe in the build system for
compilation
OvmfPkg: Reference new Tcg2PlatformPei in the build system

OvmfPkg/AmdSev/AmdSevX64.dsc | 8 ++++++++
OvmfPkg/AmdSev/AmdSevX64.fdf | 2 ++
.../PlatformBootManagerLib/BdsPlatform.c | 19 +++++++++++--------
.../PlatformBootManagerLibBhyve/BdsPlatform.c | 16 +++++++++-------
.../PlatformBootManagerLibGrub/BdsPlatform.c | 16 +++++++++-------
.../DxeTcg2PhysicalPresenceLib.c | 5 +++++
.../DxeTcg2PhysicalPresenceLib.inf | 1 +
OvmfPkg/OvmfPkgIa32.dsc | 8 ++++++++
OvmfPkg/OvmfPkgIa32.fdf | 2 ++
OvmfPkg/OvmfPkgIa32X64.dsc | 8 ++++++++
OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
OvmfPkg/OvmfPkgX64.dsc | 8 ++++++++
OvmfPkg/OvmfPkgX64.fdf | 2 ++
13 files changed, 75 insertions(+), 22 deletions(-)

--
2.31.1



Re: [PATCH v3 1/4] UefiPayloadPkg: Add LINUXBOOT payload target

Guo Dong
 

Hi Ray,

I had updated the patch to update the commit message and fix some coding style.
Please help review V4 patch.

Thanks,
Guo

-----Original Message-----
From: Ni, Ray <ray.ni@...>
Sent: Tuesday, August 24, 2021 5:35 PM
To: Cheng-Chieh Huang <chengchieh@...>; devel@edk2.groups.io
Cc: Schaefer, Daniel <daniel.schaefer@...>; Trammell Hudson <hudson@...>; Ma, Maurice <maurice.ma@...>; Dong, Guo <guo.dong@...>; You, Benjamin <benjamin.you@...>
Subject: RE: [PATCH v3 1/4] UefiPayloadPkg: Add LINUXBOOT payload target

Can you describe how LINUXBOOT payload is supported in the commit message?
One line commit message is too simple for such a big feature😊

-----Original Message-----
From: Cheng-Chieh Huang <chengchieh@...>
Sent: Monday, August 23, 2021 2:33 PM
To: devel@edk2.groups.io
Cc: Cheng-Chieh Huang <chengchieh@...>; Schaefer, Daniel
<daniel.schaefer@...>; Trammell Hudson <hudson@...>; Ma,
Maurice <maurice.ma@...>; Dong, Guo <guo.dong@...>; You,
Benjamin <benjamin.you@...>; Ni, Ray <ray.ni@...>
Subject: [PATCH v3 1/4] UefiPayloadPkg: Add LINUXBOOT payload target

Initial commit to support linuxboot payload.

Signed-off-by: Cheng-Chieh Huang <chengchieh@...>
Cc: Cheng-Chieh Huang <chengchieh@...>
Cc: Daniel Schaefer <daniel.schaefer@...>
Cc: Trammell Hudson <hudson@...>
Cc: Maurice Ma <maurice.ma@...>
Cc: Guo Dong <guo.dong@...>
Cc: Benjamin You <benjamin.you@...>
Cc: Ray Ni <ray.ni@...>
---
UefiPayloadPkg/UefiPayloadPkg.dsc | 16 +-
.../Library/LbParseLib/LbParseLib.inf | 39 ++++
UefiPayloadPkg/Library/LbParseLib/Linuxboot.h | 47 +++++
.../Library/LbParseLib/LbParseLib.c | 187 ++++++++++++++++++
.../PciHostBridgeLib/PciHostBridgeSupport.c | 6 +-
5 files changed, 288 insertions(+), 7 deletions(-) create mode
100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index bcedf1c746b4..54576ba485b7 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@ [Defines]
#
# SBL: UEFI payload for Slim Bootloader
# COREBOOT: UEFI payload for coreboot
+ # LINUXBOOT: UEFI payload for linuxboot
#
DEFINE BOOTLOADER = SBL

@@ -93,6 +94,9 @@ [Defines]

[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
+!if $(BOOTLOADER) == "LINUXBOOT"
+ *_*_*_CC_FLAGS = -D LINUXBOOT_PAYLOAD
+!endif
GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
@@ -222,11 +226,13 @@ [LibraryClasses] !endif

PlatformSupportLib|UefiPayloadPkg/Library/PlatformSupportLibNull/Platf
ormSupportLibNull.inf
!if $(UNIVERSAL_PAYLOAD) == FALSE
- !if $(BOOTLOADER) == "COREBOOT"
- BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf
- !else
- BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
- !endif
+ !if $(BOOTLOADER) == "COREBOOT"
+ BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf
+ !elseif $(BOOTLOADER) == "LINUXBOOT"
+ BlParseLib|UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
+ !else
+ BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf
+ !endif
!endif


DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.
inf diff --git a/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
new file mode 100644
index 000000000000..d75ba8db8cf3
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
@@ -0,0 +1,39 @@
+## @file
+# Linuxboot Table Parse Library.
+#
+# Copyright (c) 2021, the u-root Authors. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent # ##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = LbParseLib
+ FILE_GUID = DBA15E1E-4C16-47DF-93C0-AB5888ED14C3
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = BlParseLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ LbParseLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UefiPayloadPkg/UefiPayloadPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ IoLib
+ DebugLib
+ PcdLib
+
+[Pcd]
+ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase
diff --git a/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
b/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
new file mode 100644
index 000000000000..b3b7e70a7ccb
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
@@ -0,0 +1,47 @@
+/** @file
+ LinuxBoot PEI module include file.
+**/
+#ifndef __LINUXBOOT_PEI_H_INCLUDED__
+#define __LINUXBOOT_PEI_H_INCLUDED__
+
+#if defined(_MSC_VER)
+#pragma warning(disable : 4200)
+#endif
+
+#pragma pack(1)
+typedef struct SerialPortConfigStruct {
+ UINT32 Type;
+ UINT32 BaseAddr;
+ UINT32 Baud;
+ UINT32 RegWidth;
+ UINT32 InputHertz;
+ UINT32 UartPciAddr;
+} SerialPortConfig;
+
+typedef struct MemoryMapEntryStruct {
+ UINT64 Start;
+ UINT64 End;
+ UINT32 Type;
+} MemoryMapEntry;
+
+typedef struct UefiPayloadConfigStruct {
+ UINT64 Version;
+ UINT64 AcpiBase;
+ UINT64 AcpiSize;
+ UINT64 SmbiosBase;
+ UINT64 SmbiosSize;
+ SerialPortConfig SerialConfig;
+ UINT32 NumMemoryMapEntries;
+ MemoryMapEntry MemoryMapEntries[0]; } UefiPayloadConfig; #pragma
+pack()
+
+#define UEFI_PAYLOAD_CONFIG_VERSION 1
+
+#define LINUXBOOT_MEM_RAM 1
+#define LINUXBOOT_MEM_DEFAULT 2
+#define LINUXBOOT_MEM_ACPI 3
+#define LINUXBOOT_MEM_NVS 4
+#define LINUXBOOT_MEM_RESERVED 5
+
+#endif // __LINUXBOOT_PEI_H_INCLUDED__
diff --git a/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
new file mode 100644
index 000000000000..48d174dfc078
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
@@ -0,0 +1,187 @@
+/** @file
+ This library will parse the linuxboot table in memory and extract
+those required
+ information.
+
+ Copyright (c) 2021, the u-root Authors. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/SmBios.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BlParseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#include <Linuxboot.h>
+#include <Uefi/UefiBaseType.h>
+
+// Retrieve UefiPayloadConfig from Linuxboot's uefiboot
+UefiPayloadConfig*
+GetUefiPayLoadConfig()
+{
+ UefiPayloadConfig *Config;
+ Config = (UefiPayloadConfig*)(UINTN)(PcdGet32(PcdPayloadFdMemBase)
+- SIZE_64KB);
+ if (Config->Version != UEFI_PAYLOAD_CONFIG_VERSION) {
+ DEBUG((DEBUG_ERROR, "Expect payload Config version: %d, but get %d\n",
+ UEFI_PAYLOAD_CONFIG_VERSION, Config->Version));
+ CpuDeadLoop ();
+ }
+ return Config;
+}
+
+// Align the address and add memory rang to MemInfoCallback VOID
+AddMemoryRange (
+ IN BL_MEM_INFO_CALLBACK MemInfoCallback,
+ IN UINTN start,
+ IN UINTN end,
+ IN int type
+ ) {
+ MEMROY_MAP_ENTRY MemoryMap;
+ UINTN AlignedStart;
+ UINTN AlignedEnd;
+ AlignedStart = ALIGN_VALUE(start, SIZE_4KB);
+ AlignedEnd = ALIGN_VALUE(end, SIZE_4KB);
+ // Conservative adjustment on Memory map. This should happen when
+booting from
+ // non UEFI bios and it may report a memory region less than 4KB.
+ if (AlignedStart > start && type != LINUXBOOT_MEM_RAM) {
+ AlignedStart -= SIZE_4KB;
+ }
+ if (AlignedEnd > end + 1 && type == LINUXBOOT_MEM_RAM) {
+ AlignedEnd -= SIZE_4KB;
+ }
+ MemoryMap.Base = AlignedStart;
+ MemoryMap.Size = AlignedEnd - AlignedStart;
+ MemoryMap.Type = type;
+ MemoryMap.Flag = 0;
+ MemInfoCallback(&MemoryMap, NULL);
+}
+
+/**
+ Acquire the memory information from the linuxboot table in memory.
+
+ @param MemInfoCallback The callback routine
+ @param Params Pointer to the callback routine parameter
+
+ @retval RETURN_SUCCESS Successfully find out the memory information.
+ @retval RETURN_NOT_FOUND Failed to find the memory information.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseMemoryInfo (
+ IN BL_MEM_INFO_CALLBACK MemInfoCallback,
+ IN VOID* Params
+ ) {
+ UefiPayloadConfig *Config;
+ MemoryMapEntry* entry;
+ int Index;
+
+ Config = GetUefiPayLoadConfig();
+
+ DEBUG((DEBUG_INFO, "MemoryMap #entries: %d\n",
+ Config->NumMemoryMapEntries));
+
+ entry = &Config->MemoryMapEntries[0];
+ for (Index = 0; Index < Config->NumMemoryMapEntries; Index++) {
+ DEBUG((DEBUG_INFO, "Start: 0x%lx End: 0x%lx Type:%d\n", entry->Start,
+ entry->End, entry->Type));
+ AddMemoryRange(MemInfoCallback, entry->Start, entry->End, entry->Type);
+ entry++;
+ }
+ return RETURN_SUCCESS;
+}
+
+/**
+ Acquire acpi table and smbios table from linuxboot
+
+ @param SystemTableInfo Pointer to the system table info
+
+ @retval RETURN_SUCCESS Successfully find out the tables.
+ @retval RETURN_NOT_FOUND Failed to find the tables.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseSystemTable (
+ OUT SYSTEM_TABLE_INFO* SystemTableInfo
+ ) {
+ UefiPayloadConfig *Config;
+
+ Config = GetUefiPayLoadConfig();
+ SystemTableInfo->AcpiTableBase = Config->AcpiBase;
+ SystemTableInfo->AcpiTableSize = Config->AcpiSize;
+
+ SystemTableInfo->SmbiosTableBase = Config->SmbiosBase;
+ SystemTableInfo->SmbiosTableSize = Config->SmbiosSize;
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Find the serial port information
+
+ @param SERIAL_PORT_INFO Pointer to serial port info structure
+
+ @retval RETURN_SUCCESS Successfully find the serial port information.
+ @retval RETURN_NOT_FOUND Failed to find the serial port information .
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseSerialInfo (
+ OUT SERIAL_PORT_INFO* SerialPortInfo
+ ) {
+ UefiPayloadConfig *Config;
+ Config = GetUefiPayLoadConfig();
+
+ SerialPortInfo->BaseAddr = Config->SerialConfig.BaseAddr;
+ SerialPortInfo->RegWidth = Config->SerialConfig.RegWidth;
+ SerialPortInfo->Type = Config->SerialConfig.Type;
+ SerialPortInfo->Baud = Config->SerialConfig.Baud;
+ SerialPortInfo->InputHertz = Config->SerialConfig.InputHertz;
+ SerialPortInfo->UartPciAddr = Config->SerialConfig.UartPciAddr;
+
+ return RETURN_SUCCESS;
+}
+
+/**
+ Find the video frame buffer information
+
+ @param GfxInfo Pointer to the EFI_PEI_GRAPHICS_INFO_HOB structure
+
+ @retval RETURN_SUCCESS Successfully find the video frame buffer
+information.
+ @retval RETURN_NOT_FOUND Failed to find the video frame buffer information .
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseGfxInfo (
+ OUT EFI_PEI_GRAPHICS_INFO_HOB* GfxInfo
+ ) {
+ // Not supported
+ return RETURN_NOT_FOUND;
+}
+
+/**
+ Find the video frame buffer device information
+
+ @param GfxDeviceInfo Pointer to the EFI_PEI_GRAPHICS_DEVICE_INFO_HOB
+structure
+
+ @retval RETURN_SUCCESS Successfully find the video frame buffer
+information.
+ @retval RETURN_NOT_FOUND Failed to find the video frame buffer information.
+
+**/
+RETURN_STATUS
+EFIAPI
+ParseGfxDeviceInfo (
+ OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB* GfxDeviceInfo
+ ) {
+ return RETURN_NOT_FOUND;
+}
diff --git
a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
index b0268f05069c..a4f714f765ea 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
@@ -40,8 +40,9 @@ AdjustRootBridgeResource (
IN PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G
)
{
+#ifndef LINUXBOOT_PAYLOAD
UINT64 Mask;
-
+#endif
//
// For now try to downgrade everything into MEM32 since
// - coreboot does not assign resource above 4GB @@ -80,7 +81,7 @@
AdjustRootBridgeResource (
PMemAbove4G->Base = MAX_UINT64;
PMemAbove4G->Limit = 0;
}
-
+#ifndef LINUXBOOT_PAYLOAD
//
// Align IO resource at 4K boundary
//
@@ -98,6 +99,7 @@ AdjustRootBridgeResource (
if (Mem->Base != MAX_UINT64) {
Mem->Base &= ~Mask;
}
+#endif
}

/**
--
2.33.0.rc2.250.ged5fa647cd-goog


[`edk2-devel][PATCH] UefiPayloadPkg: Add Linux bootloader support

Guo Dong
 

From: Cheng-Chieh Huang <chengchieh@...>

V4: Update commit message and coding style.

Used Linux kernel as a bootloader to boot linux.
To boot windows, UEFI service is required for the bootloader.
So update UEFI payload to support Linux bootloader in order to
boot UEFI OS.
Linux bootloader will provide platfrom information at
(PcdPayloadFdMemBase - SIZE_64KB), the LbParseLib will parse it
and get required informaiton.

Update PciHostBridgeLib to avoid run out of IO resources issue
for a server platform.

Signed-off-by: Cheng-Chieh Huang <chengchieh@...>
Reviewed-by: Guo Dong <guo.dong@...>
Cc: Cheng-Chieh Huang <chengchieh@...>
Cc: Daniel Schaefer <daniel.schaefer@...>
Cc: Trammell Hudson <hudson@...>
Cc: Maurice Ma <maurice.ma@...>
Cc: Guo Dong <guo.dong@...>
Cc: Benjamin You <benjamin.you@...>
Cc: Ray Ni <ray.ni@...>
---
UefiPayloadPkg/Library/LbParseLib/LbParseLib.c | 194 +++++=
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
+++++++++++++++++++++++++++++++++++++++
UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf | 39 +++++=
++++++++++++++++++++++++++++++++++
UefiPayloadPkg/Library/LbParseLib/Linuxboot.h | 47 +++++=
++++++++++++++++++++++++++++++++++++++++++
UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c | 6 ++++--
UefiPayloadPkg/UefiPayloadPkg.dsc | 6 ++++++
5 files changed, 290 insertions(+), 2 deletions(-)

diff --git a/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c b/UefiPayloadPk=
g/Library/LbParseLib/LbParseLib.c
new file mode 100644
index 0000000000..d7d61e14ae
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.c
@@ -0,0 +1,194 @@
+/** @file=0D
+ This library will parse the linuxboot table in memory and extract those =
required=0D
+ information.=0D
+=0D
+ Copyright (c) 2021, the u-root Authors. All rights reserved.<BR>=0D
+ SPDX-License-Identifier: BSD-2-Clause-Patent=0D
+=0D
+**/=0D
+=0D
+=0D
+#include <IndustryStandard/Acpi.h>=0D
+#include <IndustryStandard/SmBios.h>=0D
+#include <Library/BaseLib.h>=0D
+#include <Library/BaseMemoryLib.h>=0D
+#include <Library/BlParseLib.h>=0D
+#include <Library/DebugLib.h>=0D
+#include <Library/IoLib.h>=0D
+#include <Library/PcdLib.h>=0D
+#include <Linuxboot.h>=0D
+#include <Uefi/UefiBaseType.h>=0D
+=0D
+// Retrieve UefiPayloadConfig from Linuxboot's uefiboot=0D
+UefiPayloadConfig*=0D
+GetUefiPayLoadConfig(=0D
+ VOID=0D
+ )=0D
+{=0D
+ UefiPayloadConfig *Config;=0D
+=0D
+ Config =3D (UefiPayloadConfig*)(UINTN)(PcdGet32(PcdPayloadFdMemBase) - S=
IZE_64KB);=0D
+ if (Config->Version !=3D UEFI_PAYLOAD_CONFIG_VERSION) {=0D
+ DEBUG((DEBUG_ERROR, "Expect payload Config version: %d, but get %d\n",=
=0D
+ UEFI_PAYLOAD_CONFIG_VERSION, Config->Version));=0D
+ CpuDeadLoop ();=0D
+ }=0D
+ return Config;=0D
+}=0D
+=0D
+// Align the address and add memory rang to MemInfoCallback=0D
+VOID=0D
+AddMemoryRange (=0D
+ IN BL_MEM_INFO_CALLBACK MemInfoCallback,=0D
+ IN UINT64 Start,=0D
+ IN UINT64 End,=0D
+ IN UINT32 Type=0D
+ )=0D
+{=0D
+ MEMROY_MAP_ENTRY MemoryMap;=0D
+ UINT64 AlignedStart;=0D
+ UINT64 AlignedEnd;=0D
+=0D
+ AlignedStart =3D ALIGN_VALUE(Start, SIZE_4KB);=0D
+ AlignedEnd =3D ALIGN_VALUE(End, SIZE_4KB);=0D
+ // Conservative adjustment on Memory map. This should happen when bootin=
g from=0D
+ // non UEFI bios and it may report a memory region less than 4KB.=0D
+ if (AlignedStart > Start && Type !=3D LINUXBOOT_MEM_RAM) {=0D
+ AlignedStart -=3D SIZE_4KB;=0D
+ }=0D
+ if (AlignedEnd > End + 1 && Type =3D=3D LINUXBOOT_MEM_RAM) {=0D
+ AlignedEnd -=3D SIZE_4KB;=0D
+ }=0D
+ MemoryMap.Base =3D AlignedStart;=0D
+ MemoryMap.Size =3D AlignedEnd - AlignedStart;=0D
+ MemoryMap.Type =3D (UINT8)Type;=0D
+ MemoryMap.Flag =3D 0;=0D
+ MemInfoCallback(&MemoryMap, NULL);=0D
+}=0D
+=0D
+/**=0D
+ Acquire the memory information from the linuxboot table in memory.=0D
+=0D
+ @param MemInfoCallback The callback routine=0D
+ @param Params Pointer to the callback routine parameter=0D
+=0D
+ @retval RETURN_SUCCESS Successfully find out the memory information.=
=0D
+ @retval RETURN_NOT_FOUND Failed to find the memory information.=0D
+=0D
+**/=0D
+RETURN_STATUS=0D
+EFIAPI=0D
+ParseMemoryInfo (=0D
+ IN BL_MEM_INFO_CALLBACK MemInfoCallback,=0D
+ IN VOID* Params=0D
+ )=0D
+{=0D
+ UefiPayloadConfig *Config;=0D
+ MemoryMapEntry *Entry;=0D
+ UINT32 Index;=0D
+=0D
+ Config =3D GetUefiPayLoadConfig();=0D
+=0D
+ DEBUG((DEBUG_INFO, "MemoryMap #entries: %d\n", Config->NumMemoryMapEntri=
es));=0D
+=0D
+ Entry =3D &Config->MemoryMapEntries[0];=0D
+ for (Index =3D 0; Index < Config->NumMemoryMapEntries; Index++) {=0D
+ DEBUG((DEBUG_INFO, "Start: 0x%lx End: 0x%lx Type:%d\n", Entry->Start,=
=0D
+ Entry->End, Entry->Type));=0D
+ AddMemoryRange(MemInfoCallback, Entry->Start, Entry->End, Entry->Type)=
;=0D
+ Entry++;=0D
+ }=0D
+ return RETURN_SUCCESS;=0D
+}=0D
+=0D
+/**=0D
+ Acquire acpi table and smbios table from linuxboot=0D
+=0D
+ @param SystemTableInfo Pointer to the system table info=0D
+=0D
+ @retval RETURN_SUCCESS Successfully find out the tables.=0D
+ @retval RETURN_NOT_FOUND Failed to find the tables.=0D
+=0D
+**/=0D
+RETURN_STATUS=0D
+EFIAPI=0D
+ParseSystemTable (=0D
+ OUT SYSTEM_TABLE_INFO* SystemTableInfo=0D
+ )=0D
+{=0D
+ UefiPayloadConfig *Config;=0D
+=0D
+ Config =3D GetUefiPayLoadConfig();=0D
+ SystemTableInfo->AcpiTableBase =3D Config->AcpiBase;=0D
+ SystemTableInfo->AcpiTableSize =3D (UINT32)(UINTN)Config->AcpiSize;=0D
+ SystemTableInfo->SmbiosTableBase =3D Config->SmbiosBase;=0D
+ SystemTableInfo->SmbiosTableSize =3D (UINT32)(UINTN)Config->SmbiosSize;=
=0D
+=0D
+ return RETURN_SUCCESS;=0D
+}=0D
+=0D
+/**=0D
+ Find the serial port information=0D
+=0D
+ @param SERIAL_PORT_INFO Pointer to serial port info structure=0D
+=0D
+ @retval RETURN_SUCCESS Successfully find the serial port information=
.=0D
+ @retval RETURN_NOT_FOUND Failed to find the serial port information .=
=0D
+=0D
+**/=0D
+RETURN_STATUS=0D
+EFIAPI=0D
+ParseSerialInfo (=0D
+ OUT SERIAL_PORT_INFO* SerialPortInfo=0D
+ )=0D
+{=0D
+ UefiPayloadConfig *Config;=0D
+=0D
+ Config =3D GetUefiPayLoadConfig();=0D
+ SerialPortInfo->BaseAddr =3D Config->SerialConfig.BaseAddr;=0D
+ SerialPortInfo->RegWidth =3D Config->SerialConfig.RegWidth;=0D
+ SerialPortInfo->Type =3D Config->SerialConfig.Type;=0D
+ SerialPortInfo->Baud =3D Config->SerialConfig.Baud;=0D
+ SerialPortInfo->InputHertz =3D Config->SerialConfig.InputHertz;=0D
+ SerialPortInfo->UartPciAddr =3D Config->SerialConfig.UartPciAddr;=0D
+=0D
+ return RETURN_SUCCESS;=0D
+}=0D
+=0D
+/**=0D
+ Find the video frame buffer information=0D
+=0D
+ @param GfxInfo Pointer to the EFI_PEI_GRAPHICS_INFO_HOB stru=
cture=0D
+=0D
+ @retval RETURN_SUCCESS Successfully find the video frame buffer info=
rmation.=0D
+ @retval RETURN_NOT_FOUND Failed to find the video frame buffer informa=
tion .=0D
+=0D
+**/=0D
+RETURN_STATUS=0D
+EFIAPI=0D
+ParseGfxInfo (=0D
+ OUT EFI_PEI_GRAPHICS_INFO_HOB* GfxInfo=0D
+ )=0D
+{=0D
+ // Not supported=0D
+ return RETURN_NOT_FOUND;=0D
+}=0D
+=0D
+=0D
+/**=0D
+ Find the video frame buffer device information=0D
+=0D
+ @param GfxDeviceInfo Pointer to the EFI_PEI_GRAPHICS_DEVICE_INFO_H=
OB structure=0D
+=0D
+ @retval RETURN_SUCCESS Successfully find the video frame buffer info=
rmation.=0D
+ @retval RETURN_NOT_FOUND Failed to find the video frame buffer informa=
tion .=0D
+=0D
+**/=0D
+RETURN_STATUS=0D
+EFIAPI=0D
+ParseGfxDeviceInfo (=0D
+ OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB* GfxDeviceInfo=0D
+ )=0D
+{=0D
+ return RETURN_NOT_FOUND;=0D
+}=0D
diff --git a/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf b/UefiPayload=
Pkg/Library/LbParseLib/LbParseLib.inf
new file mode 100644
index 0000000000..d75ba8db8c
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
@@ -0,0 +1,39 @@
+## @file=0D
+# Linuxboot Table Parse Library.=0D
+#=0D
+# Copyright (c) 2021, the u-root Authors. All rights reserved.<BR>=0D
+# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
+#=0D
+##=0D
+=0D
+[Defines]=0D
+ INF_VERSION =3D 0x00010005=0D
+ BASE_NAME =3D LbParseLib=0D
+ FILE_GUID =3D DBA15E1E-4C16-47DF-93C0-AB5888ED14C3=
=0D
+ MODULE_TYPE =3D BASE=0D
+ VERSION_STRING =3D 1.0=0D
+ LIBRARY_CLASS =3D BlParseLib=0D
+=0D
+#=0D
+# The following information is for reference only and not required by the =
build tools.=0D
+#=0D
+# VALID_ARCHITECTURES =3D IA32 X64=0D
+#=0D
+=0D
+[Sources]=0D
+ LbParseLib.c=0D
+=0D
+[Packages]=0D
+ MdePkg/MdePkg.dec=0D
+ MdeModulePkg/MdeModulePkg.dec=0D
+ UefiPayloadPkg/UefiPayloadPkg.dec=0D
+=0D
+[LibraryClasses]=0D
+ BaseLib=0D
+ BaseMemoryLib=0D
+ IoLib=0D
+ DebugLib=0D
+ PcdLib=0D
+=0D
+[Pcd]=0D
+ gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemBase=0D
diff --git a/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h b/UefiPayloadPkg=
/Library/LbParseLib/Linuxboot.h
new file mode 100644
index 0000000000..b3b7e70a7c
--- /dev/null
+++ b/UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
@@ -0,0 +1,47 @@
+/** @file=0D
+ LinuxBoot PEI module include file.=0D
+**/=0D
+#ifndef __LINUXBOOT_PEI_H_INCLUDED__=0D
+#define __LINUXBOOT_PEI_H_INCLUDED__=0D
+=0D
+#if defined(_MSC_VER)=0D
+#pragma warning(disable : 4200)=0D
+#endif=0D
+=0D
+#pragma pack(1)=0D
+typedef struct SerialPortConfigStruct {=0D
+ UINT32 Type;=0D
+ UINT32 BaseAddr;=0D
+ UINT32 Baud;=0D
+ UINT32 RegWidth;=0D
+ UINT32 InputHertz;=0D
+ UINT32 UartPciAddr;=0D
+} SerialPortConfig;=0D
+=0D
+typedef struct MemoryMapEntryStruct {=0D
+ UINT64 Start;=0D
+ UINT64 End;=0D
+ UINT32 Type;=0D
+} MemoryMapEntry;=0D
+=0D
+typedef struct UefiPayloadConfigStruct {=0D
+ UINT64 Version;=0D
+ UINT64 AcpiBase;=0D
+ UINT64 AcpiSize;=0D
+ UINT64 SmbiosBase;=0D
+ UINT64 SmbiosSize;=0D
+ SerialPortConfig SerialConfig;=0D
+ UINT32 NumMemoryMapEntries;=0D
+ MemoryMapEntry MemoryMapEntries[0];=0D
+} UefiPayloadConfig;=0D
+#pragma pack()=0D
+=0D
+#define UEFI_PAYLOAD_CONFIG_VERSION 1=0D
+=0D
+#define LINUXBOOT_MEM_RAM 1=0D
+#define LINUXBOOT_MEM_DEFAULT 2=0D
+#define LINUXBOOT_MEM_ACPI 3=0D
+#define LINUXBOOT_MEM_NVS 4=0D
+#define LINUXBOOT_MEM_RESERVED 5=0D
+=0D
+#endif // __LINUXBOOT_PEI_H_INCLUDED__=0D
diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c=
b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
index b0268f0506..a4f714f765 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c
@@ -40,8 +40,9 @@ AdjustRootBridgeResource (
IN PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G=0D
)=0D
{=0D
+#ifndef LINUXBOOT_PAYLOAD=0D
UINT64 Mask;=0D
-=0D
+#endif=0D
//=0D
// For now try to downgrade everything into MEM32 since=0D
// - coreboot does not assign resource above 4GB=0D
@@ -80,7 +81,7 @@ AdjustRootBridgeResource (
PMemAbove4G->Base =3D MAX_UINT64;=0D
PMemAbove4G->Limit =3D 0;=0D
}=0D
-=0D
+#ifndef LINUXBOOT_PAYLOAD=0D
//=0D
// Align IO resource at 4K boundary=0D
//=0D
@@ -98,6 +99,7 @@ AdjustRootBridgeResource (
if (Mem->Base !=3D MAX_UINT64) {=0D
Mem->Base &=3D ~Mask;=0D
}=0D
+#endif=0D
}=0D
=0D
/**=0D
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload=
Pkg.dsc
index fb805dc772..c4ae45b94f 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -35,6 +35,7 @@
#=0D
# SBL: UEFI payload for Slim Bootloader=0D
# COREBOOT: UEFI payload for coreboot=0D
+ # LINUXBOOT: UEFI payload for linuxboot=0D
#=0D
DEFINE BOOTLOADER =3D SBL=0D
=0D
@@ -105,6 +106,9 @@
=0D
[BuildOptions]=0D
*_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES=
=0D
+!if $(BOOTLOADER) =3D=3D "LINUXBOOT"=0D
+ *_*_*_CC_FLAGS =3D -D LINUXBOOT_PAYLOAD=0D
+!endif=0D
GCC:*_UNIXGCC_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D
GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D
INTEL:RELEASE_*_*_CC_FLAGS =3D /D MDEPKG_NDEBUG=0D
@@ -241,6 +245,8 @@
!if $(UNIVERSAL_PAYLOAD) =3D=3D FALSE=0D
!if $(BOOTLOADER) =3D=3D "COREBOOT"=0D
BlParseLib|UefiPayloadPkg/Library/CbParseLib/CbParseLib.inf=0D
+ !elseif $(BOOTLOADER) =3D=3D "LINUXBOOT"=0D
+ BlParseLib|UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf=0D
!else=0D
BlParseLib|UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf=0D
!endif=0D
--=20
2.32.0.windows.2


Re: [PATCH v3 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

Guo Dong
 

Hi ChengChieh,

Here is the update to this patch series:

1. UefiPayloadPkg: Add LINUXBOOT payload target
a) Ray asked to update commit message
b) There are still some coding style issues
I know it is a little difficult to fully follow EDKII coding style. I will help update this patch and send it out for review.
It would be great if you could have a test to double check with the new patch.

2. UefiPayloadPkg: Use legacy timer in Linuxboot payload
I had approved this patch. We could merged this one after the first patch got merged.

3. UefiPayloadPkg: Update maximum logic processor to 256
It was merged.

4. UefiPayloadPkg: Reserve Payload config in runtime services data
This patch should be not required when patch https://github.com/tianocore/edk2/pull/2028 (under code review) is merged.

Thanks,
Guo

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Cheng-Chieh Huang via groups.io
Sent: Sunday, August 22, 2021 11:33 PM
To: devel@edk2.groups.io
Cc: Cheng-Chieh Huang <chengchieh@...>
Subject: [edk2-devel] [PATCH v3 0/4] UefiPayloadPkg: LinuxBoot Support in UefiPayload

These are necessary patches to Support LinuxBoot in UefiPayload.
With these paches, we can boot to ESXi and Windows from a linux in QEMU.

Third parse: address formating comments.

LinuxBoot README:
https://github.com/linuxboot/edk2/blob/uefipayload/UefiPayloadPkg/README.md

v3 PR to tianocore:
https://github.com/tianocore/edk2/pull/1873

Cheng-Chieh Huang (4):
UefiPayloadPkg: Add LINUXBOOT payload target
UefiPayloadPkg: Use legacy timer in Linuxboot payload
UefiPayloadPkg: Update maximum logic processor to 256
UefiPayloadPkg: Reserve Payload config in runtime services data

UefiPayloadPkg/UefiPayloadPkg.dsc | 24 ++-
UefiPayloadPkg/UefiPayloadPkg.fdf | 5 +
.../Library/LbParseLib/LbParseLib.inf | 39 ++++
UefiPayloadPkg/Library/LbParseLib/Linuxboot.h | 47 +++++
.../Library/LbParseLib/LbParseLib.c | 187 ++++++++++++++++++
.../PciHostBridgeLib/PciHostBridgeSupport.c | 6 +-
.../UefiPayloadEntry/UefiPayloadEntry.c | 4 +
7 files changed, 304 insertions(+), 8 deletions(-) create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.inf
create mode 100644 UefiPayloadPkg/Library/LbParseLib/Linuxboot.h
create mode 100644 UefiPayloadPkg/Library/LbParseLib/LbParseLib.c

--
2.33.0.rc2.250.ged5fa647cd-goog


Re: [PATCH v1 06/10] DynamicTablesPkg: Add Configuration Manager Object parser

Joey Gouly
 

Hi again,

Replies inline,


Hi Joey,
Thanks for the review, I answered inline:


On 9/24/21 9:56 AM, Joey Gouly wrote:
Hi,

This looks good to me!

[...]

+
+/** A parser for EArmObjFixedFeatureFlags.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {
+ {"Flags", 4, "0x%x", NULL}
+};
+
+/** A parser for EArmObjItsGroup.
+*/
+STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {
+ {"GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL},
This should just be Token, not GTBlockTimerFrameToken.

The name of the field is 'GTBlockTimerFrameToken', cf
https://github.com/tianocore/edk2/blob/master/DynamicTablesPkg/Include/ArmNameSpaceObjects.h#L394
I am not sure I understand why this should 'Token' instead.
You linked to the `CmArmGTBlockInfo` struct, but I was talking about `CmArmItsGroupNode`:
https://github.com/tianocore/edk2/blob/master/DynamicTablesPkg/Include/ArmNameSpaceObjects.h#L464



+ {"ItsIdCount", 4, "0x%x", NULL},
+ {"ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL}
+};
+
[...]

diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h
new file mode 100644
index 000000000000..e229df7095d9
--- /dev/null
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.h
[...]

+/**
+ The CM_OBJ_PARSER structure describes the fields of an CmObject and
+ provides means for the parser to interpret and trace appropriately.
+
+ ParseAcpi() uses the format string specified by 'Format' for tracing
+ the field data.
+*/
+typedef struct CmObjParser CM_OBJ_PARSER;
+struct CmObjParser {
+
+ /// String describing the Cm Object
+ CONST CHAR8* NameStr;
+
+ /// The length of the field.
+ UINT32 Length;
+
+ /// Optional Print() style format string for tracing the data. If not
+ /// used this must be set to NULL.
+ CONST CHAR8* Format;
+
+ /// Optional pointer to a print formatter function which
+ /// is typically used to trace complex field information.
+ /// If not used this must be set to NULL.
+ /// The Format string is passed to the PrintFormatter function
+ /// but may be ignored by the implementation code.
+ FNPTR_PRINT_FORMATTER PrintFormatter;
+
+ /// Optional pointer to print the fields of another CM_OBJ_PARSER
+ /// structure. This is useful to print sub-structures.
+ CONST CM_OBJ_PARSER *SubObjParser;
+
+ /// Count of items in the SubObj.
+ UINTN SubObjItemCount;
The SubObjParser doesn't actually seem to be used by any of the objects? (Unless I misread when reading the list of them..)

The SubObjParser field is effectively not currently used. It will be
used in a later patch,
cf the 'UsageCounterRegister' field of
https://edk2.groups.io/g/devel/message/76954
Ok, makes sense!

Thanks,
Joey
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

Dong, Eric
 

Hi,

Can you help to explain more why PeiAllocatePages does not have the problem while PeiAllocatePool has?

Thanks,
Eric

-----Original Message-----
From: Lou, Yun <yun.lou@...>
Sent: Wednesday, September 29, 2021 7:53 PM
To: devel@edk2.groups.io
Cc: Lou, Yun <yun.lou@...>; Ni, Ray <ray.ni@...>; Dong, Eric <eric.dong@...>; Laszlo Ersek <lersek@...>; Kumar, Rahul1 <rahul1.kumar@...>
Subject: [PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

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

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

Signed-off-by: Jason Lou <yun.lou@...>
Cc: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Rahul Kumar <rahul1.kumar@...>
---
UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 6e2ab79518..e9eba64914 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -153,7 +153,7 @@ CpuInitDataInitialize (
CpuFeaturesData->AcpiCpuData= AcpiCpuData;



CpuStatus = &AcpiCpuData->CpuFeatureInitData.CpuStatus;

- Location = AllocateZeroPool (sizeof (EFI_CPU_PHYSICAL_LOCATION) * NumberOfCpus);

+ Location = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (EFI_CPU_PHYSICAL_LOCATION) * NumberOfCpus));

ASSERT (Location != NULL);

AcpiCpuData->CpuFeatureInitData.ApLocation = (EFI_PHYSICAL_ADDRESS)(UINTN)Location;



@@ -205,11 +205,11 @@ CpuInitDataInitialize (
//

// Collect valid core count in each package because not all cores are valid.

//

- ThreadCountPerPackage = AllocateZeroPool (sizeof (UINT32) * CpuStatus->PackageCount);

+ ThreadCountPerPackage = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT32) * CpuStatus->PackageCount));

ASSERT (ThreadCountPerPackage != NULL);

CpuStatus->ThreadCountPerPackage = (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCountPerPackage;



- ThreadCountPerCore = AllocateZeroPool (sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount);

+ ThreadCountPerCore = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount));

ASSERT (ThreadCountPerCore != NULL);

CpuStatus->ThreadCountPerCore = (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCountPerCore;



--
2.28.0.windows.1


Re: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

Ni, Ray
 

Is this a patch to enable CI in edk2-platforms?

Package maintainers can directly check in changes to edk2-platforms. Then how the CI is triggered?

Will the CI run because of a edk2 pull request?

Thanks,
Ray

-----Original Message-----
From: Tan, Dun <dun.tan@...>
Sent: Wednesday, September 29, 2021 2:38 PM
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew <Bret.Barkelew@...>; Kinney, Michael D
<michael.d.kinney@...>; Liming Gao <gaoliming@...>; Ni, Ray <ray.ni@...>
Subject: [PATCH] .azurepipelines: Enable CI for WhiskeylakeOpenBoard in Edk2platforms

The edk2-platforms.yml contains the necessary github repo that will be
checked out, the platform name to build and the folders in edk2 which
will trigger the CI. The edk2platforms-run-steps.yml contains the main
steps to build WhiskeylakeOpenBoard.

Cc: Sean Brogan <sean.brogan@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Ray Ni <ray.ni@...>

Signed-off-by: Dun Tan <dun.tan@...>
---
.azurepipelines/edk2-platforms.yml | 71
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.azurepipelines/edk2platforms-run-steps.yml | 72
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+)

diff --git a/.azurepipelines/edk2-platforms.yml b/.azurepipelines/edk2-platforms.yml
new file mode 100644
index 0000000000..5d47e213ad
--- /dev/null
+++ b/.azurepipelines/edk2-platforms.yml
@@ -0,0 +1,71 @@
+## @file
+# Azure Pipeline build file for WhiskeylakeOpenBoard in Edk2platforms on windows and ubuntu
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+trigger:
+ - master
+ - stable/*
+pr:
+ branches:
+ include:
+ - master
+ - stable/*
+ paths:
+ include:
+ - BaseTools
+ - CryptoPkg
+ - FatPkg
+ - IntelFsp2WrapperPkg
+ - MdeModulePkg
+ - MdePkg
+ - NetworkPkg
+ - PcAtChipsetPkg
+ - SecurityPkg
+ - ShellPkg
+ - UefiCpuPkg
+
+resources:
+ repositories:
+ - repository: edk2-platforms
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-platforms
+ - repository: edk2-non-osi
+ type: github
+ endpoint: tianocore
+ name: tianocore/edk2-non-osi
+ - repository: FSP
+ type: github
+ endpoint: tianocore
+ name: intel/FSP
+
+jobs:
+ - job: Edk2Platforms_CI_Windows
+ pool:
+ vmImage: 'windows-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ WhiskeylakeOpenBoard_UpXtreme:
+ Board.Name: "UpXtreme"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'windows-latest'
+
+ - job: Edk2Platforms_CI_Linux
+ pool:
+ vmImage: 'ubuntu-latest'
+ strategy:
+ matrix:
+ WhiskeylakeOpenBoard_WhiskeylakeURvp:
+ Board.Name: "WhiskeylakeURvp"
+ steps:
+ - template: edk2platforms-run-steps.yml
+ parameters:
+ board_name: $(Board.Name)
+ pool_name: 'ubuntu-latest'
diff --git a/.azurepipelines/edk2platforms-run-steps.yml b/.azurepipelines/edk2platforms-run-steps.yml
new file mode 100644
index 0000000000..04b5d40fd8
--- /dev/null
+++ b/.azurepipelines/edk2platforms-run-steps.yml
@@ -0,0 +1,72 @@
+## @file
+# File templates/edk2platforms-run-steps.yml
+#
+# template file containing the steps to build
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+parameters:
+- name: board_name
+ type: string
+ default: ''
+- name: pool_name
+ type: string
+ default: ''
+
+steps:
+- checkout: self
+ submodules: true
+- checkout: edk2-non-osi
+- checkout: FSP
+- checkout: edk2-platforms
+
+- task: UsePythonVersion@0
+ inputs:
+ versionSpec: "3.8.x"
+ architecture: "x64"
+
+- ${{ if contains(parameters.pool_name, 'ubuntu') }}:
+ - bash: |
+ sudo apt-get update
+ sudo apt-get install gcc g++ make uuid-dev nasm iasl
+ displayName: Update apt and Install required tools
+ - script: |
+ source edksetup.sh
+ echo "##vso[task.setvariable variable=PATH;]$PATH"
+ displayName: Set env Path
+ workingDirectory: edk2/
+
+- ${{ if contains(parameters.pool_name, 'windows') }}:
+ - powershell: |
+ choco install iasl -y --version=2017.11.10
+ echo "##vso[task.setvariable variable=IASL_PREFIX;]C:\tools\ASL\"
+ choco install nasm -y
+ echo "##vso[task.setvariable variable=NASM_PREFIX;]C:\Program Files\NASM\"
+ displayName: Windows EDK II Prerequisites
+
+# Build WhiskeylakeOpenBoard in edk2platforms
+- script: python build_bios.py --platform ${{ parameters.board_name}}
+ displayName: Build platform ${{ parameters.board_name}}
+ workingDirectory: edk2-platforms/Platform/Intel
+
+# Copy the build logs to the artifact staging directory
+- task: CopyFiles@2
+ displayName: "Copy build logs"
+ inputs:
+ targetFolder: "$(Build.ArtifactStagingDirectory)"
+ SourceFolder:
+ contents: |
+ Build.log
+ BuildReport.log
+ flattenFolders: true
+ condition: succeededOrFailed()
+
+# Publish build artifacts to Azure Artifacts/TFS or a file share
+- task: PublishBuildArtifacts@1
+ continueOnError: true
+ displayName: "Publish build logs"
+ inputs:
+ pathtoPublish: "$(Build.ArtifactStagingDirectory)"
+ artifactName: "Build Logs $(System.JobName)"
+ condition: succeededOrFailed()
--
2.31.1.windows.1


Re: [`edk2-devel][PATCH V2] UefiPayloadPkg: Build a HOB from bootloader ACPI table

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Dong, Guo <guo.dong@...>
Sent: Wednesday, September 29, 2021 1:19 AM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@...>; Ni, Ray <ray.ni@...>; Ma, Maurice <maurice.ma@...>; You, Benjamin
<benjamin.you@...>
Subject: [`edk2-devel][PATCH V2] UefiPayloadPkg: Build a HOB from bootloader ACPI table

From: Guo Dong <guo.dong@...>

V2: Update BuildHobFromAcpi() to return a HOB pointer.

For universal UEFI payload, build a HOB from the ACPI table, so that
other modules could use this info from HOB at very early DXE phase.
This code are shared by universal payload and non universal payload.

Cc: Ray Ni <ray.ni@...>
Cc: Maurice Ma <maurice.ma@...>
Cc: Benjamin You <benjamin.you@...>
Signed-off-by: Guo Dong <guo.dong@...>
---
UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c | 202
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 176 ++++-----------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 13 +++++++++++++
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 1 +
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c | 12 ++++++++++++
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 2 +-
6 files changed, 233 insertions(+), 173 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
new file mode 100644
index 0000000000..e5f2a2b124
--- /dev/null
+++ b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
@@ -0,0 +1,202 @@
+/** @file

+

+

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

+

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

+

+**/

+

+#include "UefiPayloadEntry.h"

+

+

+/**

+ Find the board related info from ACPI table

+

+ @param AcpiTableBase ACPI table start address in memory

+ @param AcpiBoardInfo Pointer to the acpi board info strucutre

+

+ @retval RETURN_SUCCESS Successfully find out all the required information.

+ @retval RETURN_NOT_FOUND Failed to find the required info.

+

+**/

+RETURN_STATUS

+ParseAcpiInfo (

+ IN UINT64 AcpiTableBase,

+ OUT ACPI_BOARD_INFO *AcpiBoardInfo

+ )

+{

+ EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;

+ EFI_ACPI_DESCRIPTION_HEADER *Rsdt;

+ UINT32 *Entry32;

+ UINTN Entry32Num;

+ EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;

+ EFI_ACPI_DESCRIPTION_HEADER *Xsdt;

+ UINT64 *Entry64;

+ UINTN Entry64Num;

+ UINTN Idx;

+ UINT32 *Signature;

+ EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr;

+ EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE
*MmCfgBase;

+

+ Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTableBase;

+ DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));

+ DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));

+

+ //

+ // Search Rsdt First

+ //

+ Fadt = NULL;

+ MmCfgHdr = NULL;

+ Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);

+ if (Rsdt != NULL) {

+ Entry32 = (UINT32 *)(Rsdt + 1);

+ Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;

+ for (Idx = 0; Idx < Entry32Num; Idx++) {

+ Signature = (UINT32 *)(UINTN)Entry32[Idx];

+ if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

+ Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

+ DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));

+ }

+

+ if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

+ MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

+ DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));

+ }

+

+ if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

+ goto Done;

+ }

+ }

+ }

+

+ //

+ // Search Xsdt Second

+ //

+ Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);

+ if (Xsdt != NULL) {

+ Entry64 = (UINT64 *)(Xsdt + 1);

+ Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;

+ for (Idx = 0; Idx < Entry64Num; Idx++) {

+ Signature = (UINT32 *)(UINTN)Entry64[Idx];

+ if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

+ Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

+ DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));

+ }

+

+ if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

+ MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

+ DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));

+ }

+

+ if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

+ goto Done;

+ }

+ }

+ }

+

+ if (Fadt == NULL) {

+ return RETURN_NOT_FOUND;

+ }

+

+Done:

+

+ AcpiBoardInfo->PmCtrlRegBase = Fadt->Pm1aCntBlk;

+ AcpiBoardInfo->PmTimerRegBase = Fadt->PmTmrBlk;

+ AcpiBoardInfo->ResetRegAddress = Fadt->ResetReg.Address;

+ AcpiBoardInfo->ResetValue = Fadt->ResetValue;

+ AcpiBoardInfo->PmEvtBase = Fadt->Pm1aEvtBlk;

+ AcpiBoardInfo->PmGpeEnBase = Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;

+

+ if (MmCfgHdr != NULL) {

+ MmCfgBase =
(EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*)
MmCfgHdr + sizeof (*MmCfgHdr));

+ AcpiBoardInfo->PcieBaseAddress = MmCfgBase->BaseAddress;

+ AcpiBoardInfo->PcieBaseSize = (MmCfgBase->EndBusNumber + 1 - MmCfgBase->StartBusNumber) * 4096 * 32 * 8;

+ } else {

+ AcpiBoardInfo->PcieBaseAddress = 0;

+ AcpiBoardInfo->PcieBaseSize = 0;

+ }

+ DEBUG ((DEBUG_INFO, "PmCtrl Reg 0x%lx\n", AcpiBoardInfo->PmCtrlRegBase));

+ DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n", AcpiBoardInfo->PmTimerRegBase));

+ DEBUG ((DEBUG_INFO, "Reset Reg 0x%lx\n", AcpiBoardInfo->ResetRegAddress));

+ DEBUG ((DEBUG_INFO, "Reset Value 0x%x\n", AcpiBoardInfo->ResetValue));

+ DEBUG ((DEBUG_INFO, "PmEvt Reg 0x%lx\n", AcpiBoardInfo->PmEvtBase));

+ DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n", AcpiBoardInfo->PmGpeEnBase));

+ DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddress));

+ DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize));

+

+ //

+ // Verify values for proper operation

+ //

+ ASSERT(Fadt->Pm1aCntBlk != 0);

+ ASSERT(Fadt->PmTmrBlk != 0);

+ ASSERT(Fadt->ResetReg.Address != 0);

+ ASSERT(Fadt->Pm1aEvtBlk != 0);

+ ASSERT(Fadt->Gpe0Blk != 0);

+

+ DEBUG_CODE_BEGIN ();

+ BOOLEAN SciEnabled;

+

+ //

+ // Check the consistency of SCI enabling

+ //

+

+ //

+ // Get SCI_EN value

+ //

+ if (Fadt->Pm1CntLen == 4) {

+ SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

+ } else {

+ //

+ // if (Pm1CntLen == 2), use 16 bit IO read;

+ // if (Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback

+ //

+ SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

+ }

+

+ if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&

+ (Fadt->SmiCmd == 0) &&

+ !SciEnabled) {

+ //

+ // The ACPI enabling status is inconsistent: SCI is not enabled but ACPI

+ // table does not provide a means to enable it through FADT->SmiCmd

+ //

+ DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsistent: SCI is not"

+ " enabled but the ACPI table does not provide a means to enable it through FADT->SmiCmd."

+ " This may cause issues in OS.\n"));

+ }

+ DEBUG_CODE_END ();

+

+ return RETURN_SUCCESS;

+}

+

+

+/**

+ Build ACPI board info HOB using infomation from ACPI table

+

+ @param AcpiTableBase ACPI table start address in memory

+

+ @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.

+**/

+ACPI_BOARD_INFO *

+BuildHobFromAcpi (

+ IN UINT64 AcpiTableBase

+ )

+{

+ EFI_STATUS Status;

+ ACPI_BOARD_INFO AcpiBoardInfo;

+ ACPI_BOARD_INFO *NewAcpiBoardInfo;

+

+ NewAcpiBoardInfo = NULL;

+ Status = ParseAcpiInfo (AcpiTableBase, &AcpiBoardInfo);

+ ASSERT_EFI_ERROR (Status);

+ if (!EFI_ERROR (Status)) {

+ NewAcpiBoardInfo = BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (ACPI_BOARD_INFO));

+ ASSERT (NewAcpiBoardInfo != NULL);

+ CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));

+ DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));

+ }

+ return NewAcpiBoardInfo;

+}

+

+

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index ae16f25c7c..a12d9961f1 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -212,167 +212,6 @@ MemInfoCallback (






-/**

- Find the board related info from ACPI table

-

- @param AcpiTableBase ACPI table start address in memory

- @param AcpiBoardInfo Pointer to the acpi board info strucutre

-

- @retval RETURN_SUCCESS Successfully find out all the required information.

- @retval RETURN_NOT_FOUND Failed to find the required info.

-

-**/

-RETURN_STATUS

-ParseAcpiInfo (

- IN UINT64 AcpiTableBase,

- OUT ACPI_BOARD_INFO *AcpiBoardInfo

- )

-{

- EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;

- EFI_ACPI_DESCRIPTION_HEADER *Rsdt;

- UINT32 *Entry32;

- UINTN Entry32Num;

- EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;

- EFI_ACPI_DESCRIPTION_HEADER *Xsdt;

- UINT64 *Entry64;

- UINTN Entry64Num;

- UINTN Idx;

- UINT32 *Signature;

- EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr;

- EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE
*MmCfgBase;

-

- Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTableBase;

- DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));

- DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));

-

- //

- // Search Rsdt First

- //

- Fadt = NULL;

- MmCfgHdr = NULL;

- Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);

- if (Rsdt != NULL) {

- Entry32 = (UINT32 *)(Rsdt + 1);

- Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;

- for (Idx = 0; Idx < Entry32Num; Idx++) {

- Signature = (UINT32 *)(UINTN)Entry32[Idx];

- if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

- Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

- DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));

- }

-

- if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

- MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

- DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));

- }

-

- if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

- goto Done;

- }

- }

- }

-

- //

- // Search Xsdt Second

- //

- Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);

- if (Xsdt != NULL) {

- Entry64 = (UINT64 *)(Xsdt + 1);

- Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;

- for (Idx = 0; Idx < Entry64Num; Idx++) {

- Signature = (UINT32 *)(UINTN)Entry64[Idx];

- if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {

- Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;

- DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));

- }

-

- if (*Signature ==
EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE)
{

- MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;

- DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));

- }

-

- if ((Fadt != NULL) && (MmCfgHdr != NULL)) {

- goto Done;

- }

- }

- }

-

- if (Fadt == NULL) {

- return RETURN_NOT_FOUND;

- }

-

-Done:

-

- AcpiBoardInfo->PmCtrlRegBase = Fadt->Pm1aCntBlk;

- AcpiBoardInfo->PmTimerRegBase = Fadt->PmTmrBlk;

- AcpiBoardInfo->ResetRegAddress = Fadt->ResetReg.Address;

- AcpiBoardInfo->ResetValue = Fadt->ResetValue;

- AcpiBoardInfo->PmEvtBase = Fadt->Pm1aEvtBlk;

- AcpiBoardInfo->PmGpeEnBase = Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;

-

- if (MmCfgHdr != NULL) {

- MmCfgBase =
(EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*)
MmCfgHdr + sizeof (*MmCfgHdr));

- AcpiBoardInfo->PcieBaseAddress = MmCfgBase->BaseAddress;

- AcpiBoardInfo->PcieBaseSize = (MmCfgBase->EndBusNumber + 1 - MmCfgBase->StartBusNumber) * 4096 * 32 * 8;

- } else {

- AcpiBoardInfo->PcieBaseAddress = 0;

- AcpiBoardInfo->PcieBaseSize = 0;

- }

- DEBUG ((DEBUG_INFO, "PmCtrl Reg 0x%lx\n", AcpiBoardInfo->PmCtrlRegBase));

- DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n", AcpiBoardInfo->PmTimerRegBase));

- DEBUG ((DEBUG_INFO, "Reset Reg 0x%lx\n", AcpiBoardInfo->ResetRegAddress));

- DEBUG ((DEBUG_INFO, "Reset Value 0x%x\n", AcpiBoardInfo->ResetValue));

- DEBUG ((DEBUG_INFO, "PmEvt Reg 0x%lx\n", AcpiBoardInfo->PmEvtBase));

- DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n", AcpiBoardInfo->PmGpeEnBase));

- DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddress));

- DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize));

-

- //

- // Verify values for proper operation

- //

- ASSERT(Fadt->Pm1aCntBlk != 0);

- ASSERT(Fadt->PmTmrBlk != 0);

- ASSERT(Fadt->ResetReg.Address != 0);

- ASSERT(Fadt->Pm1aEvtBlk != 0);

- ASSERT(Fadt->Gpe0Blk != 0);

-

- DEBUG_CODE_BEGIN ();

- BOOLEAN SciEnabled;

-

- //

- // Check the consistency of SCI enabling

- //

-

- //

- // Get SCI_EN value

- //

- if (Fadt->Pm1CntLen == 4) {

- SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

- } else {

- //

- // if (Pm1CntLen == 2), use 16 bit IO read;

- // if (Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback

- //

- SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;

- }

-

- if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&

- (Fadt->SmiCmd == 0) &&

- !SciEnabled) {

- //

- // The ACPI enabling status is inconsistent: SCI is not enabled but ACPI

- // table does not provide a means to enable it through FADT->SmiCmd

- //

- DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsistent: SCI is not"

- " enabled but the ACPI table does not provide a means to enable it through FADT->SmiCmd."

- " This may cause issues in OS.\n"));

- }

- DEBUG_CODE_END ();

-

- return RETURN_SUCCESS;

-}

-

-

/**

It will build HOBs based on information from bootloaders.



@@ -387,8 +226,7 @@ BuildHobFromBl (
EFI_STATUS Status;

SYSTEM_TABLE_INFO SysTableInfo;

SYSTEM_TABLE_INFO *NewSysTableInfo;

- ACPI_BOARD_INFO AcpiBoardInfo;

- ACPI_BOARD_INFO *NewAcpiBoardInfo;

+ ACPI_BOARD_INFO *AcpiBoardInfo;

EFI_PEI_GRAPHICS_INFO_HOB GfxInfo;

EFI_PEI_GRAPHICS_INFO_HOB *NewGfxInfo;

EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo;

@@ -471,20 +309,14 @@ BuildHobFromBl (
//

// Create guid hob for acpi board information

//

- Status = ParseAcpiInfo (SysTableInfo.AcpiTableBase, &AcpiBoardInfo);

- ASSERT_EFI_ERROR (Status);

- if (!EFI_ERROR (Status)) {

- NewAcpiBoardInfo = BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (ACPI_BOARD_INFO));

- ASSERT (NewAcpiBoardInfo != NULL);

- CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));

- DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));

- }

+ AcpiBoardInfo = BuildHobFromAcpi (SysTableInfo.AcpiTableBase);

+ ASSERT (AcpiBoardInfo != NULL);



//

// Parse memory info and build memory HOBs for reserved DRAM and MMIO

//

DEBUG ((DEBUG_INFO , "Building ResourceDescriptorHobs for reserved memory:\n"));

- Status = ParseMemoryInfo (MemInfoCallbackMmio, &AcpiBoardInfo);

+ Status = ParseMemoryInfo (MemInfoCallbackMmio, AcpiBoardInfo);

if (EFI_ERROR(Status)) {

return Status;

}

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 331724c687..9922b56b39 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -204,4 +204,17 @@ FvFindFileByTypeGuid (
IN EFI_GUID *Guid OPTIONAL,

OUT EFI_FFS_FILE_HEADER **FileHeader

);

+

+/**

+ Build ACPI board info HOB using infomation from ACPI table

+

+ @param AcpiTableBase ACPI table start address in memory

+

+ @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.

+**/

+ACPI_BOARD_INFO *

+BuildHobFromAcpi (

+ IN UINT64 AcpiTableBase

+ );

+

#endif

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 8d42925fcd..4c5170d9cc 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -25,6 +25,7 @@
UefiPayloadEntry.c

LoadDxeCore.c

MemoryAllocation.c

+ AcpiTable.c



[Sources.Ia32]

X64/VirtualMemory.h

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
index 03ad9c457b..7e67cf0f04 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c
@@ -260,6 +260,8 @@ BuildHobs (
UNIVERSAL_PAYLOAD_EXTRA_DATA *ExtraData;

UINT8 *GuidHob;

EFI_HOB_FIRMWARE_VOLUME *FvHob;

+ UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTable;

+ ACPI_BOARD_INFO *AcpiBoardInfo;



Hob.Raw = (UINT8 *) BootloaderParameter;

MinimalNeededSize = FixedPcdGet32 (PcdSystemMemoryUefiRegionSize);

@@ -351,6 +353,16 @@ BuildHobs (
*DxeFv = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) ExtraData->Entry[0].Base;

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



+ //

+ // Create guid hob for acpi board information

+ //

+ GuidHob = GetFirstGuidHob(&gUniversalPayloadAcpiTableGuid);

+ if (GuidHob != NULL) {

+ AcpiTable = (UNIVERSAL_PAYLOAD_ACPI_TABLE *) GET_GUID_HOB_DATA (GuidHob);

+ AcpiBoardInfo = BuildHobFromAcpi ((UINT64)AcpiTable->Rsdp);

+ ASSERT (AcpiBoardInfo != NULL);

+ }

+

//

// Update DXE FV information to first fv hob in the hob list, which

// is the empty FvHob created before.

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 3ee449219d..e7e05b744a 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -25,6 +25,7 @@
LoadDxeCore.c

MemoryAllocation.c

PrintHob.c

+ AcpiTable.c



[Sources.Ia32]

X64/VirtualMemory.h

@@ -61,7 +62,6 @@
gEfiGraphicsDeviceInfoHobGuid

gUefiAcpiBoardInfoGuid

gEfiSmbiosTableGuid

- gEfiAcpiTableGuid

gUefiSerialPortInfoGuid

gUniversalPayloadExtraDataGuid

gPcdDataBaseHobGuid

--
2.32.0.windows.2


Re: [PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

Ni, Ray
 

Thanks for providing a very clear commit message.

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Lou, Yun <yun.lou@...>
Sent: Wednesday, September 29, 2021 7:53 PM
To: devel@edk2.groups.io
Cc: Lou, Yun <yun.lou@...>; Ni, Ray <ray.ni@...>; Dong, Eric <eric.dong@...>; Laszlo Ersek
<lersek@...>; Kumar, Rahul1 <rahul1.kumar@...>
Subject: [PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

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

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

Signed-off-by: Jason Lou <yun.lou@...>
Cc: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Rahul Kumar <rahul1.kumar@...>
---
UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 6e2ab79518..e9eba64914 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -153,7 +153,7 @@ CpuInitDataInitialize (
CpuFeaturesData->AcpiCpuData= AcpiCpuData;



CpuStatus = &AcpiCpuData->CpuFeatureInitData.CpuStatus;

- Location = AllocateZeroPool (sizeof (EFI_CPU_PHYSICAL_LOCATION) * NumberOfCpus);

+ Location = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (EFI_CPU_PHYSICAL_LOCATION) * NumberOfCpus));

ASSERT (Location != NULL);

AcpiCpuData->CpuFeatureInitData.ApLocation = (EFI_PHYSICAL_ADDRESS)(UINTN)Location;



@@ -205,11 +205,11 @@ CpuInitDataInitialize (
//

// Collect valid core count in each package because not all cores are valid.

//

- ThreadCountPerPackage = AllocateZeroPool (sizeof (UINT32) * CpuStatus->PackageCount);

+ ThreadCountPerPackage = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT32) * CpuStatus->PackageCount));

ASSERT (ThreadCountPerPackage != NULL);

CpuStatus->ThreadCountPerPackage = (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCountPerPackage;



- ThreadCountPerCore = AllocateZeroPool (sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount);

+ ThreadCountPerCore = AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus-
MaxCoreCount));
ASSERT (ThreadCountPerCore != NULL);

CpuStatus->ThreadCountPerCore = (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCountPerCore;



--
2.28.0.windows.1


Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Yao, Jiewen
 

Right. QemuFwCfgLibMmio - per my understanding.

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Abner
Chang
Sent: Wednesday, September 29, 2021 8:47 PM
To: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@...>;
sami.mujawar@...
Cc: Ard Biesheuvel <ardb+tianocore@...>; Leif Lindholm
<leif@...>; Justen, Jordan L <jordan.l.justen@...>; Gerd
Hoffmann <kraxel@...>; Schaefer, Daniel <daniel.schaefer@...>;
Sunil V L <sunilvl@...>; nd <nd@...>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,
It should be QemuFwCfgLibMmio instead of QemuFwCfgLibMMIO, right?

Abner

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Yao, Jiewen
Sent: Wednesday, September 29, 2021 8:26 PM
To: devel@edk2.groups.io; sami.mujawar@...
Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@...>; Ard
Biesheuvel <ardb+tianocore@...>; Leif Lindholm
<leif@...>; Justen, Jordan L <jordan.l.justen@...>; Gerd
Hoffmann <kraxel@...>; Schaefer, Daniel
<daniel.schaefer@...>; Sunil V L <sunilvl@...>; nd
<nd@...>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate QemuFwCfgLib to OvmfPkg

Thank you Sami.

We have a clear naming rule for EDKII project during development.
But I don’t know where it is documented. Maybe a good addition to the doc
you point out.

To summarize what I know:

1) Library name: [<Phase>]<ClassName>Lib[<InstanceName>]
2) Driver Name: <DriverName><Phase>

For the example you point out, I see no problem, because "XenIoMmioLib" is
the class name. So XXXMmioLib is correct.

In this case, the class name is "QemuFwCfgLib", "MMIO" is the instance
name. We should use QemuFwCfgLibMmio.

Thank you
Yao Jiewen



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
Mujawar
Sent: Wednesday, September 29, 2021 7:33 PM
To: Yao, Jiewen <jiewen.yao@...>
Cc: Chang, Abner <abner.chang@...>; devel@edk2.groups.io; Ard
Biesheuvel <ardb+tianocore@...>; Leif Lindholm
<leif@...>;
Justen, Jordan L <jordan.l.justen@...>; Gerd Hoffmann
<kraxel@...>; Schaefer, Daniel <daniel.schaefer@...>; Sunil
V L
<sunilvl@...>; nd <nd@...>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in
INVALID URI REMOVED
__;!!NpxR!zMRKC5N87Eb6j69O6lJZ1hVaDVHrnj_21pwNznZx6ZAtLm0Z948atj
NrWepfxQ0$
docs.gitbook.io/edk-ii-c-coding-standards-
specification/v/release%2F2.20/4_naming_conventions/42_file_names
and
therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@...> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen


> 在 2021年9月29日,下午5:45,Sami Mujawar
<Sami.Mujawar@...> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and
rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@...>
>> Cc: Ard Biesheuvel <ardb+tianocore@...>
>> Cc: Leif Lindholm <leif@...>
>> Cc: Sami Mujawar <sami.mujawar@...>
>> Cc: Jiewen Yao <jiewen.yao@...>
>> Cc: Jordan Justen <jordan.l.justen@...>
>> Cc: Gerd Hoffmann <kraxel@...>
>> Cc: Daniel Schaefer <daniel.schaefer@...>
>> Cc: Sunil V L <sunilvl@...>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to
QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern
similar to
OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc
b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc
b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by
the
build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development
LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64
((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32
((UINT32)&Access));
>











Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Abner Chang
 

Hi Jiewen,
It should be QemuFwCfgLibMmio instead of QemuFwCfgLibMMIO, right?

Abner

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Yao, Jiewen
Sent: Wednesday, September 29, 2021 8:26 PM
To: devel@edk2.groups.io; sami.mujawar@...
Cc: Chang, Abner (HPS SW/FW Technologist) <abner.chang@...>; Ard
Biesheuvel <ardb+tianocore@...>; Leif Lindholm
<leif@...>; Justen, Jordan L <jordan.l.justen@...>; Gerd
Hoffmann <kraxel@...>; Schaefer, Daniel
<daniel.schaefer@...>; Sunil V L <sunilvl@...>; nd
<nd@...>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate QemuFwCfgLib to OvmfPkg

Thank you Sami.

We have a clear naming rule for EDKII project during development.
But I don’t know where it is documented. Maybe a good addition to the doc
you point out.

To summarize what I know:

1) Library name: [<Phase>]<ClassName>Lib[<InstanceName>]
2) Driver Name: <DriverName><Phase>

For the example you point out, I see no problem, because "XenIoMmioLib" is
the class name. So XXXMmioLib is correct.

In this case, the class name is "QemuFwCfgLib", "MMIO" is the instance
name. We should use QemuFwCfgLibMmio.

Thank you
Yao Jiewen



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
Mujawar
Sent: Wednesday, September 29, 2021 7:33 PM
To: Yao, Jiewen <jiewen.yao@...>
Cc: Chang, Abner <abner.chang@...>; devel@edk2.groups.io; Ard
Biesheuvel <ardb+tianocore@...>; Leif Lindholm
<leif@...>;
Justen, Jordan L <jordan.l.justen@...>; Gerd Hoffmann
<kraxel@...>; Schaefer, Daniel <daniel.schaefer@...>; Sunil
V L
<sunilvl@...>; nd <nd@...>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib:
Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in
INVALID URI REMOVED
__;!!NpxR!zMRKC5N87Eb6j69O6lJZ1hVaDVHrnj_21pwNznZx6ZAtLm0Z948atj
NrWepfxQ0$
docs.gitbook.io/edk-ii-c-coding-standards-
specification/v/release%2F2.20/4_naming_conventions/42_file_names
and
therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@...> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen


> 在 2021年9月29日,下午5:45,Sami Mujawar
<Sami.Mujawar@...> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and
rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@...>
>> Cc: Ard Biesheuvel <ardb+tianocore@...>
>> Cc: Leif Lindholm <leif@...>
>> Cc: Sami Mujawar <sami.mujawar@...>
>> Cc: Jiewen Yao <jiewen.yao@...>
>> Cc: Jordan Justen <jordan.l.justen@...>
>> Cc: Gerd Hoffmann <kraxel@...>
>> Cc: Daniel Schaefer <daniel.schaefer@...>
>> Cc: Sunil V L <sunilvl@...>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to
QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern
similar to
OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc
b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc
b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDev
ice
Lib.inf
>> -
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
bNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
Qem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by
the
build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development
LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64
((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32
((UINT32)&Access));
>








Re: [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Yao, Jiewen
 

Thank you Sami.

We have a clear naming rule for EDKII project during development.
But I don’t know where it is documented. Maybe a good addition to the doc you point out.

To summarize what I know:

1) Library name: [<Phase>]<ClassName>Lib[<InstanceName>]
2) Driver Name: <DriverName><Phase>

For the example you point out, I see no problem, because "XenIoMmioLib" is the class name. So XXXMmioLib is correct.

In this case, the class name is "QemuFwCfgLib", "MMIO" is the instance name. We should use QemuFwCfgLibMmio.

Thank you
Yao Jiewen

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
Mujawar
Sent: Wednesday, September 29, 2021 7:33 PM
To: Yao, Jiewen <jiewen.yao@...>
Cc: Chang, Abner <abner.chang@...>; devel@edk2.groups.io; Ard
Biesheuvel <ardb+tianocore@...>; Leif Lindholm <leif@...>;
Justen, Jordan L <jordan.l.justen@...>; Gerd Hoffmann
<kraxel@...>; Schaefer, Daniel <daniel.schaefer@...>; Sunil V L
<sunilvl@...>; nd <nd@...>
Subject: Re: [edk2-devel] [PATCH V2 6/9] ArmVirtPkg/QemuFwCfgLib: Relocate
QemuFwCfgLib to OvmfPkg

Hi Jiewen,

Thank you for clarifying the library naming convention.
I could not find any references/examples as such in https://edk2-
docs.gitbook.io/edk-ii-c-coding-standards-
specification/v/release%2F2.20/4_naming_conventions/42_file_names and
therefore had suggested following the file naming as done for Xen.

Regards,

Sami Mujawar

On 29/09/2021, 11:04, "Yao, Jiewen" <jiewen.yao@...> wrote:

hi
I think the original name is correct.

The naming convention is : <LibClassName>Lib<InstanceName>

thank you!
Yao, Jiewen


> 在 2021年9月29日,下午5:45,Sami Mujawar
<Sami.Mujawar@...> 写道:
>
> Hi Abner,
>
> Thank you for this patch.
>
> I have a minor suggestion marked inline as [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
>> On 28/09/2021 09:31 AM, Abner Chang wrote:
>> Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
>> it to QemuFwCfgLibMMIO, this library is leverage by both ARM and
>> RISC-V archs.
>>
>> Signed-off-by: Abner Chang <abner.chang@...>
>> Cc: Ard Biesheuvel <ardb+tianocore@...>
>> Cc: Leif Lindholm <leif@...>
>> Cc: Sami Mujawar <sami.mujawar@...>
>> Cc: Jiewen Yao <jiewen.yao@...>
>> Cc: Jordan Justen <jordan.l.justen@...>
>> Cc: Gerd Hoffmann <kraxel@...>
>> Cc: Daniel Schaefer <daniel.schaefer@...>
>> Cc: Sunil V L <sunilvl@...>
>> ---
>> ArmVirtPkg/ArmVirtQemu.dsc | 2 +-
>> ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +-
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf | 5 ++---
>> .../Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c | 7 ++++---
>> 4 files changed, 8 insertions(+), 8 deletions(-)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf (87%)
>> rename ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c =>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c (93%)
> [SAMI] Is it possible to rename QemuFwCfgLibMMIO.[c|inf] to
QemuFwCfgMmioLib.[c|inf], please? This would then follow a pattern similar to
OvmfPkg\Library\XenIoMmioLib\XenIoMmioLib.[c|inf].
>>
>> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
>> index 07f9699c79..6c949fd559 100644
>> --- a/ArmVirtPkg/ArmVirtQemu.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
>> @@ -59,7 +59,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice
Lib.inf
>> - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc
b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> index cf7a2b4463..64035a948d 100644
>> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
>> @@ -57,7 +57,7 @@
>> # Virtio Support
>> VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice
Lib.inf
>> - QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +
QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>>
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNu
ll.inf
>>
QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/Qe
muFwCfgSimpleParserLib.inf
>>
QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQem
uLoadImageLib.inf
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> similarity index 87%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> index f3cc827907..8101fac03f 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.inf
>> @@ -23,17 +23,16 @@
>> # The following information is for reference only and not required by the
build
>> # tools.
>> #
>> -# VALID_ARCHITECTURES = ARM AARCH64
>> +# VALID_ARCHITECTURES = ARM AARCH64 RISCV64
>> #
>> [Sources]
>> - QemuFwCfgLib.c
>> + QemuFwCfgLibMMIO.c
>> [Packages]
>> MdePkg/MdePkg.dec
>> OvmfPkg/OvmfPkg.dec
>> EmbeddedPkg/EmbeddedPkg.dec
>> - ArmVirtPkg/ArmVirtPkg.dec
>> [LibraryClasses]
>> BaseLib
>> diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> similarity index 93%
>> rename from ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> rename to OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> index e2ac4108d1..b953f2eb6c 100644
>> --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
>> +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMMIO.c
>> @@ -4,6 +4,7 @@
>> Copyright (C) 2013 - 2014, Red Hat, Inc.
>> Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
>> + (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
>> SPDX-License-Identifier: BSD-2-Clause-Patent
>> **/
>> @@ -239,7 +240,7 @@ MmioReadBytes (
>> UINT8 *Ptr;
>> UINT8 *End;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> Left = Size & 7;
>> #else
>> Left = Size & 3;
>> @@ -249,7 +250,7 @@ MmioReadBytes (
>> Ptr = Buffer;
>> End = Ptr + Size;
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> while (Ptr < End) {
>> *(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress);
>> Ptr += 8;
>> @@ -322,7 +323,7 @@ DmaTransferBytes (
>> //
>> // This will fire off the transfer.
>> //
>> -#ifdef MDE_CPU_AARCH64
>> +#if defined(MDE_CPU_AARCH64) || defined(MDE_CPU_RISCV64)
>> MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access));
>> #else
>> MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32
((UINT32)&Access));
>





Re: [PATCH v1 0/4] Set default Makefile name

Bob Feng
 

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng
Sent: Wednesday, September 29, 2021 7:44 PM
To: Pierre.Gondois@...; devel@edk2.groups.io; Liming Gao <gaoliming@...>; Sami Mujawar <sami.mujawar@...>
Subject: Re: [edk2-devel] [PATCH v1 0/4] Set default Makefile name

Reviewed-by: Bob Feng <bob.c.feng@...>

-----Original Message-----
From: Pierre.Gondois@... <Pierre.Gondois@...>
Sent: Thursday, September 23, 2021 4:59 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@...>; Liming Gao <gaoliming@...>; Sami Mujawar <sami.mujawar@...>
Subject: [PATCH v1 0/4] Set default Makefile name

From: Pierre Gondois <Pierre.Gondois@...>

A Makefile name is not set in BaseTools when only building modules or libraries. This patch-set sets a default Makefile name for the "build" command.

The patch-set also:
- Removes unsused Makefile variables
- Removes hard-coded references to "target.txt" and "tools_def.txt"

The changes can be seen at: https://github.com/PierreARM/edk2/tree/1868_BaseTools_build_py_corrections_v1

Pierre Gondois (4):
BaseTools/GenMake: Use ToolDefinition as fallback option
BaseTools/build: Set MakefileName
BaseTools: Remove Makefile/MakefileName fields
BaseTools: Remove hard-coded strings for target and tools_def

BaseTools/Source/Python/AutoGen/GenMake.py | 8 ++++----
BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 1 -
BaseTools/Source/Python/GenFds/GenFds.py | 4 ++--
.../Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++--
BaseTools/Source/Python/TargetTool/TargetTool.py | 3 ++-
BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 --
BaseTools/Source/Python/Workspace/DscBuildData.py | 9 ++++-----
BaseTools/Source/Python/build/build.py | 11 ++++-------
8 files changed, 18 insertions(+), 24 deletions(-)

--
2.17.1


[PATCH v1] UefiCpuPkg: Cpu feature data stored in memory may be migrated

Jason Lou
 

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

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

Signed-off-by: Jason Lou <yun.lou@...>
Cc: Ray Ni <ray.ni@...>
Cc: Eric Dong <eric.dong@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Rahul Kumar <rahul1.kumar@...>
---
UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 6 +++-=
--
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ=
e.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 6e2ab79518..e9eba64914 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -153,7 +153,7 @@ CpuInitDataInitialize (
CpuFeaturesData->AcpiCpuData=3D AcpiCpuData;=0D
=0D
CpuStatus =3D &AcpiCpuData->CpuFeatureInitData.CpuStatus;=0D
- Location =3D AllocateZeroPool (sizeof (EFI_CPU_PHYSICAL_LOCATION) * Numb=
erOfCpus);=0D
+ Location =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof (EFI_CPU_PHYSICAL_=
LOCATION) * NumberOfCpus));=0D
ASSERT (Location !=3D NULL);=0D
AcpiCpuData->CpuFeatureInitData.ApLocation =3D (EFI_PHYSICAL_ADDRESS)(UI=
NTN)Location;=0D
=0D
@@ -205,11 +205,11 @@ CpuInitDataInitialize (
//=0D
// Collect valid core count in each package because not all cores are va=
lid.=0D
//=0D
- ThreadCountPerPackage =3D AllocateZeroPool (sizeof (UINT32) * CpuStatus-=
PackageCount);=0D
+ ThreadCountPerPackage =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT=
32) * CpuStatus->PackageCount));=0D
ASSERT (ThreadCountPerPackage !=3D NULL);=0D
CpuStatus->ThreadCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Thread=
CountPerPackage;=0D
=0D
- ThreadCountPerCore =3D AllocateZeroPool (sizeof (UINT8) * CpuStatus->Pac=
kageCount * CpuStatus->MaxCoreCount);=0D
+ ThreadCountPerCore =3D AllocatePages (EFI_SIZE_TO_PAGES (sizeof (UINT8) =
* CpuStatus->PackageCount * CpuStatus->MaxCoreCount));=0D
ASSERT (ThreadCountPerCore !=3D NULL);=0D
CpuStatus->ThreadCountPerCore =3D (EFI_PHYSICAL_ADDRESS)(UINTN)ThreadCou=
ntPerCore;=0D
=0D
--=20
2.28.0.windows.1

9701 - 9720 of 90922