[edk2] [RFC v2 10/24] OvmfPkg: PlatformPei: reserve storage for disclosing SMST

Subject: [edk2] [RFC v2 10/24] OvmfPkg: PlatformPei: reserve storage for disclosing SMST

From: Laszlo Ersek <lersek@redhat.com>

To: edk2-devel@lists.sourceforge.net

Date: 2013-12-10 12:55:52

  • 2013-12-10 12:55:52  Laszlo Ersek   [edk2] [RFC v2 10/24] OvmfPkg: PlatformPei: reserve storage for disclosing SMST
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 
---
 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 8811542..028a640 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -63,6 +63,7 @@
   gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaSize
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuSmmAreaBase
+  gUefiOvmfPkgTokenSpaceGuid.PcdDiscloseSmstPtrPtr
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 4bce240..2616757 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -393,6 +393,10 @@ ReserveEmuSmmArea (
   Address = AllocateRuntimePool (AreaSize);
   ASSERT (Address != NULL);
   PcdSet64 (PcdEmuSmmAreaBase, (UINT64)(UINTN) Address);
+
+  Address = AllocateRuntimePool (sizeof (UINT64));
+  ASSERT (Address != NULL);
+  PcdSet64 (PcdDiscloseSmstPtrPtr, (UINT64)(UINTN) Address);
 }
 
 
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 21105ad..cfc0fc3 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -94,5 +94,10 @@
   #  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



------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel