smp-ops.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 ([email protected])
  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. void (*prepare_boot_cpu)(void);
  27. #ifdef CONFIG_HOTPLUG_CPU
  28. int (*cpu_disable)(void);
  29. void (*cpu_die)(unsigned int cpu);
  30. #endif
  31. #ifdef CONFIG_KEXEC
  32. void (*kexec_nonboot_cpu)(void);
  33. #endif
  34. };
  35. extern void register_smp_ops(const struct plat_smp_ops *ops);
  36. static inline void plat_smp_setup(void)
  37. {
  38. extern const struct plat_smp_ops *mp_ops; /* private */
  39. mp_ops->smp_setup();
  40. }
  41. extern void mips_smp_send_ipi_single(int cpu, unsigned int action);
  42. extern void mips_smp_send_ipi_mask(const struct cpumask *mask,
  43. unsigned int action);
  44. #else /* !CONFIG_SMP */
  45. struct plat_smp_ops;
  46. static inline void plat_smp_setup(void)
  47. {
  48. /* UP, nothing to do ... */
  49. }
  50. static inline void register_smp_ops(const struct plat_smp_ops *ops)
  51. {
  52. }
  53. #endif /* !CONFIG_SMP */
  54. static inline int register_up_smp_ops(void)
  55. {
  56. #ifdef CONFIG_SMP_UP
  57. extern const struct plat_smp_ops up_smp_ops;
  58. register_smp_ops(&up_smp_ops);
  59. return 0;
  60. #else
  61. return -ENODEV;
  62. #endif
  63. }
  64. static inline int register_cmp_smp_ops(void)
  65. {
  66. #ifdef CONFIG_MIPS_CMP
  67. extern const struct plat_smp_ops cmp_smp_ops;
  68. if (!mips_cm_present())
  69. return -ENODEV;
  70. register_smp_ops(&cmp_smp_ops);
  71. return 0;
  72. #else
  73. return -ENODEV;
  74. #endif
  75. }
  76. static inline int register_vsmp_smp_ops(void)
  77. {
  78. #ifdef CONFIG_MIPS_MT_SMP
  79. extern const struct plat_smp_ops vsmp_smp_ops;
  80. if (!cpu_has_mipsmt)
  81. return -ENODEV;
  82. register_smp_ops(&vsmp_smp_ops);
  83. return 0;
  84. #else
  85. return -ENODEV;
  86. #endif
  87. }
  88. #ifdef CONFIG_MIPS_CPS
  89. extern int register_cps_smp_ops(void);
  90. #else
  91. static inline int register_cps_smp_ops(void)
  92. {
  93. return -ENODEV;
  94. }
  95. #endif
  96. #endif /* __ASM_SMP_OPS_H */