diff options
author | Andrew Thoelke <andrew.thoelke@arm.com> | 2014-05-23 11:00:04 +0100 |
---|---|---|
committer | Andrew Thoelke <andrew.thoelke@arm.com> | 2014-05-23 11:00:04 +0100 |
commit | db0de0eb50db3712b271a7a4ef8ca494ab79bffa (patch) | |
tree | 03809d832bf357a05a4449e5b35c121c2bcab9d7 /services | |
parent | 3ea8540d3c582787218a8c621c36d1468e9dea93 (diff) | |
parent | dbad1bacba0a7adfd3c7c559f0fd0805087aeddd (diff) |
Merge pull request #99 from vikramkanigiri:vk/tf-issues-133_V3
Diffstat (limited to 'services')
-rw-r--r-- | services/spd/tspd/tspd_common.c | 2 | ||||
-rw-r--r-- | services/spd/tspd/tspd_main.c | 25 | ||||
-rw-r--r-- | services/std_svc/psci/psci_common.c | 21 |
3 files changed, 14 insertions, 34 deletions
diff --git a/services/spd/tspd/tspd_common.c b/services/spd/tspd/tspd_common.c index a4c39363..d3fe5ddf 100644 --- a/services/spd/tspd/tspd_common.c +++ b/services/spd/tspd/tspd_common.c @@ -91,7 +91,7 @@ int32_t tspd_init_secure_context(uint64_t entrypoint, tsp_ctx->mpidr = mpidr; cm_set_context(mpidr, &tsp_ctx->cpu_ctx, SECURE); - spsr = make_spsr(MODE_EL1, MODE_SP_ELX, rw); + spsr = SPSR_64(MODE_EL1, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS); cm_set_el3_eret_context(SECURE, entrypoint, spsr, scr); return 0; diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c index 9fda3074..21ff7ffe 100644 --- a/services/spd/tspd/tspd_main.c +++ b/services/spd/tspd/tspd_main.c @@ -66,7 +66,7 @@ DEFINE_SVC_UUID(tsp_uuid, 0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11, 0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa); -int32_t tspd_init(meminfo_t *bl32_meminfo); +int32_t tspd_init(void); /******************************************************************************* @@ -76,7 +76,7 @@ int32_t tspd_init(meminfo_t *bl32_meminfo); ******************************************************************************/ int32_t tspd_setup(void) { - el_change_info_t *image_info; + entry_point_info_t *image_info; int32_t rc; uint64_t mpidr = read_mpidr(); uint32_t linear_id; @@ -96,7 +96,7 @@ int32_t tspd_setup(void) * signalling failure initializing the service. We bail out without * registering any handlers */ - if (!image_info->entrypoint) + if (!image_info->pc) return 1; /* @@ -104,7 +104,7 @@ int32_t tspd_setup(void) * state i.e whether AArch32 or AArch64. Assuming it's AArch64 * for the time being. */ - rc = tspd_init_secure_context(image_info->entrypoint, + rc = tspd_init_secure_context(image_info->pc, TSP_AARCH64, mpidr, &tspd_sp_context[linear_id]); @@ -126,10 +126,9 @@ int32_t tspd_setup(void) * It also assumes that a valid non-secure context has been initialised by PSCI * so it does not need to save and restore any non-secure state. This function * performs a synchronous entry into the Secure payload. The SP passes control - * back to this routine through a SMC. It also passes the extents of memory made - * available to BL32 by BL31. + * back to this routine through a SMC. ******************************************************************************/ -int32_t tspd_init(meminfo_t *bl32_meminfo) +int32_t tspd_init(void) { uint64_t mpidr = read_mpidr(); uint32_t linear_id = platform_get_core_pos(mpidr); @@ -137,18 +136,6 @@ int32_t tspd_init(meminfo_t *bl32_meminfo) tsp_context_t *tsp_ctx = &tspd_sp_context[linear_id]; /* - * Arrange for passing a pointer to the meminfo structure - * describing the memory extents available to the secure - * payload. - * TODO: We are passing a pointer to BL31 internal memory - * whereas this structure should be copied to a communication - * buffer between the SP and SPD. - */ - write_ctx_reg(get_gpregs_ctx(&tsp_ctx->cpu_ctx), - CTX_GPREG_X0, - (uint64_t) bl32_meminfo); - - /* * Arrange for an entry into the test secure payload. We expect an array * of vectors in return */ diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index f24a2f02..025d8b43 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -303,6 +303,7 @@ int psci_set_ns_entry_info(unsigned int index, unsigned int rw, mode, ee, spsr = 0; unsigned long id_aa64pfr0 = read_id_aa64pfr0_el1(), scr = read_scr(); unsigned long el_status; + unsigned long daif; /* Figure out what mode do we enter the non-secure world in */ el_status = (id_aa64pfr0 >> ID_AA64PFR0_EL2_SHIFT) & @@ -330,24 +331,18 @@ int psci_set_ns_entry_info(unsigned int index, ee = read_sctlr_el1() & SCTLR_EE_BIT; } - spsr = DAIF_DBG_BIT | DAIF_ABT_BIT; - spsr |= DAIF_IRQ_BIT | DAIF_FIQ_BIT; - spsr <<= PSR_DAIF_SHIFT; - spsr |= make_spsr(mode, MODE_SP_ELX, !rw); + spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS); psci_ns_entry_info[index].sctlr |= ee; psci_ns_entry_info[index].scr |= SCR_RW_BIT; } else { - /* Check whether aarch32 has to be entered in Thumb mode */ - if (entrypoint & 0x1) - spsr = SPSR32_T_BIT; if (el_status && (scr & SCR_HCE_BIT)) { - mode = AARCH32_MODE_HYP; + mode = MODE32_hyp; ee = read_sctlr_el2() & SCTLR_EE_BIT; } else { - mode = AARCH32_MODE_SVC; + mode = MODE32_svc; ee = read_sctlr_el1() & SCTLR_EE_BIT; } @@ -355,11 +350,9 @@ int psci_set_ns_entry_info(unsigned int index, * TODO: Choose async. exception bits if HYP mode is not * implemented according to the values of SCR.{AW, FW} bits */ - spsr |= DAIF_ABT_BIT | DAIF_IRQ_BIT | DAIF_FIQ_BIT; - spsr <<= PSR_DAIF_SHIFT; - if (ee) - spsr |= SPSR32_EE_BIT; - spsr |= mode; + daif = DAIF_ABT_BIT | DAIF_IRQ_BIT | DAIF_FIQ_BIT; + + spsr = SPSR_MODE32(mode, entrypoint & 0x1, ee, daif); /* Ensure that the CSPR.E and SCTLR.EE bits match */ psci_ns_entry_info[index].sctlr |= ee; |