mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-18 18:44:22 +00:00
Merge "fconf: Clean Arm IO" into integration
This commit is contained in:
commit
ce8dfd2884
12 changed files with 150 additions and 401 deletions
7
Makefile
7
Makefile
|
@ -364,7 +364,8 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DTC_FLAGS += -I dts -O dtb
|
DTC_FLAGS += -I dts -O dtb
|
||||||
DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef -x assembler-with-cpp
|
DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \
|
||||||
|
-x assembler-with-cpp $(DEFINES)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Common sources and include directories
|
# Common sources and include directories
|
||||||
|
@ -826,7 +827,7 @@ $(eval $(call assert_boolean,SPMD_SPM_AT_SEL2))
|
||||||
$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
|
$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
|
||||||
$(eval $(call assert_boolean,USE_COHERENT_MEM))
|
$(eval $(call assert_boolean,USE_COHERENT_MEM))
|
||||||
$(eval $(call assert_boolean,USE_DEBUGFS))
|
$(eval $(call assert_boolean,USE_DEBUGFS))
|
||||||
$(eval $(call assert_boolean,USE_FCONF_BASED_IO))
|
$(eval $(call assert_boolean,ARM_IO_IN_DTB))
|
||||||
$(eval $(call assert_boolean,USE_ROMLIB))
|
$(eval $(call assert_boolean,USE_ROMLIB))
|
||||||
$(eval $(call assert_boolean,USE_TBBR_DEFS))
|
$(eval $(call assert_boolean,USE_TBBR_DEFS))
|
||||||
$(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY))
|
$(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY))
|
||||||
|
@ -904,7 +905,7 @@ $(eval $(call add_define,SPMD_SPM_AT_SEL2))
|
||||||
$(eval $(call add_define,TRUSTED_BOARD_BOOT))
|
$(eval $(call add_define,TRUSTED_BOARD_BOOT))
|
||||||
$(eval $(call add_define,USE_COHERENT_MEM))
|
$(eval $(call add_define,USE_COHERENT_MEM))
|
||||||
$(eval $(call add_define,USE_DEBUGFS))
|
$(eval $(call add_define,USE_DEBUGFS))
|
||||||
$(eval $(call add_define,USE_FCONF_BASED_IO))
|
$(eval $(call add_define,ARM_IO_IN_DTB))
|
||||||
$(eval $(call add_define,USE_ROMLIB))
|
$(eval $(call add_define,USE_ROMLIB))
|
||||||
$(eval $(call add_define,USE_TBBR_DEFS))
|
$(eval $(call add_define,USE_TBBR_DEFS))
|
||||||
$(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY))
|
$(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY))
|
||||||
|
|
|
@ -622,8 +622,8 @@ Common build options
|
||||||
exposing a virtual filesystem interface through BL31 as a SiP SMC function.
|
exposing a virtual filesystem interface through BL31 as a SiP SMC function.
|
||||||
Default is 0.
|
Default is 0.
|
||||||
|
|
||||||
- ``USE_FCONF_BASED_IO``: This flag determines whether to use IO based on the
|
- ``ARM_IO_IN_DTB``: This flag determines whether to use IO based on the
|
||||||
firmware configuration framework. This allows moving the io_policies into a
|
firmware configuration framework. This will move the io_policies into a
|
||||||
configuration device tree, instead of static structure in the code base.
|
configuration device tree, instead of static structure in the code base.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ void fconf_load_config(void)
|
||||||
err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info);
|
err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
/* Return if FW_CONFIG is not loaded */
|
/* Return if FW_CONFIG is not loaded */
|
||||||
VERBOSE("Failed to load FW_CONFIG\n");
|
WARN("Failed to load FW_CONFIG\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ USE_COHERENT_MEM := 1
|
||||||
USE_DEBUGFS := 0
|
USE_DEBUGFS := 0
|
||||||
|
|
||||||
# Build option to fconf based io
|
# Build option to fconf based io
|
||||||
USE_FCONF_BASED_IO := 0
|
ARM_IO_IN_DTB := 0
|
||||||
|
|
||||||
# Build option to choose whether Trusted Firmware uses library at ROM
|
# Build option to choose whether Trusted Firmware uses library at ROM
|
||||||
USE_ROMLIB := 0
|
USE_ROMLIB := 0
|
||||||
|
|
|
@ -41,6 +41,7 @@ BL1_SOURCES += drivers/io/io_fip.c \
|
||||||
plat/arm/common/arm_err.c \
|
plat/arm/common/arm_err.c \
|
||||||
plat/arm/board/a5ds/a5ds_err.c \
|
plat/arm/board/a5ds/a5ds_err.c \
|
||||||
plat/arm/common/arm_io_storage.c \
|
plat/arm/common/arm_io_storage.c \
|
||||||
|
plat/arm/common/fconf/arm_fconf_io.c \
|
||||||
plat/arm/board/a5ds/${ARCH}/a5ds_helpers.S \
|
plat/arm/board/a5ds/${ARCH}/a5ds_helpers.S \
|
||||||
plat/arm/board/a5ds/a5ds_bl1_setup.c \
|
plat/arm/board/a5ds/a5ds_bl1_setup.c \
|
||||||
lib/aarch32/arm32_aeabi_divmod.c \
|
lib/aarch32/arm32_aeabi_divmod.c \
|
||||||
|
@ -61,6 +62,7 @@ BL2_SOURCES += lib/aarch32/arm32_aeabi_divmod.c \
|
||||||
plat/arm/common/arm_err.c \
|
plat/arm/common/arm_err.c \
|
||||||
plat/arm/board/a5ds/a5ds_err.c \
|
plat/arm/board/a5ds/a5ds_err.c \
|
||||||
plat/arm/common/arm_io_storage.c \
|
plat/arm/common/arm_io_storage.c \
|
||||||
|
plat/arm/common/fconf/arm_fconf_io.c \
|
||||||
plat/arm/common/${ARCH}/arm_bl2_mem_params_desc.c \
|
plat/arm/common/${ARCH}/arm_bl2_mem_params_desc.c \
|
||||||
plat/arm/common/arm_image_load.c \
|
plat/arm/common/arm_image_load.c \
|
||||||
common/desc_image_load.c \
|
common/desc_image_load.c \
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
* stored in machine order (little endian).
|
* stored in machine order (little endian).
|
||||||
* This will be fixed in future.
|
* This will be fixed in future.
|
||||||
*/
|
*/
|
||||||
|
#if ARM_IO_IN_DTB
|
||||||
arm-io_policies {
|
arm-io_policies {
|
||||||
fip-handles {
|
fip-handles {
|
||||||
compatible = "arm,io-fip-handle";
|
compatible = "arm,io-fip-handle";
|
||||||
|
@ -99,6 +100,7 @@
|
||||||
nt_fw_content_cert_uuid = <0xf3c1c48e 0x11e4635d 0xee87a9a7 0xa73fb240>;
|
nt_fw_content_cert_uuid = <0xf3c1c48e 0x11e4635d 0xee87a9a7 0xa73fb240>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#endif /* ARM_IO_IN_DTB */
|
||||||
|
|
||||||
secure-partitions {
|
secure-partitions {
|
||||||
compatible = "arm,sp";
|
compatible = "arm,sp";
|
||||||
|
|
|
@ -10,11 +10,6 @@ FVP_USE_GIC_DRIVER := FVP_GICV3
|
||||||
# Use the SP804 timer instead of the generic one
|
# Use the SP804 timer instead of the generic one
|
||||||
FVP_USE_SP804_TIMER := 0
|
FVP_USE_SP804_TIMER := 0
|
||||||
|
|
||||||
# Use fconf based io for FVP
|
|
||||||
ifeq ($(BL2_AT_EL3), 0)
|
|
||||||
USE_FCONF_BASED_IO := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Default cluster count for FVP
|
# Default cluster count for FVP
|
||||||
FVP_CLUSTER_COUNT := 2
|
FVP_CLUSTER_COUNT := 2
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ BL1_SOURCES += drivers/arm/sp805/sp805.c \
|
||||||
plat/arm/common/arm_err.c \
|
plat/arm/common/arm_err.c \
|
||||||
plat/arm/board/fvp_ve/fvp_ve_err.c \
|
plat/arm/board/fvp_ve/fvp_ve_err.c \
|
||||||
plat/arm/common/arm_io_storage.c \
|
plat/arm/common/arm_io_storage.c \
|
||||||
|
plat/arm/common/fconf/arm_fconf_io.c \
|
||||||
drivers/cfi/v2m/v2m_flash.c \
|
drivers/cfi/v2m/v2m_flash.c \
|
||||||
plat/arm/board/fvp_ve/${ARCH}/fvp_ve_helpers.S \
|
plat/arm/board/fvp_ve/${ARCH}/fvp_ve_helpers.S \
|
||||||
plat/arm/board/fvp_ve/fvp_ve_bl1_setup.c \
|
plat/arm/board/fvp_ve/fvp_ve_bl1_setup.c \
|
||||||
|
@ -63,6 +64,7 @@ BL2_SOURCES += plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c \
|
||||||
plat/arm/common/arm_err.c \
|
plat/arm/common/arm_err.c \
|
||||||
plat/arm/board/fvp_ve/fvp_ve_err.c \
|
plat/arm/board/fvp_ve/fvp_ve_err.c \
|
||||||
plat/arm/common/arm_io_storage.c \
|
plat/arm/common/arm_io_storage.c \
|
||||||
|
plat/arm/common/fconf/arm_fconf_io.c \
|
||||||
plat/arm/common/${ARCH}/arm_bl2_mem_params_desc.c \
|
plat/arm/common/${ARCH}/arm_bl2_mem_params_desc.c \
|
||||||
plat/arm/common/arm_image_load.c \
|
plat/arm/common/arm_image_load.c \
|
||||||
common/desc_image_load.c \
|
common/desc_image_load.c \
|
||||||
|
|
|
@ -177,17 +177,13 @@ include lib/xlat_tables_v2/xlat_tables.mk
|
||||||
PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
|
PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (${USE_FCONF_BASED_IO}, 0)
|
ARM_IO_SOURCES += plat/arm/common/arm_io_storage.c \
|
||||||
ARM_IO_SOURCES += plat/arm/common/arm_io_storage.c
|
|
||||||
else
|
|
||||||
ARM_IO_SOURCES += plat/arm/common/arm_fconf_io_storage.c \
|
|
||||||
plat/arm/common/fconf/arm_fconf_io.c
|
plat/arm/common/fconf/arm_fconf_io.c
|
||||||
ifeq (${SPD},spmd)
|
ifeq (${SPD},spmd)
|
||||||
ifeq (${SPMD_SPM_AT_SEL2},1)
|
ifeq (${SPMD_SPM_AT_SEL2},1)
|
||||||
ARM_IO_SOURCES += plat/arm/common/fconf/arm_fconf_sp.c
|
ARM_IO_SOURCES += plat/arm/common/fconf/arm_fconf_sp.c
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
BL1_SOURCES += drivers/io/io_fip.c \
|
BL1_SOURCES += drivers/io/io_fip.c \
|
||||||
drivers/io/io_memmap.c \
|
drivers/io/io_memmap.c \
|
||||||
|
|
|
@ -1,142 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2015-2020, ARM Limited. All rights reserved.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <common/debug.h>
|
|
||||||
#include <drivers/io/io_driver.h>
|
|
||||||
#include <drivers/io/io_fip.h>
|
|
||||||
#include <drivers/io/io_memmap.h>
|
|
||||||
#include <drivers/io/io_storage.h>
|
|
||||||
#include <lib/utils.h>
|
|
||||||
|
|
||||||
#include <plat/arm/common/arm_fconf_getter.h>
|
|
||||||
#include <plat/arm/common/arm_fconf_io_storage.h>
|
|
||||||
#include <plat/arm/common/plat_arm.h>
|
|
||||||
#include <plat/common/platform.h>
|
|
||||||
#include <platform_def.h>
|
|
||||||
|
|
||||||
/* IO devices */
|
|
||||||
static const io_dev_connector_t *fip_dev_con;
|
|
||||||
uintptr_t fip_dev_handle;
|
|
||||||
static const io_dev_connector_t *memmap_dev_con;
|
|
||||||
uintptr_t memmap_dev_handle;
|
|
||||||
|
|
||||||
/* Weak definitions may be overridden in specific ARM standard platform */
|
|
||||||
#pragma weak plat_arm_io_setup
|
|
||||||
#pragma weak plat_arm_get_alt_image_source
|
|
||||||
|
|
||||||
int open_fip(const uintptr_t spec)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
uintptr_t local_image_handle;
|
|
||||||
|
|
||||||
/* See if a Firmware Image Package is available */
|
|
||||||
result = io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_ID);
|
|
||||||
if (result == 0) {
|
|
||||||
result = io_open(fip_dev_handle, spec, &local_image_handle);
|
|
||||||
if (result == 0) {
|
|
||||||
VERBOSE("Using FIP\n");
|
|
||||||
io_close(local_image_handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int open_memmap(const uintptr_t spec)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
uintptr_t local_image_handle;
|
|
||||||
|
|
||||||
result = io_dev_init(memmap_dev_handle, (uintptr_t)NULL);
|
|
||||||
if (result == 0) {
|
|
||||||
result = io_open(memmap_dev_handle, spec, &local_image_handle);
|
|
||||||
if (result == 0) {
|
|
||||||
VERBOSE("Using Memmap\n");
|
|
||||||
io_close(local_image_handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int arm_io_setup(void)
|
|
||||||
{
|
|
||||||
int io_result;
|
|
||||||
|
|
||||||
io_result = register_io_dev_fip(&fip_dev_con);
|
|
||||||
if (io_result < 0) {
|
|
||||||
return io_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
io_result = register_io_dev_memmap(&memmap_dev_con);
|
|
||||||
if (io_result < 0) {
|
|
||||||
return io_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open connections to devices and cache the handles */
|
|
||||||
io_result = io_dev_open(fip_dev_con, (uintptr_t)NULL,
|
|
||||||
&fip_dev_handle);
|
|
||||||
if (io_result < 0) {
|
|
||||||
return io_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
io_result = io_dev_open(memmap_dev_con, (uintptr_t)NULL,
|
|
||||||
&memmap_dev_handle);
|
|
||||||
|
|
||||||
return io_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void plat_arm_io_setup(void)
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = arm_io_setup();
|
|
||||||
if (err < 0) {
|
|
||||||
panic();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int plat_arm_get_alt_image_source(
|
|
||||||
unsigned int image_id __unused,
|
|
||||||
uintptr_t *dev_handle __unused,
|
|
||||||
uintptr_t *image_spec __unused)
|
|
||||||
{
|
|
||||||
/* By default do not try an alternative */
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return an IO device handle and specification which can be used to access
|
|
||||||
* an image. Use this to enforce platform load policy */
|
|
||||||
int plat_get_image_source(unsigned int image_id, uintptr_t *dev_handle,
|
|
||||||
uintptr_t *image_spec)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
const struct plat_io_policy *policy;
|
|
||||||
|
|
||||||
assert(image_id < MAX_NUMBER_IDS);
|
|
||||||
|
|
||||||
policy = FCONF_GET_PROPERTY(arm, io_policies, image_id);
|
|
||||||
result = policy->check(policy->image_spec);
|
|
||||||
if (result == 0) {
|
|
||||||
*image_spec = policy->image_spec;
|
|
||||||
*dev_handle = *(policy->dev_handle);
|
|
||||||
} else {
|
|
||||||
VERBOSE("Trying alternative IO\n");
|
|
||||||
result = plat_arm_get_alt_image_source(image_id, dev_handle,
|
|
||||||
image_spec);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* See if a Firmware Image Package is available,
|
|
||||||
* by checking if TOC is valid or not.
|
|
||||||
*/
|
|
||||||
bool arm_io_is_toc_valid(void)
|
|
||||||
{
|
|
||||||
return (io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_ID) == 0);
|
|
||||||
}
|
|
|
@ -1,13 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2015-2020, ARM Limited. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <platform_def.h>
|
|
||||||
|
|
||||||
#include <common/debug.h>
|
#include <common/debug.h>
|
||||||
#include <drivers/io/io_driver.h>
|
#include <drivers/io/io_driver.h>
|
||||||
|
@ -15,249 +12,24 @@
|
||||||
#include <drivers/io/io_memmap.h>
|
#include <drivers/io/io_memmap.h>
|
||||||
#include <drivers/io/io_storage.h>
|
#include <drivers/io/io_storage.h>
|
||||||
#include <lib/utils.h>
|
#include <lib/utils.h>
|
||||||
|
|
||||||
|
#include <plat/arm/common/arm_fconf_getter.h>
|
||||||
|
#include <plat/arm/common/arm_fconf_io_storage.h>
|
||||||
#include <plat/arm/common/plat_arm.h>
|
#include <plat/arm/common/plat_arm.h>
|
||||||
#include <plat/common/platform.h>
|
#include <plat/common/platform.h>
|
||||||
#include <tools_share/firmware_image_package.h>
|
#include <platform_def.h>
|
||||||
|
|
||||||
/* IO devices */
|
/* IO devices */
|
||||||
static const io_dev_connector_t *fip_dev_con;
|
static const io_dev_connector_t *fip_dev_con;
|
||||||
static uintptr_t fip_dev_handle;
|
uintptr_t fip_dev_handle;
|
||||||
static const io_dev_connector_t *memmap_dev_con;
|
static const io_dev_connector_t *memmap_dev_con;
|
||||||
static uintptr_t memmap_dev_handle;
|
uintptr_t memmap_dev_handle;
|
||||||
|
|
||||||
static const io_block_spec_t fip_block_spec = {
|
|
||||||
.offset = PLAT_ARM_FIP_BASE,
|
|
||||||
.length = PLAT_ARM_FIP_MAX_SIZE
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t bl2_uuid_spec = {
|
|
||||||
.uuid = UUID_TRUSTED_BOOT_FIRMWARE_BL2,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t scp_bl2_uuid_spec = {
|
|
||||||
.uuid = UUID_SCP_FIRMWARE_SCP_BL2,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t bl31_uuid_spec = {
|
|
||||||
.uuid = UUID_EL3_RUNTIME_FIRMWARE_BL31,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t bl32_uuid_spec = {
|
|
||||||
.uuid = UUID_SECURE_PAYLOAD_BL32,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t bl32_extra1_uuid_spec = {
|
|
||||||
.uuid = UUID_SECURE_PAYLOAD_BL32_EXTRA1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t bl32_extra2_uuid_spec = {
|
|
||||||
.uuid = UUID_SECURE_PAYLOAD_BL32_EXTRA2,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t bl33_uuid_spec = {
|
|
||||||
.uuid = UUID_NON_TRUSTED_FIRMWARE_BL33,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t tb_fw_config_uuid_spec = {
|
|
||||||
.uuid = UUID_TB_FW_CONFIG,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t hw_config_uuid_spec = {
|
|
||||||
.uuid = UUID_HW_CONFIG,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t soc_fw_config_uuid_spec = {
|
|
||||||
.uuid = UUID_SOC_FW_CONFIG,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t tos_fw_config_uuid_spec = {
|
|
||||||
.uuid = UUID_TOS_FW_CONFIG,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t nt_fw_config_uuid_spec = {
|
|
||||||
.uuid = UUID_NT_FW_CONFIG,
|
|
||||||
};
|
|
||||||
|
|
||||||
#if TRUSTED_BOARD_BOOT
|
|
||||||
static const io_uuid_spec_t tb_fw_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_TRUSTED_BOOT_FW_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t trusted_key_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_TRUSTED_KEY_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t scp_fw_key_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_SCP_FW_KEY_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t soc_fw_key_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_SOC_FW_KEY_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t tos_fw_key_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_TRUSTED_OS_FW_KEY_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t nt_fw_key_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_NON_TRUSTED_FW_KEY_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t scp_fw_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_SCP_FW_CONTENT_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t soc_fw_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_SOC_FW_CONTENT_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t tos_fw_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_TRUSTED_OS_FW_CONTENT_CERT,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const io_uuid_spec_t nt_fw_cert_uuid_spec = {
|
|
||||||
.uuid = UUID_NON_TRUSTED_FW_CONTENT_CERT,
|
|
||||||
};
|
|
||||||
#endif /* TRUSTED_BOARD_BOOT */
|
|
||||||
|
|
||||||
|
|
||||||
static int open_fip(const uintptr_t spec);
|
|
||||||
static int open_memmap(const uintptr_t spec);
|
|
||||||
|
|
||||||
struct plat_io_policy {
|
|
||||||
uintptr_t *dev_handle;
|
|
||||||
uintptr_t image_spec;
|
|
||||||
int (*check)(const uintptr_t spec);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* By default, ARM platforms load images from the FIP */
|
|
||||||
static const struct plat_io_policy policies[] = {
|
|
||||||
[FIP_IMAGE_ID] = {
|
|
||||||
&memmap_dev_handle,
|
|
||||||
(uintptr_t)&fip_block_spec,
|
|
||||||
open_memmap
|
|
||||||
},
|
|
||||||
[BL2_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&bl2_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[SCP_BL2_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&scp_bl2_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[BL31_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&bl31_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[BL32_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&bl32_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[BL32_EXTRA1_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&bl32_extra1_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[BL32_EXTRA2_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&bl32_extra2_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[BL33_IMAGE_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&bl33_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[TB_FW_CONFIG_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&tb_fw_config_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[HW_CONFIG_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&hw_config_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[SOC_FW_CONFIG_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&soc_fw_config_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[TOS_FW_CONFIG_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&tos_fw_config_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[NT_FW_CONFIG_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&nt_fw_config_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
#if TRUSTED_BOARD_BOOT
|
|
||||||
[TRUSTED_BOOT_FW_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&tb_fw_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[TRUSTED_KEY_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&trusted_key_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[SCP_FW_KEY_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&scp_fw_key_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[SOC_FW_KEY_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&soc_fw_key_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[TRUSTED_OS_FW_KEY_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&tos_fw_key_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[NON_TRUSTED_FW_KEY_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&nt_fw_key_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[SCP_FW_CONTENT_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&scp_fw_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[SOC_FW_CONTENT_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&soc_fw_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[TRUSTED_OS_FW_CONTENT_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&tos_fw_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
[NON_TRUSTED_FW_CONTENT_CERT_ID] = {
|
|
||||||
&fip_dev_handle,
|
|
||||||
(uintptr_t)&nt_fw_cert_uuid_spec,
|
|
||||||
open_fip
|
|
||||||
},
|
|
||||||
#endif /* TRUSTED_BOARD_BOOT */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Weak definitions may be overridden in specific ARM standard platform */
|
/* Weak definitions may be overridden in specific ARM standard platform */
|
||||||
#pragma weak plat_arm_io_setup
|
#pragma weak plat_arm_io_setup
|
||||||
#pragma weak plat_arm_get_alt_image_source
|
#pragma weak plat_arm_get_alt_image_source
|
||||||
|
|
||||||
|
int open_fip(const uintptr_t spec)
|
||||||
static int open_fip(const uintptr_t spec)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
uintptr_t local_image_handle;
|
uintptr_t local_image_handle;
|
||||||
|
@ -274,8 +46,7 @@ static int open_fip(const uintptr_t spec)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int open_memmap(const uintptr_t spec)
|
||||||
static int open_memmap(const uintptr_t spec)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
uintptr_t local_image_handle;
|
uintptr_t local_image_handle;
|
||||||
|
@ -291,7 +62,6 @@ static int open_memmap(const uintptr_t spec)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int arm_io_setup(void)
|
int arm_io_setup(void)
|
||||||
{
|
{
|
||||||
int io_result;
|
int io_result;
|
||||||
|
@ -346,9 +116,9 @@ int plat_get_image_source(unsigned int image_id, uintptr_t *dev_handle,
|
||||||
int result;
|
int result;
|
||||||
const struct plat_io_policy *policy;
|
const struct plat_io_policy *policy;
|
||||||
|
|
||||||
assert(image_id < ARRAY_SIZE(policies));
|
assert(image_id < MAX_NUMBER_IDS);
|
||||||
|
|
||||||
policy = &policies[image_id];
|
policy = FCONF_GET_PROPERTY(arm, io_policies, image_id);
|
||||||
result = policy->check(policy->image_spec);
|
result = policy->check(policy->image_spec);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
*image_spec = policy->image_spec;
|
*image_spec = policy->image_spec;
|
||||||
|
@ -370,4 +140,3 @@ bool arm_io_is_toc_valid(void)
|
||||||
{
|
{
|
||||||
return (io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_ID) == 0);
|
return (io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_ID) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,31 @@ const io_block_spec_t fip_block_spec = {
|
||||||
const io_uuid_spec_t arm_uuid_spec[MAX_NUMBER_IDS] = {
|
const io_uuid_spec_t arm_uuid_spec[MAX_NUMBER_IDS] = {
|
||||||
[BL2_IMAGE_ID] = {UUID_TRUSTED_BOOT_FIRMWARE_BL2},
|
[BL2_IMAGE_ID] = {UUID_TRUSTED_BOOT_FIRMWARE_BL2},
|
||||||
[TB_FW_CONFIG_ID] = {UUID_TB_FW_CONFIG},
|
[TB_FW_CONFIG_ID] = {UUID_TB_FW_CONFIG},
|
||||||
|
#if !ARM_IO_IN_DTB
|
||||||
|
[SCP_BL2_IMAGE_ID] = {UUID_SCP_FIRMWARE_SCP_BL2},
|
||||||
|
[BL31_IMAGE_ID] = {UUID_EL3_RUNTIME_FIRMWARE_BL31},
|
||||||
|
[BL32_IMAGE_ID] = {UUID_SECURE_PAYLOAD_BL32},
|
||||||
|
[BL32_EXTRA1_IMAGE_ID] = {UUID_SECURE_PAYLOAD_BL32_EXTRA1},
|
||||||
|
[BL32_EXTRA2_IMAGE_ID] = {UUID_SECURE_PAYLOAD_BL32_EXTRA2},
|
||||||
|
[BL33_IMAGE_ID] = {UUID_NON_TRUSTED_FIRMWARE_BL33},
|
||||||
|
[HW_CONFIG_ID] = {UUID_HW_CONFIG},
|
||||||
|
[SOC_FW_CONFIG_ID] = {UUID_SOC_FW_CONFIG},
|
||||||
|
[TOS_FW_CONFIG_ID] = {UUID_TOS_FW_CONFIG},
|
||||||
|
[NT_FW_CONFIG_ID] = {UUID_NT_FW_CONFIG},
|
||||||
|
#endif /* ARM_IO_IN_DTB */
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
[TRUSTED_BOOT_FW_CERT_ID] = {UUID_TRUSTED_BOOT_FW_CERT},
|
[TRUSTED_BOOT_FW_CERT_ID] = {UUID_TRUSTED_BOOT_FW_CERT},
|
||||||
|
#if !ARM_IO_IN_DTB
|
||||||
|
[TRUSTED_KEY_CERT_ID] = {UUID_TRUSTED_KEY_CERT},
|
||||||
|
[SCP_FW_KEY_CERT_ID] = {UUID_SCP_FW_KEY_CERT},
|
||||||
|
[SOC_FW_KEY_CERT_ID] = {UUID_SOC_FW_KEY_CERT},
|
||||||
|
[TRUSTED_OS_FW_KEY_CERT_ID] = {UUID_TRUSTED_OS_FW_KEY_CERT},
|
||||||
|
[NON_TRUSTED_FW_KEY_CERT_ID] = {UUID_NON_TRUSTED_FW_KEY_CERT},
|
||||||
|
[SCP_FW_CONTENT_CERT_ID] = {UUID_SCP_FW_CONTENT_CERT},
|
||||||
|
[SOC_FW_CONTENT_CERT_ID] = {UUID_SOC_FW_CONTENT_CERT},
|
||||||
|
[TRUSTED_OS_FW_CONTENT_CERT_ID] = {UUID_TRUSTED_OS_FW_CONTENT_CERT},
|
||||||
|
[NON_TRUSTED_FW_CONTENT_CERT_ID] = {UUID_NON_TRUSTED_FW_CONTENT_CERT},
|
||||||
|
#endif /* ARM_IO_IN_DTB */
|
||||||
#endif /* TRUSTED_BOARD_BOOT */
|
#endif /* TRUSTED_BOARD_BOOT */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,12 +70,111 @@ struct plat_io_policy policies[MAX_NUMBER_IDS] = {
|
||||||
(uintptr_t)&arm_uuid_spec[TB_FW_CONFIG_ID],
|
(uintptr_t)&arm_uuid_spec[TB_FW_CONFIG_ID],
|
||||||
open_fip
|
open_fip
|
||||||
},
|
},
|
||||||
|
#if !ARM_IO_IN_DTB
|
||||||
|
[SCP_BL2_IMAGE_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[SCP_BL2_IMAGE_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[BL31_IMAGE_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[BL31_IMAGE_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[BL32_IMAGE_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[BL32_IMAGE_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[BL32_EXTRA1_IMAGE_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[BL32_EXTRA1_IMAGE_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[BL32_EXTRA2_IMAGE_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[BL32_EXTRA2_IMAGE_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[BL33_IMAGE_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[BL33_IMAGE_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[HW_CONFIG_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[HW_CONFIG_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[SOC_FW_CONFIG_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[SOC_FW_CONFIG_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[TOS_FW_CONFIG_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[TOS_FW_CONFIG_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[NT_FW_CONFIG_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[NT_FW_CONFIG_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
#endif /* ARM_IO_IN_DTB */
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
[TRUSTED_BOOT_FW_CERT_ID] = {
|
[TRUSTED_BOOT_FW_CERT_ID] = {
|
||||||
&fip_dev_handle,
|
&fip_dev_handle,
|
||||||
(uintptr_t)&arm_uuid_spec[TRUSTED_BOOT_FW_CERT_ID],
|
(uintptr_t)&arm_uuid_spec[TRUSTED_BOOT_FW_CERT_ID],
|
||||||
open_fip
|
open_fip
|
||||||
},
|
},
|
||||||
|
#if !ARM_IO_IN_DTB
|
||||||
|
[TRUSTED_KEY_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[TRUSTED_KEY_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[SCP_FW_KEY_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[SCP_FW_KEY_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[SOC_FW_KEY_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[SOC_FW_KEY_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[TRUSTED_OS_FW_KEY_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[TRUSTED_OS_FW_KEY_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[NON_TRUSTED_FW_KEY_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[NON_TRUSTED_FW_KEY_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[SCP_FW_CONTENT_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[SCP_FW_CONTENT_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[SOC_FW_CONTENT_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[SOC_FW_CONTENT_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[TRUSTED_OS_FW_CONTENT_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[TRUSTED_OS_FW_CONTENT_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
[NON_TRUSTED_FW_CONTENT_CERT_ID] = {
|
||||||
|
&fip_dev_handle,
|
||||||
|
(uintptr_t)&arm_uuid_spec[NON_TRUSTED_FW_CONTENT_CERT_ID],
|
||||||
|
open_fip
|
||||||
|
},
|
||||||
|
#endif /* ARM_IO_IN_DTB */
|
||||||
#endif /* TRUSTED_BOARD_BOOT */
|
#endif /* TRUSTED_BOARD_BOOT */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,6 +260,8 @@ int fconf_populate_arm_io_policies(uintptr_t config)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ARM_IO_IN_DTB
|
||||||
FCONF_REGISTER_POPULATOR(TB_FW, arm_io, fconf_populate_arm_io_policies);
|
FCONF_REGISTER_POPULATOR(TB_FW, arm_io, fconf_populate_arm_io_policies);
|
||||||
|
#endif /* ARM_IO_IN_DTB */
|
||||||
|
|
||||||
#endif /* IMAGE_BL2 */
|
#endif /* IMAGE_BL2 */
|
||||||
|
|
Loading…
Add table
Reference in a new issue