Revision: 18823
          http://sourceforge.net/p/edk2/code/18823
Author:   lersek
Date:     2015-11-16 18:29:14 +0000 (Mon, 16 Nov 2015)
Log Message:
-----------
MdeModulePkg: SmmLockBoxPeiLib: work without EFI_PEI_SMM_COMMUNICATION_PPI

The RestoreLockBox() and RestoreAllLockBoxInPlace() functions handle the
case when EFI_PEI_SMM_COMMUNICATION_PPI.Communicate() returns
EFI_NOT_STARTED: they access the SMRAM directly, for restoring LockBox
data.

This occurs if a PEIM needs to restore LockBox data *before* the SMBASE is
relocated and the SMI handler is installed for all processors.

One such PEIM is UefiCpuPkg/Universal/Acpi/S3Resume2Pei. On the S3 resume
path, in function S3RestoreConfig2(), LockBox data are restored *before*
the SmmRestoreCpu() function of UefiCpuPkg/PiSmmCpuDxeSmm is called via
SmmS3ResumeState->SmmS3ResumeEntryPoint. (The latter SmmRestoreCpu()
function is responsible for the SMBASE relocation.)

If a platform knows that its PEIMs restore LockBox data *only* before
SMBASE relocation -- e.g., due to S3Resume2Pei being the platform's only
SmmLockBoxPeiLib client --, then the platform might not want to include
"UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf" at all (hence
not provide EFI_PEI_SMM_COMMUNICATION_PPI) -- because all of those
restores would be serviced by direct SMRAM access anyway.

Currently the absence of EFI_PEI_SMM_COMMUNICATION_PPI is not supported by
SmmLockBoxPeiLib, but it's not hard to implement. Handle it the same as
when EFI_PEI_SMM_COMMUNICATION_PPI.Communicate() returns EFI_NOT_STARTED:
restore LockBox data directly from SMRAM.

Suggested-by: Jiewen Yao <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Michael Kinney <[email protected]>
Cc: Jordan Justen <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c

Modified: trunk/edk2/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c
===================================================================
--- trunk/edk2/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c    
2015-11-16 08:20:17 UTC (rev 18822)
+++ trunk/edk2/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c    
2015-11-16 18:29:14 UTC (rev 18823)
@@ -563,7 +563,10 @@
              (VOID **)&SmmCommunicationPpi
              );
   if (EFI_ERROR (Status)) {
-    return EFI_NOT_STARTED;
+    DEBUG ((EFI_D_INFO, "SmmLockBoxPeiLib LocatePpi - (%r)\n", Status));
+    Status = InternalRestoreLockBoxFromSmram (Guid, Buffer, Length);
+    DEBUG ((EFI_D_INFO, "SmmLockBoxPeiLib RestoreLockBox - Exit (%r)\n", 
Status));
+    return Status;
   }
 
   //
@@ -682,7 +685,10 @@
              (VOID **)&SmmCommunicationPpi
              );
   if (EFI_ERROR (Status)) {
-    return EFI_NOT_STARTED;
+    DEBUG ((EFI_D_INFO, "SmmLockBoxPeiLib LocatePpi - (%r)\n", Status));
+    Status = InternalRestoreAllLockBoxInPlaceFromSmram ();
+    DEBUG ((EFI_D_INFO, "SmmLockBoxPeiLib RestoreAllLockBoxInPlace - Exit 
(%r)\n", Status));
+    return Status;
   }
 
   //


------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a 
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to