1 /*
2 * SMP Support
3 *
4 * Copyright (C) 1999 VA Linux Systems
5 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
6 */
7 #ifndef _ASM_IA64_SMP_H
8 #define _ASM_IA64_SMP_H
9
10 #include <linux/config.h>
11
12 #ifdef CONFIG_SMP
13
14 #include <linux/init.h>
15 #include <linux/threads.h>
16 #include <linux/kernel.h>
17
18 #include <asm/ptrace.h>
19 #include <asm/io.h>
20
21 #define XTP_OFFSET 0x1e0008
22
23 #define SMP_IRQ_REDIRECTION (1 << 0)
24 #define SMP_IPI_REDIRECTION (1 << 1)
25
26 #define smp_processor_id() (current->processor)
27
28 extern struct smp_boot_data {
29 int cpu_count;
30 int cpu_phys_id[NR_CPUS];
31 } smp_boot_data __initdata;
32
33 extern unsigned long cpu_present_map;
34 extern unsigned long cpu_online_map;
35 extern unsigned long ipi_base_addr;
36 extern int bootstrap_processor;
37 extern volatile int __cpu_physical_id[NR_CPUS];
38 extern unsigned char smp_int_redirect;
39 extern char no_int_routing;
40 extern int smp_num_cpus;
41
42 #define cpu_physical_id(i) __cpu_physical_id[i]
43 #define cpu_number_map(i) (i)
44 #define cpu_logical_map(i) (i)
45
46 extern unsigned long ap_wakeup_vector;
47
48 /*
49 * Function to map hard smp processor id to logical id. Slow, so
50 * don't use this in performance-critical code.
51 */
52 static inline int
53 cpu_logical_id (int cpuid)
54 {
55 int i;
56
57 for (i=0; i<smp_num_cpus; i++) {
58 if (cpu_physical_id(i) == cpuid)
59 break;
60 }
61 return i;
62 }
63
64 /*
65 * XTP control functions:
66 * min_xtp : route all interrupts to this CPU
67 * normal_xtp: nominal XTP value
68 * max_xtp : never deliver interrupts to this CPU.
69 */
70
71 static inline void
72 min_xtp(void)
73 {
74 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
75 writeb(0x00, ipi_base_addr | XTP_OFFSET); /* XTP to min */
76 }
77
78 static inline void
79 normal_xtp(void)
80 {
81 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
82 writeb(0x08, ipi_base_addr | XTP_OFFSET); /* XTP normal */
83 }
84
85 static inline void
86 max_xtp(void)
87 {
88 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
89 writeb(0x0f, ipi_base_addr | XTP_OFFSET); /* Set XTP to max */
90 }
91
92 static inline unsigned int
93 hard_smp_processor_id(void)
94 {
95 struct {
96 unsigned long reserved : 16;
97 unsigned long eid : 8;
98 unsigned long id : 8;
99 unsigned long ignored : 32;
100 } lid;
101
102 __asm__ ("mov %0=cr.lid" : "=r" (lid));
103
104 return lid.id << 8 | lid.eid;
105 }
106
107 #define NO_PROC_ID (-1)
108 #define PROC_CHANGE_PENALTY 20
109
110 extern void __init init_smp_config (void);
111 extern void smp_do_timer (struct pt_regs *regs);
112
113 extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
114 int retry, int wait);
115
116
117 #endif /* CONFIG_SMP */
118 #endif /* _ASM_IA64_SMP_H */
119
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.