]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fconf: Clean Arm IO
authorLouis Mayencourt <louis.mayencourt@arm.com>
Fri, 28 Feb 2020 16:57:30 +0000 (16:57 +0000)
committerLouis Mayencourt <louis.mayencourt@arm.com>
Mon, 16 Mar 2020 11:49:19 +0000 (11:49 +0000)
Merge the previously introduced arm_fconf_io_storage into arm_io_storage. This
removes the duplicate io_policies and functions definition.

This patch:
- replace arm_io_storage.c with the content of arm_fconf_io_storage.c
- rename the USE_FCONF_BASED_IO option into ARM_IO_IN_DTB.
- use the ARM_IO_IN_DTB option to compile out io_policies moved in dtb.
- propagate DEFINES when parsing dts.
- use ARM_IO_IN_DTB to include or not uuid nodes in fw_config dtb.
- set the ARM_IO_IN_DTB to 0 by default for fvp. This ensure that the behavior
  of fvp stays the same as it was before the introduction of fconf.

Change-Id: Ia774a96d1d3a2bccad29f7ce2e2b4c21b26c080e
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
12 files changed:
Makefile
docs/getting_started/build-options.rst
lib/fconf/fconf.c
make_helpers/defaults.mk
plat/arm/board/a5ds/platform.mk
plat/arm/board/fvp/fdts/fvp_fw_config.dts
plat/arm/board/fvp/platform.mk
plat/arm/board/fvp_ve/platform.mk
plat/arm/common/arm_common.mk
plat/arm/common/arm_fconf_io_storage.c [deleted file]
plat/arm/common/arm_io_storage.c
plat/arm/common/fconf/arm_fconf_io.c

index 47a544dcfa5587ac6103fd5e2f263ebb63923fe4..609600a985b91ed76760ea20517c171dc4aa8abd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -364,7 +364,8 @@ endif
 endif
 
 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
@@ -826,7 +827,7 @@ $(eval $(call assert_boolean,SPMD_SPM_AT_SEL2))
 $(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
 $(eval $(call assert_boolean,USE_COHERENT_MEM))
 $(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_TBBR_DEFS))
 $(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,USE_COHERENT_MEM))
 $(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_TBBR_DEFS))
 $(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY))
index f138feb4c877cfef85acfb027b3dd587ad5e4e3c..e53f714718500f129b37fc91c773f603d650dbb7 100644 (file)
@@ -622,8 +622,8 @@ Common build options
    exposing a virtual filesystem interface through BL31 as a SiP SMC function.
    Default is 0.
 
--  ``USE_FCONF_BASED_IO``: This flag determines whether to use IO based on the
-   firmware configuration framework. This allows moving the io_policies into a
+-  ``ARM_IO_IN_DTB``: This flag determines whether to use IO based on the
+   firmware configuration framework. This will move the io_policies into a
    configuration device tree, instead of static structure in the code base.
 
 
index 9ce46354dc66dd13a6d9489c3f0c52688f19225b..3007273ae57f41c5ec56ae23be64551f4794f474 100644 (file)
@@ -33,7 +33,7 @@ void fconf_load_config(void)
        err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info);
        if (err != 0) {
                /* Return if FW_CONFIG is not loaded */
-               VERBOSE("Failed to load FW_CONFIG\n");
+               WARN("Failed to load FW_CONFIG\n");
                return;
        }
 
index 03322db1987da8119eddd2844ed2682d1283c1af..4e968e2d3647fb2e4c856a04b65f38fae16deb72 100644 (file)
@@ -223,7 +223,7 @@ USE_COHERENT_MEM            := 1
 USE_DEBUGFS                    := 0
 
 # 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
 USE_ROMLIB                     := 0
index 7198842172bc54662bab2b7f86ea8295d0ef26e8..3a4d5e56dc4541e92baa0fc070ea5a09859c860d 100644 (file)
@@ -41,6 +41,7 @@ BL1_SOURCES           +=      drivers/io/io_fip.c                             \
                                plat/arm/common/arm_err.c                       \
                                plat/arm/board/a5ds/a5ds_err.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/a5ds_bl1_setup.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/board/a5ds/a5ds_err.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/arm_image_load.c                \
                                common/desc_image_load.c                        \
index 9a4a0579941cf3e121818838a9c034476852b7f8..2bb6c3628d6569c4a70110ee17b2c994a38d90d2 100644 (file)
@@ -75,6 +75,7 @@
         * stored in machine order (little endian).
         * This will be fixed in future.
         */
+#if ARM_IO_IN_DTB
        arm-io_policies {
                fip-handles {
                        compatible = "arm,io-fip-handle";
                        nt_fw_content_cert_uuid = <0xf3c1c48e 0x11e4635d 0xee87a9a7 0xa73fb240>;
                };
        };
