diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 9f015f1aae..6342b5c306 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -357,6 +357,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208 + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform. diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 2dc92047ef..f1230bf5a7 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -363,6 +363,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208 + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform. diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 48a7a8d2e9..e5fc90d2e6 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -362,6 +362,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208 + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform. diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 1ad5bfc26a..2105787961 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -32,9 +32,11 @@ #include #include #include +#include #include #include #include +#include #include #include "Platform.h" @@ -377,6 +379,41 @@ 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. @@ -426,6 +463,8 @@ InitializePlatform ( PeiFvInitialization (); MemMapInitialization (); + + SmbiosVersionInitialization (); } MiscInitialization (); diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index 0307bca913..721495b874 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -58,6 +58,7 @@ QemuFwCfgLib MtrrLib PcdLib + BaseMemoryLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase @@ -81,6 +82,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress [Ppis]