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>
\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
\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
\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
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
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
--- /dev/null
+/** @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
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
#\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
BaseLib\r
HobLib\r
\r
-[Pcd]\r
- gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated\r
-\r
[Protocols]\r
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
\r