blob: cc18758210053780e2cacdc44ed39227d73f9309 [file] [log] [blame]
Yatharth Kochar3a11eda2015-10-14 15:28:11 +01001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Yatharth Kochar3a11eda2015-10-14 15:28:11 +01005 */
6
7#include <bl_common.h>
8#include <debug.h>
9#include <plat_arm.h>
10#include "css_scp_bootloader.h"
11
12/* Weak definition may be overridden in specific CSS based platform */
13#pragma weak bl2u_plat_handle_scp_bl2u
14
15/* Data structure which holds the SCP_BL2U image info for BL2U */
16static image_info_t scp_bl2u_image_info;
17
18/*******************************************************************************
19 * BL1 can pass platform dependent information to BL2U in x1.
20 * In case of ARM CSS platforms x1 contains SCP_BL2U image info.
21 * In case of ARM FVP platforms x1 is not used.
22 * In both cases, x0 contains the extents of the memory available to BL2U
23 ******************************************************************************/
24void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
25{
26 if (!plat_info)
27 panic();
28
29 arm_bl2u_early_platform_setup(mem_layout, plat_info);
30
31 scp_bl2u_image_info = *(image_info_t *)plat_info;
32}
33
34/*******************************************************************************
35 * Transfer SCP_BL2U from Trusted RAM using the SCP Download protocol.
36 ******************************************************************************/
37int bl2u_plat_handle_scp_bl2u(void)
38{
39 int ret;
40
41 INFO("BL2U: Initiating SCP_BL2U transfer to SCP\n");
42
43 ret = scp_bootloader_transfer((void *)scp_bl2u_image_info.image_base,
44 scp_bl2u_image_info.image_size);
45
46 if (ret == 0)
47 INFO("BL2U: SCP_BL2U transferred to SCP\n");
48 else
49 ERROR("BL2U: SCP_BL2U transfer failure\n");
50
51 return ret;
52}