ARM Platorms: Load TB_FW_CONFIG in BL1
This patch modifies the bl1_platform_setup() API to load and authenticate TB_FW_CONFIG in BL1. The load address of the same is passed on to BL2 in `arg0` of entrypoint info. The fvp_io_storage.c and arm_io_storage.c also adds entries corresponding to TB_FW_CONFIG. A helper function `arm_load_tb_fw_config()` is added to load and authenticate TB_FW_CONFIG if present. Change-Id: Ie7bce667b3fad2b1a083bbcbc0a773f9f04254b1 Signed-off-by: Soby Mathew <soby.mathew@arm.com>
This commit is contained in:
parent
e5674e1fd6
commit
c228956afa
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -306,6 +306,12 @@
|
||||||
*/
|
*/
|
||||||
#define CACHE_WRITEBACK_GRANULE (1 << ARM_CACHE_WRITEBACK_SHIFT)
|
#define CACHE_WRITEBACK_GRANULE (1 << ARM_CACHE_WRITEBACK_SHIFT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To enable TB_FW_CONFIG to be loaded by BL1, define the corresponding base
|
||||||
|
* and limit. Leave enough space of BL2 meminfo.
|
||||||
|
*/
|
||||||
|
#define ARM_TB_FW_CONFIG_BASE ARM_BL_RAM_BASE + sizeof(meminfo_t)
|
||||||
|
#define ARM_TB_FW_CONFIG_LIMIT BL2_LIMIT
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* BL1 specific defines.
|
* BL1 specific defines.
|
||||||
|
|
|
@ -178,6 +178,9 @@ void arm_sp_min_plat_runtime_setup(void);
|
||||||
/* FIP TOC validity check */
|
/* FIP TOC validity check */
|
||||||
int arm_io_is_toc_valid(void);
|
int arm_io_is_toc_valid(void);
|
||||||
|
|
||||||
|
/* Utility functions for Dynamic Config */
|
||||||
|
void arm_load_tb_fw_config(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mandatory functions required in ARM standard platforms
|
* Mandatory functions required in ARM standard platforms
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
#define BL31_IMAGE_NAME "bl31.bin"
|
#define BL31_IMAGE_NAME "bl31.bin"
|
||||||
#define BL32_IMAGE_NAME "bl32.bin"
|
#define BL32_IMAGE_NAME "bl32.bin"
|
||||||
#define BL33_IMAGE_NAME "bl33.bin"
|
#define BL33_IMAGE_NAME "bl33.bin"
|
||||||
|
#define TB_FW_CONFIG_NAME "fvp_tb_fw_config.dtb"
|
||||||
|
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
#define TRUSTED_BOOT_FW_CERT_NAME "tb_fw.crt"
|
#define TRUSTED_BOOT_FW_CERT_NAME "tb_fw.crt"
|
||||||
|
@ -51,6 +52,10 @@ static const io_file_spec_t sh_file_spec[] = {
|
||||||
.path = BL33_IMAGE_NAME,
|
.path = BL33_IMAGE_NAME,
|
||||||
.mode = FOPEN_MODE_RB
|
.mode = FOPEN_MODE_RB
|
||||||
},
|
},
|
||||||
|
[TB_FW_CONFIG_ID] = {
|
||||||
|
.path = TB_FW_CONFIG_NAME,
|
||||||
|
.mode = FOPEN_MODE_RB
|
||||||
|
},
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
[TRUSTED_BOOT_FW_CERT_ID] = {
|
[TRUSTED_BOOT_FW_CERT_ID] = {
|
||||||
.path = TRUSTED_BOOT_FW_CERT_NAME,
|
.path = TRUSTED_BOOT_FW_CERT_NAME,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -115,6 +115,9 @@ void arm_bl1_platform_setup(void)
|
||||||
{
|
{
|
||||||
/* Initialise the IO layer and register platform IO devices */
|
/* Initialise the IO layer and register platform IO devices */
|
||||||
plat_arm_io_setup();
|
plat_arm_io_setup();
|
||||||
|
#if LOAD_IMAGE_V2
|
||||||
|
arm_load_tb_fw_config();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void bl1_platform_setup(void)
|
void bl1_platform_setup(void)
|
||||||
|
|
|
@ -136,6 +136,7 @@ BL1_SOURCES += drivers/arm/sp805/sp805.c \
|
||||||
drivers/io/io_memmap.c \
|
drivers/io/io_memmap.c \
|
||||||
drivers/io/io_storage.c \
|
drivers/io/io_storage.c \
|
||||||
plat/arm/common/arm_bl1_setup.c \
|
plat/arm/common/arm_bl1_setup.c \
|
||||||
|
plat/arm/common/arm_dyn_cfg.c \
|
||||||
plat/arm/common/arm_io_storage.c
|
plat/arm/common/arm_io_storage.c
|
||||||
ifdef EL3_PAYLOAD_BASE
|
ifdef EL3_PAYLOAD_BASE
|
||||||
# Need the arm_program_trusted_mailbox() function to release secondary CPUs from
|
# Need the arm_program_trusted_mailbox() function to release secondary CPUs from
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <desc_image_load.h>
|
||||||
|
#include <platform.h>
|
||||||
|
#include <platform_def.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <tbbr_img_def.h>
|
||||||
|
|
||||||
|
#if LOAD_IMAGE_V2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function to load TB_FW_CONFIG and populate the load information to
|
||||||
|
* arg0 of BL2 entrypoint info.
|
||||||
|
*/
|
||||||
|
void arm_load_tb_fw_config(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
uintptr_t config_base = 0;
|
||||||
|
image_desc_t *image_desc;
|
||||||
|
|
||||||
|
image_desc_t arm_tb_fw_info = {
|
||||||
|
.image_id = TB_FW_CONFIG_ID,
|
||||||
|
SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
|
||||||
|
VERSION_2, image_info_t, 0),
|
||||||
|
.image_info.image_base = ARM_TB_FW_CONFIG_BASE,
|
||||||
|
.image_info.image_max_size = ARM_TB_FW_CONFIG_LIMIT - ARM_TB_FW_CONFIG_BASE,
|
||||||
|
};
|
||||||
|
|
||||||
|
VERBOSE("BL1: Loading TB_FW_CONFIG\n");
|
||||||
|
err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info.image_info);
|
||||||
|
if (err) {
|
||||||
|
/* Return if TB_FW_CONFIG is not loaded */
|
||||||
|
VERBOSE("Failed to load TB_FW_CONFIG\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
config_base = arm_tb_fw_info.image_info.image_base;
|
||||||
|
|
||||||
|
/* The BL2 ep_info arg0 is modified to point to TB_FW_CONFIG */
|
||||||
|
image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
|
||||||
|
assert(image_desc);
|
||||||
|
image_desc->ep_info.args.arg0 = config_base;
|
||||||
|
|
||||||
|
INFO("BL1: TB_FW_CONFIG loaded at address = %p\n",
|
||||||
|
(void *) config_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LOAD_IMAGE_V2 */
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -53,6 +53,10 @@ static const io_uuid_spec_t bl33_uuid_spec = {
|
||||||
.uuid = UUID_NON_TRUSTED_FIRMWARE_BL33,
|
.uuid = UUID_NON_TRUSTED_FIRMWARE_BL33,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const io_uuid_spec_t tb_fw_config_uuid_spec = {
|
||||||
|
.uuid = UUID_TB_FW_CONFIG,
|
||||||
|
};
|
||||||
|
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
static const io_uuid_spec_t tb_fw_cert_uuid_spec = {
|
static const io_uuid_spec_t tb_fw_cert_uuid_spec = {
|
||||||
.uuid = UUID_TRUSTED_BOOT_FW_CERT,
|
.uuid = UUID_TRUSTED_BOOT_FW_CERT,
|
||||||
|
@ -147,6 +151,11 @@ static const struct plat_io_policy policies[] = {
|
||||||
(uintptr_t)&bl33_uuid_spec,
|
(uintptr_t)&bl33_uuid_spec,
|
||||||
open_fip
|
open_fip
|
||||||
},
|
},
|
||||||
|
[TB_FW_CONFIG_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&tb_fw_config_uuid_spec,
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
[TRUSTED_BOOT_FW_CERT_ID] = {
|
[TRUSTED_BOOT_FW_CERT_ID] = {
|
||||||
&fip_dev_handle,
|
&fip_dev_handle,
|
||||||
|
|
Loading…
Reference in New Issue