smp.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _ASM_X86_SMP_H_
  2. #define _ASM_X86_SMP_H_
  3. #ifndef __ASSEMBLY__
  4. #include <linux/cpumask.h>
  5. extern cpumask_t cpu_callout_map;
  6. extern int smp_num_siblings;
  7. extern unsigned int num_processors;
  8. struct smp_ops {
  9. void (*smp_prepare_boot_cpu)(void);
  10. void (*smp_prepare_cpus)(unsigned max_cpus);
  11. int (*cpu_up)(unsigned cpu);
  12. void (*smp_cpus_done)(unsigned max_cpus);
  13. void (*smp_send_stop)(void);
  14. void (*smp_send_reschedule)(int cpu);
  15. int (*smp_call_function_mask)(cpumask_t mask,
  16. void (*func)(void *info), void *info,
  17. int wait);
  18. };
  19. #ifdef CONFIG_SMP
  20. extern struct smp_ops smp_ops;
  21. static inline void smp_prepare_boot_cpu(void)
  22. {
  23. smp_ops.smp_prepare_boot_cpu();
  24. }
  25. static inline void smp_prepare_cpus(unsigned int max_cpus)
  26. {
  27. smp_ops.smp_prepare_cpus(max_cpus);
  28. }
  29. static inline int __cpu_up(unsigned int cpu)
  30. {
  31. return smp_ops.cpu_up(cpu);
  32. }
  33. static inline void smp_send_reschedule(int cpu)
  34. {
  35. smp_ops.smp_send_reschedule(cpu);
  36. }
  37. static inline int smp_call_function_mask(cpumask_t mask,
  38. void (*func) (void *info), void *info,
  39. int wait)
  40. {
  41. return smp_ops.smp_call_function_mask(mask, func, info, wait);
  42. }
  43. void native_smp_prepare_boot_cpu(void);
  44. void native_smp_prepare_cpus(unsigned int max_cpus);
  45. int native_cpu_up(unsigned int cpunum);
  46. #endif
  47. #ifdef CONFIG_X86_32
  48. # include "smp_32.h"
  49. #else
  50. # include "smp_64.h"
  51. #endif
  52. extern void smp_alloc_memory(void);
  53. extern void lock_ipi_call_lock(void);
  54. extern void unlock_ipi_call_lock(void);
  55. #endif /* __ASSEMBLY__ */
  56. #endif