]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
ArmPlatformPkg/NorFlashDxe: cue the variable driver with NvVarStoreFormatted
[mirror_edk2.git] / ArmPlatformPkg / Drivers / NorFlashDxe / NorFlashFvbDxe.c
index 3ea858f46ffba8244b98cce7feba32dd3d741ed9..e62ffbb433d08784b377b112b7b4a35bab887e06 100644 (file)
@@ -25,6 +25,7 @@
 \r
 #include <Guid/VariableFormat.h>\r
 #include <Guid/SystemNvDataGuid.h>\r
+#include <Guid/NvVarStoreFormatted.h>\r
 \r
 #include "NorFlashDxe.h"\r
 \r
@@ -59,10 +60,6 @@ InitializeFvAndVariableStoreHeaders (
   EFI_FIRMWARE_VOLUME_HEADER          *FirmwareVolumeHeader;\r
   VARIABLE_STORE_HEADER               *VariableStoreHeader;\r
 \r
-  if (!Instance->Initialized && Instance->Initialize) {\r
-    Instance->Initialize (Instance);\r
-  }\r
-\r
   HeadersLength = sizeof(EFI_FIRMWARE_VOLUME_HEADER) + sizeof(EFI_FV_BLOCK_MAP_ENTRY) + sizeof(VARIABLE_STORE_HEADER);\r
   Headers = AllocateZeroPool(HeadersLength);\r
 \r
@@ -431,10 +428,6 @@ FvbRead (
 \r
   DEBUG ((DEBUG_BLKIO, "FvbRead(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Instance->StartLba + Lba, Offset, *NumBytes, Buffer));\r
 \r
-  if (!Instance->Initialized && Instance->Initialize) {\r
-    Instance->Initialize(Instance);\r
-  }\r
-\r
   TempStatus = EFI_SUCCESS;\r
 \r
   // Cache the block size to avoid de-referencing pointers all the time\r
@@ -749,7 +742,6 @@ NorFlashFvbInitialize (
       EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  Instance->Initialized = TRUE;\r
   mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);\r
 \r
   // Set the index of the first LBA for the FVB\r
@@ -785,6 +777,18 @@ NorFlashFvbInitialize (
     }\r
   }\r
 \r
+  //\r
+  // The driver implementing the variable read service can now be dispatched;\r
+  // the varstore headers are in place.\r
+  //\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &gImageHandle,\r
+                  &gEdkiiNvVarStoreFormattedGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   //\r
   // Register for the virtual address change event\r
   //\r