kernel-entry-init.h 1016 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. mfc0 t0, CP0_EBASE
  13. andi t0, t0, 0x3ff # CPUNum
  14. beqz t0, 1f
  15. # CPUs other than zero goto smp_bootstrap
  16. j smp_bootstrap
  17. 1:
  18. .endm
  19. /*
  20. * Do SMP slave processor setup necessary before we can safely execute
  21. * C code.
  22. */
  23. .macro smp_slave_setup
  24. mfc0 t0, CP0_EBASE
  25. andi t0, t0, 0x3ff # CPUNum
  26. slti t1, t0, NR_CPUS
  27. bnez t1, 1f
  28. 2:
  29. di
  30. wait
  31. b 2b # Unknown CPU, loop forever.
  32. 1:
  33. PTR_LA t1, paravirt_smp_sp
  34. PTR_SLL t0, PTR_SCALESHIFT
  35. PTR_ADDU t1, t1, t0
  36. 3:
  37. PTR_L sp, 0(t1)
  38. beqz sp, 3b # Spin until told to proceed.
  39. PTR_LA t1, paravirt_smp_gp
  40. PTR_ADDU t1, t1, t0
  41. sync
  42. PTR_L gp, 0(t1)
  43. .endm
  44. #endif /* __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H */