aboutsummaryrefslogtreecommitdiff
path: root/lib/extensions/trf/aarch32/trf.c
diff options
context:
space:
mode:
authorManish V Badarkhe <Manish.Badarkhe@arm.com>2021-07-08 09:33:18 +0100
committerManish V Badarkhe <Manish.Badarkhe@arm.com>2021-08-26 09:32:35 +0100
commit8fcd3d9600bb2cb6809c6fc68f945ce3ad89633d (patch)
tree010d5743de8365662275525396542928a46d152f /lib/extensions/trf/aarch32/trf.c
parent5de20ece38f782c8459f546a08c6a97b9e0f5bc5 (diff)
downloadarm-trusted-firmware-8fcd3d9600bb2cb6809c6fc68f945ce3ad89633d.tar.gz
feat(trf): enable trace filter control register access from lower NS EL
Introduced a build flag 'ENABLE_TRF_FOR_NS' to enable trace filter control registers access in NS-EL2, or NS-EL1 (when NS-EL2 is implemented but unused). Change-Id: If3f53b8173a5573424b9a405a4bd8c206ffdeb8c Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Diffstat (limited to 'lib/extensions/trf/aarch32/trf.c')
-rw-r--r--lib/extensions/trf/aarch32/trf.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/extensions/trf/aarch32/trf.c b/lib/extensions/trf/aarch32/trf.c
new file mode 100644
index 000000000..834092d5a
--- /dev/null
+++ b/lib/extensions/trf/aarch32/trf.c
@@ -0,0 +1,35 @@
+/*
+ * 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/trf.h>
+
+static bool trf_supported(void)
+{
+ uint32_t features;
+
+ features = read_id_dfr0() >> ID_DFR0_TRACEFILT_SHIFT;
+ return ((features & ID_DFR0_TRACEFILT_MASK) ==
+ ID_DFR0_TRACEFILT_SUPPORTED);
+}
+
+void trf_enable(void)
+{
+ uint32_t val;
+
+ if (trf_supported()) {
+ /*
+ * Allow access of trace filter control registers from
+ * non-monitor mode
+ */
+ val = read_sdcr();
+ val &= ~SDCR_TTRF_BIT;
+ write_sdcr(val);
+ }
+}