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>
9 #ifndef _ASM_IA64_SMP_H
10 #define _ASM_IA64_SMP_H
12 #include <linux/config.h>
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>
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 {
36 int cpu_phys_id[NR_CPUS];
37 } smp_boot_data __initdata;
39 extern char no_int_routing __initdata;
41 extern cpumask_t phys_cpu_present_map;
42 extern cpumask_t cpu_online_map;
43 extern unsigned long ipi_base_addr;
44 extern unsigned char smp_int_redirect;
46 extern volatile int ia64_cpu_to_sapicid[];
47 #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
49 extern unsigned long ap_wakeup_vector;
51 #define cpu_possible_map phys_cpu_present_map
54 * Function to map hard smp processor id to logical id. Slow, so don't use this in
55 * performance-critical code.
58 cpu_logical_id (int cpuid)
62 for (i = 0; i < NR_CPUS; ++i)
63 if (cpu_physical_id(i) == cpuid)
69 * XTP control functions:
70 * min_xtp : route all interrupts to this CPU
71 * normal_xtp: nominal XTP value
72 * max_xtp : never deliver interrupts to this CPU.
78 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
79 writeb(0x00, ipi_base_addr | XTP_OFFSET); /* XTP to min */
85 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
86 writeb(0x08, ipi_base_addr | XTP_OFFSET); /* XTP normal */
92 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
93 writeb(0x0f, ipi_base_addr | XTP_OFFSET); /* Set XTP to max */
96 static inline unsigned int
97 hard_smp_processor_id (void)
101 unsigned long reserved : 16;
102 unsigned long eid : 8;
103 unsigned long id : 8;
104 unsigned long ignored : 32;
109 lid.bits = ia64_getreg(_IA64_REG_CR_LID);
110 return lid.f.id << 8 | lid.f.eid;
113 /* Upping and downing of CPUs */
114 extern int __cpu_disable (void);
115 extern void __cpu_die (unsigned int cpu);
116 extern int __cpu_up (unsigned int cpu);
117 extern void __init smp_build_cpu_map(void);
119 extern void __init init_smp_config (void);
120 extern void smp_do_timer (struct pt_regs *regs);
122 extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
123 int retry, int wait);
124 extern void smp_send_reschedule (int cpu);
126 #endif /* CONFIG_SMP */
127 #endif /* _ASM_IA64_SMP_H */