Revision: 16773
          http://sourceforge.net/p/edk2/code/16773
Author:   vanjeff
Date:     2015-02-05 07:28:03 +0000 (Thu, 05 Feb 2015)
Log Message:
-----------
SecurityPkg Variable: Introduce PcdReclaimVariableSpaceAtEndOfDxe

For trying to reclaim variable space at EndOfDxe.

(Sync patch r16688 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/16688

Modified Paths:
--------------
    branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
    
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableDxe.c
    
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
    
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c
    
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.inf

Modified: 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
===================================================================
--- 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c    
    2015-02-05 07:23:28 UTC (rev 16772)
+++ 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c    
    2015-02-05 07:28:03 UTC (rev 16773)
@@ -3453,7 +3453,16 @@
   UINTN                          CommonVariableSpace;
   UINTN                          RemainingCommonVariableSpace;
   UINTN                          RemainingHwErrVariableSpace;
+  STATIC BOOLEAN                 Reclaimed;
 
+  //
+  // This function will be called only once at EndOfDxe or ReadyToBoot event.
+  //
+  if (Reclaimed) {
+    return;
+  }
+  Reclaimed = TRUE;
+
   Status  = EFI_SUCCESS;
 
   CommonVariableSpace = ((VARIABLE_STORE_HEADER *) ((UINTN) 
(mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase)))->Size - 
sizeof (VARIABLE_STORE_HEADER) - PcdGet32(PcdHwErrStorageSize); //Allowable max 
size of common variable storage space

Modified: 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableDxe.c
===================================================================
--- 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableDxe.c 
    2015-02-05 07:23:28 UTC (rev 16772)
+++ 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableDxe.c 
    2015-02-05 07:28:03 UTC (rev 16773)
@@ -310,6 +310,9 @@
   )
 {
   mEndOfDxe = TRUE;
+  if (PcdGetBool (PcdReclaimVariableSpaceAtEndOfDxe)) {
+    ReclaimForOS ();
+  }
 }
 
 /**

Modified: 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
===================================================================
--- 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
    2015-02-05 07:23:28 UTC (rev 16772)
+++ 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableRuntimeDxe.inf
    2015-02-05 07:28:03 UTC (rev 16773)
@@ -138,6 +138,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize     ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize                ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize                 ## 
CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdReclaimVariableSpaceAtEndOfDxe   ## 
CONSUMES
 
 [FeaturePcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics        ## 
CONSUMES  # statistic the information of variable.

Modified: 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c
===================================================================
--- 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c 
    2015-02-05 07:23:28 UTC (rev 16772)
+++ 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c 
    2015-02-05 07:28:03 UTC (rev 16773)
@@ -785,6 +785,9 @@
 {
   DEBUG ((EFI_D_INFO, "[Variable]END_OF_DXE is signaled\n"));
   mEndOfDxe = TRUE;
+  if (PcdGetBool (PcdReclaimVariableSpaceAtEndOfDxe)) {
+    ReclaimForOS ();
+  }
   return EFI_SUCCESS;
 }
 

Modified: 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.inf
===================================================================
--- 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.inf
   2015-02-05 07:23:28 UTC (rev 16772)
+++ 
branches/UDK2014.SP1/SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.inf
   2015-02-05 07:28:03 UTC (rev 16773)
@@ -144,7 +144,8 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize     ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize                ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize                 ## 
CONSUMES
-  
+  gEfiMdeModulePkgTokenSpaceGuid.PcdReclaimVariableSpaceAtEndOfDxe   ## 
CONSUMES
+
 [FeaturePcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics        ## 
CONSUMES  # statistic the information of variable.
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate       ## 
CONSUMES  # Auto update PlatformLang/Lang


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to