blob: 89b8029ca58640340917083cf782354cba1bd7a6 [file] [log] [blame]
Manish V Badarkhef356f7e2021-06-29 11:44:20 +01001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stdbool.h>
8
9#include <arch.h>
10#include <arch_helpers.h>
11#include <lib/extensions/sys_reg_trace.h>
12
13static bool sys_reg_trace_supported(void)
14{
15 uint32_t features;
16
17 features = read_id_dfr0() >> ID_DFR0_COPTRC_SHIFT;
18 return ((features & ID_DFR0_COPTRC_MASK) ==
19 ID_DFR0_COPTRC_SUPPORTED);
20}
21
22void sys_reg_trace_enable(void)
23{
24 uint32_t val;
25
26 if (sys_reg_trace_supported()) {
27 /*
28 * NSACR.NSTRCDIS = b0
29 * enable NS system register access to implemented trace
30 * registers.
31 */
32 val = read_nsacr();
33 val &= ~NSTRCDIS_BIT;
34 write_nsacr(val);
35 }
36}