2009-07-20 02:40:01 +00:00
|
|
|
/*
|
2010-06-08 20:07:46 +00:00
|
|
|
* Board specific setup info
|
|
|
|
*
|
|
|
|
* (C) Copyright 2010
|
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
*
|
|
|
|
* Author :
|
|
|
|
* Aneesh V <aneesh@ti.com>
|
2009-07-20 02:40:01 +00:00
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2009-07-20 02:40:01 +00:00
|
|
|
*/
|
|
|
|
|
2013-03-14 11:15:25 +00:00
|
|
|
#include <config.h>
|
2011-11-15 14:49:55 +00:00
|
|
|
#include <asm/arch/omap.h>
|
2013-04-24 00:41:24 +00:00
|
|
|
#include <asm/omap_common.h>
|
2012-09-18 04:30:51 +00:00
|
|
|
#include <asm/arch/spl.h>
|
2012-03-08 07:20:18 +00:00
|
|
|
#include <linux/linkage.h>
|
2011-11-15 14:50:03 +00:00
|
|
|
|
2016-06-27 14:19:17 +00:00
|
|
|
.arch_extension sec
|
|
|
|
|
2015-07-15 14:02:19 +00:00
|
|
|
#ifdef CONFIG_SPL
|
2012-03-08 07:20:18 +00:00
|
|
|
ENTRY(save_boot_params)
|
2013-04-24 00:41:24 +00:00
|
|
|
ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
|
2011-11-15 14:50:03 +00:00
|
|
|
str r0, [r1]
|
2015-02-07 17:47:28 +00:00
|
|
|
b save_boot_params_ret
|
2012-03-08 07:20:18 +00:00
|
|
|
ENDPROC(save_boot_params)
|
2016-09-14 05:13:33 +00:00
|
|
|
|
|
|
|
#if !defined(CONFIG_TI_SECURE_DEVICE) && defined(CONFIG_ARMV7_LPAE)
|
|
|
|
ENTRY(switch_to_hypervisor)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Switch to hypervisor mode
|
|
|
|
*/
|
|
|
|
adr r0, save_sp
|
|
|
|
str sp, [r0]
|
|
|
|
adr r1, restore_from_hyp
|
|
|
|
ldr r0, =0x102
|
|
|
|
b omap_smc1
|
|
|
|
restore_from_hyp:
|
|
|
|
adr r0, save_sp
|
|
|
|
ldr sp, [r0]
|
|
|
|
MRC p15, 4, R0, c1, c0, 0
|
|
|
|
ldr r1, =0X1004 @Set cache enable bits for hypervisor mode
|
|
|
|
orr r0, r0, r1
|
|
|
|
MCR p15, 4, R0, c1, c0, 0
|
|
|
|
b switch_to_hypervisor_ret
|
|
|
|
save_sp:
|
|
|
|
.word 0x0
|
|
|
|
ENDPROC(switch_to_hypervisor)
|
|
|
|
#endif
|
2015-03-09 22:12:05 +00:00
|
|
|
#endif
|
2011-11-15 14:50:03 +00:00
|
|
|
|
2015-03-09 22:12:03 +00:00
|
|
|
ENTRY(omap_smc1)
|
2016-06-27 14:19:17 +00:00
|
|
|
push {r4-r12, lr} @ save registers - ROM code may pollute
|
2011-06-16 23:30:52 +00:00
|
|
|
@ our registers
|
2016-06-27 14:19:17 +00:00
|
|
|
mov r12, r0 @ Service
|
|
|
|
mov r0, r1 @ Argument
|
2015-03-09 22:12:03 +00:00
|
|
|
|
2016-06-27 14:19:17 +00:00
|
|
|
dsb
|
|
|
|
dmb
|
|
|
|
smc 0 @ SMC #0 to enter monitor mode
|
|
|
|
@ call ROM Code API for the service requested
|
|
|
|
pop {r4-r12, pc}
|
2015-03-09 22:12:03 +00:00
|
|
|
ENDPROC(omap_smc1)
|
2016-06-27 14:19:17 +00:00
|
|
|
|
|
|
|
ENTRY(omap_smc_sec)
|
|
|
|
push {r4-r12, lr} @ save registers - ROM code may pollute
|
|
|
|
@ our registers
|
|
|
|
mov r6, #0xFF @ Indicate new Task call
|
|
|
|
mov r12, #0x00 @ Secure Service ID in R12
|
|
|
|
|
|
|
|
dsb
|
|
|
|
dmb
|
|
|
|
smc 0 @ SMC #0 to enter monitor mode
|
|
|
|
|
|
|
|
b omap_smc_sec_end @ exit at end of the service execution
|
|
|
|
nop
|
|
|
|
|
|
|
|
@ In case of IRQ happening in Secure, then ARM will branch here.
|
|
|
|
@ At that moment, IRQ will be pending and ARM will jump to Non Secure
|
|
|
|
@ IRQ handler
|
|
|
|
mov r12, #0xFE
|
|
|
|
|
|
|
|
dsb
|
|
|
|
dmb
|
|
|
|
smc 0 @ SMC #0 to enter monitor mode
|
|
|
|
|
|
|
|
omap_smc_sec_end:
|
|
|
|
pop {r4-r12, pc}
|
|
|
|
ENDPROC(omap_smc_sec)
|