Skip to content

Commit

Permalink
plat-ti: Rename platform context to platform boot arguments
Browse files Browse the repository at this point in the history
Currently the non-secure context is passed in from our initial secure
software as part of the OP-TEE load process. This passed-in data will
not only contain the non-secure context but also any additional data we
may need to give to OP-TEE. Rename these structures and group the context
data into a struct for future expansion.

Signed-off-by: Andrew F. Davis <afd@ti.com>
  • Loading branch information
glneo committed Apr 21, 2017
1 parent ac0bab7 commit 79fdd7c
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions core/arch/arm/plat-ti/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,38 +125,42 @@ struct plat_nsec_ctx {
uint32_t mon_spsr;
};

struct plat_boot_args {
struct plat_nsec_ctx nsec_ctx;
};

void init_sec_mon(unsigned long nsec_entry)
{
struct plat_nsec_ctx *plat_ctx;
struct plat_boot_args *plat_boot_args;
struct sm_nsec_ctx *nsec_ctx;

plat_ctx = phys_to_virt(nsec_entry, MEM_AREA_IO_SEC);
if (!plat_ctx)
plat_boot_args = phys_to_virt(nsec_entry, MEM_AREA_IO_SEC);
if (!plat_boot_args)
panic();

/* Invalidate cache to fetch data from external memory */
cache_op_inner(DCACHE_AREA_INVALIDATE,
plat_ctx, sizeof(*plat_ctx));
plat_boot_args, sizeof(*plat_boot_args));

/* Initialize secure monitor */
nsec_ctx = sm_get_nsec_ctx();

nsec_ctx->mode_regs.usr_sp = plat_ctx->usr_sp;
nsec_ctx->mode_regs.usr_lr = plat_ctx->usr_lr;
nsec_ctx->mode_regs.irq_spsr = plat_ctx->irq_spsr;
nsec_ctx->mode_regs.irq_sp = plat_ctx->irq_sp;
nsec_ctx->mode_regs.irq_lr = plat_ctx->irq_lr;
nsec_ctx->mode_regs.svc_spsr = plat_ctx->svc_spsr;
nsec_ctx->mode_regs.svc_sp = plat_ctx->svc_sp;
nsec_ctx->mode_regs.svc_lr = plat_ctx->svc_lr;
nsec_ctx->mode_regs.abt_spsr = plat_ctx->abt_spsr;
nsec_ctx->mode_regs.abt_sp = plat_ctx->abt_sp;
nsec_ctx->mode_regs.abt_lr = plat_ctx->abt_lr;
nsec_ctx->mode_regs.und_spsr = plat_ctx->und_spsr;
nsec_ctx->mode_regs.und_sp = plat_ctx->und_sp;
nsec_ctx->mode_regs.und_lr = plat_ctx->und_lr;
nsec_ctx->mon_lr = plat_ctx->mon_lr;
nsec_ctx->mon_spsr = plat_ctx->mon_spsr;
nsec_ctx->mode_regs.usr_sp = plat_boot_args->nsec_ctx.usr_sp;
nsec_ctx->mode_regs.usr_lr = plat_boot_args->nsec_ctx.usr_lr;
nsec_ctx->mode_regs.irq_spsr = plat_boot_args->nsec_ctx.irq_spsr;
nsec_ctx->mode_regs.irq_sp = plat_boot_args->nsec_ctx.irq_sp;
nsec_ctx->mode_regs.irq_lr = plat_boot_args->nsec_ctx.irq_lr;
nsec_ctx->mode_regs.svc_spsr = plat_boot_args->nsec_ctx.svc_spsr;
nsec_ctx->mode_regs.svc_sp = plat_boot_args->nsec_ctx.svc_sp;
nsec_ctx->mode_regs.svc_lr = plat_boot_args->nsec_ctx.svc_lr;
nsec_ctx->mode_regs.abt_spsr = plat_boot_args->nsec_ctx.abt_spsr;
nsec_ctx->mode_regs.abt_sp = plat_boot_args->nsec_ctx.abt_sp;
nsec_ctx->mode_regs.abt_lr = plat_boot_args->nsec_ctx.abt_lr;
nsec_ctx->mode_regs.und_spsr = plat_boot_args->nsec_ctx.und_spsr;
nsec_ctx->mode_regs.und_sp = plat_boot_args->nsec_ctx.und_sp;
nsec_ctx->mode_regs.und_lr = plat_boot_args->nsec_ctx.und_lr;
nsec_ctx->mon_lr = plat_boot_args->nsec_ctx.mon_lr;
nsec_ctx->mon_spsr = plat_boot_args->nsec_ctx.mon_spsr;
}

void console_init(void)
Expand Down

0 comments on commit 79fdd7c

Please sign in to comment.