blob: 37bd834957e9a5f71d87484318cbed068fddb18b [file] [log] [blame]
johpow0181865962022-01-28 17:06:20 -06001/*
Boyan Karatotev6468d4a2023-02-16 15:12:45 +00002 * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
johpow0181865962022-01-28 17:06:20 -06003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
Jayanth Dodderi Chidanand69316752022-05-09 12:33:03 +01008#include <arch_features.h>
johpow0181865962022-01-28 17:06:20 -06009#include <arch_helpers.h>
Boyan Karatotev6468d4a2023-02-16 15:12:45 +000010#include <lib/extensions/brbe.h>
johpow0181865962022-01-28 17:06:20 -060011
Boyan Karatotev6468d4a2023-02-16 15:12:45 +000012void brbe_init_el3(void)
johpow0181865962022-01-28 17:06:20 -060013{
14 uint64_t val;
15
Andre Przywarac97c5512022-11-17 16:42:09 +000016 /*
17 * MDCR_EL3.SBRBE = 0b01
18 *
19 * Allows BRBE usage in non-secure world and prohibited in
20 * secure world.
21 */
22 val = read_mdcr_el3();
23 val &= ~(MDCR_SBRBE_MASK << MDCR_SBRBE_SHIFT);
24 val |= (0x1UL << MDCR_SBRBE_SHIFT);
25 write_mdcr_el3(val);
johpow0181865962022-01-28 17:06:20 -060026}