refactor(lib): define GRANULE_SHIFT as parameter
GRANULE_SHIFT is defined as build time parameter instead of
GRANULE_SIZE. This makes it possible to derive GRANULE_SIZE and
GRANULE_MASK from a single value.
Change-Id: I8e6a7aa148aade9921b062702b24111d96107dbf
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/cmake/CommonConfigs.cmake b/cmake/CommonConfigs.cmake
index b8709ac..7e1e9a4 100644
--- a/cmake/CommonConfigs.cmake
+++ b/cmake/CommonConfigs.cmake
@@ -16,10 +16,10 @@
# The RMM is mapped with 4K pages, and all RMM APIs use the same granularity.
#
arm_config_option(
- NAME GRANULE_SIZE
- HELP "Granule Size used by RMM"
+ NAME GRANULE_SHIFT
+ HELP "The shift value of granule size. i.e: GRANULE_SIZE == 1 << GRANULE_SHIFT"
TYPE STRING
- DEFAULT 4096)
+ DEFAULT 12)
#
# RMM_MAX_GRANULES. Maximum number of granules supported.
@@ -69,12 +69,12 @@
target_compile_definitions(rmm-common
INTERFACE "MAX_CPUS=${MAX_CPUS}U")
-if(NOT(GRANULE_SIZE EQUAL 4096))
- message(FATAL_ERROR "GRANULE_SIZE is not initialized correctly")
+if(NOT(GRANULE_SHIFT EQUAL 12))
+ message(FATAL_ERROR "GRANULE_SHIFT is not initialized correctly")
endif()
target_compile_definitions(rmm-common
- INTERFACE "GRANULE_SIZE=UL(${GRANULE_SIZE})")
+ INTERFACE "GRANULE_SHIFT=U(${GRANULE_SHIFT})")
if (RMM_MAX_GRANULES EQUAL 0x0)
message (FATAL_ERROR "RMM_MAX_GRANULES not configured")