OvmfPkg: set SMBIOS version in DetectSmbiosVersionLib instead of PlatformPei
This patch de-duplicates the logic added in commit
OvmfPkg: PlatformPei: set SMBIOS entry point version dynamically
(git 37baf06b, SVN r17676) by hooking DetectSmbiosVersionLib into
SmbiosDxe.
Although said commit was supposed to work with SMBIOS 3.0 payloads from
QEMU, in practice that never worked, because the size / signature checks
in SmbiosVersionInitialization() would always fail, due to the SMBIOS 3.0
entry point being structurally different. Therefore this patch doesn't
regress OvmfPkg.
Cc: Wei Huang <wei@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gabriel L. Somlo <somlo@cmu.edu>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18175 6f19259b-4bc3-4df7-8a09-765794883524
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 2bfc7aa..aeb0d8d 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -504,7 +504,10 @@
#
# SMBIOS Support
#
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf {
+ <LibraryClasses>
+ NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf
+ }
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
#
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index d9d6eeb..69e2932 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -511,7 +511,10 @@
#
# SMBIOS Support
#
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf {
+ <LibraryClasses>
+ NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf
+ }
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
#
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index a86a7f5..3d8351d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -509,7 +509,10 @@
#
# SMBIOS Support
#
- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf {
+ <LibraryClasses>
+ NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf
+ }
OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
#
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 87c51d7..9970d14 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -32,11 +32,9 @@
#include <Library/PeiServicesLib.h>
#include <Library/QemuFwCfgLib.h>
#include <Library/ResourcePublicationLib.h>
-#include <Library/BaseMemoryLib.h>
#include <Guid/MemoryTypeInformation.h>
#include <Ppi/MasterBootMode.h>
#include <IndustryStandard/Pci22.h>
-#include <IndustryStandard/SmBios.h>
#include <OvmfPlatforms.h>
#include "Platform.h"
@@ -382,41 +380,6 @@
/**
- Set the SMBIOS entry point version for the generic SmbiosDxe driver.
-**/
-STATIC
-VOID
-SmbiosVersionInitialization (
- VOID
- )
-{
- FIRMWARE_CONFIG_ITEM Anchor;
- UINTN AnchorSize;
- SMBIOS_TABLE_ENTRY_POINT QemuAnchor;
- UINT16 SmbiosVersion;
-
- if (RETURN_ERROR (QemuFwCfgFindFile ("etc/smbios/smbios-anchor", &Anchor,
- &AnchorSize)) ||
- AnchorSize != sizeof QemuAnchor) {
- return;
- }
-
- QemuFwCfgSelectItem (Anchor);
- QemuFwCfgReadBytes (AnchorSize, &QemuAnchor);
- if (CompareMem (QemuAnchor.AnchorString, "_SM_", 4) != 0 ||
- CompareMem (QemuAnchor.IntermediateAnchorString, "_DMI_", 5) != 0) {
- return;
- }
-
- SmbiosVersion = (UINT16)(QemuAnchor.MajorVersion << 8 |
- QemuAnchor.MinorVersion);
- DEBUG ((EFI_D_INFO, "%a: SMBIOS version from QEMU: 0x%04x\n", __FUNCTION__,
- SmbiosVersion));
- PcdSet16 (PcdSmbiosVersion, SmbiosVersion);
-}
-
-
-/**
Perform Platform PEI initialization.
@param FileHandle Handle of the file being invoked.
@@ -466,8 +429,6 @@
PeiFvInitialization ();
MemMapInitialization ();
-
- SmbiosVersionInitialization ();
}
MiscInitialization ();
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index cb7d7dd..81335a9 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -58,7 +58,6 @@
QemuFwCfgLib
MtrrLib
PcdLib
- BaseMemoryLib
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase
@@ -82,7 +81,6 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
- gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress