[edk2-devel] [edk2-staging/RiscV64QemuVirt PATCH V4 05/34] OvmfPkg/PlatformInitLib: Refactor to allow other architectures

Sunil V L posted 34 patches 3 years, 3 months ago
There is a newer version of this series
[edk2-devel] [edk2-staging/RiscV64QemuVirt PATCH V4 05/34] OvmfPkg/PlatformInitLib: Refactor to allow other architectures
Posted by Sunil V L 3 years, 3 months ago
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@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
 OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf          | 22 +++++++++++---------
 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/Cmos.c         |  0
 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/IntelTdx.c     |  0
 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/IntelTdxNull.c |  0
 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/MemDetect.c    |  0
 OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/Platform.c     |  0
 6 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
index 86a82ad3e084..5d31cad1b670 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]
+  Ia32X64/Cmos.c
+  Ia32X64/MemDetect.c
+  Ia32X64/Platform.c
 
 [Sources.IA32]
-  IntelTdxNull.c
+  Ia32X64/IntelTdxNull.c
 
 [Sources.X64]
-  IntelTdx.c
+  Ia32X64/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/Ia32X64/Cmos.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/Cmos.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/Cmos.c
diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdx.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/IntelTdx.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdx.c
diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdxNull.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdxNull.c
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/MemDetect.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/MemDetect.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/MemDetect.c
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Ia32X64/Platform.c
similarity index 100%
rename from OvmfPkg/Library/PlatformInitLib/Platform.c
rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/Platform.c
-- 
2.38.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95219): https://edk2.groups.io/g/devel/message/95219
Mute This Topic: https://groups.io/mt/94330824/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-staging/RiscV64QemuVirt PATCH V4 05/34] OvmfPkg/PlatformInitLib: Refactor to allow other architectures
Posted by Chang, Abner via groups.io 3 years, 3 months ago
[AMD Official Use Only - General]

Need maintainer to review this changes. However, same comment as I gave earlier. We will have to wait until the File Naming and Directory naming sections are firmed and published in edk2 coding standard spec.


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sunil V L
> via groups.io
> Sent: Saturday, October 15, 2022 12:48 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Jiewen Yao
> <jiewen.yao@intel.com>; Jordan Justen <jordan.l.justen@intel.com>; Gerd
> Hoffmann <kraxel@redhat.com>
> Subject: [edk2-devel] [edk2-staging/RiscV64QemuVirt PATCH V4 05/34]
> OvmfPkg/PlatformInitLib: Refactor to allow other architectures
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> REF:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugz
> illa.tianocore.org%2Fshow_bug.cgi%3Fid%3D4076&amp;data=05%7C01%7Ca
> bner.chang%40amd.com%7Ced7f8b92a08f4857ec8308daae040947%7C3dd89
> 61fe4884e608e11a82d994e183d%7C0%7C0%7C638013629611675307%7CUnkn
> own%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
> 1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=73IIv8KRu49Hir
> C2wbaDc8flnZRiJ78k7cuTuQyVuFw%3D&amp;reserved=0
> 
> Currently, PlatformInitLib supports only X86 architecture. So, refactor to
> allow adding other architectures like RISC-V.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> ---
>  OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf          | 22 +++++++++++-
> --------
>  OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/Cmos.c         |  0
>  OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/IntelTdx.c     |  0
>  OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/IntelTdxNull.c |  0
>  OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/MemDetect.c    |  0
>  OvmfPkg/Library/PlatformInitLib/{ => Ia32X64}/Platform.c     |  0
>  6 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
> b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
> index 86a82ad3e084..5d31cad1b670 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]
> +  Ia32X64/Cmos.c
> +  Ia32X64/MemDetect.c
> +  Ia32X64/Platform.c
> 
>  [Sources.IA32]
> -  IntelTdxNull.c
> +  Ia32X64/IntelTdxNull.c
> 
>  [Sources.X64]
> -  IntelTdx.c
> +  Ia32X64/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/Ia32X64/Cmos.c
> similarity index 100%
> rename from OvmfPkg/Library/PlatformInitLib/Cmos.c
> rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/Cmos.c
> diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
> b/OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdx.c
> similarity index 100%
> rename from OvmfPkg/Library/PlatformInitLib/IntelTdx.c
> rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdx.c
> diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c
> b/OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdxNull.c
> similarity index 100%
> rename from OvmfPkg/Library/PlatformInitLib/IntelTdxNull.c
> rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/IntelTdxNull.c
> diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> b/OvmfPkg/Library/PlatformInitLib/Ia32X64/MemDetect.c
> similarity index 100%
> rename from OvmfPkg/Library/PlatformInitLib/MemDetect.c
> rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/MemDetect.c
> diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c
> b/OvmfPkg/Library/PlatformInitLib/Ia32X64/Platform.c
> similarity index 100%
> rename from OvmfPkg/Library/PlatformInitLib/Platform.c
> rename to OvmfPkg/Library/PlatformInitLib/Ia32X64/Platform.c
> --
> 2.38.0
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95260): https://edk2.groups.io/g/devel/message/95260
Mute This Topic: https://groups.io/mt/94330824/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-