smp_32.h 3.2 KB

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