smp_32.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* smp.h: Sparc specific SMP stuff.
  2. *
  3. * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  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. extern void smp4m_irq_rotate(int cpu);
  28. /*
  29. * General functions that each host system must provide.
  30. */
  31. void sun4m_init_smp(void);
  32. void sun4d_init_smp(void);
  33. void smp_callin(void);
  34. void smp_boot_cpus(void);
  35. void smp_store_cpu_info(int);
  36. void smp_resched_interrupt(void);
  37. void smp_call_function_single_interrupt(void);
  38. void smp_call_function_interrupt(void);
  39. struct seq_file;
  40. void smp_bogo(struct seq_file *);
  41. void smp_info(struct seq_file *);
  42. struct sparc32_ipi_ops {
  43. void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1,
  44. unsigned long arg2, unsigned long arg3,
  45. unsigned long arg4);
  46. void (*resched)(int cpu);
  47. void (*single)(int cpu);
  48. void (*mask_one)(int cpu);
  49. };
  50. extern const struct sparc32_ipi_ops *sparc32_ipi_ops;
  51. static inline void xc0(smpfunc_t func)
  52. {
  53. sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);
  54. }
  55. static inline void xc1(smpfunc_t func, unsigned long arg1)
  56. {
  57. sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);
  58. }
  59. static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
  60. {
  61. sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);
  62. }
  63. static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
  64. unsigned long arg3)
  65. {
  66. sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
  67. arg1, arg2, arg3, 0);
  68. }
  69. static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
  70. unsigned long arg3, unsigned long arg4)
  71. {
  72. sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
  73. arg1, arg2, arg3, arg4);
  74. }
  75. extern void arch_send_call_function_single_ipi(int cpu);
  76. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  77. static inline int cpu_logical_map(int cpu)
  78. {
  79. return cpu;
  80. }
  81. extern int hard_smp_processor_id(void);
  82. #define raw_smp_processor_id() (current_thread_info()->cpu)
  83. #define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
  84. #define prof_counter(__cpu) cpu_data(__cpu).counter
  85. void smp_setup_cpu_possible_map(void);
  86. #endif /* !(__ASSEMBLY__) */
  87. /* Sparc specific messages. */
  88. #define MSG_CROSS_CALL 0x0005 /* run func on cpus */
  89. /* Empirical PROM processor mailbox constants. If the per-cpu mailbox
  90. * contains something other than one of these then the ipi is from
  91. * Linux's active_kernel_processor. This facility exists so that
  92. * the boot monitor can capture all the other cpus when one catches
  93. * a watchdog reset or the user enters the monitor using L1-A keys.
  94. */
  95. #define MBOX_STOPCPU 0xFB
  96. #define MBOX_IDLECPU 0xFC
  97. #define MBOX_IDLECPU2 0xFD
  98. #define MBOX_STOPCPU2 0xFE
  99. #else /* SMP */
  100. #define hard_smp_processor_id() 0
  101. #define smp_setup_cpu_possible_map() do { } while (0)
  102. #endif /* !(SMP) */
  103. #endif /* !(_SPARC_SMP_H) */