lowlevel_init.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Board specific setup info
  3. *
  4. * (C) Copyright 2010
  5. * Texas Instruments, <www.ti.com>
  6. *
  7. * Author :
  8. * Aneesh V <aneesh@ti.com>
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. #include <config.h>
  13. #include <asm/arch/omap.h>
  14. #include <asm/omap_common.h>
  15. #include <asm/arch/spl.h>
  16. #include <linux/linkage.h>
  17. .arch_extension sec
  18. #ifdef CONFIG_SPL
  19. ENTRY(save_boot_params)
  20. ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
  21. str r0, [r1]
  22. b save_boot_params_ret
  23. ENDPROC(save_boot_params)
  24. #if !defined(CONFIG_TI_SECURE_DEVICE) && defined(CONFIG_ARMV7_LPAE)
  25. ENTRY(switch_to_hypervisor)
  26. /*
  27. * Switch to hypervisor mode
  28. */
  29. adr r0, save_sp
  30. str sp, [r0]
  31. adr r1, restore_from_hyp
  32. ldr r0, =0x102
  33. b omap_smc1
  34. restore_from_hyp:
  35. adr r0, save_sp
  36. ldr sp, [r0]
  37. MRC p15, 4, R0, c1, c0, 0
  38. ldr r1, =0X1004 @Set cache enable bits for hypervisor mode
  39. orr r0, r0, r1
  40. MCR p15, 4, R0, c1, c0, 0
  41. b switch_to_hypervisor_ret
  42. save_sp:
  43. .word 0x0
  44. ENDPROC(switch_to_hypervisor)
  45. #endif
  46. #endif
  47. ENTRY(omap_smc1)
  48. push {r4-r12, lr} @ save registers - ROM code may pollute
  49. @ our registers
  50. mov r12, r0 @ Service
  51. mov r0, r1 @ Argument
  52. dsb
  53. dmb
  54. smc 0 @ SMC #0 to enter monitor mode
  55. @ call ROM Code API for the service requested
  56. pop {r4-r12, pc}
  57. ENDPROC(omap_smc1)
  58. ENTRY(omap_smc_sec)
  59. push {r4-r12, lr} @ save registers - ROM code may pollute
  60. @ our registers
  61. mov r6, #0xFF @ Indicate new Task call
  62. mov r12, #0x00 @ Secure Service ID in R12
  63. dsb
  64. dmb
  65. smc 0 @ SMC #0 to enter monitor mode
  66. b omap_smc_sec_end @ exit at end of the service execution
  67. nop
  68. @ In case of IRQ happening in Secure, then ARM will branch here.
  69. @ At that moment, IRQ will be pending and ARM will jump to Non Secure
  70. @ IRQ handler
  71. mov r12, #0xFE
  72. dsb
  73. dmb
  74. smc 0 @ SMC #0 to enter monitor mode
  75. omap_smc_sec_end:
  76. pop {r4-r12, pc}
  77. ENDPROC(omap_smc_sec)