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
This commit is contained in:
Laszlo Ersek 2015-08-06 10:13:42 +00:00 committed by lersek
parent b265ed9284
commit 98937dc293
5 changed files with 12 additions and 44 deletions

View File

@ -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
#

View File

@ -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
#

View File

@ -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
#

View File

@ -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"
@ -381,41 +379,6 @@ DebugDumpCmos (
}
/**
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.
@ -466,8 +429,6 @@ InitializePlatform (
PeiFvInitialization ();
MemMapInitialization ();
SmbiosVersionInitialization ();
}
MiscInitialization ();

View File

@ -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