johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
Jayanth Dodderi Chidanand | 6931675 | 2022-05-09 12:33:03 +0100 | [diff] [blame] | 8 | #include <arch_features.h> |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 9 | #include <arch_helpers.h> |
| 10 | |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 11 | void brbe_enable(void) |
| 12 | { |
| 13 | uint64_t val; |
| 14 | |
Andre Przywara | c97c551 | 2022-11-17 16:42:09 +0000 | [diff] [blame] | 15 | /* |
| 16 | * MDCR_EL3.SBRBE = 0b01 |
| 17 | * |
| 18 | * Allows BRBE usage in non-secure world and prohibited in |
| 19 | * secure world. |
| 20 | */ |
| 21 | val = read_mdcr_el3(); |
| 22 | val &= ~(MDCR_SBRBE_MASK << MDCR_SBRBE_SHIFT); |
| 23 | val |= (0x1UL << MDCR_SBRBE_SHIFT); |
| 24 | write_mdcr_el3(val); |
johpow01 | 8186596 | 2022-01-28 17:06:20 -0600 | [diff] [blame] | 25 | } |