smp-ops.h 2.3 KB

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