Gary Morrison | 3d7f654 | 2021-01-27 13:08:47 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <asm_macros.S> |
| 8 | |
| 9 | .globl disable_mpu_el2 |
| 10 | .globl disable_mpu_icache_el2 |
| 11 | |
| 12 | /* --------------------------------------------------------------------------- |
| 13 | * Disable the MPU at EL2. |
| 14 | * --------------------------------------------------------------------------- |
| 15 | */ |
| 16 | |
| 17 | func disable_mpu_el2 |
| 18 | mov x1, #(SCTLR_M_BIT | SCTLR_C_BIT) |
| 19 | do_disable_mpu_el2: |
| 20 | mrs x0, sctlr_el2 |
| 21 | bic x0, x0, x1 |
| 22 | msr sctlr_el2, x0 |
| 23 | isb /* ensure MMU is off */ |
| 24 | dsb sy |
| 25 | ret |
| 26 | endfunc disable_mpu_el2 |
| 27 | |
| 28 | |
| 29 | func disable_mpu_icache_el2 |
| 30 | mov x1, #(SCTLR_M_BIT | SCTLR_C_BIT | SCTLR_I_BIT) |
| 31 | b do_disable_mpu_el2 |
| 32 | endfunc disable_mpu_icache_el2 |