refactor(neoverse-rd): refactor mmap macro for CSS device memory region
There are two macros that define CSS device memory map range and
attributes - one for local chip and the other for remote chip. Refactor
these two macros into a single macro that uses the chip ID to identify
the local or the remote chip.
Signed-off-by: Rohit Mathew <rohit.mathew@arm.com>
Change-Id: I8c5374587391839260079f49f66c3307cf7118a9
diff --git a/plat/arm/board/neoverse_rd/common/include/nrd1/nrd_css_fw_def1.h b/plat/arm/board/neoverse_rd/common/include/nrd1/nrd_css_fw_def1.h
index 0949d36..ddf5dc2 100644
--- a/plat/arm/board/neoverse_rd/common/include/nrd1/nrd_css_fw_def1.h
+++ b/plat/arm/board/neoverse_rd/common/include/nrd1/nrd_css_fw_def1.h
@@ -55,13 +55,7 @@
* MMU mappings
******************************************************************************/
-#define NRD_MAP_DEVICE \
- MAP_REGION_FLAT( \
- NRD_DEVICE_BASE, \
- NRD_DEVICE_SIZE, \
- MT_DEVICE | MT_RW | MT_SECURE)
-
-#define NRD_MAP_DEVICE_REMOTE_CHIP(n) \
+#define NRD_MAP_DEVICE(n) \
MAP_REGION_FLAT( \
NRD_REMOTE_CHIP_MEM_OFFSET(n) + \
NRD_DEVICE_BASE, \
diff --git a/plat/arm/board/neoverse_rd/common/nrd_plat1.c b/plat/arm/board/neoverse_rd/common/nrd_plat1.c
index 9d33f5b..bd848ec 100644
--- a/plat/arm/board/neoverse_rd/common/nrd_plat1.c
+++ b/plat/arm/board/neoverse_rd/common/nrd_plat1.c
@@ -32,7 +32,7 @@
const mmap_region_t plat_arm_mmap[] = {
ARM_MAP_SHARED_RAM,
NRD_MAP_FLASH0_RO,
- NRD_MAP_DEVICE,
+ NRD_MAP_DEVICE(0),
SOC_CSS_MAP_DEVICE,
{0}
};
@@ -44,17 +44,17 @@
#ifdef PLAT_ARM_MEM_PROT_ADDR
ARM_V2M_MAP_MEM_PROTECT,
#endif
- NRD_MAP_DEVICE,
+ NRD_MAP_DEVICE(0),
SOC_CSS_MAP_DEVICE,
ARM_MAP_NS_DRAM1,
#if NRD_CHIP_COUNT > 1
- NRD_MAP_DEVICE_REMOTE_CHIP(1),
+ NRD_MAP_DEVICE(1),
#endif
#if NRD_CHIP_COUNT > 2
- NRD_MAP_DEVICE_REMOTE_CHIP(2),
+ NRD_MAP_DEVICE(2),
#endif
#if NRD_CHIP_COUNT > 3
- NRD_MAP_DEVICE_REMOTE_CHIP(3),
+ NRD_MAP_DEVICE(3),
#endif
#if ARM_BL31_IN_DRAM
ARM_MAP_BL31_SEC_DRAM,
@@ -72,7 +72,7 @@
const mmap_region_t plat_arm_mmap[] = {
ARM_MAP_SHARED_RAM,
V2M_MAP_IOFPGA,
- NRD_MAP_DEVICE,
+ NRD_MAP_DEVICE(0),
#ifdef PLAT_ARM_MEM_PROT_ADDR
ARM_V2M_MAP_MEM_PROTECT,
#endif
diff --git a/plat/arm/board/neoverse_rd/platform/rdn1edge/rdn1edge_plat.c b/plat/arm/board/neoverse_rd/platform/rdn1edge/rdn1edge_plat.c
index d57b87b..f40c9a4 100644
--- a/plat/arm/board/neoverse_rd/platform/rdn1edge/rdn1edge_plat.c
+++ b/plat/arm/board/neoverse_rd/platform/rdn1edge/rdn1edge_plat.c
@@ -14,7 +14,7 @@
#if defined(IMAGE_BL31)
static const mmap_region_t rdn1edge_dynamic_mmap[] = {
ARM_MAP_SHARED_RAM_REMOTE_CHIP(1),
- NRD_MAP_DEVICE_REMOTE_CHIP(1),
+ NRD_MAP_DEVICE(1),
SOC_CSS_MAP_DEVICE_REMOTE_CHIP(1)
};
diff --git a/plat/arm/board/neoverse_rd/platform/rdv1mc/rdv1mc_plat.c b/plat/arm/board/neoverse_rd/platform/rdv1mc/rdv1mc_plat.c
index f6365fe..313eeba 100644
--- a/plat/arm/board/neoverse_rd/platform/rdv1mc/rdv1mc_plat.c
+++ b/plat/arm/board/neoverse_rd/platform/rdv1mc/rdv1mc_plat.c
@@ -14,16 +14,16 @@
#if defined(IMAGE_BL31)
static const mmap_region_t rdv1mc_dynamic_mmap[] = {
ARM_MAP_SHARED_RAM_REMOTE_CHIP(1),
- NRD_MAP_DEVICE_REMOTE_CHIP(1),
+ NRD_MAP_DEVICE(1),
SOC_CSS_MAP_DEVICE_REMOTE_CHIP(1),
#if (NRD_CHIP_COUNT > 2)
ARM_MAP_SHARED_RAM_REMOTE_CHIP(2),
- NRD_MAP_DEVICE_REMOTE_CHIP(2),
+ NRD_MAP_DEVICE(2),
SOC_CSS_MAP_DEVICE_REMOTE_CHIP(2),
#endif
#if (NRD_CHIP_COUNT > 3)
ARM_MAP_SHARED_RAM_REMOTE_CHIP(3),
- NRD_MAP_DEVICE_REMOTE_CHIP(3),
+ NRD_MAP_DEVICE(3),
SOC_CSS_MAP_DEVICE_REMOTE_CHIP(3)
#endif
};