]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
Variable driver: add checking to make sure flash is properly initialized
[mirror_edk2.git] / EdkModulePkg / Universal / Variable / RuntimeDxe / Variable.c
index e224558651e24fa5c100a9ea1b0435b630a83d73..589217a992c3a88e28ce9b362159b994e9485f9e 100644 (file)
@@ -1403,6 +1403,15 @@ Returns:
                 sizeof (UINT32),\r
                 (UINT8 *) &VariableStoreEntry.Length\r
                 );\r
+      // \r
+      // As Variables are stored in NV storage, which are slow devices,such as flash.\r
+      // Variable operation may skip checking variable program result to improve performance,\r
+      // We can assume Variable program is OK through some check point.\r
+      // Variable Store Size Setting should be the first Variable write operation,\r
+      // We can assume all Read/Write is OK if we can set Variable store size successfully.\r
+      // If write fail, we will assert here\r
+      //\r
+      ASSERT(VariableStoreHeader->Size == VariableStoreEntry.Length);\r
 \r
       if (EFI_ERROR (Status)) {\r
         return Status;\r