xref: /linux/arch/arm/mach-omap2/omap-smc.S (revision ba9456ac9c72a7a5d4d59340aba4259351832521)
1*ba9456acSSantosh Shilimkar/*
2*ba9456acSSantosh Shilimkar * OMAP44xx secure APIs file.
3*ba9456acSSantosh Shilimkar *
4*ba9456acSSantosh Shilimkar * Copyright (C) 2010 Texas Instruments, Inc.
5*ba9456acSSantosh Shilimkar * Written by Santosh Shilimkar <santosh.shilimkar@ti.com>
6*ba9456acSSantosh Shilimkar *
7*ba9456acSSantosh Shilimkar *
8*ba9456acSSantosh Shilimkar * This program is free software,you can redistribute it and/or modify
9*ba9456acSSantosh Shilimkar * it under the terms of the GNU General Public License version 2 as
10*ba9456acSSantosh Shilimkar * published by the Free Software Foundation.
11*ba9456acSSantosh Shilimkar */
12*ba9456acSSantosh Shilimkar
13*ba9456acSSantosh Shilimkar#include <linux/linkage.h>
14*ba9456acSSantosh Shilimkar
15*ba9456acSSantosh Shilimkar/*
16*ba9456acSSantosh Shilimkar * This is common routine to manage secure monitor API
17*ba9456acSSantosh Shilimkar * used to modify the PL310 secure registers.
18*ba9456acSSantosh Shilimkar * 'r0' contains the value to be modified and 'r12' contains
19*ba9456acSSantosh Shilimkar * the monitor API number. It uses few CPU registers
20*ba9456acSSantosh Shilimkar * internally and hence they need be backed up including
21*ba9456acSSantosh Shilimkar * link register "lr".
22*ba9456acSSantosh Shilimkar * Function signature : void omap_smc1(u32 fn, u32 arg)
23*ba9456acSSantosh Shilimkar */
24*ba9456acSSantosh Shilimkar
25*ba9456acSSantosh ShilimkarENTRY(omap_smc1)
26*ba9456acSSantosh Shilimkar	stmfd   sp!, {r2-r12, lr}
27*ba9456acSSantosh Shilimkar	mov	r12, r0
28*ba9456acSSantosh Shilimkar	mov 	r0, r1
29*ba9456acSSantosh Shilimkar	dsb
30*ba9456acSSantosh Shilimkar	smc	#0
31*ba9456acSSantosh Shilimkar	ldmfd   sp!, {r2-r12, pc}
32*ba9456acSSantosh ShilimkarENDPROC(omap_smc1)
33*ba9456acSSantosh Shilimkar
34*ba9456acSSantosh Shilimkar/**
35*ba9456acSSantosh Shilimkar * u32 omap_smc2(u32 id, u32 falg, u32 pargs)
36*ba9456acSSantosh Shilimkar * Low level common routine for secure HAL and PPA APIs.
37*ba9456acSSantosh Shilimkar * @id: Application ID of HAL APIs
38*ba9456acSSantosh Shilimkar * @flag: Flag to indicate the criticality of operation
39*ba9456acSSantosh Shilimkar * @pargs: Physical address of parameter list starting
40*ba9456acSSantosh Shilimkar *	    with number of parametrs
41*ba9456acSSantosh Shilimkar */
42*ba9456acSSantosh ShilimkarENTRY(omap_smc2)
43*ba9456acSSantosh Shilimkar	stmfd   sp!, {r4-r12, lr}
44*ba9456acSSantosh Shilimkar	mov	r3, r2
45*ba9456acSSantosh Shilimkar	mov	r2, r1
46*ba9456acSSantosh Shilimkar	mov	r1, #0x0	@ Process ID
47*ba9456acSSantosh Shilimkar	mov	r6, #0xff
48*ba9456acSSantosh Shilimkar	mov	r12, #0x00	@ Secure Service ID
49*ba9456acSSantosh Shilimkar	mov	r7, #0
50*ba9456acSSantosh Shilimkar	mcr	p15, 0, r7, c7, c5, 6
51*ba9456acSSantosh Shilimkar	dsb
52*ba9456acSSantosh Shilimkar	dmb
53*ba9456acSSantosh Shilimkar	smc	#0
54*ba9456acSSantosh Shilimkar	ldmfd   sp!, {r4-r12, pc}
55*ba9456acSSantosh ShilimkarENDPROC(omap_smc2)
56*ba9456acSSantosh Shilimkar
57*ba9456acSSantosh ShilimkarENTRY(omap_modify_auxcoreboot0)
58*ba9456acSSantosh Shilimkar	stmfd   sp!, {r1-r12, lr}
59*ba9456acSSantosh Shilimkar	ldr	r12, =0x104
60*ba9456acSSantosh Shilimkar	dsb
61*ba9456acSSantosh Shilimkar	smc	#0
62*ba9456acSSantosh Shilimkar	ldmfd   sp!, {r1-r12, pc}
63*ba9456acSSantosh ShilimkarENDPROC(omap_modify_auxcoreboot0)
64*ba9456acSSantosh Shilimkar
65*ba9456acSSantosh ShilimkarENTRY(omap_auxcoreboot_addr)
66*ba9456acSSantosh Shilimkar	stmfd   sp!, {r2-r12, lr}
67*ba9456acSSantosh Shilimkar	ldr	r12, =0x105
68*ba9456acSSantosh Shilimkar	dsb
69*ba9456acSSantosh Shilimkar	smc	#0
70*ba9456acSSantosh Shilimkar	ldmfd   sp!, {r2-r12, pc}
71*ba9456acSSantosh ShilimkarENDPROC(omap_auxcoreboot_addr)
72*ba9456acSSantosh Shilimkar
73*ba9456acSSantosh ShilimkarENTRY(omap_read_auxcoreboot0)
74*ba9456acSSantosh Shilimkar	stmfd   sp!, {r2-r12, lr}
75*ba9456acSSantosh Shilimkar	ldr	r12, =0x103
76*ba9456acSSantosh Shilimkar	dsb
77*ba9456acSSantosh Shilimkar	smc	#0
78*ba9456acSSantosh Shilimkar	mov	r0, r0, lsr #9
79*ba9456acSSantosh Shilimkar	ldmfd   sp!, {r2-r12, pc}
80*ba9456acSSantosh ShilimkarENDPROC(omap_read_auxcoreboot0)
81