UINTN RuntimeMmioRegionSize;\r
\r
DEBUG((DEBUG_BLKIO,"NorFlashFvbInitialize\n"));\r
+ ASSERT((Instance != NULL));\r
+\r
+ //\r
+ // Declare the Non-Volatile storage as EFI_MEMORY_RUNTIME\r
+ //\r
+\r
+ // Note: all the NOR Flash region needs to be reserved into the UEFI Runtime memory;\r
+ // even if we only use the small block region at the top of the NOR Flash.\r
+ // The reason is when the NOR Flash memory is set into program mode, the command\r
+ // is written as the base of the flash region (ie: Instance->DeviceBaseAddress)\r
+ RuntimeMmioRegionSize = (Instance->RegionBaseAddress - Instance->DeviceBaseAddress) + Instance->Size;\r
+\r
+ Status = gDS->AddMemorySpace (\r
+ EfiGcdMemoryTypeMemoryMappedIo,\r
+ Instance->DeviceBaseAddress, RuntimeMmioRegionSize,\r
+ EFI_MEMORY_UC | EFI_MEMORY_RUNTIME\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ Status = gDS->SetMemorySpaceAttributes (\r
+ Instance->DeviceBaseAddress, RuntimeMmioRegionSize,\r
+ EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);\r
+ ASSERT_EFI_ERROR (Status);\r
\r
Instance->Initialized = TRUE;\r
mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);\r
}\r
}\r
\r
- //\r
- // Declare the Non-Volatile storage as EFI_MEMORY_RUNTIME\r
- //\r
-\r
- // Note: all the NOR Flash region needs to be reserved into the UEFI Runtime memory;\r
- // even if we only use the small block region at the top of the NOR Flash.\r
- // The reason is when the NOR Flash memory is set into program mode, the command\r
- // is written as the base of the flash region (ie: Instance->DeviceBaseAddress)\r
- RuntimeMmioRegionSize = (Instance->RegionBaseAddress - Instance->DeviceBaseAddress) + Instance->Size;\r
-\r
- Status = gDS->AddMemorySpace (\r
- EfiGcdMemoryTypeMemoryMappedIo,\r
- Instance->DeviceBaseAddress, RuntimeMmioRegionSize,\r
- EFI_MEMORY_UC | EFI_MEMORY_RUNTIME\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Status = gDS->SetMemorySpaceAttributes (\r
- Instance->DeviceBaseAddress, RuntimeMmioRegionSize,\r
- EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Register for the virtual address change event\r
//\r