2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
9 #include <platform_def.h>
11 #include <common/bl_common.h>
12 #include <common/debug.h>
13 #include <drivers/arm/ccn.h>
14 #include <plat/common/platform.h>
15 #include <services/secure_partition.h>
18 #include <arm_spm_def.h>
20 #include "../../../../bl1/bl1_private.h"
24 * The next 2 constants identify the extents of the coherent memory region.
25 * These addresses are used by the MMU setup code and therefore they must be
26 * page-aligned. It is the responsibility of the linker script to ensure that
27 * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols
28 * refer to page-aligned addresses.
30 #define BL1_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
31 #define BL1_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
32 #define BL2_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
33 #define BL2_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
35 #define BL31_COHERENT_RAM_BASE (uintptr_t)(&__COHERENT_RAM_START__)
36 #define BL31_COHERENT_RAM_LIMIT (uintptr_t)(&__COHERENT_RAM_END__)
39 #define SGI_MAP_FLASH0_RO MAP_REGION_FLAT(V2M_FLASH0_BASE,\
41 MT_DEVICE | MT_RO | MT_SECURE)
43 * Table of regions for different BL stages to map using the MMU.
44 * This doesn't include Trusted RAM as the 'mem_layout' argument passed to
45 * arm_configure_mmu_elx() will give the available subset of that.
47 * Replace or extend the below regions as required
50 const mmap_region_t plat_arm_mmap
[] = {
59 const mmap_region_t plat_arm_mmap
[] = {
66 ARM_MAP_BL31_SEC_DRAM
,
71 #if TRUSTED_BOARD_BOOT && !BL2_AT_EL3
78 const mmap_region_t plat_arm_mmap
[] = {
89 #if ENABLE_SPM && defined(IMAGE_BL31)
90 const mmap_region_t plat_arm_secure_partition_mmap
[] = {
91 PLAT_ARM_SECURE_MAP_DEVICE
,
93 ARM_SP_IMAGE_NS_BUF_MMAP
,
99 #endif /* ENABLE_SPM && defined(IMAGE_BL31) */
104 #if ENABLE_SPM && defined(IMAGE_BL31)
106 * Boot information passed to a secure partition during initialisation. Linear
107 * indices in MP information will be filled at runtime.
109 static secure_partition_mp_info_t sp_mp_info
[] = {
110 [0] = {0x81000000, 0},
111 [1] = {0x81000100, 0},
112 [2] = {0x81000200, 0},
113 [3] = {0x81000300, 0},
114 [4] = {0x81010000, 0},
115 [5] = {0x81010100, 0},
116 [6] = {0x81010200, 0},
117 [7] = {0x81010300, 0},
120 const secure_partition_boot_info_t plat_arm_secure_partition_boot_info
= {
121 .h
.type
= PARAM_SP_IMAGE_BOOT_INFO
,
122 .h
.version
= VERSION_1
,
123 .h
.size
= sizeof(secure_partition_boot_info_t
),
125 .sp_mem_base
= ARM_SP_IMAGE_BASE
,
126 .sp_mem_limit
= ARM_SP_IMAGE_LIMIT
,
127 .sp_image_base
= ARM_SP_IMAGE_BASE
,
128 .sp_stack_base
= PLAT_SP_IMAGE_STACK_BASE
,
129 .sp_heap_base
= ARM_SP_IMAGE_HEAP_BASE
,
130 .sp_ns_comm_buf_base
= ARM_SP_IMAGE_NS_BUF_BASE
,
131 .sp_shared_buf_base
= PLAT_SPM_BUF_BASE
,
132 .sp_image_size
= ARM_SP_IMAGE_SIZE
,
133 .sp_pcpu_stack_size
= PLAT_SP_IMAGE_STACK_PCPU_SIZE
,
134 .sp_heap_size
= ARM_SP_IMAGE_HEAP_SIZE
,
135 .sp_ns_comm_buf_size
= ARM_SP_IMAGE_NS_BUF_SIZE
,
136 .sp_shared_buf_size
= PLAT_SPM_BUF_SIZE
,
137 .num_sp_mem_regions
= ARM_SP_IMAGE_NUM_MEM_REGIONS
,
138 .num_cpus
= PLATFORM_CORE_COUNT
,
139 .mp_info
= &sp_mp_info
[0],
142 const struct mmap_region
*plat_get_secure_partition_mmap(void *cookie
)
144 return plat_arm_secure_partition_mmap
;
147 const struct secure_partition_boot_info
*plat_get_secure_partition_boot_info(
150 return &plat_arm_secure_partition_boot_info
;
152 #endif /* ENABLE_SPM && defined(IMAGE_BL31) */
154 #if TRUSTED_BOARD_BOOT
155 int plat_get_mbedtls_heap(void **heap_addr
, size_t *heap_size
)
157 assert(heap_addr
!= NULL
);
158 assert(heap_size
!= NULL
);
160 return arm_get_mbedtls_heap(heap_addr
, heap_size
);