The Xen code in SmbiosPlatformDxe is centered on the informational HOB
with GUID gEfiXenInfoGuid. This Xen hand-off mechanism is specific to the
IA32 and X64 architectures. Therefore, sequester it from the rest of the
source with appropriate preprocessing directives, arch-specific INF file
sections, and by renaming "Xen.c" to "X86Xen.c".

(That file name pattern is inspired by
"OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c".)

This change enables SmbiosPlatformDxe for ARM architectures; update the
VALID_ARCHITECTURES comment accordingly.

Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Wei Liu <wei.l...@citrix.com>
Cc: Gabriel Somlo <so...@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 12 ++++++++----
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h   |  2 ++
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c   |  5 +++++
 OvmfPkg/SmbiosPlatformDxe/{Xen.c => X86Xen.c}   |  0
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf 
b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 6596392..ac4666a 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -25,15 +25,17 @@ [Defines]
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64
 #
 
 [Sources]
   SmbiosPlatformDxe.h
   SmbiosPlatformDxe.c
-  Xen.c
   Qemu.c
 
+[Sources.IA32, Sources.X64]
+  X86Xen.c
+
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
@@ -45,14 +47,16 @@ [LibraryClasses]
   BaseLib
   UefiDriverEntryPoint
   DebugLib
-  HobLib
   QemuFwCfgLib
   MemoryAllocationLib
 
+[LibraryClasses.IA32, LibraryClasses.X64]
+  HobLib
+
 [Protocols]
   gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED
 
-[Guids]
+[Guids.IA32, Guids.X64]
   gEfiXenInfoGuid
 
 [Depex]
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h 
b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 6210a56..428bdcf 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -28,6 +28,7 @@
 #include <Library/MemoryAllocationLib.h>
 
 
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
 /**
   Locates the Xen SMBIOS data if it exists
 
@@ -38,6 +39,7 @@ SMBIOS_TABLE_ENTRY_POINT *
 GetXenSmbiosTables (
   VOID
   );
+#endif
 
 
 /**
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c 
b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 29948a4..941f8cd 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -195,7 +195,12 @@ SmbiosTablePublishEntry (
   //
   // Add Xen or QEMU SMBIOS data if found
   //
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
   EntryPointStructure = GetXenSmbiosTables ();
+#else
+  EntryPointStructure = NULL;
+#endif
+
   if (EntryPointStructure != NULL) {
     SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
   } else {
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c 
b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
similarity index 100%
rename from OvmfPkg/SmbiosPlatformDxe/Xen.c
rename to OvmfPkg/SmbiosPlatformDxe/X86Xen.c
-- 
1.8.3.1



------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to