Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
smp.h
Go to the documentation of this file.
1 /*
2  * SMP Support
3  *
4  * Copyright (C) 1999 VA Linux Systems
5  * Copyright (C) 1999 Walt Drummond <[email protected]>
6  * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P.
7  * David Mosberger-Tang <[email protected]>
8  * Bjorn Helgaas <[email protected]>
9  */
10 #ifndef _ASM_IA64_SMP_H
11 #define _ASM_IA64_SMP_H
12 
13 #include <linux/init.h>
14 #include <linux/threads.h>
15 #include <linux/kernel.h>
16 #include <linux/cpumask.h>
17 #include <linux/bitops.h>
18 #include <linux/irqreturn.h>
19 
20 #include <asm/io.h>
21 #include <asm/param.h>
22 #include <asm/processor.h>
23 #include <asm/ptrace.h>
24 
25 static inline unsigned int
26 ia64_get_lid (void)
27 {
28  union {
29  struct {
30  unsigned long reserved : 16;
31  unsigned long eid : 8;
32  unsigned long id : 8;
33  unsigned long ignored : 32;
34  } f;
35  unsigned long bits;
36  } lid;
37 
39  return lid.f.id << 8 | lid.f.eid;
40 }
41 
42 #define hard_smp_processor_id() ia64_get_lid()
43 
44 #ifdef CONFIG_SMP
45 
46 #define XTP_OFFSET 0x1e0008
47 
48 #define SMP_IRQ_REDIRECTION (1 << 0)
49 #define SMP_IPI_REDIRECTION (1 << 1)
50 
51 #define raw_smp_processor_id() (current_thread_info()->cpu)
52 
53 extern struct smp_boot_data {
54  int cpu_count;
55  int cpu_phys_id[NR_CPUS];
56 } smp_boot_data __initdata;
57 
58 extern char no_int_routing __devinitdata;
59 
62 extern int smp_num_siblings;
63 extern void __iomem *ipi_base_addr;
64 extern unsigned char smp_int_redirect;
65 
66 extern volatile int ia64_cpu_to_sapicid[];
67 #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
68 
69 extern unsigned long ap_wakeup_vector;
70 
71 /*
72  * Function to map hard smp processor id to logical id. Slow, so don't use this in
73  * performance-critical code.
74  */
75 static inline int
77 {
78  int i;
79 
80  for (i = 0; i < NR_CPUS; ++i)
81  if (cpu_physical_id(i) == cpuid)
82  break;
83  return i;
84 }
85 
86 /*
87  * XTP control functions:
88  * min_xtp : route all interrupts to this CPU
89  * normal_xtp: nominal XTP value
90  * max_xtp : never deliver interrupts to this CPU.
91  */
92 
93 static inline void
94 min_xtp (void)
95 {
96  if (smp_int_redirect & SMP_IRQ_REDIRECTION)
97  writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
98 }
99 
100 static inline void
101 normal_xtp (void)
102 {
103  if (smp_int_redirect & SMP_IRQ_REDIRECTION)
104  writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
105 }
106 
107 static inline void
108 max_xtp (void)
109 {
110  if (smp_int_redirect & SMP_IRQ_REDIRECTION)
111  writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
112 }
113 
114 /* Upping and downing of CPUs */
115 extern int __cpu_disable (void);
116 extern void __cpu_die (unsigned int cpu);
117 extern void cpu_die (void) __attribute__ ((noreturn));
118 extern void __init smp_build_cpu_map(void);
119 
120 extern void __init init_smp_config (void);
121 extern void smp_do_timer (struct pt_regs *regs);
122 
123 extern irqreturn_t handle_IPI(int irq, void *dev_id);
124 extern void smp_send_reschedule (int cpu);
125 extern void identify_siblings (struct cpuinfo_ia64 *);
126 extern int is_multithreading_enabled(void);
127 
128 extern void arch_send_call_function_single_ipi(int cpu);
130 
131 #else /* CONFIG_SMP */
132 
133 #define cpu_logical_id(i) 0
134 #define cpu_physical_id(i) ia64_get_lid()
135 
136 #endif /* CONFIG_SMP */
137 #endif /* _ASM_IA64_SMP_H */