]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
authorLaszlo Ersek <lersek@redhat.com>
Wed, 26 May 2021 20:14:45 +0000 (22:14 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 4 Jun 2021 16:01:50 +0000 (16:01 +0000)
Remove the SmbiosTablePublishEntry() function from "SmbiosPlatformDxe.c".
"SmbiosPlatformDxe.c" becomes hypervisor-agnostic.

Add SmbiosTablePublishEntry() back, simplified for QEMU, to the existent
file "Qemu.c". The GetQemuSmbiosTables() function no longer needs to be
declared in "SmbiosPlatformDxe.h"; "SmbiosPlatformDxe.h" becomes
hypervisor-agnostic.

Add SmbiosTablePublishEntry() back, renamed and simplified for Xen, to the
new, arch-independent file "Xen.c". (The existent Xen-specific C files are
arch-dependent.)

Update both INF files; remove the dependencies that are now superfluous in
each.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210526201446.12554-43-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
OvmfPkg/SmbiosPlatformDxe/Qemu.c
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
OvmfPkg/SmbiosPlatformDxe/Xen.c [new file with mode: 0644]
OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf

index fcfc3e33c28c3500246616a62578deaa50db7b48..a668c6ac2123f75d5fc984d3eb3952082aa0cee7 100644 (file)
@@ -48,3 +48,36 @@ GetQemuSmbiosTables (
 \r
   return QemuTables;\r
 }\r
+\r
+/**\r
+  Installs SMBIOS information for OVMF\r
+\r
+  @param ImageHandle     Module's image handle\r
+  @param SystemTable     Pointer of EFI_SYSTEM_TABLE\r
+\r
+  @retval EFI_SUCCESS    Smbios data successfully installed\r
+  @retval Other          Smbios data was not installed\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmbiosTablePublishEntry (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  UINT8                     *SmbiosTables;\r
+\r
+  Status = EFI_NOT_FOUND;\r
+  //\r
+  // Add QEMU SMBIOS data if found\r
+  //\r
+  SmbiosTables = GetQemuSmbiosTables ();\r
+  if (SmbiosTables != NULL) {\r
+    Status = InstallAllStructures (SmbiosTables);\r
+    FreePool (SmbiosTables);\r
+  }\r
+\r
+  return Status;\r
+}\r
index f280a1852ddd8bd00cac1c2c6f4466731542157d..7bcf83762e9b960d71aee9525b203e49a617de5c 100644 (file)
 \r
 #include <IndustryStandard/SmBios.h>          // SMBIOS_TABLE_TYPE0\r
 #include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()\r
-#include <Library/MemoryAllocationLib.h>      // FreePool()\r
 #include <Library/UefiBootServicesTableLib.h> // gBS\r
 #include <Protocol/Smbios.h>                  // EFI_SMBIOS_PROTOCOL\r
 \r
 #include "SmbiosPlatformDxe.h"\r
-#include "XenSmbiosPlatformDxe.h"\r
 \r
 #define TYPE0_STRINGS \\r
   "EFI Development Kit II / OVMF\0"     /* Vendor */ \\r
@@ -168,50 +166,3 @@ InstallAllStructures (
 \r
   return EFI_SUCCESS;\r
 }\r
-\r
-\r
-/**\r
-  Installs SMBIOS information for OVMF\r
-\r
-  @param ImageHandle     Module's image handle\r
-  @param SystemTable     Pointer of EFI_SYSTEM_TABLE\r
-\r
-  @retval EFI_SUCCESS    Smbios data successfully installed\r
-  @retval Other          Smbios data was not installed\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmbiosTablePublishEntry (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure;\r
-  UINT8                     *SmbiosTables;\r
-\r
-  Status = EFI_NOT_FOUND;\r
-  //\r
-  // Add Xen or QEMU SMBIOS data if found\r
-  //\r
-  EntryPointStructure = GetXenSmbiosTables ();\r
-  if (EntryPointStructure != NULL) {\r
-    SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;\r
-  } else {\r
-    SmbiosTables = GetQemuSmbiosTables ();\r
-  }\r
-\r
-  if (SmbiosTables != NULL) {\r
-    Status = InstallAllStructures (SmbiosTables);\r
-\r
-    //\r
-    // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):\r
-    //\r
-    if (EntryPointStructure == NULL) {\r
-      FreePool (SmbiosTables);\r
-    }\r
-  }\r
-\r
-  return Status;\r
-}\r
index 0ae2556fe800d1383a6c321f06fd9359d7dfc00f..213a7f39e91d0b81a47a5c61bbaebd78e0f13789 100644 (file)
@@ -22,15 +22,4 @@ InstallAllStructures (
   IN UINT8                     *TableAddress\r
   );\r
 \r
-/**\r
-  Locates and extracts the QEMU SMBIOS table data if present in fw_cfg\r
-\r
-  @return             Address of extracted QEMU SMBIOS data\r
-\r
-**/\r
-UINT8 *\r
-GetQemuSmbiosTables (\r
-  VOID\r
-  );\r
-\r
 #endif\r
index 140fa16ac135cf634b136bc174b57365fe0d79a3..eaee73110d27c1c92b7033b03bf1e76f21b341b7 100644 (file)
   Qemu.c\r
   SmbiosPlatformDxe.c\r
   SmbiosPlatformDxe.h\r
-  XenSmbiosPlatformDxe.h\r
-\r
-[Sources.IA32, Sources.X64]\r
-  X86Xen.c\r
-\r
-[Sources.ARM, Sources.AARCH64]\r
-  ArmXen.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   UefiBootServicesTableLib\r
   UefiDriverEntryPoint\r
 \r
-[LibraryClasses.IA32, LibraryClasses.X64]\r
-  BaseLib\r
-  HobLib\r
-\r
 [Pcd]\r
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated\r
 \r
 [Protocols]\r
   gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
 \r
-[Guids.IA32, Guids.X64]\r
-  gEfiXenInfoGuid\r
-\r
 [Depex]\r
   gEfiSmbiosProtocolGuid\r
 \r
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/Xen.c
new file mode 100644 (file)
index 0000000..75d9550
--- /dev/null
@@ -0,0 +1,49 @@
+/** @file\r
+  This driver installs SMBIOS information for OVMF on Xen\r
+\r
+  Copyright (C) 2021, Red Hat, Inc.\r
+  Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>\r
+  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "SmbiosPlatformDxe.h"\r
+#include "XenSmbiosPlatformDxe.h"\r
+\r
+/**\r
+  Installs SMBIOS information for OVMF on Xen\r
+\r
+  @param ImageHandle     Module's image handle\r
+  @param SystemTable     Pointer of EFI_SYSTEM_TABLE\r
+\r
+  @retval EFI_SUCCESS    Smbios data successfully installed\r
+  @retval Other          Smbios data was not installed\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+XenSmbiosTablePublishEntry (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure;\r
+  UINT8                     *SmbiosTables;\r
+\r
+  Status = EFI_NOT_FOUND;\r
+  //\r
+  // Add Xen SMBIOS data if found\r
+  //\r
+  EntryPointStructure = GetXenSmbiosTables ();\r
+  if (EntryPointStructure != NULL) {\r
+    SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;\r
+    if (SmbiosTables != NULL) {\r
+      Status = InstallAllStructures (SmbiosTables);\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
index 5a093c69afd9c1bc52c73c5389fdcaf9f3010dc5..7f4588e33d1e753a94da18fc5828d1ef94b66629 100644 (file)
@@ -16,7 +16,7 @@
   MODULE_TYPE                    = DXE_DRIVER\r
   VERSION_STRING                 = 1.0\r
 \r
-  ENTRY_POINT                    = SmbiosTablePublishEntry\r
+  ENTRY_POINT                    = XenSmbiosTablePublishEntry\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
@@ -25,9 +25,9 @@
 #\r
 \r
 [Sources]\r
-  Qemu.c\r
   SmbiosPlatformDxe.c\r
   SmbiosPlatformDxe.h\r
+  Xen.c\r
   XenSmbiosPlatformDxe.h\r
 \r
 [Sources.IA32, Sources.X64]\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
+\r
+[Packages.IA32, Packages.X64]\r
   OvmfPkg/OvmfPkg.dec\r
 \r
 [LibraryClasses]\r
   DebugLib\r
-  MemoryAllocationLib\r
-  PcdLib\r
-  QemuFwCfgLib\r
   UefiBootServicesTableLib\r
   UefiDriverEntryPoint\r
 \r
@@ -52,9 +51,6 @@
   BaseLib\r
   HobLib\r
 \r
-[Pcd]\r
-  gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated\r
-\r
 [Protocols]\r
   gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
 \r