trusty: Restore working trusty setup code and include trusty image in build
Change-Id: I081901e7df22f78dd9c4fc4c6bfad2aceb870a2d Signed-off-by: Arve Hjønnevåg <arve@android.com>
This commit is contained in:
parent
e5dbebf84e
commit
7c3309c901
|
@ -385,11 +385,23 @@ static const spd_pm_ops_t trusty_pm = {
|
||||||
.svc_suspend_finish = trusty_cpu_suspend_finish_handler,
|
.svc_suspend_finish = trusty_cpu_suspend_finish_handler,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void plat_trusty_set_boot_args(aapcs64_params_t *args);
|
||||||
|
|
||||||
|
#ifdef TSP_SEC_MEM_SIZE
|
||||||
|
#pragma weak plat_trusty_set_boot_args
|
||||||
|
void plat_trusty_set_boot_args(aapcs64_params_t *args)
|
||||||
|
{
|
||||||
|
args->arg0 = TSP_SEC_MEM_SIZE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int32_t trusty_setup(void)
|
static int32_t trusty_setup(void)
|
||||||
{
|
{
|
||||||
entry_point_info_t *ep_info;
|
entry_point_info_t *ep_info;
|
||||||
|
uint32_t instr;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
int aarch32 = 0;
|
||||||
|
|
||||||
/* Get trusty's entry point info */
|
/* Get trusty's entry point info */
|
||||||
ep_info = bl31_plat_get_next_image_ep_info(SECURE);
|
ep_info = bl31_plat_get_next_image_ep_info(SECURE);
|
||||||
|
@ -398,17 +410,29 @@ static int32_t trusty_setup(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trusty runs in AARCH64 mode */
|
instr = *(uint32_t *)ep_info->pc;
|
||||||
SET_PARAM_HEAD(ep_info, PARAM_EP, VERSION_1, SECURE | EP_ST_ENABLE);
|
|
||||||
ep_info->spsr = SPSR_64(MODE_EL1, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
|
|
||||||
|
|
||||||
/*
|
if (instr >> 24 == 0xea) {
|
||||||
* arg0 = TZDRAM aperture available for BL32
|
INFO("trusty: Found 32 bit image\n");
|
||||||
* arg1 = BL32 boot params
|
aarch32 = 1;
|
||||||
* arg2 = BL32 boot params length
|
} else if (instr >> 8 == 0xd53810 || instr >> 16 == 0x9400) {
|
||||||
*/
|
INFO("trusty: Found 64 bit image\n");
|
||||||
ep_info->args.arg1 = ep_info->args.arg2;
|
} else {
|
||||||
ep_info->args.arg2 = TRUSTY_PARAMS_LEN_BYTES;
|
NOTICE("trusty: Found unknown image, 0x%x\n", instr);
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_PARAM_HEAD(ep_info, PARAM_EP, VERSION_1, SECURE | EP_ST_ENABLE);
|
||||||
|
if (!aarch32)
|
||||||
|
ep_info->spsr = SPSR_64(MODE_EL1, MODE_SP_ELX,
|
||||||
|
DISABLE_ALL_EXCEPTIONS);
|
||||||
|
else
|
||||||
|
ep_info->spsr = SPSR_MODE32(MODE32_svc, SPSR_T_ARM,
|
||||||
|
SPSR_E_LITTLE,
|
||||||
|
DAIF_FIQ_BIT |
|
||||||
|
DAIF_IRQ_BIT |
|
||||||
|
DAIF_ABT_BIT);
|
||||||
|
memset(&ep_info->args, 0, sizeof(ep_info->args));
|
||||||
|
plat_trusty_set_boot_args(&ep_info->args);
|
||||||
|
|
||||||
/* register init handler */
|
/* register init handler */
|
||||||
bl31_register_bl32_init(trusty_init);
|
bl31_register_bl32_init(trusty_init);
|
||||||
|
|
|
@ -8,3 +8,5 @@ SPD_INCLUDES :=
|
||||||
|
|
||||||
SPD_SOURCES := services/spd/trusty/trusty.c \
|
SPD_SOURCES := services/spd/trusty/trusty.c \
|
||||||
services/spd/trusty/trusty_helpers.S
|
services/spd/trusty/trusty_helpers.S
|
||||||
|
|
||||||
|
NEED_BL32 := yes
|
||||||
|
|
Loading…
Reference in New Issue