1#ifndef __ASM_SMP_H
2#define __ASM_SMP_H
3
4#include <linux/config.h>
5#include <asm/pal.h>
6
7/* HACK: Cabrio WHAMI return value is bogus if more than 8 bits used.. :-( */
8
9static __inline__ unsigned char
10__hard_smp_processor_id(void)
11{
12	register unsigned char __r0 __asm__("$0");
13	__asm__ __volatile__(
14		"call_pal %1 #whami"
15		: "=r"(__r0)
16		:"i" (PAL_whami)
17		: "$1", "$22", "$23", "$24", "$25");
18	return __r0;
19}
20
21#ifdef CONFIG_SMP
22
23#include <linux/threads.h>
24#include <asm/irq.h>
25
26struct cpuinfo_alpha {
27	unsigned long loops_per_jiffy;
28	unsigned long last_asn;
29	int need_new_asn;
30	int asn_lock;
31	unsigned long *pgd_cache;
32	unsigned long *pmd_cache;
33	unsigned long *pte_cache;
34	unsigned long pgtable_cache_sz;
35	unsigned long ipi_count;
36	unsigned long irq_attempt[NR_IRQS];
37	unsigned long prof_multiplier;
38	unsigned long prof_counter;
39	unsigned char mcheck_expected;
40	unsigned char mcheck_taken;
41	unsigned char mcheck_extra;
42} __attribute__((aligned(64)));
43
44extern struct cpuinfo_alpha cpu_data[NR_CPUS];
45
46#define PROC_CHANGE_PENALTY     20
47
48/* Map from cpu id to sequential logical cpu number.  This will only
49   not be idempotent when cpus failed to come on-line.  */
50extern int __cpu_number_map[NR_CPUS];
51#define cpu_number_map(cpu)  __cpu_number_map[cpu]
52
53/* The reverse map from sequential logical cpu number to cpu id.  */
54extern int __cpu_logical_map[NR_CPUS];
55#define cpu_logical_map(cpu)  __cpu_logical_map[cpu]
56
57#define hard_smp_processor_id()	__hard_smp_processor_id()
58#define smp_processor_id()	(current->processor)
59
60extern unsigned long cpu_present_mask;
61#define cpu_online_map cpu_present_mask
62
63extern int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, unsigned long cpu);
64
65#else /* CONFIG_SMP */
66
67#define smp_call_function_on_cpu(func,info,retry,wait,cpu)    ({ 0; })
68
69#endif /* CONFIG_SMP */
70
71#define NO_PROC_ID	(-1)
72
73#endif
74