RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / asm-ia64 / smp.h
blobc60024989ebd59b70bd090d01cc0ada6a95ad9d4
1 /*
2 * SMP Support
4 * Copyright (C) 1999 VA Linux Systems
5 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
6 * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P.
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * Bjorn Helgaas <bjorn.helgaas@hp.com>
9 */
10 #ifndef _ASM_IA64_SMP_H
11 #define _ASM_IA64_SMP_H
13 #include <linux/init.h>
14 #include <linux/threads.h>
15 #include <linux/kernel.h>
16 #include <linux/cpumask.h>
18 #include <asm/bitops.h>
19 #include <asm/io.h>
20 #include <asm/param.h>
21 #include <asm/processor.h>
22 #include <asm/ptrace.h>
24 static inline unsigned int
25 ia64_get_lid (void)
27 union {
28 struct {
29 unsigned long reserved : 16;
30 unsigned long eid : 8;
31 unsigned long id : 8;
32 unsigned long ignored : 32;
33 } f;
34 unsigned long bits;
35 } lid;
37 lid.bits = ia64_getreg(_IA64_REG_CR_LID);
38 return lid.f.id << 8 | lid.f.eid;
41 #define hard_smp_processor_id() ia64_get_lid()
43 #ifdef CONFIG_SMP
45 #define XTP_OFFSET 0x1e0008
47 #define SMP_IRQ_REDIRECTION (1 << 0)
48 #define SMP_IPI_REDIRECTION (1 << 1)
50 #define raw_smp_processor_id() (current_thread_info()->cpu)
52 extern struct smp_boot_data {
53 int cpu_count;
54 int cpu_phys_id[NR_CPUS];
55 } smp_boot_data __initdata;
57 extern char no_int_routing __devinitdata;
59 extern cpumask_t cpu_online_map;
60 extern cpumask_t cpu_core_map[NR_CPUS];
61 extern cpumask_t cpu_sibling_map[NR_CPUS];
62 extern int smp_num_siblings;
63 extern int smp_num_cpucores;
64 extern void __iomem *ipi_base_addr;
65 extern unsigned char smp_int_redirect;
67 extern volatile int ia64_cpu_to_sapicid[];
68 #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
70 extern unsigned long ap_wakeup_vector;
73 * Function to map hard smp processor id to logical id. Slow, so don't use this in
74 * performance-critical code.
76 static inline int
77 cpu_logical_id (int cpuid)
79 int i;
81 for (i = 0; i < NR_CPUS; ++i)
82 if (cpu_physical_id(i) == cpuid)
83 break;
84 return i;
88 * XTP control functions:
89 * min_xtp : route all interrupts to this CPU
90 * normal_xtp: nominal XTP value
91 * max_xtp : never deliver interrupts to this CPU.
94 static inline void
95 min_xtp (void)
97 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
98 writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
101 static inline void
102 normal_xtp (void)
104 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
105 writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
108 static inline void
109 max_xtp (void)
111 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
112 writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
115 /* Upping and downing of CPUs */
116 extern int __cpu_disable (void);
117 extern void __cpu_die (unsigned int cpu);
118 extern void cpu_die (void) __attribute__ ((noreturn));
119 extern int __cpu_up (unsigned int cpu);
120 extern void __init smp_build_cpu_map(void);
122 extern void __init init_smp_config (void);
123 extern void smp_do_timer (struct pt_regs *regs);
125 extern void smp_send_reschedule (int cpu);
126 extern void lock_ipi_calllock(void);
127 extern void unlock_ipi_calllock(void);
128 extern void identify_siblings (struct cpuinfo_ia64 *);
129 extern int is_multithreading_enabled(void);
131 #else /* CONFIG_SMP */
133 #define cpu_logical_id(i) 0
134 #define cpu_physical_id(i) ia64_get_lid()
136 #endif /* CONFIG_SMP */
137 #endif /* _ASM_IA64_SMP_H */