1 /* smp.h: Sparc specific SMP stuff.
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
9 #include <linux/threads.h>
14 #include <linux/cpumask.h>
16 #endif /* __ASSEMBLY__ */
22 #include <asm/ptrace.h>
24 #include <linux/atomic.h>
27 * Private routines/data
30 extern unsigned char boot_cpu_id;
31 extern volatile unsigned long cpu_callin_map[NR_CPUS];
32 extern cpumask_t smp_commenced_mask;
33 extern struct linux_prom_registers smp_penguin_ctable;
35 typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long,
36 unsigned long, unsigned long);
39 extern void smp4m_irq_rotate(int cpu);
42 * General functions that each host system must provide.
45 void sun4m_init_smp(void);
46 void sun4d_init_smp(void);
48 void smp_callin(void);
49 void smp_store_cpu_info(int);
51 void smp_resched_interrupt(void);
52 void smp_call_function_single_interrupt(void);
53 void smp_call_function_interrupt(void);
56 void smp_bogo(struct seq_file *);
57 void smp_info(struct seq_file *);
59 struct sparc32_ipi_ops {
60 void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1,
61 unsigned long arg2, unsigned long arg3,
63 void (*resched)(int cpu);
64 void (*single)(int cpu);
65 void (*mask_one)(int cpu);
67 extern const struct sparc32_ipi_ops *sparc32_ipi_ops;
69 static inline void xc0(smpfunc_t func)
71 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);
74 static inline void xc1(smpfunc_t func, unsigned long arg1)
76 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);
78 static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
80 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);
83 static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
86 sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
90 static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
91 unsigned long arg3, unsigned long arg4)
93 sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
94 arg1, arg2, arg3, arg4);
97 extern void arch_send_call_function_single_ipi(int cpu);
98 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
100 static inline int cpu_logical_map(int cpu)
105 extern int hard_smp_processor_id(void);
107 #define raw_smp_processor_id() (current_thread_info()->cpu)
109 #define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
110 #define prof_counter(__cpu) cpu_data(__cpu).counter
112 void smp_setup_cpu_possible_map(void);
114 #endif /* !(__ASSEMBLY__) */
116 /* Sparc specific messages. */
117 #define MSG_CROSS_CALL 0x0005 /* run func on cpus */
119 /* Empirical PROM processor mailbox constants. If the per-cpu mailbox
120 * contains something other than one of these then the ipi is from
121 * Linux's active_kernel_processor. This facility exists so that
122 * the boot monitor can capture all the other cpus when one catches
123 * a watchdog reset or the user enters the monitor using L1-A keys.
125 #define MBOX_STOPCPU 0xFB
126 #define MBOX_IDLECPU 0xFC
127 #define MBOX_IDLECPU2 0xFD
128 #define MBOX_STOPCPU2 0xFE
132 #define hard_smp_processor_id() 0
133 #define smp_setup_cpu_possible_map() do { } while (0)
136 #endif /* !(_SPARC_SMP_H) */