blob: 6ba1fb8b11e225683cb32aafa959fdfcc73967c5 [file] [log] [blame]
Ralf Baechle87353d82007-11-19 12:23:51 +00001/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 * Copyright (C) 2000, 2001, 2002 Ralf Baechle
9 * Copyright (C) 2000, 2001 Broadcom Corporation
10 */
11#ifndef __ASM_SMP_OPS_H
12#define __ASM_SMP_OPS_H
13
Ralf Baechle4f55fd72011-06-01 14:20:09 +010014#include <linux/errno.h>
15
Paul Burton237036d2014-01-15 10:31:54 +000016#include <asm/mips-cm.h>
17
Ralf Baechle87353d82007-11-19 12:23:51 +000018#ifdef CONFIG_SMP
19
20#include <linux/cpumask.h>
21
Ralf Baechlef5fd02a2009-03-25 14:41:09 +010022struct task_struct;
23
Ralf Baechle87353d82007-11-19 12:23:51 +000024struct plat_smp_ops {
25 void (*send_ipi_single)(int cpu, unsigned int action);
Rusty Russell48a048f2009-09-24 09:34:44 -060026 void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action);
Ralf Baechle87353d82007-11-19 12:23:51 +000027 void (*init_secondary)(void);
28 void (*smp_finish)(void);
Ralf Baechle87353d82007-11-19 12:23:51 +000029 void (*boot_secondary)(int cpu, struct task_struct *idle);
30 void (*smp_setup)(void);
31 void (*prepare_cpus)(unsigned int max_cpus);
Ralf Baechle1b2bc752009-06-23 10:00:31 +010032#ifdef CONFIG_HOTPLUG_CPU
33 int (*cpu_disable)(void);
34 void (*cpu_die)(unsigned int cpu);
35#endif
Ralf Baechle87353d82007-11-19 12:23:51 +000036};
37
38extern void register_smp_ops(struct plat_smp_ops *ops);
39
40static inline void plat_smp_setup(void)
41{
42 extern struct plat_smp_ops *mp_ops; /* private */
43
44 mp_ops->smp_setup();
45}
46
Paul Burtonb9660872014-03-24 10:19:33 +000047extern void gic_send_ipi_single(int cpu, unsigned int action);
48extern void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action);
49
Ralf Baechle87353d82007-11-19 12:23:51 +000050#else /* !CONFIG_SMP */
51
52struct plat_smp_ops;
53
54static inline void plat_smp_setup(void)
55{
56 /* UP, nothing to do ... */
57}
58
59static inline void register_smp_ops(struct plat_smp_ops *ops)
60{
61}
62
63#endif /* !CONFIG_SMP */
64
Ralf Baechle852fe312011-05-28 15:27:59 +010065static inline int register_up_smp_ops(void)
66{
67#ifdef CONFIG_SMP_UP
68 extern struct plat_smp_ops up_smp_ops;
69
70 register_smp_ops(&up_smp_ops);
71
72 return 0;
73#else
74 return -ENODEV;
75#endif
76}
77
78static inline int register_cmp_smp_ops(void)
79{
80#ifdef CONFIG_MIPS_CMP
81 extern struct plat_smp_ops cmp_smp_ops;
82
Paul Burton237036d2014-01-15 10:31:54 +000083 if (!mips_cm_present())
84 return -ENODEV;
85
Ralf Baechle852fe312011-05-28 15:27:59 +010086 register_smp_ops(&cmp_smp_ops);
87
88 return 0;
89#else
90 return -ENODEV;
91#endif
92}
93
94static inline int register_vsmp_smp_ops(void)
95{
96#ifdef CONFIG_MIPS_MT_SMP
97 extern struct plat_smp_ops vsmp_smp_ops;
98
99 register_smp_ops(&vsmp_smp_ops);
100
101 return 0;
102#else
103 return -ENODEV;
104#endif
105}
Ralf Baechle87353d82007-11-19 12:23:51 +0000106
Paul Burton0ee958e2014-01-15 10:31:53 +0000107#ifdef CONFIG_MIPS_CPS
108extern int register_cps_smp_ops(void);
109#else
110static inline int register_cps_smp_ops(void)
111{
112 return -ENODEV;
113}
114#endif
115
Ralf Baechle87353d82007-11-19 12:23:51 +0000116#endif /* __ASM_SMP_OPS_H */