From ffb91edfd5eef02d0f7e0326bfa7023e8ea9bb6d Mon Sep 17 00:00:00 2001 From: Eugene Cohen Date: Wed, 9 Jul 2014 11:14:36 +0000 Subject: [PATCH] ArmPkg/ArmLib: Improved ArmConfigureMmu Performance Data & Instruction Caches can be kept enabled while the new translation table is filled. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eugene Cohen Reviewed-By: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15647 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c index d64c188dc5..1a5d982022 100644 --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c @@ -238,18 +238,6 @@ ArmConfigureMmu ( ZeroMem (TranslationTable, TRANSLATION_TABLE_SECTION_SIZE); - ArmCleanInvalidateDataCache (); - ArmInvalidateInstructionCache (); - - ArmDisableDataCache (); - ArmDisableInstructionCache(); - // TLBs are also invalidated when calling ArmDisableMmu() - ArmDisableMmu (); - - // Make sure nothing sneaked into the cache - ArmCleanInvalidateDataCache (); - ArmInvalidateInstructionCache (); - // By default, mark the translation table as belonging to a uncached region TranslationTableAttribute = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; while (MemoryTable->Length != 0) { @@ -277,6 +265,18 @@ ArmConfigureMmu ( return RETURN_UNSUPPORTED; } + ArmCleanInvalidateDataCache (); + ArmInvalidateInstructionCache (); + + ArmDisableDataCache (); + ArmDisableInstructionCache(); + // TLBs are also invalidated when calling ArmDisableMmu() + ArmDisableMmu (); + + // Make sure nothing sneaked into the cache + ArmCleanInvalidateDataCache (); + ArmInvalidateInstructionCache (); + ArmSetTTBR0 ((VOID *)(UINTN)(((UINTN)TranslationTable & ~TRANSLATION_TABLE_SECTION_ALIGNMENT_MASK) | (TTBRAttributes & 0x7F))); ArmSetDomainAccessControl (DOMAIN_ACCESS_CONTROL_NONE(15) | -- 2.39.2