blob: eb67b6365137746f8cb4be504b01f8a001737fa3 [file] [log] [blame]
Jens Wiklander52c798e2015-12-07 14:37:10 +01001/*
Jean-Philippe Bruckerb54f6c92023-09-07 17:46:12 +01002 * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
Jens Wiklander52c798e2015-12-07 14:37:10 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Jens Wiklander52c798e2015-12-07 14:37:10 +01005 */
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00006
Fu Weic2f78442017-05-27 21:21:42 +08007#include <assert.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <string.h>
9
Jens Wiklander52c798e2015-12-07 14:37:10 +010010#include <libfdt.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000011
Jens Wiklander52c798e2015-12-07 14:37:10 +010012#include <platform_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000013
Jean-Philippe Brucker721b83d2023-09-07 18:13:07 +010014#include <arch_features.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000015#include <arch_helpers.h>
16#include <common/bl_common.h>
17#include <common/debug.h>
18#include <common/desc_image_load.h>
Andre Przywaraffbacb02019-07-10 17:27:17 +010019#include <common/fdt_fixup.h>
Jens Wiklandera43c1282022-11-22 14:39:26 +010020#include <common/fdt_wrappers.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000021#include <lib/optee_utils.h>
Raymond Mao032ba022023-06-28 15:07:15 -070022#include <lib/transfer_list.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000023#include <lib/utils.h>
24#include <plat/common/platform.h>
25
Isla Mitchelle3631462017-07-14 10:46:32 +010026#include "qemu_private.h"
Jens Wiklander52c798e2015-12-07 14:37:10 +010027
Chen Baozif7d9aa82023-02-20 10:50:15 +000028#define MAP_BL2_TOTAL MAP_REGION_FLAT( \
29 bl2_tzram_layout.total_base, \
30 bl2_tzram_layout.total_size, \
Jean-Philippe Bruckerb54f6c92023-09-07 17:46:12 +010031 MT_MEMORY | MT_RW | EL3_PAS)
Chen Baozif7d9aa82023-02-20 10:50:15 +000032
33#define MAP_BL2_RO MAP_REGION_FLAT( \
34 BL_CODE_BASE, \
35 BL_CODE_END - BL_CODE_BASE, \
Jean-Philippe Bruckerb54f6c92023-09-07 17:46:12 +010036 MT_CODE | EL3_PAS), \
Chen Baozif7d9aa82023-02-20 10:50:15 +000037 MAP_REGION_FLAT( \
38 BL_RO_DATA_BASE, \
39 BL_RO_DATA_END \
40 - BL_RO_DATA_BASE, \
Jean-Philippe Bruckerb54f6c92023-09-07 17:46:12 +010041 MT_RO_DATA | EL3_PAS)
Chen Baozif7d9aa82023-02-20 10:50:15 +000042
Chen Baozi097a43a2023-03-12 20:58:04 +080043#if USE_COHERENT_MEM
Chen Baozif7d9aa82023-02-20 10:50:15 +000044#define MAP_BL_COHERENT_RAM MAP_REGION_FLAT( \
45 BL_COHERENT_RAM_BASE, \
46 BL_COHERENT_RAM_END \
47 - BL_COHERENT_RAM_BASE, \
Jean-Philippe Bruckerb54f6c92023-09-07 17:46:12 +010048 MT_DEVICE | MT_RW | EL3_PAS)
Chen Baozi097a43a2023-03-12 20:58:04 +080049#endif
Jens Wiklander52c798e2015-12-07 14:37:10 +010050
Fu Weic2f78442017-05-27 21:21:42 +080051/* Data structure which holds the extents of the trusted SRAM for BL2 */
52static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
Raymond Mao032ba022023-06-28 15:07:15 -070053static struct transfer_list_header *bl2_tl;
Fu Weic2f78442017-05-27 21:21:42 +080054
Jens Wiklandere22b91e2018-09-04 14:07:19 +020055void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
56 u_register_t arg2, u_register_t arg3)
Jens Wiklander52c798e2015-12-07 14:37:10 +010057{
Jens Wiklandere22b91e2018-09-04 14:07:19 +020058 meminfo_t *mem_layout = (void *)arg1;
59
Jens Wiklander52c798e2015-12-07 14:37:10 +010060 /* Initialize the console to provide early debug support */
Michalis Pappascca6cb72018-03-04 15:43:38 +080061 qemu_console_init();
Jens Wiklander52c798e2015-12-07 14:37:10 +010062
63 /* Setup the BL2 memory layout */
64 bl2_tzram_layout = *mem_layout;
65
66 plat_qemu_io_setup();
67}
68
69static void security_setup(void)
70{
71 /*
72 * This is where a TrustZone address space controller and other
73 * security related peripherals, would be configured.
74 */
75}
76
77static void update_dt(void)
78{
Raymond Mao032ba022023-06-28 15:07:15 -070079#if TRANSFER_LIST
80 struct transfer_list_entry *te;
81#endif
Jens Wiklander52c798e2015-12-07 14:37:10 +010082 int ret;
Andrew Walbran9c4d0692020-01-15 14:11:31 +000083 void *fdt = (void *)(uintptr_t)ARM_PRELOADED_DTB_BASE;
Jens Wiklander52c798e2015-12-07 14:37:10 +010084
85 ret = fdt_open_into(fdt, fdt, PLAT_QEMU_DT_MAX_SIZE);
86 if (ret < 0) {
87 ERROR("Invalid Device Tree at %p: error %d\n", fdt, ret);
88 return;
89 }
90
91 if (dt_add_psci_node(fdt)) {
92 ERROR("Failed to add PSCI Device Tree node\n");
93 return;
94 }
95
96 if (dt_add_psci_cpu_enable_methods(fdt)) {
97 ERROR("Failed to add PSCI cpu enable methods in Device Tree\n");
98 return;
99 }
100
Jean-Philippe Brucker721b83d2023-09-07 18:13:07 +0100101#if ENABLE_RME
102 if (fdt_add_reserved_memory(fdt, "rmm", REALM_DRAM_BASE,
103 REALM_DRAM_SIZE)) {
104 ERROR("Failed to reserve RMM memory in Device Tree\n");
105 return;
106 }
107
108 INFO("Reserved RMM memory [0x%lx, 0x%lx] in Device tree\n",
109 (uintptr_t)REALM_DRAM_BASE,
110 (uintptr_t)REALM_DRAM_BASE + REALM_DRAM_SIZE - 1);
111#endif
112
Jens Wiklander52c798e2015-12-07 14:37:10 +0100113 ret = fdt_pack(fdt);
114 if (ret < 0)
115 ERROR("Failed to pack Device Tree at %p: error %d\n", fdt, ret);
Raymond Mao032ba022023-06-28 15:07:15 -0700116
117#if TRANSFER_LIST
Raymond Maobb653862023-10-04 09:58:29 -0700118 /* create a TE */
Raymond Mao032ba022023-06-28 15:07:15 -0700119 te = transfer_list_add(bl2_tl, TL_TAG_FDT, fdt_totalsize(fdt), fdt);
120 if (!te) {
121 ERROR("Failed to add FDT entry to Transfer List\n");
122 return;
123 }
124#endif
Jens Wiklander52c798e2015-12-07 14:37:10 +0100125}
126
127void bl2_platform_setup(void)
128{
Raymond Mao032ba022023-06-28 15:07:15 -0700129#if TRANSFER_LIST
130 bl2_tl = transfer_list_init((void *)(uintptr_t)FW_HANDOFF_BASE,
131 FW_HANDOFF_SIZE);
132 if (!bl2_tl) {
133 ERROR("Failed to initialize Transfer List at 0x%lx\n",
134 (unsigned long)FW_HANDOFF_BASE);
135 }
136#endif
Jens Wiklander52c798e2015-12-07 14:37:10 +0100137 security_setup();
138 update_dt();
139
140 /* TODO Initialize timer */
141}
142
Raymond Mao032ba022023-06-28 15:07:15 -0700143void qemu_bl2_sync_transfer_list(void)
144{
145#if TRANSFER_LIST
146 transfer_list_update_checksum(bl2_tl);
147#endif
148}
149
Chen Baozif7d9aa82023-02-20 10:50:15 +0000150void bl2_plat_arch_setup(void)
151{
152 const mmap_region_t bl_regions[] = {
153 MAP_BL2_TOTAL,
154 MAP_BL2_RO,
Chen Baozi097a43a2023-03-12 20:58:04 +0800155#if USE_COHERENT_MEM
Chen Baozif7d9aa82023-02-20 10:50:15 +0000156 MAP_BL_COHERENT_RAM,
Chen Baozi097a43a2023-03-12 20:58:04 +0800157#endif
Jean-Philippe Brucker721b83d2023-09-07 18:13:07 +0100158#if ENABLE_RME
159 MAP_RMM_DRAM,
160 MAP_GPT_L0_REGION,
161 MAP_GPT_L1_REGION,
162#endif
Chen Baozif7d9aa82023-02-20 10:50:15 +0000163 {0}
164 };
165
166 setup_page_tables(bl_regions, plat_qemu_get_mmap());
167
Jean-Philippe Brucker721b83d2023-09-07 18:13:07 +0100168#if ENABLE_RME
169 /* BL2 runs in EL3 when RME enabled. */
Sona Mathew9e505f92024-03-13 11:33:54 -0500170 assert(is_feat_rme_present());
Jean-Philippe Brucker721b83d2023-09-07 18:13:07 +0100171 enable_mmu_el3(0);
172#else /* ENABLE_RME */
173
Julius Werner8e0ef0f2019-07-09 14:02:43 -0700174#ifdef __aarch64__
Chen Baozif7d9aa82023-02-20 10:50:15 +0000175 enable_mmu_el1(0);
Julius Werner8e0ef0f2019-07-09 14:02:43 -0700176#else
Chen Baozif7d9aa82023-02-20 10:50:15 +0000177 enable_mmu_svc_mon(0);
Etienne Carriere911de8c2018-02-02 13:23:22 +0100178#endif
Jean-Philippe Brucker721b83d2023-09-07 18:13:07 +0100179#endif /* ENABLE_RME */
Jens Wiklander52c798e2015-12-07 14:37:10 +0100180}
181
182/*******************************************************************************
183 * Gets SPSR for BL32 entry
184 ******************************************************************************/
185static uint32_t qemu_get_spsr_for_bl32_entry(void)
186{
Julius Werner8e0ef0f2019-07-09 14:02:43 -0700187#ifdef __aarch64__
Jens Wiklander52c798e2015-12-07 14:37:10 +0100188 /*
189 * The Secure Payload Dispatcher service is responsible for
190 * setting the SPSR prior to entry into the BL3-2 image.
191 */
192 return 0;
Etienne Carriere911de8c2018-02-02 13:23:22 +0100193#else
194 return SPSR_MODE32(MODE32_svc, SPSR_T_ARM, SPSR_E_LITTLE,
195 DISABLE_ALL_EXCEPTIONS);
196#endif
Jens Wiklander52c798e2015-12-07 14:37:10 +0100197}
198
199/*******************************************************************************
200 * Gets SPSR for BL33 entry
201 ******************************************************************************/
202static uint32_t qemu_get_spsr_for_bl33_entry(void)
203{
Jens Wiklander52c798e2015-12-07 14:37:10 +0100204 uint32_t spsr;
Julius Werner8e0ef0f2019-07-09 14:02:43 -0700205#ifdef __aarch64__
Etienne Carriere911de8c2018-02-02 13:23:22 +0100206 unsigned int mode;
Jens Wiklander52c798e2015-12-07 14:37:10 +0100207
208 /* Figure out what mode we enter the non-secure world in */
Antonio Nino Diaz864ca6f2018-10-31 15:25:35 +0000209 mode = (el_implemented(2) != EL_IMPL_NONE) ? MODE_EL2 : MODE_EL1;
Jens Wiklander52c798e2015-12-07 14:37:10 +0100210
211 /*
212 * TODO: Consider the possibility of specifying the SPSR in
213 * the FIP ToC and allowing the platform to have a say as
214 * well.
215 */
216 spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
Etienne Carriere911de8c2018-02-02 13:23:22 +0100217#else
218 spsr = SPSR_MODE32(MODE32_svc,
219 plat_get_ns_image_entrypoint() & 0x1,
220 SPSR_E_LITTLE, DISABLE_ALL_EXCEPTIONS);
221#endif
Jens Wiklander52c798e2015-12-07 14:37:10 +0100222 return spsr;
223}
224
Jens Wiklandera43c1282022-11-22 14:39:26 +0100225#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2
226static int load_sps_from_tb_fw_config(struct image_info *image_info)
227{
228 void *dtb = (void *)image_info->image_base;
229 const char *compat_str = "arm,sp";
230 const struct fdt_property *uuid;
231 uint32_t load_addr;
232 const char *name;
233 int sp_node;
234 int node;
235
236 node = fdt_node_offset_by_compatible(dtb, -1, compat_str);
237 if (node < 0) {
238 ERROR("Can't find %s in TB_FW_CONFIG", compat_str);
239 return -1;
240 }
241
242 fdt_for_each_subnode(sp_node, dtb, node) {
243 name = fdt_get_name(dtb, sp_node, NULL);
244 if (name == NULL) {
245 ERROR("Can't get name of node in dtb\n");
246 return -1;
247 }
248 uuid = fdt_get_property(dtb, sp_node, "uuid", NULL);
249 if (uuid == NULL) {
250 ERROR("Can't find property uuid in node %s", name);
251 return -1;
252 }
253 if (fdt_read_uint32(dtb, sp_node, "load-address",
254 &load_addr) < 0) {
255 ERROR("Can't read load-address in node %s", name);
256 return -1;
257 }
258 if (qemu_io_register_sp_pkg(name, uuid->data, load_addr) < 0) {
259 return -1;
260 }
261 }
262
263 return 0;
264}
265#endif /*defined(SPD_spmd) && SPMD_SPM_AT_SEL2*/
266
Raymond Maobb653862023-10-04 09:58:29 -0700267#if defined(SPD_opteed) || defined(AARCH32_SP_OPTEE) || defined(SPMC_OPTEE)
268static int handoff_pageable_part(uint64_t pagable_part)
269{
270#if TRANSFER_LIST
271 struct transfer_list_entry *te;
272
273 te = transfer_list_add(bl2_tl, TL_TAG_OPTEE_PAGABLE_PART,
274 sizeof(pagable_part), &pagable_part);
275 if (!te) {
276 INFO("Cannot add TE for pageable part\n");
277 return -1;
278 }
279#endif
280 return 0;
281}
282#endif
283
Fu Weic2f78442017-05-27 21:21:42 +0800284static int qemu_bl2_handle_post_image_load(unsigned int image_id)
285{
286 int err = 0;
287 bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id);
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200288#if defined(SPD_opteed) || defined(AARCH32_SP_OPTEE) || defined(SPMC_OPTEE)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200289 bl_mem_params_node_t *pager_mem_params = NULL;
290 bl_mem_params_node_t *paged_mem_params = NULL;
291#endif
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200292#if defined(SPD_spmd)
Jens Wiklanderd4b84f02022-11-18 15:40:04 +0100293 bl_mem_params_node_t *bl32_mem_params = NULL;
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200294#endif
Raymond Mao032ba022023-06-28 15:07:15 -0700295#if TRANSFER_LIST
296 struct transfer_list_header *ns_tl = NULL;
Raymond Mao032ba022023-06-28 15:07:15 -0700297#endif
Fu Weic2f78442017-05-27 21:21:42 +0800298
299 assert(bl_mem_params);
300
301 switch (image_id) {
Raymond Maobb653862023-10-04 09:58:29 -0700302#if TRANSFER_LIST
303 case BL31_IMAGE_ID:
304 /*
305 * arg0 is a bl_params_t reserved for bl31_early_platform_setup2
levi.yun010d2ae2024-05-13 10:27:17 +0100306 * we just need arg1 and arg3 for BL31 to update the TL from S
Raymond Maobb653862023-10-04 09:58:29 -0700307 * to NS memory before it exits
308 */
levi.yun010d2ae2024-05-13 10:27:17 +0100309#ifdef __aarch64__
310 if (GET_RW(bl_mem_params->ep_info.spsr) == MODE_RW_64) {
311 bl_mem_params->ep_info.args.arg1 =
312 TRANSFER_LIST_HANDOFF_X1_VALUE(REGISTER_CONVENTION_VERSION);
313 } else
314#endif
315 {
316 bl_mem_params->ep_info.args.arg1 =
317 TRANSFER_LIST_HANDOFF_R1_VALUE(REGISTER_CONVENTION_VERSION);
318 }
319
Raymond Maobb653862023-10-04 09:58:29 -0700320 bl_mem_params->ep_info.args.arg3 = (uintptr_t)bl2_tl;
321 break;
322#endif
Fu Weic2f78442017-05-27 21:21:42 +0800323 case BL32_IMAGE_ID:
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200324#if defined(SPD_opteed) || defined(AARCH32_SP_OPTEE) || defined(SPMC_OPTEE)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200325 pager_mem_params = get_bl_mem_params_node(BL32_EXTRA1_IMAGE_ID);
326 assert(pager_mem_params);
327
328 paged_mem_params = get_bl_mem_params_node(BL32_EXTRA2_IMAGE_ID);
329 assert(paged_mem_params);
330
331 err = parse_optee_header(&bl_mem_params->ep_info,
332 &pager_mem_params->image_info,
333 &paged_mem_params->image_info);
334 if (err != 0) {
335 WARN("OPTEE header parse error.\n");
336 }
Raymond Maobb653862023-10-04 09:58:29 -0700337
338 /* add TL_TAG_OPTEE_PAGABLE_PART entry to the TL */
339 if (handoff_pageable_part(bl_mem_params->ep_info.args.arg1)) {
340 return -1;
341 }
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200342#endif
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200343
Raymond Maobb653862023-10-04 09:58:29 -0700344 INFO("Handoff to BL32\n");
345 bl_mem_params->ep_info.spsr = qemu_get_spsr_for_bl32_entry();
346 if (TRANSFER_LIST &&
347 transfer_list_set_handoff_args(bl2_tl,
348 &bl_mem_params->ep_info))
349 break;
350
351 INFO("Using default arguments\n");
Jens Wiklanderd4b84f02022-11-18 15:40:04 +0100352#if defined(SPMC_OPTEE)
353 /*
354 * Explicit zeroes to unused registers since they may have
355 * been populated by parse_optee_header() above.
356 *
357 * OP-TEE expects system DTB in x2 and TOS_FW_CONFIG in x0,
358 * the latter is filled in below for TOS_FW_CONFIG_ID and
359 * applies to any other SPMC too.
360 */
361 bl_mem_params->ep_info.args.arg2 = ARM_PRELOADED_DTB_BASE;
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200362#elif defined(SPD_opteed)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200363 /*
364 * OP-TEE expect to receive DTB address in x2.
365 * This will be copied into x2 by dispatcher.
366 */
Andrew Walbran9c4d0692020-01-15 14:11:31 +0000367 bl_mem_params->ep_info.args.arg3 = ARM_PRELOADED_DTB_BASE;
Jens Wiklanderff263dc2021-05-25 18:15:11 +0200368#elif defined(AARCH32_SP_OPTEE)
Etienne Carriere911de8c2018-02-02 13:23:22 +0100369 bl_mem_params->ep_info.args.arg0 =
370 bl_mem_params->ep_info.args.arg1;
371 bl_mem_params->ep_info.args.arg1 = 0;
Andrew Walbran9c4d0692020-01-15 14:11:31 +0000372 bl_mem_params->ep_info.args.arg2 = ARM_PRELOADED_DTB_BASE;
Etienne Carriere911de8c2018-02-02 13:23:22 +0100373 bl_mem_params->ep_info.args.arg3 = 0;
374#endif
Fu Weic2f78442017-05-27 21:21:42 +0800375 break;
Etienne Carriere911de8c2018-02-02 13:23:22 +0100376
Fu Weic2f78442017-05-27 21:21:42 +0800377 case BL33_IMAGE_ID:
Etienne Carriere911de8c2018-02-02 13:23:22 +0100378#ifdef AARCH32_SP_OPTEE
379 /* AArch32 only core: OP-TEE expects NSec EP in register LR */
380 pager_mem_params = get_bl_mem_params_node(BL32_IMAGE_ID);
381 assert(pager_mem_params);
382 pager_mem_params->ep_info.lr_svc = bl_mem_params->ep_info.pc;
383#endif
384
Raymond Mao032ba022023-06-28 15:07:15 -0700385 bl_mem_params->ep_info.spsr = qemu_get_spsr_for_bl33_entry();
386
Andrew Walbran9c4d0692020-01-15 14:11:31 +0000387#if ARM_LINUX_KERNEL_AS_BL33
388 /*
389 * According to the file ``Documentation/arm64/booting.txt`` of
390 * the Linux kernel tree, Linux expects the physical address of
391 * the device tree blob (DTB) in x0, while x1-x3 are reserved
392 * for future use and must be 0.
393 */
394 bl_mem_params->ep_info.args.arg0 =
395 (u_register_t)ARM_PRELOADED_DTB_BASE;
396 bl_mem_params->ep_info.args.arg1 = 0U;
397 bl_mem_params->ep_info.args.arg2 = 0U;
398 bl_mem_params->ep_info.args.arg3 = 0U;
Raymond Mao032ba022023-06-28 15:07:15 -0700399#elif TRANSFER_LIST
400 if (bl2_tl) {
Raymond Maobb653862023-10-04 09:58:29 -0700401 /* relocate the tl to pre-allocate NS memory */
Raymond Mao032ba022023-06-28 15:07:15 -0700402 ns_tl = transfer_list_relocate(bl2_tl,
403 (void *)(uintptr_t)FW_NS_HANDOFF_BASE,
404 bl2_tl->max_size);
405 if (!ns_tl) {
406 ERROR("Relocate TL to 0x%lx failed\n",
407 (unsigned long)FW_NS_HANDOFF_BASE);
408 return -1;
409 }
Raymond Maobb653862023-10-04 09:58:29 -0700410 }
Raymond Mao032ba022023-06-28 15:07:15 -0700411
Raymond Maobb653862023-10-04 09:58:29 -0700412 INFO("Handoff to BL33\n");
413 if (!transfer_list_set_handoff_args(ns_tl,
414 &bl_mem_params->ep_info)) {
415 INFO("Invalid TL, fallback to default arguments\n");
Raymond Mao032ba022023-06-28 15:07:15 -0700416 bl_mem_params->ep_info.args.arg0 = 0xffff & read_mpidr();
417 }
Andrew Walbran9c4d0692020-01-15 14:11:31 +0000418#else
Fu Weic2f78442017-05-27 21:21:42 +0800419 /* BL33 expects to receive the primary CPU MPID (through r0) */
420 bl_mem_params->ep_info.args.arg0 = 0xffff & read_mpidr();
Raymond Maobb653862023-10-04 09:58:29 -0700421#endif /* ARM_LINUX_KERNEL_AS_BL33 */
Andrew Walbran9c4d0692020-01-15 14:11:31 +0000422
Fu Weic2f78442017-05-27 21:21:42 +0800423 break;
Jens Wiklandera43c1282022-11-22 14:39:26 +0100424#ifdef SPD_spmd
425#if SPMD_SPM_AT_SEL2
426 case TB_FW_CONFIG_ID:
427 err = load_sps_from_tb_fw_config(&bl_mem_params->image_info);
428 break;
429#endif
Jens Wiklanderd4b84f02022-11-18 15:40:04 +0100430 case TOS_FW_CONFIG_ID:
431 /* An SPMC expects TOS_FW_CONFIG in x0/r0 */
432 bl32_mem_params = get_bl_mem_params_node(BL32_IMAGE_ID);
433 bl32_mem_params->ep_info.args.arg0 =
434 bl_mem_params->image_info.image_base;
435 break;
436#endif
Jonathan Wrightff957ed2018-03-14 15:24:00 +0000437 default:
438 /* Do nothing in default case */
439 break;
Fu Weic2f78442017-05-27 21:21:42 +0800440 }
441
442 return err;
443}
444
445/*******************************************************************************
446 * This function can be used by the platforms to update/use image
447 * information for given `image_id`.
448 ******************************************************************************/
449int bl2_plat_handle_post_image_load(unsigned int image_id)
450{
451 return qemu_bl2_handle_post_image_load(image_id);
452}
Jens Wiklander52c798e2015-12-07 14:37:10 +0100453
Etienne Carriere911de8c2018-02-02 13:23:22 +0100454uintptr_t plat_get_ns_image_entrypoint(void)
Jens Wiklander52c798e2015-12-07 14:37:10 +0100455{
456 return NS_IMAGE_OFFSET;
457}