Add API to return memory map on ARM platforms
authorVikram Kanigiri <vikram.kanigiri@arm.com>
Thu, 12 Nov 2015 18:52:34 +0000 (18:52 +0000)
committerVikram Kanigiri <vikram.kanigiri@arm.com>
Mon, 15 Feb 2016 10:20:16 +0000 (10:20 +0000)
Functions to configure the MMU in S-EL1 and EL3 on ARM platforms
expect each platform to export its memory map in the `plat_arm_mmap`
data structure. This approach does not scale well in case the memory
map cannot be determined until runtime. To cater for this possibility,
this patch introduces the plat_arm_get_mmap() API. It returns a
reference to the `plat_arm_mmap` by default but can be overridden
by a platform if required.

Change-Id: Idae6ad8fdf40cdddcd8b992abc188455fa047c74

include/plat/arm/common/plat_arm.h
plat/arm/common/aarch64/arm_common.c

index 3b6a04ba3c1a836ff4548d1ed34e24a7003d5c48..a7c34afc4b6ee74683e0e39dc2963ac8a5db8b14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
 #include <stdint.h>
 #include <xlat_tables.h>
 
-/*
- * Extern declarations common to ARM standard platforms
- */
-extern const mmap_region_t plat_arm_mmap[];
-
 #define ARM_CASSERT_MMAP                                               \
        CASSERT((ARRAY_SIZE(plat_arm_mmap) + ARM_BL_REGIONS)            \
                <= MAX_MMAP_REGIONS,                                    \
@@ -204,6 +199,6 @@ int plat_arm_get_alt_image_source(
        uintptr_t *dev_handle,
        uintptr_t *image_spec);
 unsigned int plat_arm_calc_core_pos(u_register_t mpidr);
-
+const mmap_region_t *plat_arm_get_mmap(void);
 
 #endif /* __PLAT_ARM_H__ */
index a211f16d3c8815710b42e9a5fed8d811008d9ade..02062861f36d076f1c98a8b8058255559793bd9f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -35,6 +35,7 @@
 #include <platform_def.h>
 #include <xlat_tables.h>
 
+extern const mmap_region_t plat_arm_mmap[];
 
 static const int cci_map[] = {
        PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX,
@@ -43,6 +44,7 @@ static const int cci_map[] = {
 
 /* Weak definitions may be overridden in specific ARM standard platform */
 #pragma weak plat_get_ns_image_entrypoint
+#pragma weak plat_arm_get_mmap
 
 
 /*******************************************************************************
@@ -67,7 +69,7 @@ static const int cci_map[] = {
                mmap_add_region(coh_start, coh_start,                   \
                                coh_limit - coh_start,                  \
                                MT_DEVICE | MT_RW | MT_SECURE);         \
-               mmap_add(plat_arm_mmap);                                \
+               mmap_add(plat_arm_get_mmap());                          \
                init_xlat_tables();                                     \
                                                                        \
                enable_mmu_el##_el(0);                                  \
@@ -85,7 +87,7 @@ static const int cci_map[] = {
                mmap_add_region(ro_start, ro_start,                     \
                                ro_limit - ro_start,                    \
                                MT_MEMORY | MT_RO | MT_SECURE);         \
-               mmap_add(plat_arm_mmap);                                \
+               mmap_add(plat_arm_get_mmap());                          \
                init_xlat_tables();                                     \
                                                                        \
                enable_mmu_el##_el(0);                                  \
@@ -161,3 +163,11 @@ void arm_configure_sys_timer(void)
        reg_val = (1 << CNTNSAR_NS_SHIFT(PLAT_ARM_NSTIMER_FRAME_ID));
        mmio_write_32(ARM_SYS_TIMCTL_BASE + CNTNSAR, reg_val);
 }
+
+/*******************************************************************************
+ * Returns ARM platform specific memory map regions.
+ ******************************************************************************/
+const mmap_region_t *plat_arm_get_mmap(void)
+{
+       return plat_arm_mmap;
+}