feat(rmm): simplify __table_is_uniform_block()
This patch removes testing of different ripas values
in __table_is_uniform_block() as not needed.
Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I112031a5efd0c4f6661ebb875b5c040194ad4b8a
diff --git a/lib/realm/src/s2tt.c b/lib/realm/src/s2tt.c
index f422001..f2c3584 100644
--- a/lib/realm/src/s2tt.c
+++ b/lib/realm/src/s2tt.c
@@ -878,36 +878,14 @@
typedef bool (*s2tte_type_checker)(unsigned long s2tte);
static bool __table_is_uniform_block(unsigned long *table,
- s2tte_type_checker s2tte_is_x,
- enum ripas *ripas_ptr)
+ s2tte_type_checker s2tte_is_x)
{
- unsigned long s2tte = s2tte_read(&table[0]);
- enum ripas ripas_val;
- unsigned int i;
-
- if (!s2tte_is_x(s2tte)) {
- return false;
- }
-
- if (ripas_ptr != NULL) {
- ripas_val = s2tte_get_ripas(s2tte);
- }
-
- for (i = 1U; i < S2TTES_PER_S2TT; i++) {
- s2tte = s2tte_read(&table[i]);
+ for (unsigned int i = 0U; i < S2TTES_PER_S2TT; i++) {
+ unsigned long s2tte = s2tte_read(&table[i]);
if (!s2tte_is_x(s2tte)) {
return false;
}
-
- if ((ripas_ptr != NULL) &&
- (s2tte_get_ripas(s2tte) != ripas_val)) {
- return false;
- }
- }
-
- if (ripas_ptr != NULL) {
- *ripas_ptr = ripas_val;
}
return true;
@@ -918,7 +896,7 @@
*/
bool table_is_unassigned_empty_block(unsigned long *table)
{
- return __table_is_uniform_block(table, s2tte_is_unassigned_empty, NULL);
+ return __table_is_uniform_block(table, s2tte_is_unassigned_empty);
}
/*
@@ -926,7 +904,7 @@
*/
bool table_is_unassigned_ram_block(unsigned long *table)
{
- return __table_is_uniform_block(table, s2tte_is_unassigned_ram, NULL);
+ return __table_is_uniform_block(table, s2tte_is_unassigned_ram);
}
/*
@@ -934,7 +912,7 @@
*/
bool table_is_unassigned_ns_block(unsigned long *table)
{
- return __table_is_uniform_block(table, s2tte_is_unassigned_ns, NULL);
+ return __table_is_uniform_block(table, s2tte_is_unassigned_ns);
}
/*
@@ -942,7 +920,7 @@
*/
bool table_is_destroyed_block(unsigned long *table)
{
- return __table_is_uniform_block(table, s2tte_is_destroyed, NULL);
+ return __table_is_uniform_block(table, s2tte_is_destroyed);
}
typedef bool (*s2tte_type_level_checker)(unsigned long s2tte, long level);