malta_smtc.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Malta Platform-specific hooks for SMP operation
  3. */
  4. #include <linux/irq.h>
  5. #include <linux/init.h>
  6. #include <asm/mipsregs.h>
  7. #include <asm/mipsmtregs.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. void core_send_ipi(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. /*
  20. * Platform "CPU" startup hook
  21. */
  22. void __cpuinit prom_boot_secondary(int cpu, struct task_struct *idle)
  23. {
  24. smtc_boot_secondary(cpu, idle);
  25. }
  26. /*
  27. * Post-config but pre-boot cleanup entry point
  28. */
  29. void __cpuinit prom_init_secondary(void)
  30. {
  31. void smtc_init_secondary(void);
  32. int myvpe;
  33. /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */
  34. myvpe = read_c0_tcbind() & TCBIND_CURVPE;
  35. if (myvpe != 0) {
  36. /* Ideally, this should be done only once per VPE, but... */
  37. clear_c0_status(ST0_IM);
  38. set_c0_status((0x100 << cp0_compare_irq)
  39. | (0x100 << MIPS_CPU_IPI_IRQ));
  40. if (cp0_perfcount_irq >= 0)
  41. set_c0_status(0x100 << cp0_perfcount_irq);
  42. }
  43. smtc_init_secondary();
  44. }
  45. /*
  46. * Platform SMP pre-initialization
  47. *
  48. * As noted above, we can assume a single CPU for now
  49. * but it may be multithreaded.
  50. */
  51. void __cpuinit plat_smp_setup(void)
  52. {
  53. if (read_c0_config3() & (1<<2))
  54. mipsmt_build_cpu_map(0);
  55. }
  56. void __init plat_prepare_cpus(unsigned int max_cpus)
  57. {
  58. if (read_c0_config3() & (1<<2))
  59. mipsmt_prepare_cpus();
  60. }
  61. /*
  62. * SMP initialization finalization entry point
  63. */
  64. void __cpuinit prom_smp_finish(void)
  65. {
  66. smtc_smp_finish();
  67. }
  68. /*
  69. * Hook for after all CPUs are online
  70. */
  71. void prom_cpus_done(void)
  72. {
  73. }