smp-ops.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #ifdef CONFIG_SMP
  15. #include <linux/cpumask.h>
  16. struct task_struct;
  17. struct plat_smp_ops {
  18. void (*send_ipi_single)(int cpu, unsigned int action);
  19. void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action);
  20. void (*init_secondary)(void);
  21. void (*smp_finish)(void);
  22. void (*cpus_done)(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. #else /* !CONFIG_SMP */
  38. struct plat_smp_ops;
  39. static inline void plat_smp_setup(void)
  40. {
  41. /* UP, nothing to do ... */
  42. }
  43. static inline void register_smp_ops(struct plat_smp_ops *ops)
  44. {
  45. }
  46. #endif /* !CONFIG_SMP */
  47. static inline int register_up_smp_ops(void)
  48. {
  49. #ifdef CONFIG_SMP_UP
  50. extern struct plat_smp_ops up_smp_ops;
  51. register_smp_ops(&up_smp_ops);
  52. return 0;
  53. #else
  54. return -ENODEV;
  55. #endif
  56. }
  57. static inline int register_cmp_smp_ops(void)
  58. {
  59. #ifdef CONFIG_MIPS_CMP
  60. extern struct plat_smp_ops cmp_smp_ops;
  61. register_smp_ops(&cmp_smp_ops);
  62. return 0;
  63. #else
  64. return -ENODEV;
  65. #endif
  66. }
  67. static inline int register_vsmp_smp_ops(void)
  68. {
  69. #ifdef CONFIG_MIPS_MT_SMP
  70. extern struct plat_smp_ops vsmp_smp_ops;
  71. register_smp_ops(&vsmp_smp_ops);
  72. return 0;
  73. #else
  74. return -ENODEV;
  75. #endif
  76. }
  77. #endif /* __ASM_SMP_OPS_H */