smp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef __ASM_SH_SMP_H
  2. #define __ASM_SH_SMP_H
  3. #include <linux/bitops.h>
  4. #include <linux/cpumask.h>
  5. #ifdef CONFIG_SMP
  6. #include <linux/spinlock.h>
  7. #include <asm/atomic.h>
  8. #include <asm/current.h>
  9. #define raw_smp_processor_id() (current_thread_info()->cpu)
  10. #define hard_smp_processor_id() plat_smp_processor_id()
  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. /* I've no idea what the real meaning of this is */
  18. #define PROC_CHANGE_PENALTY 20
  19. #define NO_PROC_ID (-1)
  20. struct smp_fn_call_struct {
  21. spinlock_t lock;
  22. atomic_t finished;
  23. void (*fn)(void *);
  24. void *data;
  25. };
  26. extern struct smp_fn_call_struct smp_fn_call;
  27. #define SMP_MSG_FUNCTION 0
  28. #define SMP_MSG_RESCHEDULE 1
  29. #define SMP_MSG_NR 2
  30. void plat_smp_setup(void);
  31. void plat_prepare_cpus(unsigned int max_cpus);
  32. int plat_smp_processor_id(void);
  33. void plat_start_cpu(unsigned int cpu, unsigned long entry_point);
  34. void plat_send_ipi(unsigned int cpu, unsigned int message);
  35. int plat_register_ipi_handler(unsigned int message,
  36. void (*handler)(void *), void *arg);
  37. #else
  38. #define hard_smp_processor_id() (0)
  39. #endif /* CONFIG_SMP */
  40. #endif /* __ASM_SH_SMP_H */