smp-ops.h 1.9 KB

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