IN UINT64 RegionLength,\r
IN UINT64 AttributeSetMask,\r
IN UINT64 AttributeClearMask,\r
+ IN UINT64 *RootTable,\r
IN BOOLEAN TableIsLive\r
)\r
{\r
RegionStart + RegionLength,\r
AttributeSetMask,\r
AttributeClearMask,\r
- ArmGetTTBR0BaseAddress (),\r
+ RootTable,\r
GetRootTableLevel (T0SZ),\r
TableIsLive\r
);\r
MemoryRegion->Length,\r
ArmMemoryAttributeToPageAttribute (MemoryRegion->Attributes) | TT_AF,\r
0,\r
+ RootTable,\r
FALSE\r
);\r
}\r
Length,\r
PageAttributes,\r
PageAttributeMask,\r
+ ArmGetTTBR0BaseAddress (),\r
TRUE\r
);\r
}\r
Length,\r
Attributes,\r
BlockEntryMask,\r
+ ArmGetTTBR0BaseAddress (),\r
TRUE\r
);\r
}\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- //\r
- // We set TTBR0 just after allocating the table to retrieve its location from\r
- // the subsequent functions without needing to pass this value across the\r
- // functions. The MMU is only enabled after the translation tables are\r
- // populated.\r
- //\r
- ArmSetTTBR0 (TranslationTable);\r
-\r
if (TranslationTableBase != NULL) {\r
*TranslationTableBase = TranslationTable;\r
}\r
*TranslationTableSize = RootTableEntryCount * sizeof (UINT64);\r
}\r
\r
- //\r
- // Make sure we are not inadvertently hitting in the caches\r
- // when populating the page tables.\r
- //\r
- InvalidateDataCacheRange (\r
- TranslationTable,\r
- RootTableEntryCount * sizeof (UINT64)\r
- );\r
+ if (!ArmMmuEnabled ()) {\r
+ //\r
+ // Make sure we are not inadvertently hitting in the caches\r
+ // when populating the page tables.\r
+ //\r
+ InvalidateDataCacheRange (\r
+ TranslationTable,\r
+ RootTableEntryCount * sizeof (UINT64)\r
+ );\r
+ }\r
+\r
ZeroMem (TranslationTable, RootTableEntryCount * sizeof (UINT64));\r
\r
while (MemoryTable->Length != 0) {\r
MAIR_ATTR (TT_ATTR_INDX_MEMORY_WRITE_BACK, MAIR_ATTR_NORMAL_MEMORY_WRITE_BACK)\r
);\r
\r
- ArmDisableAlignmentCheck ();\r
- ArmEnableStackAlignmentCheck ();\r
- ArmEnableInstructionCache ();\r
- ArmEnableDataCache ();\r
+ ArmSetTTBR0 (TranslationTable);\r
+\r
+ if (!ArmMmuEnabled ()) {\r
+ ArmDisableAlignmentCheck ();\r
+ ArmEnableStackAlignmentCheck ();\r
+ ArmEnableInstructionCache ();\r
+ ArmEnableDataCache ();\r
+\r
+ ArmEnableMmu ();\r
+ }\r
\r
- ArmEnableMmu ();\r
return EFI_SUCCESS;\r
\r
FreeTranslationTable:\r