kernel-entry-init.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2013 Cavium, Inc
  7. */
  8. #ifndef __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H
  9. #define __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H
  10. #define CP0_EBASE $15, 1
  11. .macro kernel_entry_setup
  12. #ifdef CONFIG_SMP
  13. mfc0 t0, CP0_EBASE
  14. andi t0, t0, 0x3ff # CPUNum
  15. beqz t0, 1f
  16. # CPUs other than zero goto smp_bootstrap
  17. j smp_bootstrap
  18. #endif /* CONFIG_SMP */
  19. 1:
  20. .endm
  21. /*
  22. * Do SMP slave processor setup necessary before we can safely execute
  23. * C code.
  24. */
  25. .macro smp_slave_setup
  26. mfc0 t0, CP0_EBASE
  27. andi t0, t0, 0x3ff # CPUNum
  28. slti t1, t0, NR_CPUS
  29. bnez t1, 1f
  30. 2:
  31. di
  32. wait
  33. b 2b # Unknown CPU, loop forever.
  34. 1:
  35. PTR_LA t1, paravirt_smp_sp
  36. PTR_SLL t0, PTR_SCALESHIFT
  37. PTR_ADDU t1, t1, t0
  38. 3:
  39. PTR_L sp, 0(t1)
  40. beqz sp, 3b # Spin until told to proceed.
  41. PTR_LA t1, paravirt_smp_gp
  42. PTR_ADDU t1, t1, t0
  43. sync
  44. PTR_L gp, 0(t1)
  45. .endm
  46. #endif /* __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H */