#include <Library/PrePiHobListPointerLib.h>\r
#include <Library/TimerLib.h>\r
#include <Library/PerformanceLib.h>\r
+#include <Library/CacheMaintenanceLib.h>\r
\r
#include <Ppi/GuidedSectionExtraction.h>\r
#include <Ppi/ArmMpCoreInfo.h>\r
// Initialize the architecture specific bits\r
ArchInitialize ();\r
\r
- // Initialize the Serial Port\r
- SerialPortInitialize ();\r
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r",\r
- (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);\r
- SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
-\r
// Declare the PI/UEFI memory region\r
HobList = HobConstructor (\r
(VOID*)UefiMemoryBase,\r
);\r
PrePeiSetHobList (HobList);\r
\r
+ //\r
+ // Ensure that the loaded image is invalidated in the caches, so that any\r
+ // modifications we made with the caches and MMU off (such as the applied\r
+ // relocations) don't become invisible once we turn them on.\r
+ //\r
+ InvalidateDataCacheRange((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), PcdGet32 (PcdFdSize));\r
+\r
// Initialize MMU and Memory HOBs (Resource Descriptor HOBs)\r
Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));\r
ASSERT_EFI_ERROR (Status);\r
\r
+ // Initialize the Serial Port\r
+ SerialPortInitialize ();\r
+ CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %s built at %a on %a)\n\r",\r
+ (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__);\r
+ SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
+\r
// Create the Stacks HOB (reserve the memory for all stacks)\r
StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize);\r
BuildStackHob (StacksBase, StacksSize);\r