]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeCache.h
MdeModulePkg/Variable: Add RT GetVariable() cache support
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / VariableRuntimeCache.h
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeCache.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeCache.h
new file mode 100644 (file)
index 0000000..f9804a1
--- /dev/null
@@ -0,0 +1,51 @@
+/** @file\r
+  The common variable volatile store routines shared by the DXE_RUNTIME variable\r
+  module and the DXE_SMM variable module.\r
+\r
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _VARIABLE_RUNTIME_CACHE_H_\r
+#define _VARIABLE_RUNTIME_CACHE_H_\r
+\r
+#include "Variable.h"\r
+\r
+/**\r
+  Copies any pending updates to runtime variable caches.\r
+\r
+  @retval EFI_UNSUPPORTED         The volatile store to be updated is not initialized properly.\r
+  @retval EFI_SUCCESS             The volatile store was updated successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+FlushPendingRuntimeVariableCacheUpdates (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Synchronizes the runtime variable caches with all pending updates outside runtime.\r
+\r
+  Ensures all conditions are met to maintain coherency for runtime cache updates. This function will attempt\r
+  to write the given update (and any other pending updates) if the ReadLock is available. Otherwise, the\r
+  update is added as a pending update for the given variable store and it will be flushed to the runtime cache\r
+  at the next opportunity the ReadLock is available.\r
+\r
+  @param[in] VariableRuntimeCache Variable runtime cache structure for the runtime cache being synchronized.\r
+  @param[in] Offset               Offset in bytes to apply the update.\r
+  @param[in] Length               Length of data in bytes of the update.\r
+\r
+  @retval EFI_SUCCESS             The update was added as a pending update successfully. If the variable runtime\r
+                                  cache ReadLock was available, the runtime cache was updated successfully.\r
+  @retval EFI_UNSUPPORTED         The volatile store to be updated is not initialized properly.\r
+\r
+**/\r
+EFI_STATUS\r
+SynchronizeRuntimeVariableCache (\r
+  IN  VARIABLE_RUNTIME_CACHE          *VariableRuntimeCache,\r
+  IN  UINTN                           Offset,\r
+  IN  UINTN                           Length\r
+  );\r
+\r
+#endif\r