bcm_kona_smc_asm.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (C) 2013 Broadcom Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation version 2.
  7. *
  8. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  9. * kind, whether express or implied; without even the implied warranty
  10. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #include <linux/linkage.h>
  14. #include "bcm_kona_smc.h"
  15. /*
  16. * int bcm_kona_smc_asm(u32 service_id, u32 buffer_addr)
  17. */
  18. ENTRY(bcm_kona_smc_asm)
  19. stmfd sp!, {r4-r12, lr}
  20. mov r4, r0 @ service_id
  21. mov r5, #3 @ Keep IRQ and FIQ off in SM
  22. /*
  23. * Since interrupts are disabled in the open mode, we must keep
  24. * interrupts disabled in secure mode by setting R5=0x3. If interrupts
  25. * are enabled in open mode, we can set R5=0x0 to allow interrupts in
  26. * secure mode. If we did this, the secure monitor would return back
  27. * control to the open mode to handle the interrupt prior to completing
  28. * the secure service. If this happened, R12 would not be
  29. * SEC_EXIT_NORMAL and we would need to call SMC again after resetting
  30. * R5 (it gets clobbered by the secure monitor) and setting R4 to
  31. * SSAPI_RET_FROM_INT_SERV to indicate that we want the secure monitor
  32. * to finish up the previous uncompleted secure service.
  33. */
  34. mov r6, r1 @ buffer_addr
  35. smc #0
  36. /* Check r12 for SEC_EXIT_NORMAL here if interrupts are enabled */
  37. ldmfd sp!, {r4-r12, pc}
  38. ENDPROC(bcm_kona_smc_asm)