diff options
author | Juan Castillo <juan.castillo@arm.com> | 2015-04-13 17:36:19 +0100 |
---|---|---|
committer | Juan Castillo <juan.castillo@arm.com> | 2015-06-25 08:53:26 +0100 |
commit | 16948ae1d9e14190229f0fd8602f8cc0f25d57d2 (patch) | |
tree | 264ca269eed1b8628622286f2021ac538f3ca4da /include | |
parent | d5e0a933b3e6e0ff43e6d46982b93605a5eadf05 (diff) |
Use numbers to identify images instead of names
The Trusted firmware code identifies BL images by name. The platform
port defines a name for each image e.g. the IO framework uses this
mechanism in the platform function plat_get_image_source(). For
a given image name, it returns the handle to the image file which
involves comparing images names. In addition, if the image is
packaged in a FIP, a name comparison is required to find the UUID
for the image. This method is not optimal.
This patch changes the interface between the generic and platform
code with regard to identifying images. The platform port must now
allocate a unique number (ID) for every image. The generic code will
use the image ID instead of the name to access its attributes.
As a result, the plat_get_image_source() function now takes an image
ID as an input parameter. The organisation of data structures within
the IO framework has been rationalised to use an image ID as an index
into an array which contains attributes of the image such as UUID and
name. This prevents the name comparisons.
A new type 'io_uuid_spec_t' has been introduced in the IO framework
to specify images identified by UUID (i.e. when the image is contained
in a FIP file). There is no longer need to maintain a look-up table
[iname_name --> uuid] in the io_fip driver code.
Because image names are no longer mandatory in the platform port, the
debug messages in the generic code will show the image identifier
instead of the file name. The platforms that support semihosting to
load images (i.e. FVP) must provide the file names as definitions
private to the platform.
The ARM platform ports and documentation have been updated accordingly.
All ARM platforms reuse the image IDs defined in the platform common
code. These IDs will be used to access other attributes of an image in
subsequent patches.
IMPORTANT: applying this patch breaks compatibility for platforms that
use TF BL1 or BL2 images or the image loading code. The platform port
must be updated to match the new interface.
Change-Id: I9c1b04cb1a0684c6ee65dee66146dd6731751ea5
Diffstat (limited to 'include')
-rw-r--r-- | include/common/bl_common.h | 4 | ||||
-rw-r--r-- | include/drivers/io/io_storage.h | 6 | ||||
-rw-r--r-- | include/plat/arm/common/plat_arm.h | 5 | ||||
-rw-r--r-- | include/plat/common/common_def.h | 42 | ||||
-rw-r--r-- | include/plat/common/platform.h | 2 |
5 files changed, 34 insertions, 25 deletions
diff --git a/include/common/bl_common.h b/include/common/bl_common.h index 985ec0df..1e848969 100644 --- a/include/common/bl_common.h +++ b/include/common/bl_common.h @@ -226,9 +226,9 @@ CASSERT(sizeof(unsigned long) == ******************************************************************************/ unsigned long page_align(unsigned long, unsigned); void change_security_state(unsigned int); -unsigned long image_size(const char *); +unsigned long image_size(unsigned int image_id); int load_image(meminfo_t *mem_layout, - const char *image_name, + unsigned int image_id, uint64_t image_base, image_info_t *image_data, entry_point_info_t *entry_point_info); diff --git a/include/drivers/io/io_storage.h b/include/drivers/io/io_storage.h index ae1158c0..e98dcd04 100644 --- a/include/drivers/io/io_storage.h +++ b/include/drivers/io/io_storage.h @@ -33,6 +33,7 @@ #include <stdint.h> #include <stdio.h> /* For ssize_t */ +#include <uuid.h> /* Device type which can be used to enable policy decisions about which device @@ -67,6 +68,11 @@ typedef struct io_file_spec { unsigned int mode; } io_file_spec_t; +/* UUID specification - used to refer to data accessed using UUIDs (i.e. FIP + * images) */ +typedef struct io_uuid_spec { + const uuid_t uuid; +} io_uuid_spec_t; /* Block specification - used to refer to data on a device supporting * block-like entities */ diff --git a/include/plat/arm/common/plat_arm.h b/include/plat/arm/common/plat_arm.h index e1221a90..d7eaac1d 100644 --- a/include/plat/arm/common/plat_arm.h +++ b/include/plat/arm/common/plat_arm.h @@ -196,8 +196,9 @@ void plat_arm_pwrc_setup(void); */ void plat_arm_io_setup(void); int plat_arm_get_alt_image_source( - const uintptr_t image_spec, - uintptr_t *dev_handle); + unsigned int image_id, + uintptr_t *dev_handle, + uintptr_t *image_spec); void plat_arm_topology_setup(void); diff --git a/include/plat/common/common_def.h b/include/plat/common/common_def.h index 1e2a417c..705878d8 100644 --- a/include/plat/common/common_def.h +++ b/include/plat/common/common_def.h @@ -47,38 +47,40 @@ */ #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" +/* Firmware Image Package */ +#define FIP_IMAGE_ID 0 + /* Trusted Boot Firmware BL2 */ -#define BL2_IMAGE_NAME "bl2.bin" +#define BL2_IMAGE_ID 1 /* SCP Firmware BL3-0 */ -#define BL30_IMAGE_NAME "bl30.bin" +#define BL30_IMAGE_ID 2 /* EL3 Runtime Firmware BL31 */ -#define BL31_IMAGE_NAME "bl31.bin" +#define BL31_IMAGE_ID 3 /* Secure Payload BL32 (Trusted OS) */ -#define BL32_IMAGE_NAME "bl32.bin" +#define BL32_IMAGE_ID 4 /* Non-Trusted Firmware BL33 */ -#define BL33_IMAGE_NAME "bl33.bin" - -/* Firmware Image Package */ -#define FIP_IMAGE_NAME "fip.bin" +#define BL33_IMAGE_ID 5 #if TRUSTED_BOARD_BOOT + /* Certificates */ -# define BL2_CERT_NAME "bl2.crt" -# define TRUSTED_KEY_CERT_NAME "trusted_key.crt" - -# define BL30_KEY_CERT_NAME "bl30_key.crt" -# define BL31_KEY_CERT_NAME "bl31_key.crt" -# define BL32_KEY_CERT_NAME "bl32_key.crt" -# define BL33_KEY_CERT_NAME "bl33_key.crt" - -# define BL30_CERT_NAME "bl30.crt" -# define BL31_CERT_NAME "bl31.crt" -# define BL32_CERT_NAME "bl32.crt" -# define BL33_CERT_NAME "bl33.crt" +#define BL2_CERT_ID 6 +#define TRUSTED_KEY_CERT_ID 7 + +#define BL30_KEY_CERT_ID 8 +#define BL31_KEY_CERT_ID 9 +#define BL32_KEY_CERT_ID 10 +#define BL33_KEY_CERT_ID 11 + +#define BL30_CERT_ID 12 +#define BL31_CERT_ID 13 +#define BL32_CERT_ID 14 +#define BL33_CERT_ID 15 + #endif /* TRUSTED_BOARD_BOOT */ /* diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index 8188f456..73c2fdd4 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -50,7 +50,7 @@ struct bl31_params; * Mandatory common functions ******************************************************************************/ uint64_t plat_get_syscnt_freq(void); -int plat_get_image_source(const char *image_name, +int plat_get_image_source(unsigned int image_id, uintptr_t *dev_handle, uintptr_t *image_spec); unsigned long plat_get_ns_image_entrypoint(void); |