This patch is to make sure at least VARIABLE_RECLAIM_THRESHOLD (1024) bytes of spaces must be available in NV variable region. This conservative approach is make sure OS loader will have space to save important data.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1697 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2006-10-10 02:21:51 +00:00
parent 5f5f28c90d
commit c65c1e1e14
2 changed files with 18 additions and 0 deletions

View File

@ -1388,6 +1388,23 @@ Returns:
mVariableModuleGlobal->NonVolatileLastVariableOffset = (UINTN) NextVariable - (UINTN) CurrPtr; mVariableModuleGlobal->NonVolatileLastVariableOffset = (UINTN) NextVariable - (UINTN) CurrPtr;
//
// Check if the free area is blow a threshold
//
if ((((VARIABLE_STORE_HEADER *)((UINTN) CurrPtr))->Size - mVariableModuleGlobal->NonVolatileLastVariableOffset) < VARIABLE_RECLAIM_THRESHOLD) {
Status = Reclaim (
mVariableModuleGlobal->VariableBase[Physical].NonVolatileVariableBase,
&mVariableModuleGlobal->NonVolatileLastVariableOffset,
FALSE
);
}
if (EFI_ERROR (Status)) {
gBS->FreePool (mVariableModuleGlobal);
gBS->FreePool (VolatileVariableStore);
return Status;
}
// //
// Check if the free area is really free. // Check if the free area is really free.
// //

View File

@ -35,6 +35,7 @@ Abstract:
#define ALIGNMENT 1 #define ALIGNMENT 1
#endif #endif
#define VARIABLE_RECLAIM_THRESHOLD (1024)
#define VARIABLE_STORE_SIZE (64 * 1024) #define VARIABLE_STORE_SIZE (64 * 1024)
#define SCRATCH_SIZE (4 * 1024) #define SCRATCH_SIZE (4 * 1024)