summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2016-07-05 09:55:03 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2016-07-08 14:37:11 +0100
commited81f3ebbfb5abc7d0d250fbc71f297a904d71ae (patch)
treeeccc1a97f08450bd2a91c3205372af544cd67f9d /lib
parentc02fcc4a3849af4e534c8cf726562694f69b9a04 (diff)
Introduce utils.h header file
This patch introduces a new header file: include/lib/utils.h. Its purpose is to provide generic macros and helper functions that are independent of any BL image, architecture, platform and even not specific to Trusted Firmware. For now, it contains only 2 macros: ARRAY_SIZE() and IS_POWER_OF_TWO(). These were previously defined in bl_common.h and xlat_tables.c respectively. bl_common.h includes utils.h to retain compatibility for platforms that relied on bl_common.h for the ARRAY_SIZE() macro. Upstream platform ports that use this macro have been updated to include utils.h. Change-Id: I960450f54134f25d1710bfbdc4184f12c049a9a9
Diffstat (limited to 'lib')
-rw-r--r--lib/xlat_tables/aarch64/xlat_tables.c3
-rw-r--r--lib/xlat_tables/xlat_tables_common.c2
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/xlat_tables/aarch64/xlat_tables.c b/lib/xlat_tables/aarch64/xlat_tables.c
index 051e46a2..19eb7d5d 100644
--- a/lib/xlat_tables/aarch64/xlat_tables.c
+++ b/lib/xlat_tables/aarch64/xlat_tables.c
@@ -33,11 +33,10 @@
#include <assert.h>
#include <cassert.h>
#include <platform_def.h>
+#include <utils.h>
#include <xlat_tables.h>
#include "../xlat_tables_private.h"
-#define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
-
/*
* The virtual address space size must be a power of two (as set in TCR.T0SZ).
* As we start the initial lookup at level 1, it must also be between 2 GB and
diff --git a/lib/xlat_tables/xlat_tables_common.c b/lib/xlat_tables/xlat_tables_common.c
index e1448b94..71e3efca 100644
--- a/lib/xlat_tables/xlat_tables_common.c
+++ b/lib/xlat_tables/xlat_tables_common.c
@@ -31,11 +31,11 @@
#include <arch.h>
#include <arch_helpers.h>
#include <assert.h>
-#include <bl_common.h>
#include <cassert.h>
#include <debug.h>
#include <platform_def.h>
#include <string.h>
+#include <utils.h>
#include <xlat_tables.h>
#if LOG_LEVEL >= LOG_LEVEL_VERBOSE