In the next patch we'll add a driver that exposes the SMM System
Management System Table (normally only accessible in SMM) to the world.

For this purpose we allocate a PCD called PcdDiscloseSmstPtrPtr that
contains a pointer to the pointer to the SMST.

PCD value,          pointer to
lost at warm  --->  SMST in runtime  --->  SMST: also survives
reboot but          storage:
recreated           survives warm
with same           reboot
value               (reallocated
                    in same spot)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/PlatformPei/PlatformPei.inf | 1 +
 OvmfPkg/PlatformPei/Platform.c      | 4 ++++
 OvmfPkg/OvmfPkg.dec                 | 5 +++++
 3 files changed, 10 insertions(+)

diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
b/OvmfPkg/PlatformPei/PlatformPei.inf
index 80b3c31..a306319 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -61,10 +61,11 @@
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
   gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaSize
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaBase
+  gUefiOvmfPkgTokenSpaceGuid.PcdDiscloseSmstPtrPtr
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
   gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index db045f4..426ff45 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -318,10 +318,14 @@ ReserveEmuSmmArea (
   // Resume.
   //
   Address = AllocateRuntimePool (AreaSize);
   ASSERT (Address != NULL);
   PcdSet64 (PcdEmuSmmAreaBase, (UINT64)(UINTN) Address);
+
+  Address = AllocateRuntimePool (sizeof (UINT64));
+  ASSERT (Address != NULL);
+  PcdSet64 (PcdDiscloseSmstPtrPtr, (UINT64)(UINTN) Address);
 }
 
 
 VOID
 DebugDumpCmos (
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 21105ad..cfc0fc3 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -92,7 +92,12 @@
   #  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
 
+  ## The DiscloseSmstSmm SMM driver stores the address of the System Management
+  #  System Table in the location pointed to by this PCD. The EmuSmmPei PEIM
+  #  fetches the SMST address from the same location.
+  gUefiOvmfPkgTokenSpaceGuid.PcdDiscloseSmstPtrPtr|0x0|UINT64|0x13
+
 [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

Reply via email to