initial commit with v2.6.9
[linux-2.6.9-moxart.git] / include / asm-ia64 / smp.h
blobd6838c9b7bb4ee0a4dbec410ed154756800f328f
1 /*
2 * SMP Support
4 * Copyright (C) 1999 VA Linux Systems
5 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
6 * Copyright (C) 2001-2003 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 */
9 #ifndef _ASM_IA64_SMP_H
10 #define _ASM_IA64_SMP_H
12 #include <linux/config.h>
14 #ifdef CONFIG_SMP
16 #include <linux/init.h>
17 #include <linux/threads.h>
18 #include <linux/kernel.h>
19 #include <linux/cpumask.h>
21 #include <asm/bitops.h>
22 #include <asm/io.h>
23 #include <asm/param.h>
24 #include <asm/processor.h>
25 #include <asm/ptrace.h>
27 #define XTP_OFFSET 0x1e0008
29 #define SMP_IRQ_REDIRECTION (1 << 0)
30 #define SMP_IPI_REDIRECTION (1 << 1)
32 #define smp_processor_id() (current_thread_info()->cpu)
34 extern struct smp_boot_data {
35 int cpu_count;
36 int cpu_phys_id[NR_CPUS];
37 } smp_boot_data __initdata;
39 extern char no_int_routing __devinitdata;
41 extern cpumask_t cpu_online_map;
42 extern void __iomem *ipi_base_addr;
43 extern unsigned char smp_int_redirect;
45 extern volatile int ia64_cpu_to_sapicid[];
46 #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
48 extern unsigned long ap_wakeup_vector;
51 * Function to map hard smp processor id to logical id. Slow, so don't use this in
52 * performance-critical code.
54 static inline int
55 cpu_logical_id (int cpuid)
57 int i;
59 for (i = 0; i < NR_CPUS; ++i)
60 if (cpu_physical_id(i) == cpuid)
61 break;
62 return i;
66 * XTP control functions:
67 * min_xtp : route all interrupts to this CPU
68 * normal_xtp: nominal XTP value
69 * max_xtp : never deliver interrupts to this CPU.
72 static inline void
73 min_xtp (void)
75 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
76 writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
79 static inline void
80 normal_xtp (void)
82 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
83 writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
86 static inline void
87 max_xtp (void)
89 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
90 writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
93 static inline unsigned int
94 hard_smp_processor_id (void)
96 union {
97 struct {
98 unsigned long reserved : 16;
99 unsigned long eid : 8;
100 unsigned long id : 8;
101 unsigned long ignored : 32;
102 } f;
103 unsigned long bits;
104 } lid;
106 lid.bits = ia64_getreg(_IA64_REG_CR_LID);
107 return lid.f.id << 8 | lid.f.eid;
110 /* Upping and downing of CPUs */
111 extern int __cpu_disable (void);
112 extern void __cpu_die (unsigned int cpu);
113 extern void cpu_die (void) __attribute__ ((noreturn));
114 extern int __cpu_up (unsigned int cpu);
115 extern void __init smp_build_cpu_map(void);
117 extern void __init init_smp_config (void);
118 extern void smp_do_timer (struct pt_regs *regs);
120 extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
121 int retry, int wait);
122 extern void smp_send_reschedule (int cpu);
123 extern void lock_ipi_calllock(void);
124 extern void unlock_ipi_calllock(void);
126 #else
128 #define cpu_logical_id(cpuid) 0
130 #endif /* CONFIG_SMP */
131 #endif /* _ASM_IA64_SMP_H */