malta_smtc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Malta Platform-specific hooks for SMP operation
  3. */
  4. #include <linux/init.h>
  5. #include <asm/mipsregs.h>
  6. #include <asm/mipsmtregs.h>
  7. #include <asm/smtc.h>
  8. #include <asm/smtc_ipi.h>
  9. /* VPE/SMP Prototype implements platform interfaces directly */
  10. /*
  11. * Cause the specified action to be performed on a targeted "CPU"
  12. */
  13. void core_send_ipi(int cpu, unsigned int action)
  14. {
  15. /* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */
  16. smtc_send_ipi(cpu, LINUX_SMP_IPI, action);
  17. }
  18. /*
  19. * Platform "CPU" startup hook
  20. */
  21. void prom_boot_secondary(int cpu, struct task_struct *idle)
  22. {
  23. smtc_boot_secondary(cpu, idle);
  24. }
  25. /*
  26. * Post-config but pre-boot cleanup entry point
  27. */
  28. void prom_init_secondary(void)
  29. {
  30. void smtc_init_secondary(void);
  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. /* Ideally, this should be done only once per VPE, but... */
  36. clear_c0_status(ST0_IM);
  37. set_c0_status((0x100 << cp0_compare_irq)
  38. | (0x100 << MIPS_CPU_IPI_IRQ));
  39. if (cp0_perfcount_irq >= 0)
  40. set_c0_status(0x100 << cp0_perfcount_irq);
  41. }
  42. smtc_init_secondary();
  43. }
  44. /*
  45. * Platform SMP pre-initialization
  46. *
  47. * As noted above, we can assume a single CPU for now
  48. * but it may be multithreaded.
  49. */
  50. void __cpuinit plat_smp_setup(void)
  51. {
  52. if (read_c0_config3() & (1<<2))
  53. mipsmt_build_cpu_map(0);
  54. }
  55. void __init plat_prepare_cpus(unsigned int max_cpus)
  56. {
  57. if (read_c0_config3() & (1<<2))
  58. mipsmt_prepare_cpus();
  59. }
  60. /*
  61. * SMP initialization finalization entry point
  62. */
  63. void prom_smp_finish(void)
  64. {
  65. smtc_smp_finish();
  66. }
  67. /*
  68. * Hook for after all CPUs are online
  69. */
  70. void prom_cpus_done(void)
  71. {
  72. }