Skip to content

Commit

Permalink
core: arm: imx: use core_mmu_get_io_va
Browse files Browse the repository at this point in the history
Use core_mmu_get_io_va to simplify the code.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
  • Loading branch information
MrVan committed May 31, 2017
1 parent 610cd2a commit 222db71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
9 changes: 1 addition & 8 deletions core/arch/arm/plat-imx/imx_pl310.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ void arm_cl2_enable(vaddr_t pl310_base)

vaddr_t pl310_base(void)
{
static void *va;

if (cpu_mmu_enabled()) {
if (!va)
va = phys_to_virt(PL310_BASE, MEM_AREA_IO_SEC);
return (vaddr_t)va;
}
return PL310_BASE;
return core_mmu_get_io_va(PL310_BASE);
}

6 changes: 2 additions & 4 deletions core/arch/arm/plat-imx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ void main_init_gic(void)
vaddr_t gicc_base;
vaddr_t gicd_base;

gicc_base = (vaddr_t)phys_to_virt(GIC_BASE + GICC_OFFSET,
MEM_AREA_IO_SEC);
gicd_base = (vaddr_t)phys_to_virt(GIC_BASE + GICD_OFFSET,
MEM_AREA_IO_SEC);
gicc_base = core_mmu_get_io_va(GIC_BASE + GICC_OFFSET);
gicd_base = core_mmu_get_io_va(GIC_BASE + GICD_OFFSET);

if (!gicc_base || !gicd_base)
panic();
Expand Down
17 changes: 4 additions & 13 deletions core/arch/arm/plat-imx/psci.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,14 @@
#include <tee/entry_std.h>
#include <tee/entry_fast.h>

static vaddr_t src_base(void)
{
static void *va;

if (cpu_mmu_enabled()) {
if (!va)
va = phys_to_virt(SRC_BASE, MEM_AREA_IO_SEC);
return (vaddr_t)va;
}
return SRC_BASE;
}

int psci_cpu_on(uint32_t core_idx, uint32_t entry,
uint32_t context_id __attribute__((unused)))
{
uint32_t val;
vaddr_t va = src_base();
vaddr_t va = core_mmu_get_io_va(SRC_BASE);

if (!va)
EMSG("No SRC mapping\n");

if ((core_idx == 0) || (core_idx >= CFG_TEE_CORE_NB_CORE))
return PSCI_RET_INVALID_PARAMETERS;
Expand Down

0 comments on commit 222db71

Please sign in to comment.