aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2021-05-24 21:00:07 +0100
committerChris Kay <chris.kay@arm.com>2021-10-26 12:14:31 +0100
commitb4b726ea868359cf683c07337b69fe91a2a6929a (patch)
tree630ffe5e382251ccbb3f41b650f8da360a653123 /lib
parent6c8dda19e5f484f8544365fd71d965f0afc39244 (diff)
downloadarm-trusted-firmware-b4b726ea868359cf683c07337b69fe91a2a6929a.tar.gz
refactor(amu)!: privatize unused AMU APIs
This change reduces the exposed surface area of the AMU API in order to simplify the refactoring work in following patches. The functions and definitions privatized by this change are not used by other parts of the code-base today. BREAKING CHANGE: The public AMU API has been reduced to enablement only to facilitate refactoring work. These APIs were not previously used. Change-Id: Ibf6174fb5b3949de3c4ba6847cce47d82a6bd08c Signed-off-by: Chris Kay <chris.kay@arm.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/extensions/amu/aarch32/amu.c26
-rw-r--r--lib/extensions/amu/aarch64/amu.c34
2 files changed, 16 insertions, 44 deletions
diff --git a/lib/extensions/amu/aarch32/amu.c b/lib/extensions/amu/aarch32/amu.c
index ed56dddc9..8896e5c69 100644
--- a/lib/extensions/amu/aarch32/amu.c
+++ b/lib/extensions/amu/aarch32/amu.c
@@ -25,7 +25,7 @@ static struct amu_ctx amu_ctxs[PLATFORM_CORE_COUNT];
* ID_PFR0_AMU_V1P1: FEAT_AMUv1p1 supported (introduced in ARM v8.6)
* ID_PFR0_AMU_NOT_SUPPORTED: not supported
*/
-unsigned int amu_get_version(void)
+static unsigned int amu_get_version(void)
{
return (unsigned int)(read_id_pfr0() >> ID_PFR0_AMU_SHIFT) &
ID_PFR0_AMU_MASK;
@@ -33,7 +33,7 @@ unsigned int amu_get_version(void)
#if AMU_GROUP1_NR_COUNTERS
/* Check if group 1 counters is implemented */
-bool amu_group1_supported(void)
+static bool amu_group1_supported(void)
{
uint32_t features = read_amcfgr() >> AMCFGR_NCG_SHIFT;
@@ -113,7 +113,7 @@ void amu_enable(bool el2_unused)
}
/* Read the group 0 counter identified by the given `idx`. */
-uint64_t amu_group0_cnt_read(unsigned int idx)
+static uint64_t amu_group0_cnt_read(unsigned int idx)
{
assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
assert(idx < AMU_GROUP0_NR_COUNTERS);
@@ -122,7 +122,7 @@ uint64_t amu_group0_cnt_read(unsigned int idx)
}
/* Write the group 0 counter identified by the given `idx` with `val` */
-void amu_group0_cnt_write(unsigned int idx, uint64_t val)
+static void amu_group0_cnt_write(unsigned int idx, uint64_t val)
{
assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
assert(idx < AMU_GROUP0_NR_COUNTERS);
@@ -133,7 +133,7 @@ void amu_group0_cnt_write(unsigned int idx, uint64_t val)
#if AMU_GROUP1_NR_COUNTERS
/* Read the group 1 counter identified by the given `idx` */
-uint64_t amu_group1_cnt_read(unsigned int idx)
+static uint64_t amu_group1_cnt_read(unsigned int idx)
{
assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
assert(amu_group1_supported());
@@ -143,7 +143,7 @@ uint64_t amu_group1_cnt_read(unsigned int idx)
}
/* Write the group 1 counter identified by the given `idx` with `val` */
-void amu_group1_cnt_write(unsigned int idx, uint64_t val)
+static void amu_group1_cnt_write(unsigned int idx, uint64_t val)
{
assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
assert(amu_group1_supported());
@@ -152,20 +152,6 @@ void amu_group1_cnt_write(unsigned int idx, uint64_t val)
amu_group1_cnt_write_internal(idx, val);
isb();
}
-
-/*
- * Program the event type register for the given `idx` with
- * the event number `val`
- */
-void amu_group1_set_evtype(unsigned int idx, unsigned int val)
-{
- assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
- assert(amu_group1_supported());
- assert(idx < AMU_GROUP1_NR_COUNTERS);
-
- amu_group1_set_evtype_internal(idx, val);
- isb();
-}
#endif /* AMU_GROUP1_NR_COUNTERS */
static void *amu_context_save(const void *arg)
diff --git a/lib/extensions/amu/aarch64/amu.c b/lib/extensions/amu/aarch64/amu.c
index 295c0d569..97eb1e366 100644
--- a/lib/extensions/amu/aarch64/amu.c
+++ b/lib/extensions/amu/aarch64/amu.c
@@ -26,7 +26,7 @@ static struct amu_ctx amu_ctxs[PLATFORM_CORE_COUNT];
* ID_AA64PFR0_AMU_V1P1: FEAT_AMUv1p1 supported (introduced in ARM v8.6)
* ID_AA64PFR0_AMU_NOT_SUPPORTED: not supported
*/
-unsigned int amu_get_version(void)
+static unsigned int amu_get_version(void)
{
return (unsigned int)(read_id_aa64pfr0_el1() >> ID_AA64PFR0_AMU_SHIFT) &
ID_AA64PFR0_AMU_MASK;
@@ -34,7 +34,7 @@ unsigned int amu_get_version(void)
#if AMU_GROUP1_NR_COUNTERS
/* Check if group 1 counters is implemented */
-bool amu_group1_supported(void)
+static bool amu_group1_supported(void)
{
uint64_t features = read_amcfgr_el0() >> AMCFGR_EL0_NCG_SHIFT;
@@ -130,7 +130,7 @@ void amu_enable(bool el2_unused, cpu_context_t *ctx)
}
/* Read the group 0 counter identified by the given `idx`. */
-uint64_t amu_group0_cnt_read(unsigned int idx)
+static uint64_t amu_group0_cnt_read(unsigned int idx)
{
assert(amu_get_version() != ID_AA64PFR0_AMU_NOT_SUPPORTED);
assert(idx < AMU_GROUP0_NR_COUNTERS);
@@ -139,7 +139,7 @@ uint64_t amu_group0_cnt_read(unsigned int idx)
}
/* Write the group 0 counter identified by the given `idx` with `val` */
-void amu_group0_cnt_write(unsigned int idx, uint64_t val)
+static void amu_group0_cnt_write(unsigned int idx, uint64_t val)
{
assert(amu_get_version() != ID_AA64PFR0_AMU_NOT_SUPPORTED);
assert(idx < AMU_GROUP0_NR_COUNTERS);
@@ -154,7 +154,7 @@ void amu_group0_cnt_write(unsigned int idx, uint64_t val)
*
* Using this function requires FEAT_AMUv1p1 support.
*/
-uint64_t amu_group0_voffset_read(unsigned int idx)
+static uint64_t amu_group0_voffset_read(unsigned int idx)
{
assert(amu_get_version() >= ID_AA64PFR0_AMU_V1P1);
assert(idx < AMU_GROUP0_NR_COUNTERS);
@@ -169,7 +169,7 @@ uint64_t amu_group0_voffset_read(unsigned int idx)
*
* Using this function requires FEAT_AMUv1p1 support.
*/
-void amu_group0_voffset_write(unsigned int idx, uint64_t val)
+static void amu_group0_voffset_write(unsigned int idx, uint64_t val)
{
assert(amu_get_version() >= ID_AA64PFR0_AMU_V1P1);
assert(idx < AMU_GROUP0_NR_COUNTERS);
@@ -181,7 +181,7 @@ void amu_group0_voffset_write(unsigned int idx, uint64_t val)
#if AMU_GROUP1_NR_COUNTERS
/* Read the group 1 counter identified by the given `idx` */
-uint64_t amu_group1_cnt_read(unsigned int idx)
+static uint64_t amu_group1_cnt_read(unsigned int idx)
{
assert(amu_get_version() != ID_AA64PFR0_AMU_NOT_SUPPORTED);
assert(amu_group1_supported());
@@ -191,7 +191,7 @@ uint64_t amu_group1_cnt_read(unsigned int idx)
}
/* Write the group 1 counter identified by the given `idx` with `val` */
-void amu_group1_cnt_write(unsigned int idx, uint64_t val)
+static void amu_group1_cnt_write(unsigned int idx, uint64_t val)
{
assert(amu_get_version() != ID_AA64PFR0_AMU_NOT_SUPPORTED);
assert(amu_group1_supported());
@@ -206,7 +206,7 @@ void amu_group1_cnt_write(unsigned int idx, uint64_t val)
*
* Using this function requires FEAT_AMUv1p1 support.
*/
-uint64_t amu_group1_voffset_read(unsigned int idx)
+static uint64_t amu_group1_voffset_read(unsigned int idx)
{
assert(amu_get_version() >= ID_AA64PFR0_AMU_V1P1);
assert(amu_group1_supported());
@@ -222,7 +222,7 @@ uint64_t amu_group1_voffset_read(unsigned int idx)
*
* Using this function requires FEAT_AMUv1p1 support.
*/
-void amu_group1_voffset_write(unsigned int idx, uint64_t val)
+static void amu_group1_voffset_write(unsigned int idx, uint64_t val)
{
assert(amu_get_version() >= ID_AA64PFR0_AMU_V1P1);
assert(amu_group1_supported());
@@ -233,20 +233,6 @@ void amu_group1_voffset_write(unsigned int idx, uint64_t val)
amu_group1_voffset_write_internal(idx, val);
isb();
}
-
-/*
- * Program the event type register for the given `idx` with
- * the event number `val`
- */
-void amu_group1_set_evtype(unsigned int idx, unsigned int val)
-{
- assert(amu_get_version() != ID_AA64PFR0_AMU_NOT_SUPPORTED);
- assert(amu_group1_supported());
- assert(idx < AMU_GROUP1_NR_COUNTERS);
-
- amu_group1_set_evtype_internal(idx, val);
- isb();
-}
#endif /* AMU_GROUP1_NR_COUNTERS */
static void *amu_context_save(const void *arg)