0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __ASM_SMP_H
0012 #define __ASM_SMP_H
0013
0014 #include <linux/bitops.h>
0015 #include <linux/linkage.h>
0016 #include <linux/smp.h>
0017 #include <linux/threads.h>
0018 #include <linux/cpumask.h>
0019
0020 #include <linux/atomic.h>
0021 #include <asm/smp-ops.h>
0022
0023 extern int smp_num_siblings;
0024 extern cpumask_t cpu_sibling_map[];
0025 extern cpumask_t cpu_core_map[];
0026 extern cpumask_t cpu_foreign_map[];
0027
0028 static inline int raw_smp_processor_id(void)
0029 {
0030 #if defined(__VDSO__)
0031 extern int vdso_smp_processor_id(void)
0032 __compiletime_error("VDSO should not call smp_processor_id()");
0033 return vdso_smp_processor_id();
0034 #else
0035 return current_thread_info()->cpu;
0036 #endif
0037 }
0038 #define raw_smp_processor_id raw_smp_processor_id
0039
0040
0041
0042 extern int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP];
0043 #define cpu_number_map(cpu) __cpu_number_map[cpu]
0044
0045
0046 extern int __cpu_logical_map[NR_CPUS];
0047 #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
0048
0049 #define NO_PROC_ID (-1)
0050
0051 #define SMP_RESCHEDULE_YOURSELF 0x1
0052 #define SMP_CALL_FUNCTION 0x2
0053
0054 #define SMP_ICACHE_FLUSH 0x4
0055 #define SMP_ASK_C0COUNT 0x8
0056
0057
0058 extern cpumask_t cpu_coherent_mask;
0059
0060 extern asmlinkage void smp_bootstrap(void);
0061
0062 extern void calculate_cpu_foreign_map(void);
0063
0064
0065
0066
0067
0068
0069 static inline void smp_send_reschedule(int cpu)
0070 {
0071 extern const struct plat_smp_ops *mp_ops;
0072
0073 mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
0074 }
0075
0076 #ifdef CONFIG_HOTPLUG_CPU
0077 static inline int __cpu_disable(void)
0078 {
0079 extern const struct plat_smp_ops *mp_ops;
0080
0081 return mp_ops->cpu_disable();
0082 }
0083
0084 static inline void __cpu_die(unsigned int cpu)
0085 {
0086 extern const struct plat_smp_ops *mp_ops;
0087
0088 mp_ops->cpu_die(cpu);
0089 }
0090
0091 extern void play_dead(void);
0092 #endif
0093
0094 #ifdef CONFIG_KEXEC
0095 static inline void kexec_nonboot_cpu(void)
0096 {
0097 extern const struct plat_smp_ops *mp_ops;
0098
0099 return mp_ops->kexec_nonboot_cpu();
0100 }
0101
0102 static inline void *kexec_nonboot_cpu_func(void)
0103 {
0104 extern const struct plat_smp_ops *mp_ops;
0105
0106 return mp_ops->kexec_nonboot_cpu;
0107 }
0108 #endif
0109
0110
0111
0112
0113
0114
0115 int mips_smp_ipi_allocate(const struct cpumask *mask);
0116
0117
0118
0119
0120
0121
0122 int mips_smp_ipi_free(const struct cpumask *mask);
0123
0124 static inline void arch_send_call_function_single_ipi(int cpu)
0125 {
0126 extern const struct plat_smp_ops *mp_ops;
0127
0128 mp_ops->send_ipi_single(cpu, SMP_CALL_FUNCTION);
0129 }
0130
0131 static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
0132 {
0133 extern const struct plat_smp_ops *mp_ops;
0134
0135 mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
0136 }
0137
0138 #endif