blob: c3b4f2b3ffcb73bef44ab8c54800f9c0344df0a3 [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>
Antonio Nino Diazbd7b7402019-01-25 14:30:04 +00009#include <plat/arm/common/plat_arm.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <plat/common/platform.h>
11
Soby Mathew73b7bf92017-05-03 12:58:41 +010012#include "../drivers/scp/css_scp.h"
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010013
14/* Weak definition may be overridden in specific CSS based platform */
15#pragma weak bl2u_plat_handle_scp_bl2u
16
17/* Data structure which holds the SCP_BL2U image info for BL2U */
18static image_info_t scp_bl2u_image_info;
19
20/*******************************************************************************
21 * BL1 can pass platform dependent information to BL2U in x1.
22 * In case of ARM CSS platforms x1 contains SCP_BL2U image info.
23 * In case of ARM FVP platforms x1 is not used.
24 * In both cases, x0 contains the extents of the memory available to BL2U
25 ******************************************************************************/
26void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
27{
28 if (!plat_info)
29 panic();
30
31 arm_bl2u_early_platform_setup(mem_layout, plat_info);
32
33 scp_bl2u_image_info = *(image_info_t *)plat_info;
34}
35
36/*******************************************************************************
37 * Transfer SCP_BL2U from Trusted RAM using the SCP Download protocol.
38 ******************************************************************************/
39int bl2u_plat_handle_scp_bl2u(void)
40{
41 int ret;
42
43 INFO("BL2U: Initiating SCP_BL2U transfer to SCP\n");
44
Soby Mathew73b7bf92017-05-03 12:58:41 +010045 ret = css_scp_boot_image_xfer((void *)scp_bl2u_image_info.image_base,
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010046 scp_bl2u_image_info.image_size);
47
48 if (ret == 0)
Soby Mathew73b7bf92017-05-03 12:58:41 +010049 ret = css_scp_boot_ready();
50
51 if (ret == 0)
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010052 INFO("BL2U: SCP_BL2U transferred to SCP\n");
53 else
54 ERROR("BL2U: SCP_BL2U transfer failure\n");
55
56 return ret;
57}