Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 1 | /* |
Roberto Vargas | 2b36b15 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 7 | #include <common/bl_common.h> |
| 8 | #include <common/debug.h> |
Antonio Nino Diaz | 326f56b | 2019-01-23 18:55:03 +0000 | [diff] [blame] | 9 | #include <drivers/arm/css/css_scp.h> |
Antonio Nino Diaz | bd7b740 | 2019-01-25 14:30:04 +0000 | [diff] [blame] | 10 | #include <plat/arm/common/plat_arm.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | #include <plat/common/platform.h> |
| 12 | |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 13 | /* Weak definition may be overridden in specific CSS based platform */ |
| 14 | #pragma weak bl2u_plat_handle_scp_bl2u |
| 15 | |
| 16 | /* Data structure which holds the SCP_BL2U image info for BL2U */ |
| 17 | static image_info_t scp_bl2u_image_info; |
| 18 | |
| 19 | /******************************************************************************* |
| 20 | * BL1 can pass platform dependent information to BL2U in x1. |
| 21 | * In case of ARM CSS platforms x1 contains SCP_BL2U image info. |
| 22 | * In case of ARM FVP platforms x1 is not used. |
| 23 | * In both cases, x0 contains the extents of the memory available to BL2U |
| 24 | ******************************************************************************/ |
| 25 | void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) |
| 26 | { |
| 27 | if (!plat_info) |
| 28 | panic(); |
| 29 | |
| 30 | arm_bl2u_early_platform_setup(mem_layout, plat_info); |
| 31 | |
| 32 | scp_bl2u_image_info = *(image_info_t *)plat_info; |
| 33 | } |
| 34 | |
| 35 | /******************************************************************************* |
| 36 | * Transfer SCP_BL2U from Trusted RAM using the SCP Download protocol. |
| 37 | ******************************************************************************/ |
| 38 | int bl2u_plat_handle_scp_bl2u(void) |
| 39 | { |
| 40 | int ret; |
| 41 | |
| 42 | INFO("BL2U: Initiating SCP_BL2U transfer to SCP\n"); |
| 43 | |
Soby Mathew | 73b7bf9 | 2017-05-03 12:58:41 +0100 | [diff] [blame] | 44 | ret = css_scp_boot_image_xfer((void *)scp_bl2u_image_info.image_base, |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 45 | scp_bl2u_image_info.image_size); |
| 46 | |
| 47 | if (ret == 0) |
Soby Mathew | 73b7bf9 | 2017-05-03 12:58:41 +0100 | [diff] [blame] | 48 | ret = css_scp_boot_ready(); |
| 49 | |
| 50 | if (ret == 0) |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 51 | INFO("BL2U: SCP_BL2U transferred to SCP\n"); |
| 52 | else |
| 53 | ERROR("BL2U: SCP_BL2U transfer failure\n"); |
| 54 | |
| 55 | return ret; |
| 56 | } |