arm-trusted-firmware/lib/extensions/debug/debugv8p9.c
Arvind Ram Prakash 83271d5a5a feat(debugv8p9): add support for FEAT_Debugv8p9
This patch enables FEAT_Debugv8p9 and prevents EL1/0 from
trapping to EL3 when accessing MDSELR_EL1 register by
setting the MDCR_EL3.EBWE bit.

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: I3613af1dd8cb8c0d3c33dc959f170846c0b9695a
2024-07-18 13:49:43 -05:00

26 lines
672 B
C

/*
* Copyright (c) 2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <arch_features.h>
#include <arch_helpers.h>
#include <lib/extensions/debug_v8p9.h>
void debugv8p9_extended_bp_wp_enable(cpu_context_t *ctx)
{
el3_state_t *state = get_el3state_ctx(ctx);
u_register_t mdcr_el3_val = read_ctx_reg(state, CTX_MDCR_EL3);
/* When FEAT_Debugv8p9 is implemented:
*
* MDCR_EL3.EBWE: Set to 0b1
* Enables use of additional breakpoints or watchpoints,
* and disables trap to EL3 on accesses to debug register.
*/
mdcr_el3_val |= MDCR_EBWE_BIT;
write_ctx_reg(state, CTX_MDCR_EL3, mdcr_el3_val);
}