blob: 834092d5a0df94426b904fe01d5b99bf098ca7bc [file] [log] [blame]
Manish V Badarkhe51a97112021-07-08 09:33:18 +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/trf.h>
12
13static bool trf_supported(void)
14{
15 uint32_t features;
16
17 features = read_id_dfr0() >> ID_DFR0_TRACEFILT_SHIFT;
18 return ((features & ID_DFR0_TRACEFILT_MASK) ==
19 ID_DFR0_TRACEFILT_SUPPORTED);
20}
21
22void trf_enable(void)
23{
24 uint32_t val;
25
26 if (trf_supported()) {
27 /*
28 * Allow access of trace filter control registers from
29 * non-monitor mode
30 */
31 val = read_sdcr();
32 val &= ~SDCR_TTRF_BIT;
33 write_sdcr(val);
34 }
35}