On Wed, Mar 02, 2016 at 09:08:46PM +0000, evan.ll...@arm.com wrote:
> From: Evan Lloyd <evan.ll...@arm.com>
> 
> Architecturally, the TTBCR register value is undefined at reset for
> Non-Secure.
> On some platforms the reset value for TTBCR is not zero and
> this causes a data abort exception once the MMU is enabled.
> 
> This patch configures the TTBCR register to enable translation table
> walk using TTBR0.

Thanks Evan, pushed with one hopefully non-contentious modification
to your updated comment (see below).

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Evan Lloyd <evan.ll...@arm.com>


> diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c 
> b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
> index fc8ea42..7caff5a 100644
> --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
> +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
> @@ -1,7 +1,7 @@
>  /** @file
>  *  File managing the MMU for ARMv7 architecture
>  *
> -*  Copyright (c) 2011-2013, ARM Limited. All rights reserved.
> +*  Copyright (c) 2011-2016, ARM Limited. All rights reserved.
>  *
>  *  This program and the accompanying materials
>  *  are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -347,6 +347,16 @@ ArmConfigureMmu (
>  
>    ArmSetTTBR0 ((VOID *)(UINTN)(((UINTN)TranslationTable & 
> ~TRANSLATION_TABLE_SECTION_ALIGNMENT_MASK) | (TTBRAttributes & 0x7F)));
>  
> +  //
> +  // The TTBCR register value is undefined at reset in the Non-Secure world.
> +  // Writing 0 has the effect of:
> +  //   Clearing EAE: Use short descriptors, as mandated by specification.
> +  //   Clearing PD0 and PD1: Translation Table Walk Disable is off.
> +  //   Clearing N: Perform all translation table walks through TTBR0.
> +  //               (0 is the default reset value, in non-secure systems.)

+  //               (0 is the default reset value in systems not implementing
+  //               the Security Extensions.)
   
> +  //
> +  ArmSetTTBCR (0);
> +
>    ArmSetDomainAccessControl (DOMAIN_ACCESS_CONTROL_NONE(15) |
>                               DOMAIN_ACCESS_CONTROL_NONE(14) |
>                               DOMAIN_ACCESS_CONTROL_NONE(13) |
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to