smp_32.h 3.3 KB

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