1 /*
2  * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef ARM_TRUSTED_FIRMWARE_EXPORT_COMMON_BL_COMMON_EXP_H
8 #define ARM_TRUSTED_FIRMWARE_EXPORT_COMMON_BL_COMMON_EXP_H
9 
10 /* EXPORT HEADER -- See include/export/README for details! -- EXPORT HEADER */
11 
12 #include "ep_info_exp.h"
13 #include "tbbr/tbbr_img_def_exp.h"
14 
15 /*
16  * The following are used for image state attributes.
17  * Image can only be in one of the following state.
18  */
19 #define IMAGE_STATE_RESET		U(0)
20 #define IMAGE_STATE_COPIED		U(1)
21 #define IMAGE_STATE_COPYING		U(2)
22 #define IMAGE_STATE_AUTHENTICATED	U(3)
23 #define IMAGE_STATE_EXECUTED		U(4)
24 #define IMAGE_STATE_INTERRUPTED		U(5)
25 
26 #define IMAGE_ATTRIB_SKIP_LOADING	U(0x02)
27 #define IMAGE_ATTRIB_PLAT_SETUP		U(0x04)
28 
29 #define INVALID_IMAGE_ID		U(0xFFFFFFFF)
30 
31 #ifndef __ASSEMBLER__
32 
33 /*****************************************************************************
34  * Image info binary provides information from the image loader that
35  * can be used by the firmware to manage available trusted RAM.
36  * More advanced firmware image formats can provide additional
37  * information that enables optimization or greater flexibility in the
38  * common firmware code
39  *****************************************************************************/
40 typedef struct image_info {
41 	param_header_t h;
42 	uintptr_t image_base;   /* physical address of base of image */
43 	uint32_t image_size;    /* bytes read from image file */
44 	uint32_t image_max_size;
45 } image_info_t;
46 
47 /* BL image node in the BL image execution sequence */
48 typedef struct bl_params_node {
49 	unsigned int image_id;
50 	image_info_t *image_info;
51 	entry_point_info_t *ep_info;
52 	struct bl_params_node *next_params_info;
53 } bl_params_node_t;
54 
55 /*
56  * BL image head node in the BL image execution sequence
57  * It is also used to pass information to next BL image.
58  */
59 typedef struct bl_params {
60 	param_header_t h;
61 	bl_params_node_t *head;
62 } bl_params_t;
63 
64 /*****************************************************************************
65  * The image descriptor struct definition.
66  *****************************************************************************/
67 typedef struct image_desc {
68 	/* Contains unique image id for the image. */
69 	unsigned int image_id;
70 	/*
71 	 * This member contains Image state information.
72 	 * Refer IMAGE_STATE_XXX defined above.
73 	 */
74 	unsigned int state;
75 	uint32_t copied_size;	/* image size copied in blocks */
76 	image_info_t image_info;
77 	entry_point_info_t ep_info;
78 } image_desc_t;
79 
80 /* BL image node in the BL image loading sequence */
81 typedef struct bl_load_info_node {
82 	unsigned int image_id;
83 	image_info_t *image_info;
84 	struct bl_load_info_node *next_load_info;
85 } bl_load_info_node_t;
86 
87 /* BL image head node in the BL image loading sequence */
88 typedef struct bl_load_info {
89 	param_header_t h;
90 	bl_load_info_node_t *head;
91 } bl_load_info_t;
92 
93 #endif /* __ASSEMBLER__ */
94 
95 #endif /* ARM_TRUSTED_FIRMWARE_EXPORT_COMMON_BL_COMMON_EXP_H */
96