aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bl2/bl2.h28
-rw-r--r--include/bl31/bl31.h4
-rw-r--r--include/common/bl_common.h135
3 files changed, 130 insertions, 37 deletions
diff --git a/include/bl2/bl2.h b/include/bl2/bl2.h
index 25b6f9c..5936d84 100644
--- a/include/bl2/bl2.h
+++ b/include/bl2/bl2.h
@@ -47,6 +47,32 @@ struct bl31_args;
*****************************************/
extern void bl2_platform_setup(void);
extern struct meminfo *bl2_plat_sec_mem_layout(void);
-extern struct bl31_args *bl2_get_bl31_args_ptr(void);
+
+/*******************************************************************************
+ * This function returns a pointer to the shared memory that the platform has
+ * kept aside to pass trusted firmware related information that BL3-1
+ * could need
+ ******************************************************************************/
+extern struct bl31_params *bl2_plat_get_bl31_params(void);
+
+/*******************************************************************************
+ * This function returns a pointer to the shared memory that the platform has
+ * kept aside to pass platform related information that BL3-1 could need
+ ******************************************************************************/
+extern struct bl31_plat_params *bl2_plat_get_bl31_plat_params(void);
+
+/*******************************************************************************
+ * This function returns a pointer to the shared memory that the platform
+ * has kept to point to entry point information of BL31 to BL2
+ ******************************************************************************/
+extern struct entry_point_info *bl2_plat_get_bl31_ep_info(void);
+
+
+/************************************************************************
+ * This function flushes to main memory all the params that are
+ * passed to BL3-1
+ **************************************************************************/
+extern void bl2_plat_flush_bl31_params(void);
+
#endif /* __BL2_H__ */
diff --git a/include/bl31/bl31.h b/include/bl31/bl31.h
index b60e32c..ad6e70e 100644
--- a/include/bl31/bl31.h
+++ b/include/bl31/bl31.h
@@ -42,7 +42,7 @@ extern unsigned long bl31_entrypoint;
* Forward declarations
*****************************************/
struct meminfo;
-struct el_change_info;
+struct entry_point_info;
/*******************************************************************************
* Function prototypes
@@ -52,7 +52,7 @@ extern void bl31_next_el_arch_setup(uint32_t security_state);
extern void bl31_set_next_image_type(uint32_t type);
extern uint32_t bl31_get_next_image_type(void);
extern void bl31_prepare_next_image_entry();
-extern struct el_change_info *bl31_get_next_image_info(uint32_t type);
+extern struct entry_point_info *bl31_get_next_image_info(uint32_t type);
extern void bl31_platform_setup(void);
extern struct meminfo *bl31_plat_get_bl32_mem_layout(void);
extern struct meminfo *bl31_plat_sec_mem_layout(void);
diff --git a/include/common/bl_common.h b/include/common/bl_common.h
index 72e2f6f..e3e4a43 100644
--- a/include/common/bl_common.h
+++ b/include/common/bl_common.h
@@ -31,8 +31,9 @@
#ifndef __BL_COMMON_H__
#define __BL_COMMON_H__
-#define SECURE 0
-#define NON_SECURE 1
+#define SECURE 0x0
+#define NON_SECURE 0x1
+#define PARAM_EP_SECURITY_MASK 0x1
#define UP 1
#define DOWN 0
@@ -58,15 +59,32 @@
/*******************************************************************************
* Constants that allow assembler code to access members of and the
- * 'el_change_info' structure at their correct offsets.
+ * 'entry_point_info' structure at their correct offsets.
******************************************************************************/
-#define EL_CHANGE_INFO_PC_OFFSET 0x0
-#define EL_CHANGE_INFO_ARGS_OFFSET 0x18
+#define ENTRY_POINT_INFO_PC_OFFSET 0x08
+#define ENTRY_POINT_INFO_ARGS_OFFSET 0x18
-#ifndef __ASSEMBLY__
+#define GET_SECURITY_STATE(x) (x & PARAM_EP_SECURITY_MASK)
+#define SET_SECURITY_STATE(x, security) \
+ ((x) = ((x) & ~PARAM_EP_SECURITY_MASK) | (security))
+
+#define PARAM_EP 0x01
+#define PARAM_IMAGE_BINARY 0x02
+#define PARAM_BL31 0x03
+
+#define VERSION_1 0x01
+#define SET_PARAM_HEAD(_p, _type, _ver, _attr) do { \
+ (_p)->h.type = (uint8_t)(_type); \
+ (_p)->h.version = (uint8_t)(_ver); \
+ (_p)->h.size = (uint16_t)sizeof(*_p); \
+ (_p)->h.attr = (uint32_t)(_attr) ; \
+ } while (0)
+
+#ifndef __ASSEMBLY__
#include <cdefs.h> /* For __dead2 */
#include <cassert.h>
+#include <stdint.h>
/*******************************************************************************
* Structure used for telling the next BL how much of a particular type of
@@ -92,50 +110,97 @@ typedef struct aapcs64_params {
unsigned long arg7;
} aapcs64_params_t;
-/*******************************************************************************
- * This structure represents the superset of information needed while switching
- * exception levels. The only two mechanisms to do so are ERET & SMC. In case of
- * SMC all members apart from 'aapcs64_params' will be ignored.
- * NOTE: BL1 expects entrypoint followed by spsr while processing SMC to jump
- * to BL31 from the start of el_change_info
- ******************************************************************************/
-typedef struct el_change_info {
- unsigned long entrypoint;
- unsigned long spsr;
- unsigned long security_state;
+/***************************************************************************
+ * This structure provides version information and the size of the
+ * structure, attributes for the structure it represents
+ ***************************************************************************/
+typedef struct param_header {
+ uint8_t type; /* type of the structure */
+ uint8_t version; /* version of this structure */
+ uint16_t size; /* size of this structure in bytes */
+ uint32_t attr; /* attributes: unused bits SBZ */
+} param_header_t;
+
+/*****************************************************************************
+ * This structure represents the superset of information needed while
+ * switching exception levels. The only two mechanisms to do so are
+ * ERET & SMC. Security state is indicated using bit zero of header
+ * attribute
+ * NOTE: BL1 expects entrypoint followed by spsr while processing
+ * SMC to jump to BL31 from the start of entry_point_info
+ *****************************************************************************/
+typedef struct entry_point_info {
+ param_header_t h;
+ uintptr_t pc;
+ uint32_t spsr;
aapcs64_params_t args;
-} el_change_info_t;
+} entry_point_info_t;
+
+/*****************************************************************************
+ * Image info binary provides information from the image loader that
+ * can be used by the firmware to manage available trusted RAM.
+ * More advanced firmware image formats can provide additional
+ * information that enables optimization or greater flexibility in the
+ * common firmware code
+ *****************************************************************************/
+typedef struct image_info {
+ param_header_t h;
+ uintptr_t image_base; /* physical address of base of image */
+ uint32_t image_size; /* bytes read from image file */
+} image_info_t;
/*******************************************************************************
* This structure represents the superset of information that can be passed to
* BL31 e.g. while passing control to it from BL2. The BL32 parameters will be
- * populated only if BL2 detects its presence.
+ * populated only if BL2 detects its presence. A pointer to a structure of this
+ * type should be passed in X3 to BL31's cold boot entrypoint
+ *
+ * Use of this structure and the X3 parameter is not mandatory: the BL3-1
+ * platform code can use other mechanisms to provide the necessary information
+ * about BL3-2 and BL3-3 to the common and SPD code.
+ *
+ * BL3-1 image information is mandatory if this structure is used. If either of
+ * the optional BL3-2 and BL3-3 image information is not provided, this is
+ * indicated by the respective image_info pointers being zero.
******************************************************************************/
-typedef struct bl31_args {
- el_change_info_t bl31_image_info;
+typedef struct bl31_params {
+ param_header_t h;
+ image_info_t *bl31_image_info;
+ entry_point_info_t *bl32_ep_info;
+ image_info_t *bl32_image_info;
+ entry_point_info_t *bl33_ep_info;
+ image_info_t *bl33_image_info;
+} bl31_params_t;
+
+
+/***************************************************************************
+ * This structure provides platform specific data that needs to be known to
+ * BL31. Currently, The loader updates the memory information available for
+ * each binary
+ ***************************************************************************/
+typedef struct bl31_plat_params {
meminfo_t bl31_meminfo;
- el_change_info_t bl32_image_info;
meminfo_t bl32_meminfo;
- el_change_info_t bl33_image_info;
meminfo_t bl33_meminfo;
-} bl31_args_t;
+} bl31_plat_params_t;
/*
- * Compile time assertions related to the 'el_change_info' structure to
+ * Compile time assertions related to the 'entry_point_info' structure to
* ensure that the assembler and the compiler view of the offsets of
* the structure members is the same.
*/
-CASSERT(EL_CHANGE_INFO_PC_OFFSET == \
- __builtin_offsetof(el_change_info_t, entrypoint), \
- assert_BL31_pc_offset_mismatch);
+CASSERT(ENTRY_POINT_INFO_PC_OFFSET ==
+ __builtin_offsetof(entry_point_info_t, pc), \
+ assert_BL31_pc_offset_mismatch);
-CASSERT(EL_CHANGE_INFO_ARGS_OFFSET == \
- __builtin_offsetof(el_change_info_t, args), \
+CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \
+ __builtin_offsetof(entry_point_info_t, args), \
assert_BL31_args_offset_mismatch);
-CASSERT(sizeof(unsigned long) == __builtin_offsetof(el_change_info_t, spsr) - \
- __builtin_offsetof(el_change_info_t, entrypoint), \
+CASSERT(sizeof(unsigned long) ==
+ __builtin_offsetof(entry_point_info_t, spsr) - \
+ __builtin_offsetof(entry_point_info_t, pc), \
assert_entrypoint_and_spsr_should_be_adjacent);
/*******************************************************************************
@@ -151,10 +216,12 @@ extern void init_bl31_mem_layout(const meminfo_t *,
meminfo_t *,
unsigned int) __attribute__((weak));
extern unsigned long image_size(const char *);
-extern unsigned long load_image(meminfo_t *,
+extern int load_image(meminfo_t *,
const char *,
unsigned int,
- unsigned long);
+ unsigned long,
+ image_info_t *,
+ entry_point_info_t *);
extern unsigned long *get_el_change_mem_ptr(void);
extern const char build_message[];