smp-ops.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. #include <linux/errno.h>
  14. #include <asm/mips-cps.h>
  15. #ifdef CONFIG_SMP
  16. #include <linux/cpumask.h>
  17. struct task_struct;
  18. struct plat_smp_ops {
  19. void (*send_ipi_single)(int cpu, unsigned int action);
  20. void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action);
  21. void (*init_secondary)(void);
  22. void (*smp_finish)(void);
  23. int (*boot_secondary)(int cpu, struct task_struct *idle);
  24. void (*smp_setup)(void);
  25. void (*prepare_cpus)(unsigned int max_cpus);
  26. #ifdef CONFIG_HOTPLUG_CPU
  27. int (*cpu_disable)(void);
  28. void (*cpu_die)(unsigned int cpu);
  29. #endif
  30. #ifdef CONFIG_KEXEC
  31. void (*kexec_nonboot_cpu)(void);
  32. #endif
  33. };
  34. extern void register_smp_ops(const struct plat_smp_ops *ops);
  35. static inline void plat_smp_setup(void)
  36. {
  37. extern const struct plat_smp_ops *mp_ops; /* private */
  38. mp_ops->smp_setup();
  39. }
  40. extern void mips_smp_send_ipi_single(int cpu, unsigned int action);
  41. extern void mips_smp_send_ipi_mask(const struct cpumask *mask,
  42. unsigned int action);
  43. #else /* !CONFIG_SMP */
  44. struct plat_smp_ops;
  45. static inline void plat_smp_setup(void)
  46. {
  47. /* UP, nothing to do ... */
  48. }
  49. static inline void register_smp_ops(const struct plat_smp_ops *ops)
  50. {
  51. }
  52. #endif /* !CONFIG_SMP */
  53. static inline int register_up_smp_ops(void)
  54. {
  55. #ifdef CONFIG_SMP_UP
  56. extern const struct plat_smp_ops up_smp_ops;
  57. register_smp_ops(&up_smp_ops);
  58. return 0;
  59. #else
  60. return -ENODEV;
  61. #endif
  62. }
  63. static inline int register_cmp_smp_ops(void)
  64. {
  65. #ifdef CONFIG_MIPS_CMP
  66. extern const struct plat_smp_ops cmp_smp_ops;
  67. if (!mips_cm_present())
  68. return -ENODEV;
  69. register_smp_ops(&cmp_smp_ops);
  70. return 0;
  71. #else
  72. return -ENODEV;
  73. #endif
  74. }
  75. static inline int register_vsmp_smp_ops(void)
  76. {
  77. #ifdef CONFIG_MIPS_MT_SMP
  78. extern const struct plat_smp_ops vsmp_smp_ops;
  79. register_smp_ops(&vsmp_smp_ops);
  80. return 0;
  81. #else
  82. return -ENODEV;
  83. #endif
  84. }
  85. #ifdef CONFIG_MIPS_CPS
  86. extern int register_cps_smp_ops(void);
  87. #else
  88. static inline int register_cps_smp_ops(void)
  89. {
  90. return -ENODEV;
  91. }
  92. #endif
  93. #endif /* __ASM_SMP_OPS_H */