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