aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/mem_region.c2
-rw-r--r--lib/xlat_tables/xlat_tables_common.c10
-rw-r--r--lib/xlat_tables_v2/xlat_tables_internal.c10
-rw-r--r--lib/xlat_tables_v2/xlat_tables_private.h27
4 files changed, 23 insertions, 26 deletions
diff --git a/lib/utils/mem_region.c b/lib/utils/mem_region.c
index 24c2c1ded..e9541ba32 100644
--- a/lib/utils/mem_region.c
+++ b/lib/utils/mem_region.c
@@ -58,7 +58,7 @@ void clear_map_dyn_mem_regions(mem_region_t *regions,
uintptr_t begin;
int r;
size_t size;
- const mmap_attr_t attr = MT_MEMORY|MT_RW|MT_NS;
+ const unsigned int attr = MT_MEMORY | MT_RW | MT_NS;
assert(regions != NULL);
assert(nregions > 0 && chunk > 0);
diff --git a/lib/xlat_tables/xlat_tables_common.c b/lib/xlat_tables/xlat_tables_common.c
index 21bf48973..b42cd6814 100644
--- a/lib/xlat_tables/xlat_tables_common.c
+++ b/lib/xlat_tables/xlat_tables_common.c
@@ -66,7 +66,7 @@ void print_mmap(void)
}
void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
- size_t size, mmap_attr_t attr)
+ size_t size, unsigned int attr)
{
mmap_region_t *mm = mmap;
mmap_region_t *mm_last = mm + ARRAY_SIZE(mmap) - 1;
@@ -178,8 +178,8 @@ void mmap_add(const mmap_region_t *mm)
}
}
-static uint64_t mmap_desc(mmap_attr_t attr, unsigned long long addr_pa,
- unsigned int level)
+static uint64_t mmap_desc(unsigned int attr, unsigned long long addr_pa,
+ unsigned int level)
{
uint64_t desc;
int mem_type;
@@ -264,7 +264,7 @@ static uint64_t mmap_desc(mmap_attr_t attr, unsigned long long addr_pa,
* value pointed by attr should be ignored by the caller.
*/
static int mmap_region_attr(mmap_region_t *mm, uintptr_t base_va,
- size_t size, mmap_attr_t *attr)
+ size_t size, unsigned int *attr)
{
/* Don't assume that the area is contained in the first region */
int ret = -1;
@@ -348,7 +348,7 @@ static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
* there are partially overlapping regions. On success,
* it will return the innermost region's attributes.
*/
- mmap_attr_t attr;
+ unsigned int attr;
int r = mmap_region_attr(mm, base_va, level_size, &attr);
if (!r) {
diff --git a/lib/xlat_tables_v2/xlat_tables_internal.c b/lib/xlat_tables_v2/xlat_tables_internal.c
index 3b586b2a0..5beb51e90 100644
--- a/lib/xlat_tables_v2/xlat_tables_internal.c
+++ b/lib/xlat_tables_v2/xlat_tables_internal.c
@@ -823,10 +823,8 @@ void mmap_add_region_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm)
ctx->max_va = end_va;
}
-void mmap_add_region(unsigned long long base_pa,
- uintptr_t base_va,
- size_t size,
- mmap_attr_t attr)
+void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, size_t size,
+ unsigned int attr)
{
mmap_region_t mm = MAP_REGION(base_pa, base_va, size, attr);
mmap_add_region_ctx(&tf_xlat_ctx, &mm);
@@ -947,8 +945,8 @@ int mmap_add_dynamic_region_ctx(xlat_ctx_t *ctx, mmap_region_t *mm)
return 0;
}
-int mmap_add_dynamic_region(unsigned long long base_pa,
- uintptr_t base_va, size_t size, mmap_attr_t attr)
+int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va,
+ size_t size, unsigned int attr)
{
mmap_region_t mm = MAP_REGION(base_pa, base_va, size, attr);
return mmap_add_dynamic_region_ctx(&tf_xlat_ctx, &mm);
diff --git a/lib/xlat_tables_v2/xlat_tables_private.h b/lib/xlat_tables_v2/xlat_tables_private.h
index 07963b187..157dd0396 100644
--- a/lib/xlat_tables_v2/xlat_tables_private.h
+++ b/lib/xlat_tables_v2/xlat_tables_private.h
@@ -12,27 +12,26 @@
#if PLAT_XLAT_TABLES_DYNAMIC
/*
- * Shifts and masks to access fields of an mmap_attr_t
+ * Private shifts and masks to access fields of an mmap attribute
*/
/* Dynamic or static */
-#define MT_DYN_SHIFT 30 /* 31 would cause undefined behaviours */
+#define MT_DYN_SHIFT U(31)
/*
* Memory mapping private attributes
*
- * Private attributes not exposed in the mmap_attr_t enum.
+ * Private attributes not exposed in the public header.
*/
-typedef enum {
- /*
- * Regions mapped before the MMU can't be unmapped dynamically (they are
- * static) and regions mapped with MMU enabled can be unmapped. This
- * behaviour can't be overridden.
- *
- * Static regions can overlap each other, dynamic regions can't.
- */
- MT_STATIC = 0 << MT_DYN_SHIFT,
- MT_DYNAMIC = 1 << MT_DYN_SHIFT
-} mmap_priv_attr_t;
+
+/*
+ * Regions mapped before the MMU can't be unmapped dynamically (they are
+ * static) and regions mapped with MMU enabled can be unmapped. This
+ * behaviour can't be overridden.
+ *
+ * Static regions can overlap each other, dynamic regions can't.
+ */
+#define MT_STATIC (U(0) << MT_DYN_SHIFT)
+#define MT_DYNAMIC (U(1) << MT_DYN_SHIFT)
#endif /* PLAT_XLAT_TABLES_DYNAMIC */