[edk2-devel] [edk2-staging/RiscV64QemuVirt PATCH V2 05/33] OvmfPkg/PlatformInitLib: Refactor to allow other architectures
Sunil V L
sunilvl at ventanamicro.com
Wed Oct 12 10:44:28 UTC 2022
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4076
Currently, PlatformInitLib supports only X86 architecture. So,
refactor to allow adding other architectures like RISC-V.
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Gerd Hoffmann <kraxel at redhat.com>
Signed-off-by: Sunil V L <sunilvl at ventanamicro.com>
---
.../PlatformInitLib/PlatformInitLib.inf | 22 ++++++++++---------
.../PlatformInitLib/{ => Ia32_X64}/Cmos.c | 0
.../PlatformInitLib/{ => Ia32_X64}/IntelTdx.c | 0
.../{ => Ia32_X64}/IntelTdxNull.c | 0
.../{ => Ia32_X64}/MemDetect.c | 0
.../PlatformInitLib/{ => Ia32_X64}/Platform.c | 0
6 files changed, 12 insertions(+), 10 deletions(-)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/Cmos.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/IntelTdx.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/IntelTdxNull.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/MemDetect.c (100%)
rename OvmfPkg/Library/PlatformInitLib/{ => Ia32_X64}/Platform.c (100%)
diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
index 86a82ad3e084..d4449e40af61 100644
--- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
+++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
@@ -22,16 +22,16 @@ [Defines]
# VALID_ARCHITECTURES = IA32 X64 EBC
#
-[Sources]
- Cmos.c
- MemDetect.c
- Platform.c
+[Sources.IA32, Sources.X64]
+ Ia32_X64/Cmos.c
+ Ia32_X64/MemDetect.c
+ Ia32_X64/Platform.c
[Sources.IA32]
- IntelTdxNull.c
+ Ia32_X64/IntelTdxNull.c
[Sources.X64]
- IntelTdx.c
+ Ia32_X64/IntelTdx.c
[Packages]
EmbeddedPkg/EmbeddedPkg.dec
@@ -45,12 +45,14 @@ [LibraryClasses]
DebugLib
IoLib
HobLib
+ PcdLib
+ PciLib
+
+[LibraryClasses.IA32, LibraryClasses.X64]
+ MtrrLib
QemuFwCfgLib
QemuFwCfgSimpleParserLib
MemoryAllocationLib
- MtrrLib
- PcdLib
- PciLib
PeiHardwareInfoLib
[LibraryClasses.X64]
@@ -100,5 +102,5 @@ [FixedPcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase
gUefiOvmfPkgTokenSpaceGuid.PcdCfvRawDataSize
-[FeaturePcd]
+[FeaturePcd.IA32, FeaturePcd.X64]
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
diff --git a/OvmfPkg/Library/PlatformInitLib/Cmos.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/Cmos.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/Cmos.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/Cmos.c
diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdx.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/IntelTdx.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdx.c
diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdxNull.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/IntelTdxNull.c
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/MemDetect.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/MemDetect.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/MemDetect.c
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Ia32_X64/Platform.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/Platform.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32_X64/Platform.c
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95069): https://edk2.groups.io/g/devel/message/95069
Mute This Topic: https://groups.io/mt/94278061/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list