xref: /arm-trusted-firmware/services/std_svc/spm/common/spm_xlat_common.c (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright (c) 2023, ARM Limited and Contributors. All rights reserved.
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu  */
6*91f16700Schasinglulu 
7*91f16700Schasinglulu #include <lib/xlat_tables/xlat_tables_v2.h>
8*91f16700Schasinglulu #include <platform_def.h>
9*91f16700Schasinglulu 
10*91f16700Schasinglulu /* Place translation tables by default along with the ones used by BL31. */
11*91f16700Schasinglulu #ifndef PLAT_SP_IMAGE_XLAT_SECTION_NAME
12*91f16700Schasinglulu #define PLAT_SP_IMAGE_XLAT_SECTION_NAME	".xlat_table"
13*91f16700Schasinglulu #endif
14*91f16700Schasinglulu #ifndef PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME
15*91f16700Schasinglulu #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME	".bss"
16*91f16700Schasinglulu #endif
17*91f16700Schasinglulu 
18*91f16700Schasinglulu /* Allocate and initialise the translation context for the secure partitions. */
19*91f16700Schasinglulu REGISTER_XLAT_CONTEXT2(sp,
20*91f16700Schasinglulu 		       PLAT_SP_IMAGE_MMAP_REGIONS,
21*91f16700Schasinglulu 		       PLAT_SP_IMAGE_MAX_XLAT_TABLES,
22*91f16700Schasinglulu 		       PLAT_VIRT_ADDR_SPACE_SIZE, PLAT_PHY_ADDR_SPACE_SIZE,
23*91f16700Schasinglulu 		       EL1_EL0_REGIME, PLAT_SP_IMAGE_XLAT_SECTION_NAME,
24*91f16700Schasinglulu 		       PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME);
25*91f16700Schasinglulu 
26*91f16700Schasinglulu /* Get handle of Secure Partition translation context */
27*91f16700Schasinglulu xlat_ctx_t *spm_get_sp_xlat_context(void)
28*91f16700Schasinglulu {
29*91f16700Schasinglulu 	return &sp_xlat_ctx;
30*91f16700Schasinglulu };
31