lowlevel.S 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * (C) Copyright 2014 Freescale Semiconductor
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. *
  6. * Extracted from armv8/start.S
  7. */
  8. #include <config.h>
  9. #include <linux/linkage.h>
  10. #include <asm/macro.h>
  11. ENTRY(lowlevel_init)
  12. mov x29, lr /* Save LR */
  13. /* Set the SMMU page size in the sACR register */
  14. ldr x1, =SMMU_BASE
  15. ldr w0, [x1, #0x10]
  16. orr w0, w0, #1 << 16 /* set sACR.pagesize to indicate 64K page */
  17. str w0, [x1, #0x10]
  18. /* Initialize GIC Secure Bank Status */
  19. #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
  20. branch_if_slave x0, 1f
  21. ldr x0, =GICD_BASE
  22. bl gic_init_secure
  23. 1:
  24. #ifdef CONFIG_GICV3
  25. ldr x0, =GICR_BASE
  26. bl gic_init_secure_percpu
  27. #elif defined(CONFIG_GICV2)
  28. ldr x0, =GICD_BASE
  29. ldr x1, =GICC_BASE
  30. bl gic_init_secure_percpu
  31. #endif
  32. #endif
  33. branch_if_master x0, x1, 1f
  34. /*
  35. * Slave should wait for master clearing spin table.
  36. * This sync prevent salves observing incorrect
  37. * value of spin table and jumping to wrong place.
  38. */
  39. #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
  40. #ifdef CONFIG_GICV2
  41. ldr x0, =GICC_BASE
  42. #endif
  43. bl gic_wait_for_interrupt
  44. #endif
  45. /*
  46. * All processors will enter EL2 and optionally EL1.
  47. */
  48. bl armv8_switch_to_el2
  49. #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
  50. bl armv8_switch_to_el1
  51. #endif
  52. b 2f
  53. 1:
  54. 2:
  55. mov lr, x29 /* Restore LR */
  56. ret
  57. ENDPROC(lowlevel_init)