Santosh Shilimkar | d660f9a | 2010-03-11 07:33:46 +0000 | [diff] [blame] | 1 | /* |
Pali Rohár | a33f178 | 2013-09-08 09:43:29 +0200 | [diff] [blame] | 2 | * OMAP34xx and OMAP44xx secure APIs file. |
Santosh Shilimkar | d660f9a | 2010-03-11 07:33:46 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2010 Texas Instruments, Inc. |
| 5 | * Written by Santosh Shilimkar <santosh.shilimkar@ti.com> |
| 6 | * |
Pali Rohár | a33f178 | 2013-09-08 09:43:29 +0200 | [diff] [blame] | 7 | * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> |
| 8 | * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> |
Santosh Shilimkar | d660f9a | 2010-03-11 07:33:46 +0000 | [diff] [blame] | 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 | |
| 27 | ENTRY(omap_smc1) |
| 28 | stmfd sp!, {r2-r12, lr} |
| 29 | mov r12, r0 |
| 30 | mov r0, r1 |
| 31 | dsb |
Richard Woodruff | df571c4a | 2010-04-07 07:47:21 +0000 | [diff] [blame] | 32 | smc #0 |
Santosh Shilimkar | d660f9a | 2010-03-11 07:33:46 +0000 | [diff] [blame] | 33 | ldmfd sp!, {r2-r12, pc} |
Dave Martin | f96bdfa | 2011-03-04 15:33:54 +0000 | [diff] [blame] | 34 | ENDPROC(omap_smc1) |
Santosh Shilimkar | 3f9eaf0 | 2010-08-02 13:18:18 +0300 | [diff] [blame] | 35 | |
Santosh Shilimkar | ba9456a | 2011-06-06 17:56:49 +0530 | [diff] [blame] | 36 | /** |
| 37 | * u32 omap_smc2(u32 id, u32 falg, u32 pargs) |
| 38 | * Low level common routine for secure HAL and PPA APIs. |
| 39 | * @id: Application ID of HAL APIs |
| 40 | * @flag: Flag to indicate the criticality of operation |
| 41 | * @pargs: Physical address of parameter list starting |
| 42 | * with number of parametrs |
| 43 | */ |
| 44 | ENTRY(omap_smc2) |
| 45 | stmfd sp!, {r4-r12, lr} |
| 46 | mov r3, r2 |
| 47 | mov r2, r1 |
| 48 | mov r1, #0x0 @ Process ID |
| 49 | mov r6, #0xff |
| 50 | mov r12, #0x00 @ Secure Service ID |
| 51 | mov r7, #0 |
| 52 | mcr p15, 0, r7, c7, c5, 6 |
| 53 | dsb |
| 54 | dmb |
| 55 | smc #0 |
| 56 | ldmfd sp!, {r4-r12, pc} |
| 57 | ENDPROC(omap_smc2) |
| 58 | |
Pali Rohár | a33f178 | 2013-09-08 09:43:29 +0200 | [diff] [blame] | 59 | /** |
| 60 | * u32 omap_smc3(u32 service_id, u32 process_id, u32 flag, u32 pargs) |
| 61 | * Low level common routine for secure HAL and PPA APIs via smc #1 |
| 62 | * r0 - @service_id: Secure Service ID |
| 63 | * r1 - @process_id: Process ID |
| 64 | * r2 - @flag: Flag to indicate the criticality of operation |
| 65 | * r3 - @pargs: Physical address of parameter list |
| 66 | */ |
| 67 | ENTRY(omap_smc3) |
| 68 | stmfd sp!, {r4-r11, lr} |
| 69 | mov r12, r0 @ Copy the secure service ID |
| 70 | mov r6, #0xff @ Indicate new Task call |
| 71 | dsb @ Memory Barrier (not sure if needed, copied from omap_smc2) |
| 72 | smc #1 @ Call PPA service |
| 73 | ldmfd sp!, {r4-r11, pc} |
| 74 | ENDPROC(omap_smc3) |
| 75 | |
Santosh Shilimkar | 3f9eaf0 | 2010-08-02 13:18:18 +0300 | [diff] [blame] | 76 | ENTRY(omap_modify_auxcoreboot0) |
| 77 | stmfd sp!, {r1-r12, lr} |
| 78 | ldr r12, =0x104 |
| 79 | dsb |
| 80 | smc #0 |
| 81 | ldmfd sp!, {r1-r12, pc} |
Dave Martin | f96bdfa | 2011-03-04 15:33:54 +0000 | [diff] [blame] | 82 | ENDPROC(omap_modify_auxcoreboot0) |
Santosh Shilimkar | 3f9eaf0 | 2010-08-02 13:18:18 +0300 | [diff] [blame] | 83 | |
| 84 | ENTRY(omap_auxcoreboot_addr) |
| 85 | stmfd sp!, {r2-r12, lr} |
| 86 | ldr r12, =0x105 |
| 87 | dsb |
| 88 | smc #0 |
| 89 | ldmfd sp!, {r2-r12, pc} |
Dave Martin | f96bdfa | 2011-03-04 15:33:54 +0000 | [diff] [blame] | 90 | ENDPROC(omap_auxcoreboot_addr) |
Santosh Shilimkar | 3f9eaf0 | 2010-08-02 13:18:18 +0300 | [diff] [blame] | 91 | |
| 92 | ENTRY(omap_read_auxcoreboot0) |
| 93 | stmfd sp!, {r2-r12, lr} |
| 94 | ldr r12, =0x103 |
| 95 | dsb |
| 96 | smc #0 |
| 97 | mov r0, r0, lsr #9 |
| 98 | ldmfd sp!, {r2-r12, pc} |
Dave Martin | f96bdfa | 2011-03-04 15:33:54 +0000 | [diff] [blame] | 99 | ENDPROC(omap_read_auxcoreboot0) |