aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mach-generic
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-28 12:47:24 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-28 17:20:37 -0500
commit5a44632f77a9c867621f7bf80c233eac75fea672 (patch)
tree48a89d50ab1e4d8f46c663631efdb0913c5c1f58 /arch/x86/mach-generic
parent328386d7ab600aa0993a1226f5817ac30a735724 (diff)
x86, numaq: consolidate code
Move all the NUMAQ subarch definitions into numaq.c. With this it ceases to depend on build-time subarch features. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mach-generic')
-rw-r--r--arch/x86/mach-generic/numaq.c171
1 files changed, 166 insertions, 5 deletions
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c
index ddb50fba2868..c221cfb2c2db 100644
--- a/arch/x86/mach-generic/numaq.c
+++ b/arch/x86/mach-generic/numaq.c
@@ -11,14 +11,175 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/numaq/apicdef.h> 14#include <linux/numa.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <asm/numaq/apic.h>
17#include <asm/numaq/ipi.h>
18#include <asm/numaq/mpparse.h>
19#include <asm/numaq/wakecpu.h>
20#include <asm/numaq.h> 16#include <asm/numaq.h>
17#include <asm/io.h>
18#include <linux/mmzone.h>
19#include <linux/nodemask.h>
21 20
21#define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER)
22
23static inline unsigned int numaq_get_apic_id(unsigned long x)
24{
25 return (x >> 24) & 0x0F;
26}
27
28void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector);
29void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
30
31static inline void numaq_send_IPI_mask(const struct cpumask *mask, int vector)
32{
33 default_send_IPI_mask_sequence(mask, vector);
34}
35
36static inline void numaq_send_IPI_allbutself(int vector)
37{
38 default_send_IPI_mask_allbutself(cpu_online_mask, vector);
39}
40
41static inline void numaq_send_IPI_all(int vector)
42{
43 numaq_send_IPI_mask(cpu_online_mask, vector);
44}
45
46extern void numaq_mps_oem_check(struct mpc_table *, char *, char *);
47
48#define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8)
49#define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa)
50
51/*
52 * Because we use NMIs rather than the INIT-STARTUP sequence to
53 * bootstrap the CPUs, the APIC may be in a weird state. Kick it:
54 */
55static inline void numaq_smp_callin_clear_local_apic(void)
56{
57 clear_local_APIC();
58}
59
60static inline void
61numaq_store_NMI_vector(unsigned short *high, unsigned short *low)
62{
63 printk("Storing NMI vector\n");
64 *high =
65 *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH));
66 *low =
67 *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW));
68}
69
70static inline const cpumask_t *numaq_target_cpus(void)
71{
72 return &CPU_MASK_ALL;
73}
74
75static inline unsigned long
76numaq_check_apicid_used(physid_mask_t bitmap, int apicid)
77{
78 return physid_isset(apicid, bitmap);
79}
80
81static inline unsigned long numaq_check_apicid_present(int bit)
82{
83 return physid_isset(bit, phys_cpu_present_map);
84}
85
86#define apicid_cluster(apicid) (apicid & 0xF0)
87
88static inline int numaq_apic_id_registered(void)
89{
90 return 1;
91}
92
93static inline void numaq_init_apic_ldr(void)
94{
95 /* Already done in NUMA-Q firmware */
96}
97
98static inline void numaq_setup_apic_routing(void)
99{
100 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
101 "NUMA-Q", nr_ioapics);
102}
103
104/*
105 * Skip adding the timer int on secondary nodes, which causes
106 * a small but painful rift in the time-space continuum.
107 */
108static inline int numaq_multi_timer_check(int apic, int irq)
109{
110 return apic != 0 && irq == 0;
111}
112
113static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map)
114{
115 /* We don't have a good way to do this yet - hack */
116 return physids_promote(0xFUL);
117}
118
119/* Mapping from cpu number to logical apicid */
120extern u8 cpu_2_logical_apicid[];
121
122static inline int numaq_cpu_to_logical_apicid(int cpu)
123{
124 if (cpu >= nr_cpu_ids)
125 return BAD_APICID;
126 return (int)cpu_2_logical_apicid[cpu];
127}
128
129/*
130 * Supporting over 60 cpus on NUMA-Q requires a locality-dependent
131 * cpu to APIC ID relation to properly interact with the intelligent
132 * mode of the cluster controller.
133 */
134static inline int numaq_cpu_present_to_apicid(int mps_cpu)
135{
136 if (mps_cpu < 60)
137 return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
138 else
139 return BAD_APICID;
140}
141
142static inline int numaq_apicid_to_node(int logical_apicid)
143{
144 return logical_apicid >> 4;
145}
146
147static inline physid_mask_t numaq_apicid_to_cpu_present(int logical_apicid)
148{
149 int node = numaq_apicid_to_node(logical_apicid);
150 int cpu = __ffs(logical_apicid & 0xf);
151
152 return physid_mask_of_physid(cpu + 4*node);
153}
154
155extern void *xquad_portio;
156
157static inline int numaq_check_phys_apicid_present(int boot_cpu_physical_apicid)
158{
159 return 1;
160}
161
162/*
163 * We use physical apicids here, not logical, so just return the default
164 * physical broadcast to stop people from breaking us
165 */
166static inline unsigned int numaq_cpu_mask_to_apicid(const cpumask_t *cpumask)
167{
168 return 0x0F;
169}
170
171static inline unsigned int
172numaq_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
173 const struct cpumask *andmask)
174{
175 return 0x0F;
176}
177
178/* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
179static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb)
180{
181 return cpuid_apic >> index_msb;
182}
22static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) 183static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
23{ 184{
24 numaq_mps_oem_check(mpc, oem, productid); 185 numaq_mps_oem_check(mpc, oem, productid);