smp_32.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* smp.h: Sparc specific SMP stuff.
  2. *
  3. * Copyright (C) 1996 David S. Miller ([email protected])
  4. */
  5. #ifndef _SPARC_SMP_H
  6. #define _SPARC_SMP_H
  7. #include <linux/threads.h>
  8. #include <asm/head.h>
  9. #ifndef __ASSEMBLY__
  10. #include <linux/cpumask.h>
  11. #endif /* __ASSEMBLY__ */
  12. #ifdef CONFIG_SMP
  13. #ifndef __ASSEMBLY__
  14. #include <asm/ptrace.h>
  15. #include <asm/asi.h>
  16. #include <linux/atomic.h>
  17. /*
  18. * Private routines/data
  19. */
  20. extern unsigned char boot_cpu_id;
  21. extern volatile unsigned long cpu_callin_map[NR_CPUS];
  22. extern cpumask_t smp_commenced_mask;
  23. extern struct linux_prom_registers smp_penguin_ctable;
  24. typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long,
  25. unsigned long, unsigned long);
  26. void cpu_panic(void);
  27. /*
  28. * General functions that each host system must provide.
  29. */
  30. void sun4m_init_smp(void);
  31. void sun4d_init_smp(void);
  32. void smp_callin(void);
  33. void smp_store_cpu_info(int);
  34. void smp_resched_interrupt(void);
  35. void smp_call_function_single_interrupt(void);
  36. void smp_call_function_interrupt(void);
  37. struct seq_file;
  38. void smp_bogo(struct seq_file *);
  39. void smp_info(struct seq_file *);
  40. struct sparc32_ipi_ops {
  41. void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1,
  42. unsigned long arg2, unsigned long arg3,
  43. unsigned long arg4);
  44. void (*resched)(int cpu);
  45. void (*single)(int cpu);
  46. void (*mask_one)(int cpu);
  47. };
  48. extern const struct sparc32_ipi_ops *sparc32_ipi_ops;
  49. static inline void xc0(smpfunc_t func)
  50. {
  51. sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);
  52. }
  53. static inline void xc1(smpfunc_t func, unsigned long arg1)
  54. {
  55. sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);
  56. }
  57. static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
  58. {
  59. sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);
  60. }
  61. static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
  62. unsigned long arg3)
  63. {
  64. sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
  65. arg1, arg2, arg3, 0);
  66. }
  67. static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
  68. unsigned long arg3, unsigned long arg4)
  69. {
  70. sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
  71. arg1, arg2, arg3, arg4);
  72. }
  73. void arch_send_call_function_single_ipi(int cpu);
  74. void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  75. static inline int cpu_logical_map(int cpu)
  76. {
  77. return cpu;
  78. }
  79. int hard_smp_processor_id(void);
  80. #define raw_smp_processor_id() (current_thread_info()->cpu)
  81. void smp_setup_cpu_possible_map(void);
  82. #endif /* !(__ASSEMBLY__) */
  83. /* Sparc specific messages. */
  84. #define MSG_CROSS_CALL 0x0005 /* run func on cpus */
  85. /* Empirical PROM processor mailbox constants. If the per-cpu mailbox
  86. * contains something other than one of these then the ipi is from
  87. * Linux's active_kernel_processor. This facility exists so that
  88. * the boot monitor can capture all the other cpus when one catches
  89. * a watchdog reset or the user enters the monitor using L1-A keys.
  90. */
  91. #define MBOX_STOPCPU 0xFB
  92. #define MBOX_IDLECPU 0xFC
  93. #define MBOX_IDLECPU2 0xFD
  94. #define MBOX_STOPCPU2 0xFE
  95. #else /* SMP */
  96. #define hard_smp_processor_id() 0
  97. #define smp_setup_cpu_possible_map() do { } while (0)
  98. #endif /* !(SMP) */
  99. #endif /* !(_SPARC_SMP_H) */