omap-smc.S 2.4 KB

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