xref: /openbmc/linux/arch/arm/mach-omap2/omap-smc.S (revision 3fe1ee40)
1/*
2 * OMAP34xx and OMAP44xx secure APIs file.
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Written by Santosh Shilimkar <santosh.shilimkar@ti.com>
6 *
7 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
8 * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
9 *
10 * This program is free software,you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/linkage.h>
16
17/*
18 * This is common routine to manage secure monitor API
19 * used to modify the PL310 secure registers.
20 * 'r0' contains the value to be modified and 'r12' contains
21 * the monitor API number. It uses few CPU registers
22 * internally and hence they need be backed up including
23 * link register "lr".
24 * Function signature : void omap_smc1(u32 fn, u32 arg)
25 */
26	.arch armv7-a
27	.arch_extension sec
28ENTRY(omap_smc1)
29	stmfd   sp!, {r2-r12, lr}
30	mov	r12, r0
31	mov 	r0, r1
32	dsb
33	smc	#0
34	ldmfd   sp!, {r2-r12, pc}
35ENDPROC(omap_smc1)
36
37/**
38 * u32 omap_smc2(u32 id, u32 falg, u32 pargs)
39 * Low level common routine for secure HAL and PPA APIs.
40 * @id: Application ID of HAL APIs
41 * @flag: Flag to indicate the criticality of operation
42 * @pargs: Physical address of parameter list starting
43 *	    with number of parametrs
44 */
45ENTRY(omap_smc2)
46	stmfd   sp!, {r4-r12, lr}
47	mov	r3, r2
48	mov	r2, r1
49	mov	r1, #0x0	@ Process ID
50	mov	r6, #0xff
51	mov	r12, #0x00	@ Secure Service ID
52	mov	r7, #0
53	mcr	p15, 0, r7, c7, c5, 6
54	dsb
55	dmb
56	smc	#0
57	ldmfd   sp!, {r4-r12, pc}
58ENDPROC(omap_smc2)
59
60/**
61 * u32 omap_smc3(u32 service_id, u32 process_id, u32 flag, u32 pargs)
62 * Low level common routine for secure HAL and PPA APIs via smc #1
63 * r0 - @service_id: Secure Service ID
64 * r1 - @process_id: Process ID
65 * r2 - @flag: Flag to indicate the criticality of operation
66 * r3 - @pargs: Physical address of parameter list
67 */
68ENTRY(omap_smc3)
69	stmfd	sp!, {r4-r11, lr}
70	mov	r12, r0		@ Copy the secure service ID
71	mov	r6, #0xff	@ Indicate new Task call
72	dsb			@ Memory Barrier (not sure if needed, copied from omap_smc2)
73	smc	#1		@ Call PPA service
74	ldmfd	sp!, {r4-r11, pc}
75ENDPROC(omap_smc3)
76
77ENTRY(omap_modify_auxcoreboot0)
78	stmfd   sp!, {r1-r12, lr}
79	ldr	r12, =0x104
80	dsb
81	smc	#0
82	ldmfd   sp!, {r1-r12, pc}
83ENDPROC(omap_modify_auxcoreboot0)
84
85ENTRY(omap_auxcoreboot_addr)
86	stmfd   sp!, {r2-r12, lr}
87	ldr	r12, =0x105
88	dsb
89	smc	#0
90	ldmfd   sp!, {r2-r12, pc}
91ENDPROC(omap_auxcoreboot_addr)
92
93ENTRY(omap_read_auxcoreboot0)
94	stmfd   sp!, {r2-r12, lr}
95	ldr	r12, =0x103
96	dsb
97	smc	#0
98	ldmfd   sp!, {r2-r12, pc}
99ENDPROC(omap_read_auxcoreboot0)
100