mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 18:14:24 +00:00

Introduced a build flag 'ENABLE_SYS_REG_TRACE_FOR_NS' to enable trace system registers access in NS-EL2, or NS-EL1 (when NS-EL2 is implemented but unused). Change-Id: Idc1acede4186e101758cbf7bed5af7b634d7d18d Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
36 lines
678 B
C
36 lines
678 B
C
/*
|
|
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <arch.h>
|
|
#include <arch_helpers.h>
|
|
#include <lib/extensions/sys_reg_trace.h>
|
|
|
|
static bool sys_reg_trace_supported(void)
|
|
{
|
|
uint32_t features;
|
|
|
|
features = read_id_dfr0() >> ID_DFR0_COPTRC_SHIFT;
|
|
return ((features & ID_DFR0_COPTRC_MASK) ==
|
|
ID_DFR0_COPTRC_SUPPORTED);
|
|
}
|
|
|
|
void sys_reg_trace_enable(void)
|
|
{
|
|
uint32_t val;
|
|
|
|
if (sys_reg_trace_supported()) {
|
|
/*
|
|
* NSACR.NSTRCDIS = b0
|
|
* enable NS system register access to implemented trace
|
|
* registers.
|
|
*/
|
|
val = read_nsacr();
|
|
val &= ~NSTRCDIS_BIT;
|
|
write_nsacr(val);
|
|
}
|
|
}
|