blob: b73da3c5f10a9140ba730836d3e496af3e2358c6 [file] [log] [blame]
Sam Ravnborgf5e706a2008-07-17 21:55:51 -07001/* 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 Ravnborgf5e706a2008-07-17 21:55:51 -070011
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 Sharma600634972011-07-26 16:09:06 -070024#include <linux/atomic.h>
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070025
26/*
27 * Private routines/data
28 */
29
30extern unsigned char boot_cpu_id;
Sam Ravnborgb7afdb72011-01-28 22:08:18 +000031extern volatile unsigned long cpu_callin_map[NR_CPUS];
32extern cpumask_t smp_commenced_mask;
33extern struct linux_prom_registers smp_penguin_ctable;
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070034
35typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long,
36 unsigned long, unsigned long);
37
Sam Ravnborgb7afdb72011-01-28 22:08:18 +000038void cpu_panic(void);
39extern void smp4m_irq_rotate(int cpu);
40
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070041/*
42 * General functions that each host system must provide.
43 */
44
45void sun4m_init_smp(void);
46void sun4d_init_smp(void);
47
48void smp_callin(void);
49void smp_boot_cpus(void);
50void smp_store_cpu_info(int);
51
Daniel Hellstromd6d04812011-05-02 00:08:51 +000052void smp_resched_interrupt(void);
53void smp_call_function_single_interrupt(void);
54void smp_call_function_interrupt(void);
55
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070056struct seq_file;
57void smp_bogo(struct seq_file *);
58void smp_info(struct seq_file *);
59
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020060struct sparc32_ipi_ops {
61 void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1,
62 unsigned long arg2, unsigned long arg3,
63 unsigned long arg4);
64 void (*resched)(int cpu);
65 void (*single)(int cpu);
66 void (*mask_one)(int cpu);
67};
68extern const struct sparc32_ipi_ops *sparc32_ipi_ops;
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070069
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020070static inline void xc0(smpfunc_t func)
71{
72 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);
73}
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070074
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070075static inline void xc1(smpfunc_t func, unsigned long arg1)
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020076{
77 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);
78}
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070079static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020080{
81 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);
82}
83
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070084static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020085 unsigned long arg3)
86{
87 sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
88 arg1, arg2, arg3, 0);
89}
90
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070091static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
Sam Ravnborg4ba22b12012-05-14 15:14:36 +020092 unsigned long arg3, unsigned long arg4)
93{
94 sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
95 arg1, arg2, arg3, arg4);
96}
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070097
Daniel Hellstromd6d04812011-05-02 00:08:51 +000098extern void arch_send_call_function_single_ipi(int cpu);
99extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
David S. Miller66e4f8c2008-08-27 20:03:22 -0700100
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700101static inline int cpu_logical_map(int cpu)
102{
103 return cpu;
104}
105
David S. Millerc68e5d32012-05-13 23:09:04 -0700106extern int hard_smp_processor_id(void);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700107
108#define raw_smp_processor_id() (current_thread_info()->cpu)
109
110#define prof_multiplier(__cpu) cpu_data(__cpu).multiplier
111#define prof_counter(__cpu) cpu_data(__cpu).counter
112
113void smp_setup_cpu_possible_map(void);
114
115#endif /* !(__ASSEMBLY__) */
116
117/* Sparc specific messages. */
118#define MSG_CROSS_CALL 0x0005 /* run func on cpus */
119
120/* Empirical PROM processor mailbox constants. If the per-cpu mailbox
121 * contains something other than one of these then the ipi is from
122 * Linux's active_kernel_processor. This facility exists so that
123 * the boot monitor can capture all the other cpus when one catches
124 * a watchdog reset or the user enters the monitor using L1-A keys.
125 */
126#define MBOX_STOPCPU 0xFB
127#define MBOX_IDLECPU 0xFC
128#define MBOX_IDLECPU2 0xFD
129#define MBOX_STOPCPU2 0xFE
130
131#else /* SMP */
132
133#define hard_smp_processor_id() 0
134#define smp_setup_cpu_possible_map() do { } while (0)
135
136#endif /* !(SMP) */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700137#endif /* !(_SPARC_SMP_H) */