ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[firefly-linux-kernel-4.4.55.git] / security / tlk_driver / ote_asm.S
1 /*
2  * Copyright (c) 2014, NVIDIA Corporation. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  */
13
14 #include <linux/linkage.h>
15 #include <linux/init.h>
16
17 #ifdef CONFIG_ARM64
18
19 ENTRY(tlk_irq_handler)
20         mov     x0, #0x5
21         movk    x0, #0x3200, lsl #16    // TE_SMC_NS_IRQ_DONE
22         smc     #0
23         ret
24 ENDPROC(tlk_irq_handler)
25
26 /* uint32_t tlk_generic_smc(uint32_t arg0, uint32_t arg1, uint32_t arg2) */
27 ENTRY(_tlk_generic_smc)
28         smc     #0
29         ret
30 ENDPROC(_tlk_generic_smc)
31
32         /* allows MAX_EXT_SMC_ARGS (r0-r11) to be passed in registers */
33
34 /* uint32_t tlk_extended_smc(uint32_t *regs) */
35 ENTRY(_tlk_extended_smc)
36         /*
37          * Allows MAX_EXT_SMC_ARGS (r0-r11) to be passed in registers
38          * (for aarch64, these are scratch, so no need to save them)
39          */
40         mov     x12, x0
41         ldp     x0, x1, [x12], #16
42         ldp     x2, x3, [x12], #16
43         ldp     x4, x5, [x12], #16
44         ldp     x6, x7, [x12], #16
45         ldp     x8, x9, [x12], #16
46         ldp     x10, x11, [x12], #16
47         smc     #0
48         ret
49 ENDPROC(_tlk_extended_smc)
50
51 #else
52
53 ENTRY(tlk_irq_handler)
54         movw    r0, #0x5
55         movt    r0, #0x3200     @ TE_SMC_NS_IRQ_DONE
56         mov     r1, #0
57         mov     r2, #0
58         smc     #0
59 ENDPROC(tlk_irq_handler)
60
61 ENTRY(_tlk_generic_smc)
62         smc     #0
63         mov     pc, lr
64 ENDPROC(_tlk_generic_smc)
65
66 ENTRY(_tlk_extended_smc)
67         stmfd   sp!, {r4-r12}   @ save reg state
68         mov     r12, r0         @ reg ptr to r12
69         ldmia   r12, {r0-r11}   @ load arg regs
70         smc     #0
71         ldmfd   sp!, {r4-r12}   @ restore saved regs
72 ENDPROC(_tlk_extended_smc)
73
74 #endif