mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
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>
This commit is contained in:
parent
d4a8aaee73
commit
ce270905bf
@ -48,3 +48,36 @@ GetQemuSmbiosTables (
|
|||||||
|
|
||||||
return QemuTables;
|
return QemuTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Installs SMBIOS information for OVMF
|
||||||
|
|
||||||
|
@param ImageHandle Module's image handle
|
||||||
|
@param SystemTable Pointer of EFI_SYSTEM_TABLE
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Smbios data successfully installed
|
||||||
|
@retval Other Smbios data was not installed
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SmbiosTablePublishEntry (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINT8 *SmbiosTables;
|
||||||
|
|
||||||
|
Status = EFI_NOT_FOUND;
|
||||||
|
//
|
||||||
|
// Add QEMU SMBIOS data if found
|
||||||
|
//
|
||||||
|
SmbiosTables = GetQemuSmbiosTables ();
|
||||||
|
if (SmbiosTables != NULL) {
|
||||||
|
Status = InstallAllStructures (SmbiosTables);
|
||||||
|
FreePool (SmbiosTables);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
@ -10,12 +10,10 @@
|
|||||||
|
|
||||||
#include <IndustryStandard/SmBios.h> // SMBIOS_TABLE_TYPE0
|
#include <IndustryStandard/SmBios.h> // SMBIOS_TABLE_TYPE0
|
||||||
#include <Library/DebugLib.h> // ASSERT_EFI_ERROR()
|
#include <Library/DebugLib.h> // ASSERT_EFI_ERROR()
|
||||||
#include <Library/MemoryAllocationLib.h> // FreePool()
|
|
||||||
#include <Library/UefiBootServicesTableLib.h> // gBS
|
#include <Library/UefiBootServicesTableLib.h> // gBS
|
||||||
#include <Protocol/Smbios.h> // EFI_SMBIOS_PROTOCOL
|
#include <Protocol/Smbios.h> // EFI_SMBIOS_PROTOCOL
|
||||||
|
|
||||||
#include "SmbiosPlatformDxe.h"
|
#include "SmbiosPlatformDxe.h"
|
||||||
#include "XenSmbiosPlatformDxe.h"
|
|
||||||
|
|
||||||
#define TYPE0_STRINGS \
|
#define TYPE0_STRINGS \
|
||||||
"EFI Development Kit II / OVMF\0" /* Vendor */ \
|
"EFI Development Kit II / OVMF\0" /* Vendor */ \
|
||||||
@ -168,50 +166,3 @@ InstallAllStructures (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Installs SMBIOS information for OVMF
|
|
||||||
|
|
||||||
@param ImageHandle Module's image handle
|
|
||||||
@param SystemTable Pointer of EFI_SYSTEM_TABLE
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Smbios data successfully installed
|
|
||||||
@retval Other Smbios data was not installed
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
SmbiosTablePublishEntry (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
|
|
||||||
UINT8 *SmbiosTables;
|
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
|
||||||
//
|
|
||||||
// Add Xen or QEMU SMBIOS data if found
|
|
||||||
//
|
|
||||||
EntryPointStructure = GetXenSmbiosTables ();
|
|
||||||
if (EntryPointStructure != NULL) {
|
|
||||||
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
|
|
||||||
} else {
|
|
||||||
SmbiosTables = GetQemuSmbiosTables ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SmbiosTables != NULL) {
|
|
||||||
Status = InstallAllStructures (SmbiosTables);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):
|
|
||||||
//
|
|
||||||
if (EntryPointStructure == NULL) {
|
|
||||||
FreePool (SmbiosTables);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
@ -22,15 +22,4 @@ InstallAllStructures (
|
|||||||
IN UINT8 *TableAddress
|
IN UINT8 *TableAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Locates and extracts the QEMU SMBIOS table data if present in fw_cfg
|
|
||||||
|
|
||||||
@return Address of extracted QEMU SMBIOS data
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT8 *
|
|
||||||
GetQemuSmbiosTables (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,13 +27,6 @@
|
|||||||
Qemu.c
|
Qemu.c
|
||||||
SmbiosPlatformDxe.c
|
SmbiosPlatformDxe.c
|
||||||
SmbiosPlatformDxe.h
|
SmbiosPlatformDxe.h
|
||||||
XenSmbiosPlatformDxe.h
|
|
||||||
|
|
||||||
[Sources.IA32, Sources.X64]
|
|
||||||
X86Xen.c
|
|
||||||
|
|
||||||
[Sources.ARM, Sources.AARCH64]
|
|
||||||
ArmXen.c
|
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
@ -47,19 +40,12 @@
|
|||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
|
|
||||||
[LibraryClasses.IA32, LibraryClasses.X64]
|
|
||||||
BaseLib
|
|
||||||
HobLib
|
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
|
gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
[Guids.IA32, Guids.X64]
|
|
||||||
gEfiXenInfoGuid
|
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
gEfiSmbiosProtocolGuid
|
gEfiSmbiosProtocolGuid
|
||||||
|
|
||||||
|
49
OvmfPkg/SmbiosPlatformDxe/Xen.c
Normal file
49
OvmfPkg/SmbiosPlatformDxe/Xen.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/** @file
|
||||||
|
This driver installs SMBIOS information for OVMF on Xen
|
||||||
|
|
||||||
|
Copyright (C) 2021, Red Hat, Inc.
|
||||||
|
Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
|
||||||
|
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "SmbiosPlatformDxe.h"
|
||||||
|
#include "XenSmbiosPlatformDxe.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Installs SMBIOS information for OVMF on Xen
|
||||||
|
|
||||||
|
@param ImageHandle Module's image handle
|
||||||
|
@param SystemTable Pointer of EFI_SYSTEM_TABLE
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Smbios data successfully installed
|
||||||
|
@retval Other Smbios data was not installed
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
XenSmbiosTablePublishEntry (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;
|
||||||
|
UINT8 *SmbiosTables;
|
||||||
|
|
||||||
|
Status = EFI_NOT_FOUND;
|
||||||
|
//
|
||||||
|
// Add Xen SMBIOS data if found
|
||||||
|
//
|
||||||
|
EntryPointStructure = GetXenSmbiosTables ();
|
||||||
|
if (EntryPointStructure != NULL) {
|
||||||
|
SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
|
||||||
|
if (SmbiosTables != NULL) {
|
||||||
|
Status = InstallAllStructures (SmbiosTables);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
MODULE_TYPE = DXE_DRIVER
|
MODULE_TYPE = DXE_DRIVER
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
|
|
||||||
ENTRY_POINT = SmbiosTablePublishEntry
|
ENTRY_POINT = XenSmbiosTablePublishEntry
|
||||||
|
|
||||||
#
|
#
|
||||||
# The following information is for reference only and not required by the build tools.
|
# The following information is for reference only and not required by the build tools.
|
||||||
@ -25,9 +25,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
Qemu.c
|
|
||||||
SmbiosPlatformDxe.c
|
SmbiosPlatformDxe.c
|
||||||
SmbiosPlatformDxe.h
|
SmbiosPlatformDxe.h
|
||||||
|
Xen.c
|
||||||
XenSmbiosPlatformDxe.h
|
XenSmbiosPlatformDxe.h
|
||||||
|
|
||||||
[Sources.IA32, Sources.X64]
|
[Sources.IA32, Sources.X64]
|
||||||
@ -38,13 +38,12 @@
|
|||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
|
[Packages.IA32, Packages.X64]
|
||||||
OvmfPkg/OvmfPkg.dec
|
OvmfPkg/OvmfPkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
DebugLib
|
DebugLib
|
||||||
MemoryAllocationLib
|
|
||||||
PcdLib
|
|
||||||
QemuFwCfgLib
|
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
|
|
||||||
@ -52,9 +51,6 @@
|
|||||||
BaseLib
|
BaseLib
|
||||||
HobLib
|
HobLib
|
||||||
|
|
||||||
[Pcd]
|
|
||||||
gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
|
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user