blob: 9c8d34b07ebf19cac5a07ce711419410b6209320 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_SMP_H
2#define __ASM_SH_SMP_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/bitops.h>
5#include <linux/cpumask.h>
6
7#ifdef CONFIG_SMP
8
Evgeniy Polyakov66c52272007-05-31 13:46:21 +09009#include <linux/spinlock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <asm/atomic.h>
11#include <asm/current.h>
12
Ingo Molnar39c715b2005-06-21 17:14:34 -070013#define raw_smp_processor_id() (current_thread_info()->cpu)
Paul Mundtaba10302007-09-21 18:32:32 +090014#define hard_smp_processor_id() plat_smp_processor_id()
15
16/* Map from cpu id to sequential logical cpu number. */
17extern int __cpu_number_map[NR_CPUS];
18#define cpu_number_map(cpu) __cpu_number_map[cpu]
19
20/* The reverse map from sequential logical cpu number to cpu id. */
21extern int __cpu_logical_map[NR_CPUS];
22#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24/* I've no idea what the real meaning of this is */
25#define PROC_CHANGE_PENALTY 20
26
27#define NO_PROC_ID (-1)
28
29struct smp_fn_call_struct {
30 spinlock_t lock;
31 atomic_t finished;
32 void (*fn)(void *);
33 void *data;
34};
35
36extern struct smp_fn_call_struct smp_fn_call;
37
Paul Mundtaba10302007-09-21 18:32:32 +090038#define SMP_MSG_FUNCTION 0
39#define SMP_MSG_RESCHEDULE 1
40#define SMP_MSG_NR 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Paul Mundtaba10302007-09-21 18:32:32 +090042void plat_smp_setup(void);
43void plat_prepare_cpus(unsigned int max_cpus);
44int plat_smp_processor_id(void);
45void plat_start_cpu(unsigned int cpu, unsigned long entry_point);
46void plat_send_ipi(unsigned int cpu, unsigned int message);
47int plat_register_ipi_handler(unsigned int message,
48 void (*handler)(void *), void *arg);
49
50#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
Paul Mundt027e56e2007-06-20 18:23:49 +090052#define hard_smp_processor_id() (0)
53
Paul Mundtaba10302007-09-21 18:32:32 +090054#endif /* CONFIG_SMP */
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#endif /* __ASM_SH_SMP_H */