Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 1 | /* |
| 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 Baechle | 4f55fd7 | 2011-06-01 14:20:09 +0100 | [diff] [blame] | 14 | #include <linux/errno.h> |
| 15 | |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 16 | #ifdef CONFIG_SMP |
| 17 | |
| 18 | #include <linux/cpumask.h> |
| 19 | |
Ralf Baechle | f5fd02a | 2009-03-25 14:41:09 +0100 | [diff] [blame] | 20 | struct task_struct; |
| 21 | |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 22 | struct plat_smp_ops { |
| 23 | void (*send_ipi_single)(int cpu, unsigned int action); |
Rusty Russell | 48a048f | 2009-09-24 09:34:44 -0600 | [diff] [blame] | 24 | void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action); |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 25 | void (*init_secondary)(void); |
| 26 | void (*smp_finish)(void); |
| 27 | void (*cpus_done)(void); |
| 28 | void (*boot_secondary)(int cpu, struct task_struct *idle); |
| 29 | void (*smp_setup)(void); |
| 30 | void (*prepare_cpus)(unsigned int max_cpus); |
Ralf Baechle | 1b2bc75 | 2009-06-23 10:00:31 +0100 | [diff] [blame] | 31 | #ifdef CONFIG_HOTPLUG_CPU |
| 32 | int (*cpu_disable)(void); |
| 33 | void (*cpu_die)(unsigned int cpu); |
| 34 | #endif |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | extern void register_smp_ops(struct plat_smp_ops *ops); |
| 38 | |
| 39 | static inline void plat_smp_setup(void) |
| 40 | { |
| 41 | extern struct plat_smp_ops *mp_ops; /* private */ |
| 42 | |
| 43 | mp_ops->smp_setup(); |
| 44 | } |
| 45 | |
| 46 | #else /* !CONFIG_SMP */ |
| 47 | |
| 48 | struct plat_smp_ops; |
| 49 | |
| 50 | static inline void plat_smp_setup(void) |
| 51 | { |
| 52 | /* UP, nothing to do ... */ |
| 53 | } |
| 54 | |
| 55 | static inline void register_smp_ops(struct plat_smp_ops *ops) |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | #endif /* !CONFIG_SMP */ |
| 60 | |
Ralf Baechle | 852fe31 | 2011-05-28 15:27:59 +0100 | [diff] [blame] | 61 | static inline int register_up_smp_ops(void) |
| 62 | { |
| 63 | #ifdef CONFIG_SMP_UP |
| 64 | extern struct plat_smp_ops up_smp_ops; |
| 65 | |
| 66 | register_smp_ops(&up_smp_ops); |
| 67 | |
| 68 | return 0; |
| 69 | #else |
| 70 | return -ENODEV; |
| 71 | #endif |
| 72 | } |
| 73 | |
| 74 | static inline int register_cmp_smp_ops(void) |
| 75 | { |
| 76 | #ifdef CONFIG_MIPS_CMP |
| 77 | extern struct plat_smp_ops cmp_smp_ops; |
| 78 | |
| 79 | register_smp_ops(&cmp_smp_ops); |
| 80 | |
| 81 | return 0; |
| 82 | #else |
| 83 | return -ENODEV; |
| 84 | #endif |
| 85 | } |
| 86 | |
| 87 | static inline int register_vsmp_smp_ops(void) |
| 88 | { |
| 89 | #ifdef CONFIG_MIPS_MT_SMP |
| 90 | extern struct plat_smp_ops vsmp_smp_ops; |
| 91 | |
| 92 | register_smp_ops(&vsmp_smp_ops); |
| 93 | |
| 94 | return 0; |
| 95 | #else |
| 96 | return -ENODEV; |
| 97 | #endif |
| 98 | } |
Ralf Baechle | 87353d8 | 2007-11-19 12:23:51 +0000 | [diff] [blame] | 99 | |
| 100 | #endif /* __ASM_SMP_OPS_H */ |