msp_smtc.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * MSP71xx Platform-specific hooks for SMP operation
  3. */
  4. #include <linux/irq.h>
  5. #include <linux/init.h>
  6. #include <asm/mipsmtregs.h>
  7. #include <asm/mipsregs.h>
  8. #include <asm/smtc.h>
  9. #include <asm/smtc_ipi.h>
  10. /* VPE/SMP Prototype implements platform interfaces directly */
  11. /*
  12. * Cause the specified action to be performed on a targeted "CPU"
  13. */
  14. static void msp_smtc_send_ipi_single(int cpu, unsigned int action)
  15. {
  16. /* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */
  17. smtc_send_ipi(cpu, LINUX_SMP_IPI, action);
  18. }
  19. static void msp_smtc_send_ipi_mask(const struct cpumask *mask,
  20. unsigned int action)
  21. {
  22. unsigned int i;
  23. for_each_cpu(i, mask)
  24. msp_smtc_send_ipi_single(i, action);
  25. }
  26. /*
  27. * Post-config but pre-boot cleanup entry point
  28. */
  29. static void __cpuinit msp_smtc_init_secondary(void)
  30. {
  31. int myvpe;
  32. /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */
  33. myvpe = read_c0_tcbind() & TCBIND_CURVPE;
  34. if (myvpe > 0)
  35. change_c0_status(ST0_IM, STATUSF_IP0 | STATUSF_IP1 |
  36. STATUSF_IP6 | STATUSF_IP7);
  37. smtc_init_secondary();
  38. }
  39. /*
  40. * Platform "CPU" startup hook
  41. */
  42. static void __cpuinit msp_smtc_boot_secondary(int cpu,
  43. struct task_struct *idle)
  44. {
  45. smtc_boot_secondary(cpu, idle);
  46. }
  47. /*
  48. * SMP initialization finalization entry point
  49. */
  50. static void __cpuinit msp_smtc_smp_finish(void)
  51. {
  52. smtc_smp_finish();
  53. }
  54. /*
  55. * Hook for after all CPUs are online
  56. */
  57. static void msp_smtc_cpus_done(void)
  58. {
  59. }
  60. /*
  61. * Platform SMP pre-initialization
  62. *
  63. * As noted above, we can assume a single CPU for now
  64. * but it may be multithreaded.
  65. */
  66. static void __init msp_smtc_smp_setup(void)
  67. {
  68. /*
  69. * we won't get the definitive value until
  70. * we've run smtc_prepare_cpus later, but
  71. */
  72. if (read_c0_config3() & (1 << 2))
  73. smp_num_siblings = smtc_build_cpu_map(0);
  74. }
  75. static void __init msp_smtc_prepare_cpus(unsigned int max_cpus)
  76. {
  77. smtc_prepare_cpus(max_cpus);
  78. }
  79. struct plat_smp_ops msp_smtc_smp_ops = {
  80. .send_ipi_single = msp_smtc_send_ipi_single,
  81. .send_ipi_mask = msp_smtc_send_ipi_mask,
  82. .init_secondary = msp_smtc_init_secondary,
  83. .smp_finish = msp_smtc_smp_finish,
  84. .cpus_done = msp_smtc_cpus_done,
  85. .boot_secondary = msp_smtc_boot_secondary,
  86. .smp_setup = msp_smtc_smp_setup,
  87. .prepare_cpus = msp_smtc_prepare_cpus,
  88. };