+#endif /* ARM_IO_IN_DTB */
 
        secure-partitions {
                compatible = "arm,sp";
index ca35697e07ee33b2b3ec6176c580e4609ea3779d..3255e996e0c74340004730599f1e7e97021422c3 100644 (file)
@@ -10,11 +10,6 @@ FVP_USE_GIC_DRIVER   := FVP_GICV3
 # Use the SP804 timer instead of the generic one
 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
 FVP_CLUSTER_COUNT      := 2
 
index 7883719b0915896f475ce552fbd34a015d746f22..9ada86bf1e61eb9274731d3a75230a25350d633c 100644 (file)
@@ -42,6 +42,7 @@ BL1_SOURCES           +=      drivers/arm/sp805/sp805.c                       \
                                plat/arm/common/arm_err.c                       \
                                plat/arm/board/fvp_ve/fvp_ve_err.c              \
                                plat/arm/common/arm_io_storage.c                \
+                               plat/arm/common/fconf/arm_fconf_io.c            \
                                drivers/cfi/v2m/v2m_flash.c                     \
                                plat/arm/board/fvp_ve/${ARCH}/fvp_ve_helpers.S  \
                                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/board/fvp_ve/fvp_ve_err.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/arm_image_load.c                \
                                common/desc_image_load.c                        \
index 65f6bf3c34ae4e0b2b19b6a28ebe0ab0cd3f852a..8368d34c8de206fed5d2df50d896cdf5f60dd14a 100644 (file)
@@ -177,15 +177,11 @@ include lib/xlat_tables_v2/xlat_tables.mk
 PLAT_BL_COMMON_SOURCES +=      ${XLAT_TABLES_LIB_SRCS}
 endif
 
-ifeq (${USE_FCONF_BASED_IO}, 0)
-ARM_IO_SOURCES         +=      plat/arm/common/arm_io_storage.c
-else
-ARM_IO_SOURCES         +=      plat/arm/common/arm_fconf_io_storage.c          \
+ARM_IO_SOURCES         +=      plat/arm/common/arm_io_storage.c                \
                                plat/arm/common/fconf/arm_fconf_io.c
 ifeq (${SPD},spmd)
 ARM_IO_SOURCES         +=      plat/arm/common/fconf/arm_fconf_sp.c
 endif
-endif
 
 BL1_SOURCES            +=      drivers/io/io_fip.c                             \
                                drivers/io/io_memmap.c                          \
diff --git a/plat/arm/common/arm_fconf_io_storage.c b/plat/arm/common/arm_fconf_io_storage.c
deleted file mode 100644 (file)
index 6fcfbd6..0000000
+++ /dev/null
@@ -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);
-}
index f5d8a414d958988750dd658989faed5f79aab8af..6fcfbd6fbcc32bbbe6ec160aab8dc30d79262cd7 100644 (file)
@@ -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
  */
 
 #include <assert.h>
-#include <string.h>
-
-#include <platform_def.h>
 
 #include <common/debug.h>
 #include <drivers/io/io_driver.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 <tools_share/firmware_image_package.h>
+#include <platform_def.h>
 
 /* IO devices */
 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 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 */
-};
-
+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
 
-
-static int open_fip(const uintptr_t spec)
+int open_fip(const uintptr_t spec)
 {
        int result;
        uintptr_t local_image_handle;
@@ -274,8 +46,7 @@ static int open_fip(const uintptr_t spec)
        return result;
 }
 
-
-static int open_memmap(const uintptr_t spec)
+int open_memmap(const uintptr_t spec)
 {
        int result;
        uintptr_t local_image_handle;
@@ -291,7 +62,6 @@ static int open_memmap(const uintptr_t spec)
        return result;
 }
 
-
 int arm_io_setup(void)
 {
        int io_result;
@@ -346,9 +116,9 @@ int plat_get_image_source(unsigned int image_id, uintptr_t *dev_handle,
        int result;
        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);
        if (result == 0) {
                *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);
 }
-
index 017af79a5c5a2e93984f20c682bf38f908f22984..6ebc467ed61764eaaa4e0fda254a23ca52d57ac5 100644 (file)
@@ -25,8 +25,31 @@ const io_block_spec_t fip_block_spec = {
 const io_uuid_spec_t arm_uuid_spec[MAX_NUMBER_IDS] = {
        [BL2_IMAGE_ID] = {UUID_TRUSTED_BOOT_FIRMWARE_BL2},
        [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
        [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 */
 };
 
@@ -47,12 +70,111 @@ struct plat_io_policy policies[MAX_NUMBER_IDS] = {
                (uintptr_t)&arm_uuid_spec[TB_FW_CONFIG_ID],
                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
        [TRUSTED_BOOT_FW_CERT_ID] = {
                &fip_dev_handle,
                (uintptr_t)&arm_uuid_spec[TRUSTED_BOOT_FW_CERT_ID],
                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 */
 };
 
@@ -138,6 +260,8 @@ int fconf_populate_arm_io_policies(uintptr_t config)
        return 0;
 }
 
+#if ARM_IO_IN_DTB
 FCONF_REGISTER_POPULATOR(TB_FW, arm_io, fconf_populate_arm_io_policies);
+#endif /* ARM_IO_IN_DTB */
 
 #endif /* IMAGE_BL2 */