aboutsummaryrefslogtreecommitdiff
path: root/common/bl_common.c
diff options
context:
space:
mode:
authorAchin Gupta <achin.gupta@arm.com>2014-02-19 17:18:23 +0000
committerDan Handley <dan.handley@arm.com>2014-02-20 19:06:34 +0000
commite4d084ea9629703166e59d116d4aefbd6f2be531 (patch)
tree68e863ffaea93a977f7590e2e52139d0ea96a0fb /common/bl_common.c
parenta7934d69508872919787742c7680b68807c24361 (diff)
downloadarm-trusted-firmware-e4d084ea9629703166e59d116d4aefbd6f2be531.tar.gz
Rework BL2 to BL3-1 hand over interface
This patch reworks BL2 to BL3-1 hand over interface by introducing a composite structure (bl31_args) that holds the superset of information that needs to be passed from BL2 to BL3-1. - The extents of secure memory available to BL3-1 - The extents of memory available to BL3-2 (not yet implemented) and BL3-3 - Information to execute BL3-2 (not yet implemented) and BL3-3 images This patch also introduces a new platform API (bl2_get_bl31_args_ptr) that needs to be implemented by the platform code to export reference to bl31_args structure which has been allocated in platform-defined memory. The platform will initialize the extents of memory available to BL3-3 during early platform setup in bl31_args structure. This obviates the need for bl2_get_ns_mem_layout platform API. BL2 calls the bl2_get_bl31_args_ptr function to get a reference to bl31_args structure. It uses the 'bl33_meminfo' field of this structure to load the BL3-3 image. It sets the entry point information for the BL3-3 image in the 'bl33_image_info' field of this structure. The reference to this structure is passed to the BL3-1 image. Also fixes issue ARM-software/tf-issues#25 Change-Id: Ic36426196dd5ebf89e60ff42643bed01b3500517
Diffstat (limited to 'common/bl_common.c')
-rw-r--r--common/bl_common.c63
1 files changed, 25 insertions, 38 deletions
diff --git a/common/bl_common.c b/common/bl_common.c
index 7e17bb8..fb86ac5 100644
--- a/common/bl_common.c
+++ b/common/bl_common.c
@@ -40,17 +40,6 @@
#include "io_storage.h"
#include "debug.h"
-/***********************************************************
- * Memory for sharing data while changing exception levels.
- * Only used by the primary core.
- **********************************************************/
-unsigned char bl2_el_change_mem_ptr[EL_CHANGE_MEM_SIZE];
-
-unsigned long *get_el_change_mem_ptr(void)
-{
- return (unsigned long *) bl2_el_change_mem_ptr;
-}
-
unsigned long page_align(unsigned long value, unsigned dir)
{
unsigned long page_size = 1 << FOUR_KB_SHIFT;
@@ -85,9 +74,9 @@ void change_security_state(unsigned int target_security_state)
write_scr(scr);
}
-int drop_el(aapcs64_params *args,
- unsigned long spsr,
- unsigned long entrypoint)
+void __dead2 drop_el(aapcs64_params *args,
+ unsigned long spsr,
+ unsigned long entrypoint)
{
write_spsr(spsr);
write_elr(entrypoint);
@@ -99,19 +88,18 @@ int drop_el(aapcs64_params *args,
args->arg5,
args->arg6,
args->arg7);
- return -EINVAL;
}
-long raise_el(aapcs64_params *args)
+void __dead2 raise_el(aapcs64_params *args)
{
- return smc(args->arg0,
- args->arg1,
- args->arg2,
- args->arg3,
- args->arg4,
- args->arg5,
- args->arg6,
- args->arg7);
+ smc(args->arg0,
+ args->arg1,
+ args->arg2,
+ args->arg3,
+ args->arg4,
+ args->arg5,
+ args->arg6,
+ args->arg7);
}
/*
@@ -119,7 +107,7 @@ long raise_el(aapcs64_params *args)
* Add support for dropping into EL0 etc. Consider adding support
* for switching from S-EL1 to S-EL0/1 etc.
*/
-long change_el(el_change_info *info)
+void __dead2 change_el(el_change_info *info)
{
unsigned long current_el = read_current_el();
@@ -134,9 +122,9 @@ long change_el(el_change_info *info)
if (info->security_state == NON_SECURE)
change_security_state(info->security_state);
- return drop_el(&info->args, info->spsr, info->entrypoint);
+ drop_el(&info->args, info->spsr, info->entrypoint);
} else
- return raise_el(&info->args);
+ raise_el(&info->args);
}
/* TODO: add a parameter for DAIF. not needed right now */
@@ -515,11 +503,11 @@ fail: image_base = 0;
* The only way of doing the latter is through an SMC. In either case, setup the
* parameters for the EL change request correctly.
******************************************************************************/
-int run_image(unsigned long entrypoint,
- unsigned long spsr,
- unsigned long target_security_state,
- meminfo *mem_layout,
- void *data)
+void __dead2 run_image(unsigned long entrypoint,
+ unsigned long spsr,
+ unsigned long target_security_state,
+ void *first_arg,
+ void *second_arg)
{
el_change_info run_image_info;
unsigned long current_el = read_current_el();
@@ -529,7 +517,6 @@ int run_image(unsigned long entrypoint,
run_image_info.entrypoint = entrypoint;
run_image_info.spsr = spsr;
run_image_info.security_state = target_security_state;
- run_image_info.next = 0;
/*
* If we are EL3 then only an eret can take us to the desired
@@ -538,14 +525,14 @@ int run_image(unsigned long entrypoint,
* will go into the general purpose register xY e.g. arg0->x0
*/
if (GET_EL(current_el) == MODE_EL3) {
- run_image_info.args.arg1 = (unsigned long) mem_layout;
- run_image_info.args.arg2 = (unsigned long) data;
+ run_image_info.args.arg1 = (unsigned long) first_arg;
+ run_image_info.args.arg2 = (unsigned long) second_arg;
} else {
run_image_info.args.arg1 = entrypoint;
run_image_info.args.arg2 = spsr;
- run_image_info.args.arg3 = (unsigned long) mem_layout;
- run_image_info.args.arg4 = (unsigned long) data;
+ run_image_info.args.arg3 = (unsigned long) first_arg;
+ run_image_info.args.arg4 = (unsigned long) second_arg;
}
- return change_el(&run_image_info);
+ change_el(&run_image_info);
}