smp-ops.h 2.3 KB

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