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>
diff --git a/lib/extensions/amu/aarch32/amu.c b/lib/extensions/amu/aarch32/amu.c
index ed56ddd..8896e5c 100644
--- a/lib/extensions/amu/aarch32/amu.c
+++ b/lib/extensions/amu/aarch32/amu.c
@@ -25,7 +25,7 @@
* 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 @@
#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 @@
}
/* 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 @@
}
/* 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 @@
#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 @@
}
/* 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 @@
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 295c0d5..97eb1e3 100644
--- a/lib/extensions/amu/aarch64/amu.c
+++ b/lib/extensions/amu/aarch64/amu.c
@@ -26,7 +26,7 @@
* 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 @@
#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 @@
}
/* 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 @@
}
/* 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 @@
*
* 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 @@
*
* 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 @@
#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 @@
}
/* 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 @@
*
* 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 @@
*
* 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 @@
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)