| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- /*
- * Copyright (c) 2008 Travis Geiselbrecht
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- #include <asm.h>
- .arch_extension sec
- FUNCTION(arm_undefined)
- stmfd sp!, { r0-r12, r14 }
- sub sp, sp, #12
- mov r0, sp
- mrs r1, spsr
- stmia r0, { r1, r13-r14 }^
- b arm_undefined_handler
- b .
- FUNCTION(arm_syscall)
- stmfd sp!, { r0-r12, r14 }
- sub sp, sp, #12
- mov r0, sp
- mrs r1, spsr
- stmia r0, { r1, r13-r14 }^
- b arm_syscall_handler
- b .
- FUNCTION(arm_prefetch_abort)
- stmfd sp!, { r0-r12, r14 }
- sub sp, sp, #12
- mov r0, sp
- mrs r1, spsr
- stmia r0, { r1, r13-r14 }^
- b arm_prefetch_abort_handler
- b .
- FUNCTION(arm_data_abort)
- stmfd sp!, { r0-r12, r14 }
- sub sp, sp, #12
- mov r0, sp
- mrs r1, spsr
- stmia r0, { r1, r13-r14 }^
- b arm_data_abort_handler
- b .
- FUNCTION(arm_reserved)
- b .
- FUNCTION(arm_irq)
- /* XXX only deals with interrupting supervisor mode */
- /* save r4-r6 and use as a temporary place to save while we switch into supervisor mode */
- stmia r13, { r4-r6 }
- mov r4, r13
- sub r5, lr, #4
- mrs r6, spsr
- /* move into supervisor mode. irq/fiq disabled */
- msr cpsr_c, #(3<<6 | 0x13)
- /* save the return address */
- stmfd sp!, { r5 }
- /* save C trashed regs, supervisor lr */
- stmfd sp!, { r0-r3, r12, lr }
- /* save spsr */
- stmfd sp!, { r6 }
- /* restore r4-r6 */
- ldmia r4, { r4-r6 }
- /* increment the global critical section count */
- ldr r1, =critical_section_count
- ldr r0, [r1]
- add r0, r0, #1
- str r0, [r1]
- /* call into higher level code */
- mov r0, sp /* iframe */
- bl platform_irq
- /* reschedule if the handler returns nonzero */
- cmp r0, #0
- blne thread_preempt
- /* decrement the global critical section count */
- ldr r1, =critical_section_count
- ldr r0, [r1]
- sub r0, r0, #1
- str r0, [r1]
- /* restore spsr */
- ldmfd sp!, { r0 }
- msr spsr_cxsf, r0
- /* restore back to where we came from */
- ldmfd sp!, { r0-r3, r12, lr, pc }^
- .bss
- .align 2
- .global irq_save_spot
- irq_save_spot:
- .word 0 /* r4 */
- .word 0 /* r5 */
- .word 0 /* r6 */
- .text
- FUNCTION(arm_fiq)
- sub lr, lr, #4
- stmfd sp!, { r0-r3, r12, lr }
- bl platform_fiq
- ldmfd sp!, { r0-r3, r12, pc }^
- .ltorg
- .text
- #ifndef MTK_SMC_ID_MGMT
- .text
- FUNCTION(jumparch64_smc)
- push {r4}
- mov r4, r3
- mov r3, r2
- mov r2, r1
- mov r1, r0
- ldr r0, =0x82000115 /*r0: ATF Function ID, please check MTK_SIP_KERNEL_BOOT_AARCH32 in vendor/arm/atf/include/bl31/services/sip_svc.h*/
- smc #0
- pop {r4}
- b .
- .text
- FUNCTION(dapc_smc)
- mov r3, r2
- mov r2, r1
- mov r1, r0
- ldr r0, =0x82000101 /*please check MTK_SIP_LK_DAPC_INIT_AARCH32 in vendor/arm/atf-1.0/include/bl31/services/sip_svc.h*/
- smc #0
- bx lr
- .text
- FUNCTION(md_reg_write_smc)
- push {r4}
- mov r4, r3
- mov r3, r2
- mov r2, r1
- mov r1, r0
- ldr r0, =0x82000102 /*please check MTK_SIP_LK_LTE_REG_WRITE_TH_AARCH32 in vendor/arm/atf-1.0/include/bl31/services/sip_svc.h*/
- smc #0
- pop {r4}
- bx lr
- .text
- FUNCTION(rpmb_init)
- ldr r0, =0x82000103 /*please check MTK_SIP_LK_RPMB_INIT_AARCH32 in vendor/arm/atf-1.0/include/bl31/services/sip_svc.h*/
- smc #0
- bx lr
- .text
- FUNCTION(rpmb_uninit)
- ldr r0, =0x82000104 /*please check MTK_SIP_LK_RPMB_UNINIT_AARCH32 in vendor/arm/atf-1.0/include/bl31/services/sip_svc.h*/
- smc #0
- bx lr
- .text
- FUNCTION(rpmb_hmac)
- mov r2, r1
- mov r1, r0
- ldr r0, =0x82000105 /*please check MTK_SIP_LK_RPMB_HMAC_AARCH32 in vendor/arm/atf-1.0/include/bl31/services/sip_svc.h*/
- smc #0
- bx lr
- .text
- FUNCTION(crypto_hw_init)
- mov r2, r1
- mov r1, r0
- ldr r0, =0x8200010B
- smc #0
- bx lr
- .text
- FUNCTION(crypto_hw_disable)
- ldr r0, =0x8200010C
- smc #0
- bx lr
- .text
- FUNCTION(sha256atf_init)
- ldr r0, =0x8200010D
- smc #0
- bx lr
- .text
- FUNCTION(sha256atf_process)
- mov r2, r1
- mov r1, r0
- ldr r0, =0x8200010E
- smc #0
- bx lr
- .text
- FUNCTION(sha256atf_done)
- ldr r0, =0x8200010F
- smc #0
- bx lr
- .text
- FUNCTION(get_rnd)
- push {r4}
- mov r4, r0
- ldr r0, =0x82000110
- smc #0
- str r1, [r4]
- pop {r4}
- bx lr
- .text
- FUNCTION(mt_secure_call)
- smc #0
- bx lr
- #endif
|