0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __ASM_SMP_OPS_H
0012 #define __ASM_SMP_OPS_H
0013
0014 #include <linux/errno.h>
0015
0016 #include <asm/mips-cps.h>
0017
0018 #ifdef CONFIG_SMP
0019
0020 #include <linux/cpumask.h>
0021
0022 struct task_struct;
0023
0024 struct plat_smp_ops {
0025 void (*send_ipi_single)(int cpu, unsigned int action);
0026 void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action);
0027 void (*init_secondary)(void);
0028 void (*smp_finish)(void);
0029 int (*boot_secondary)(int cpu, struct task_struct *idle);
0030 void (*smp_setup)(void);
0031 void (*prepare_cpus)(unsigned int max_cpus);
0032 void (*prepare_boot_cpu)(void);
0033 #ifdef CONFIG_HOTPLUG_CPU
0034 int (*cpu_disable)(void);
0035 void (*cpu_die)(unsigned int cpu);
0036 #endif
0037 #ifdef CONFIG_KEXEC
0038 void (*kexec_nonboot_cpu)(void);
0039 #endif
0040 };
0041
0042 extern void register_smp_ops(const struct plat_smp_ops *ops);
0043
0044 static inline void plat_smp_setup(void)
0045 {
0046 extern const struct plat_smp_ops *mp_ops;
0047
0048 mp_ops->smp_setup();
0049 }
0050
0051 extern void mips_smp_send_ipi_single(int cpu, unsigned int action);
0052 extern void mips_smp_send_ipi_mask(const struct cpumask *mask,
0053 unsigned int action);
0054
0055 #else
0056
0057 struct plat_smp_ops;
0058
0059 static inline void plat_smp_setup(void)
0060 {
0061
0062 }
0063
0064 static inline void register_smp_ops(const struct plat_smp_ops *ops)
0065 {
0066 }
0067
0068 #endif
0069
0070 static inline int register_up_smp_ops(void)
0071 {
0072 #ifdef CONFIG_SMP_UP
0073 extern const struct plat_smp_ops up_smp_ops;
0074
0075 register_smp_ops(&up_smp_ops);
0076
0077 return 0;
0078 #else
0079 return -ENODEV;
0080 #endif
0081 }
0082
0083 static inline int register_cmp_smp_ops(void)
0084 {
0085 #ifdef CONFIG_MIPS_CMP
0086 extern const struct plat_smp_ops cmp_smp_ops;
0087
0088 if (!mips_cm_present())
0089 return -ENODEV;
0090
0091 register_smp_ops(&cmp_smp_ops);
0092
0093 return 0;
0094 #else
0095 return -ENODEV;
0096 #endif
0097 }
0098
0099 static inline int register_vsmp_smp_ops(void)
0100 {
0101 #ifdef CONFIG_MIPS_MT_SMP
0102 extern const struct plat_smp_ops vsmp_smp_ops;
0103
0104 if (!cpu_has_mipsmt)
0105 return -ENODEV;
0106
0107 register_smp_ops(&vsmp_smp_ops);
0108
0109 return 0;
0110 #else
0111 return -ENODEV;
0112 #endif
0113 }
0114
0115 #ifdef CONFIG_MIPS_CPS
0116 extern int register_cps_smp_ops(void);
0117 #else
0118 static inline int register_cps_smp_ops(void)
0119 {
0120 return -ENODEV;
0121 }
0122 #endif
0123
0124 #endif