35 VariableRuntimeCacheContext = &mVariableModuleGlobal->VariableGlobal.VariableRuntimeCacheContext;
37 if ((VariableRuntimeCacheContext->VariableRuntimeNvCache.Store ==
NULL) ||
38 (VariableRuntimeCacheContext->VariableRuntimeVolatileCache.Store ==
NULL) ||
39 (VariableRuntimeCacheContext->PendingUpdate ==
NULL))
41 return EFI_UNSUPPORTED;
44 if (*(VariableRuntimeCacheContext->PendingUpdate)) {
45 if ((VariableRuntimeCacheContext->VariableRuntimeHobCache.Store !=
NULL) &&
46 (mVariableModuleGlobal->VariableGlobal.HobVariableBase > 0))
50 ((UINT8 *)(
UINTN)VariableRuntimeCacheContext->VariableRuntimeHobCache.Store) +
51 VariableRuntimeCacheContext->VariableRuntimeHobCache.PendingUpdateOffset
54 ((UINT8 *)(
UINTN)mVariableModuleGlobal->VariableGlobal.HobVariableBase) +
55 VariableRuntimeCacheContext->VariableRuntimeHobCache.PendingUpdateOffset
57 VariableRuntimeCacheContext->VariableRuntimeHobCache.PendingUpdateLength
59 VariableRuntimeCacheContext->VariableRuntimeHobCache.PendingUpdateLength = 0;
60 VariableRuntimeCacheContext->VariableRuntimeHobCache.PendingUpdateOffset = 0;
65 ((UINT8 *)(
UINTN)VariableRuntimeCacheContext->VariableRuntimeNvCache.Store) +
66 VariableRuntimeCacheContext->VariableRuntimeNvCache.PendingUpdateOffset
70 VariableRuntimeCacheContext->VariableRuntimeNvCache.PendingUpdateOffset
72 VariableRuntimeCacheContext->VariableRuntimeNvCache.PendingUpdateLength
74 VariableRuntimeCacheContext->VariableRuntimeNvCache.PendingUpdateLength = 0;
75 VariableRuntimeCacheContext->VariableRuntimeNvCache.PendingUpdateOffset = 0;
79 ((UINT8 *)(
UINTN)VariableRuntimeCacheContext->VariableRuntimeVolatileCache.Store) +
80 VariableRuntimeCacheContext->VariableRuntimeVolatileCache.PendingUpdateOffset
83 ((UINT8 *)(
UINTN)mVariableModuleGlobal->VariableGlobal.VolatileVariableBase) +
84 VariableRuntimeCacheContext->VariableRuntimeVolatileCache.PendingUpdateOffset
86 VariableRuntimeCacheContext->VariableRuntimeVolatileCache.PendingUpdateLength
88 VariableRuntimeCacheContext->VariableRuntimeVolatileCache.PendingUpdateLength = 0;
89 VariableRuntimeCacheContext->VariableRuntimeVolatileCache.PendingUpdateOffset = 0;
90 *(VariableRuntimeCacheContext->PendingUpdate) =
FALSE;
120 if (VariableRuntimeCache ==
NULL) {
121 return EFI_INVALID_PARAMETER;
122 }
else if (VariableRuntimeCache->Store ==
NULL) {
128 if ((mVariableModuleGlobal->VariableGlobal.VariableRuntimeCacheContext.PendingUpdate ==
NULL) ||
129 (mVariableModuleGlobal->VariableGlobal.VariableRuntimeCacheContext.ReadLock ==
NULL))
131 return EFI_UNSUPPORTED;
134 if (*(mVariableModuleGlobal->VariableGlobal.VariableRuntimeCacheContext.PendingUpdate) &&
135 (VariableRuntimeCache->PendingUpdateLength > 0))
137 VariableRuntimeCache->PendingUpdateLength =
140 (
UINTN)(VariableRuntimeCache->PendingUpdateOffset + VariableRuntimeCache->PendingUpdateLength),
142 ) -
MIN ((
UINTN)VariableRuntimeCache->PendingUpdateOffset, Offset)
144 VariableRuntimeCache->PendingUpdateOffset =
145 (UINT32)
MIN ((
UINTN)VariableRuntimeCache->PendingUpdateOffset, Offset);
147 VariableRuntimeCache->PendingUpdateLength = (UINT32)Length;
148 VariableRuntimeCache->PendingUpdateOffset = (UINT32)Offset;
151 *(mVariableModuleGlobal->VariableGlobal.VariableRuntimeCacheContext.PendingUpdate) =
TRUE;
153 if (*(mVariableModuleGlobal->VariableGlobal.VariableRuntimeCacheContext.ReadLock) ==
FALSE) {
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS FlushPendingRuntimeVariableCacheUpdates(VOID)
VARIABLE_STORE_HEADER * mNvVariableCache
EFI_STATUS SynchronizeRuntimeVariableCache(IN VARIABLE_RUNTIME_CACHE *VariableRuntimeCache, IN UINTN Offset, IN UINTN Length)