Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 1 | /* smp.h: Sparc specific SMP stuff. |
| 2 | * |
| 3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
| 4 | */ |
| 5 | |
| 6 | #ifndef _SPARC_SMP_H |
| 7 | #define _SPARC_SMP_H |
| 8 | |
| 9 | #include <linux/threads.h> |
| 10 | #include <asm/head.h> |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 11 | |
| 12 | #ifndef __ASSEMBLY__ |
| 13 | |
| 14 | #include <linux/cpumask.h> |
| 15 | |
| 16 | #endif /* __ASSEMBLY__ */ |
| 17 | |
| 18 | #ifdef CONFIG_SMP |
| 19 | |
| 20 | #ifndef __ASSEMBLY__ |
| 21 | |
| 22 | #include <asm/ptrace.h> |
| 23 | #include <asm/asi.h> |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 24 | #include <linux/atomic.h> |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 25 | |
| 26 | /* |
| 27 | * Private routines/data |
| 28 | */ |
| 29 | |
| 30 | extern unsigned char boot_cpu_id; |
Sam Ravnborg | b7afdb7 | 2011-01-28 22:08:18 +0000 | [diff] [blame] | 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; |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 34 | |
| 35 | typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, |
| 36 | unsigned long, unsigned long); |
| 37 | |
Sam Ravnborg | b7afdb7 | 2011-01-28 22:08:18 +0000 | [diff] [blame] | 38 | void cpu_panic(void); |
Sam Ravnborg | b7afdb7 | 2011-01-28 22:08:18 +0000 | [diff] [blame] | 39 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 40 | /* |
| 41 | * General functions that each host system must provide. |
| 42 | */ |
| 43 | |
| 44 | void sun4m_init_smp(void); |
| 45 | void sun4d_init_smp(void); |
| 46 | |
| 47 | void smp_callin(void); |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 48 | void smp_store_cpu_info(int); |
| 49 | |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 50 | void smp_resched_interrupt(void); |
| 51 | void smp_call_function_single_interrupt(void); |
| 52 | void smp_call_function_interrupt(void); |
| 53 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 54 | struct seq_file; |
| 55 | void smp_bogo(struct seq_file *); |
| 56 | void smp_info(struct seq_file *); |
| 57 | |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 58 | struct sparc32_ipi_ops { |
| 59 | void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1, |
| 60 | unsigned long arg2, unsigned long arg3, |
| 61 | unsigned long arg4); |
| 62 | void (*resched)(int cpu); |
| 63 | void (*single)(int cpu); |
| 64 | void (*mask_one)(int cpu); |
| 65 | }; |
| 66 | extern const struct sparc32_ipi_ops *sparc32_ipi_ops; |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 67 | |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 68 | static inline void xc0(smpfunc_t func) |
| 69 | { |
| 70 | sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0); |
| 71 | } |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 72 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 73 | static inline void xc1(smpfunc_t func, unsigned long arg1) |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 74 | { |
| 75 | sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0); |
| 76 | } |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 77 | static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2) |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 78 | { |
| 79 | sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0); |
| 80 | } |
| 81 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 82 | static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2, |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 83 | unsigned long arg3) |
| 84 | { |
| 85 | sparc32_ipi_ops->cross_call(func, *cpu_online_mask, |
| 86 | arg1, arg2, arg3, 0); |
| 87 | } |
| 88 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 89 | static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2, |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 90 | unsigned long arg3, unsigned long arg4) |
| 91 | { |
| 92 | sparc32_ipi_ops->cross_call(func, *cpu_online_mask, |
| 93 | arg1, arg2, arg3, arg4); |
| 94 | } |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 95 | |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 96 | extern void arch_send_call_function_single_ipi(int cpu); |
| 97 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
David S. Miller | 66e4f8c | 2008-08-27 20:03:22 -0700 | [diff] [blame] | 98 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 99 | static inline int cpu_logical_map(int cpu) |
| 100 | { |
| 101 | return cpu; |
| 102 | } |
| 103 | |
David S. Miller | c68e5d3 | 2012-05-13 23:09:04 -0700 | [diff] [blame] | 104 | extern int hard_smp_processor_id(void); |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 105 | |
| 106 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
| 107 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 108 | void smp_setup_cpu_possible_map(void); |
| 109 | |
| 110 | #endif /* !(__ASSEMBLY__) */ |
| 111 | |
| 112 | /* Sparc specific messages. */ |
| 113 | #define MSG_CROSS_CALL 0x0005 /* run func on cpus */ |
| 114 | |
| 115 | /* Empirical PROM processor mailbox constants. If the per-cpu mailbox |
| 116 | * contains something other than one of these then the ipi is from |
| 117 | * Linux's active_kernel_processor. This facility exists so that |
| 118 | * the boot monitor can capture all the other cpus when one catches |
| 119 | * a watchdog reset or the user enters the monitor using L1-A keys. |
| 120 | */ |
| 121 | #define MBOX_STOPCPU 0xFB |
| 122 | #define MBOX_IDLECPU 0xFC |
| 123 | #define MBOX_IDLECPU2 0xFD |
| 124 | #define MBOX_STOPCPU2 0xFE |
| 125 | |
| 126 | #else /* SMP */ |
| 127 | |
| 128 | #define hard_smp_processor_id() 0 |
| 129 | #define smp_setup_cpu_possible_map() do { } while (0) |
| 130 | |
| 131 | #endif /* !(SMP) */ |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 132 | #endif /* !(_SPARC_SMP_H) */ |