1 /* 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 trf_supported(void)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 trf_enable(void)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 } 36