The same trick is used as for the original NvVars emulation; the allocation is done early so that it ends up at an invariant address across warm reboot.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- OvmfPkg/PlatformPei/PlatformPei.inf | 2 ++ OvmfPkg/PlatformPei/Platform.c | 24 ++++++++++++++++++++++++ OvmfPkg/OvmfPkg.dec | 11 +++++++++++ 3 files changed, 37 insertions(+) diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index 3d5cbbb..80b3c31 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -59,10 +59,12 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress + gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaSize + gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaBase gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index fb56e99..db045f4 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -299,10 +299,33 @@ ReserveEmuVariableNvStore ( PcdSet64 (PcdEmuVariableNvStoreReserved, VariableStore); } VOID +ReserveEmuSmmArea ( + ) +{ + UINT32 AreaSize; + VOID *Address; + + AreaSize = PcdGet32 (PcdEmuSmmAreaSize); + if (AreaSize == 0) { + return; + } + + // + // We use the same trick here as in ReserveEmuVariableNvStore(). This area + // expressly doesn't need to survive cold reboots, only S3 Suspend and + // Resume. + // + Address = AllocateRuntimePool (AreaSize); + ASSERT (Address != NULL); + PcdSet64 (PcdEmuSmmAreaBase, (UINT64)(UINTN) Address); +} + + +VOID DebugDumpCmos ( VOID ) { UINTN Loop; @@ -346,10 +369,11 @@ InitializePlatform ( TopOfMemory = MemDetect (); InitializeXen (); ReserveEmuVariableNvStore (); + ReserveEmuSmmArea (); PeiFvInitialization (); MemMapInitialization (TopOfMemory); diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 9d7fedf..21105ad 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -67,10 +67,15 @@ # so that scanning the number of devices given by their product is still # acceptably fast. gUefiOvmfPkgTokenSpaceGuid.PcdVirtioScsiMaxTargetLimit|31|UINT16|6 gUefiOvmfPkgTokenSpaceGuid.PcdVirtioScsiMaxLunLimit|7|UINT32|7 + ## This PCD determines the size of the runtime pool allocation that we + # reserve in PlatformPei as backing store for EmuSmmDxe (ie. SMRAM + # emulation). Zero size disables SMRAM emulation. + gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaSize|0x00100000|UINT32|0x11 + [PcdsFixedAtBuild] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x0|UINT32|0xa gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize|0|UINT32|0xb @@ -81,7 +86,13 @@ [PcdsDynamic, PcdsDynamicEx] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10 + ## The following PCD carries from PlatformPei to EmuSmmDxe the base address + # of the runtime pool allocation that we reserve as backing store for SMRAM + # emulation. Its type cannot be VOID* because PEI and DXE can have different + # bitnesses. + gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaBase|0x0|UINT64|0x12 + [PcdsFeatureFlag] gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootEnable|FALSE|BOOLEAN|3 -- 1.8.3.1 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel