4 * Copyright (C) 1999 VA Linux Systems
5 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
6 * Copyright (C) 2001 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>
21 #include <asm/param.h>
22 #include <asm/processor.h>
23 #include <asm/ptrace.h>
25 #define XTP_OFFSET 0x1e0008
27 #define SMP_IRQ_REDIRECTION (1 << 0)
28 #define SMP_IPI_REDIRECTION (1 << 1)
30 #define smp_processor_id() (current->processor)
32 extern struct smp_boot_data {
34 int cpu_phys_id[NR_CPUS];
35 } smp_boot_data __initdata;
37 extern char no_int_routing __initdata;
39 extern volatile unsigned long cpu_online_map;
40 extern unsigned long ipi_base_addr;
41 extern unsigned char smp_int_redirect;
42 extern int smp_num_cpus;
44 extern volatile int ia64_cpu_to_sapicid[];
45 #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
46 #define cpu_number_map(i) (i)
47 #define cpu_logical_map(i) (i)
49 extern unsigned long ap_wakeup_vector;
52 * Function to map hard smp processor id to logical id. Slow, so
53 * don't use this in performance-critical code.
56 cpu_logical_id (int cpuid)
60 for (i = 0; i < smp_num_cpus; ++i)
61 if (cpu_physical_id(i) == (__u32) cpuid)
67 * XTP control functions:
68 * min_xtp : route all interrupts to this CPU
69 * normal_xtp: nominal XTP value
70 * max_xtp : never deliver interrupts to this CPU.
76 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
77 writeb(0x00, ipi_base_addr | XTP_OFFSET); /* XTP to min */
83 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
84 writeb(0x08, ipi_base_addr | XTP_OFFSET); /* XTP normal */
90 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
91 writeb(0x0f, ipi_base_addr | XTP_OFFSET); /* Set XTP to max */
94 static inline unsigned int
95 hard_smp_processor_id (void)
99 unsigned long reserved : 16;
100 unsigned long eid : 8;
101 unsigned long id : 8;
102 unsigned long ignored : 32;
107 lid.bits = ia64_get_lid();
108 return lid.f.id << 8 | lid.f.eid;
111 #define NO_PROC_ID 0xffffffff /* no processor magic marker */
114 * Extra overhead to move a task from one cpu to another (due to TLB and cache misses).
115 * Expressed in "negative nice value" units (larger number means higher priority/penalty).
117 #define PROC_CHANGE_PENALTY 20
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);
126 #endif /* CONFIG_SMP */
127 #endif /* _ASM_IA64_SMP_H */