smp.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef __ASM_SH_SMP_H
  2. #define __ASM_SH_SMP_H
  3. #include <linux/bitops.h>
  4. #include <linux/cpumask.h>
  5. #include <asm/smp-ops.h>
  6. #ifdef CONFIG_SMP
  7. #include <linux/spinlock.h>
  8. #include <asm/atomic.h>
  9. #include <asm/current.h>
  10. #define raw_smp_processor_id() (current_thread_info()->cpu)
  11. /* Map from cpu id to sequential logical cpu number. */
  12. extern int __cpu_number_map[NR_CPUS];
  13. #define cpu_number_map(cpu) __cpu_number_map[cpu]
  14. /* The reverse map from sequential logical cpu number to cpu id. */
  15. extern int __cpu_logical_map[NR_CPUS];
  16. #define cpu_logical_map(cpu) __cpu_logical_map[cpu]
  17. enum {
  18. SMP_MSG_FUNCTION,
  19. SMP_MSG_RESCHEDULE,
  20. SMP_MSG_FUNCTION_SINGLE,
  21. SMP_MSG_TIMER,
  22. SMP_MSG_NR, /* must be last */
  23. };
  24. void smp_message_recv(unsigned int msg);
  25. void smp_timer_broadcast(const struct cpumask *mask);
  26. void local_timer_interrupt(void);
  27. void local_timer_setup(unsigned int cpu);
  28. void arch_send_call_function_single_ipi(int cpu);
  29. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  30. static inline int hard_smp_processor_id(void)
  31. {
  32. extern struct plat_smp_ops *mp_ops; /* private */
  33. if (!mp_ops)
  34. return 0; /* boot CPU */
  35. return mp_ops->smp_processor_id();
  36. }
  37. #else
  38. #define hard_smp_processor_id() (0)
  39. #endif /* CONFIG_SMP */
  40. #endif /* __ASM_SH_SMP_H */