omap-smc.S 2.5 KB

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