\r
#include <Guid/VariableFormat.h>\r
#include <Guid/SystemNvDataGuid.h>\r
+#include <Guid/NvVarStoreFormatted.h>\r
\r
#include "NorFlashDxe.h"\r
\r
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
\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
}\r
\r
// How many Lba blocks are we requested to erase?\r
- NumOfLba = VA_ARG (Args, UINT32);\r
+ NumOfLba = VA_ARG (Args, UINTN);\r
\r
// All blocks must be within range\r
- DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks: Check if: ( StartingLba=%ld + NumOfLba=%d - 1 ) > LastBlock=%ld.\n", Instance->StartLba + StartingLba, NumOfLba, Instance->Media.LastBlock));\r
+ DEBUG ((\r
+ DEBUG_BLKIO,\r
+ "FvbEraseBlocks: Check if: ( StartingLba=%ld + NumOfLba=%Lu - 1 ) > LastBlock=%ld.\n",\r
+ Instance->StartLba + StartingLba,\r
+ (UINT64)NumOfLba,\r
+ Instance->Media.LastBlock\r
+ ));\r
if ((NumOfLba == 0) || ((Instance->StartLba + StartingLba + NumOfLba - 1) > Instance->Media.LastBlock)) {\r
VA_END (Args);\r
DEBUG ((EFI_D_ERROR, "FvbEraseBlocks: ERROR - Lba range goes past the last Lba.\n"));\r
}\r
\r
// How many Lba blocks are we requested to erase?\r
- NumOfLba = VA_ARG (Args, UINT32);\r
+ NumOfLba = VA_ARG (Args, UINTN);\r
\r
// Go through each one and erase it\r
while (NumOfLba > 0) {\r
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
}\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