1 /*
2  * Copyright (c) 2018-2021, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch.h>
8 #include <arch_helpers.h>
9 #include <assert.h>
10 #include <errno.h>
11 #include <lib/el3_runtime/context_mgmt.h>
12 #include <lib/spinlock.h>
13 #include <lib/xlat_tables/xlat_tables_v2.h>
14 #include <platform_def.h>
15 #include <plat/common/platform.h>
16 
17 #include "spm_common.h"
18 #include "spm_shim_private.h"
19 
20 /* Place translation tables by default along with the ones used by BL31. */
21 #ifndef PLAT_SP_IMAGE_XLAT_SECTION_NAME
22 #define PLAT_SP_IMAGE_XLAT_SECTION_NAME	"xlat_table"
23 #endif
24 #ifndef PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME
25 #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME	".bss"
26 #endif
27 
28 /* Allocate and initialise the translation context for the secure partitions. */
29 REGISTER_XLAT_CONTEXT2(sp,
30 		       PLAT_SP_IMAGE_MMAP_REGIONS,
31 		       PLAT_SP_IMAGE_MAX_XLAT_TABLES,
32 		       PLAT_VIRT_ADDR_SPACE_SIZE, PLAT_PHY_ADDR_SPACE_SIZE,
33 		       EL1_EL0_REGIME, PLAT_SP_IMAGE_XLAT_SECTION_NAME,
34 		       PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME);
35 
36 /* Get handle of Secure Partition translation context */
spm_get_sp_xlat_context(void)37 xlat_ctx_t *spm_get_sp_xlat_context(void)
38 {
39 	return &sp_xlat_ctx;
40 };
41