aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/mpparse_32.c
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2008-03-27 16:54:13 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:31 -0400
commitc853c67690448415af2d204062028d1456f524de (patch)
tree81a17ede04ea543a3458e05ff1b5be0ed06317ba /arch/x86/kernel/mpparse_32.c
parent987dd2d4d465e80e00d6a0b16787a78aa75dd66a (diff)
x86: separate generic_processor_info into its own function
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/mpparse_32.c')
-rw-r--r--arch/x86/kernel/mpparse_32.c158
1 files changed, 82 insertions, 76 deletions
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index c487bc99d7a3..b0aed978eef1 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -109,12 +109,91 @@ static int mpc_record;
109static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __cpuinitdata; 109static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __cpuinitdata;
110#endif 110#endif
111 111
112static void __cpuinit MP_processor_info (struct mpc_config_processor *m) 112static void __cpuinit generic_processor_info(int apicid, int version)
113{ 113{
114 int ver, apicid, cpu; 114 int cpu;
115 cpumask_t tmp_map; 115 cpumask_t tmp_map;
116 physid_mask_t phys_cpu; 116 physid_mask_t phys_cpu;
117 117
118
119 /*
120 * Validate version
121 */
122 if (version == 0x0) {
123 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
124 "fixing up to 0x10. (tell your hw vendor)\n",
125 version);
126 version = 0x10;
127 }
128 apic_version[apicid] = version;
129
130 phys_cpu = apicid_to_cpu_present(apicid);
131 physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
132
133 if (num_processors >= NR_CPUS) {
134 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
135 " Processor ignored.\n", NR_CPUS);
136 return;
137 }
138
139 if (num_processors >= maxcpus) {
140 printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
141 " Processor ignored.\n", maxcpus);
142 return;
143 }
144
145 num_processors++;
146 cpus_complement(tmp_map, cpu_present_map);
147 cpu = first_cpu(tmp_map);
148
149 if (apicid == boot_cpu_physical_apicid)
150 /*
151 * x86_bios_cpu_apicid is required to have processors listed
152 * in same order as logical cpu numbers. Hence the first
153 * entry is BSP, and so on.
154 */
155 cpu = 0;
156
157 /*
158 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
159 * but we need to work other dependencies like SMP_SUSPEND etc
160 * before this can be done without some confusion.
161 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
162 * - Ashok Raj <ashok.raj@intel.com>
163 */
164 if (num_processors > 8) {
165 switch (boot_cpu_data.x86_vendor) {
166 case X86_VENDOR_INTEL:
167 if (!APIC_XAPIC(version)) {
168 def_to_bigsmp = 0;
169 break;
170 }
171 /* If P4 and above fall through */
172 case X86_VENDOR_AMD:
173 def_to_bigsmp = 1;
174 }
175 }
176#ifdef CONFIG_SMP
177 /* are we being called early in kernel startup? */
178 if (x86_cpu_to_apicid_early_ptr) {
179 u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr;
180 u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
181
182 cpu_to_apicid[cpu] = apicid;
183 bios_cpu_apicid[cpu] = apicid;
184 } else {
185 per_cpu(x86_cpu_to_apicid, cpu) = apicid;
186 per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
187 }
188#endif
189 cpu_set(cpu, cpu_possible_map);
190 cpu_set(cpu, cpu_present_map);
191}
192
193static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
194{
195 int apicid;
196
118 if (!(m->mpc_cpuflag & CPU_ENABLED)) { 197 if (!(m->mpc_cpuflag & CPU_ENABLED)) {
119 disabled_cpus++; 198 disabled_cpus++;
120 return; 199 return;
@@ -184,80 +263,7 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
184 boot_cpu_physical_apicid = m->mpc_apicid; 263 boot_cpu_physical_apicid = m->mpc_apicid;
185 } 264 }
186 265
187 ver = m->mpc_apicver; 266 generic_processor_info(apicid, m->mpc_apicver);
188
189 /*
190 * Validate version
191 */
192 if (ver == 0x0) {
193 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
194 "fixing up to 0x10. (tell your hw vendor)\n",
195 m->mpc_apicid);
196 ver = 0x10;
197 }
198 apic_version[m->mpc_apicid] = ver;
199
200 phys_cpu = apicid_to_cpu_present(apicid);
201 physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
202
203 if (num_processors >= NR_CPUS) {
204 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
205 " Processor ignored.\n", NR_CPUS);
206 return;
207 }
208
209 if (num_processors >= maxcpus) {
210 printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
211 " Processor ignored.\n", maxcpus);
212 return;
213 }
214
215 num_processors++;
216 cpus_complement(tmp_map, cpu_present_map);
217 cpu = first_cpu(tmp_map);
218
219 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
220 /*
221 * x86_bios_cpu_apicid is required to have processors listed
222 * in same order as logical cpu numbers. Hence the first
223 * entry is BSP, and so on.
224 */
225 cpu = 0;
226
227 /*
228 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
229 * but we need to work other dependencies like SMP_SUSPEND etc
230 * before this can be done without some confusion.
231 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
232 * - Ashok Raj <ashok.raj@intel.com>
233 */
234 if (num_processors > 8) {
235 switch (boot_cpu_data.x86_vendor) {
236 case X86_VENDOR_INTEL:
237 if (!APIC_XAPIC(ver)) {
238 def_to_bigsmp = 0;
239 break;
240 }
241 /* If P4 and above fall through */
242 case X86_VENDOR_AMD:
243 def_to_bigsmp = 1;
244 }
245 }
246#ifdef CONFIG_SMP
247 /* are we being called early in kernel startup? */
248 if (x86_cpu_to_apicid_early_ptr) {
249 u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr;
250 u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
251
252 cpu_to_apicid[cpu] = m->mpc_apicid;
253 bios_cpu_apicid[cpu] = m->mpc_apicid;
254 } else {
255 per_cpu(x86_cpu_to_apicid, cpu) = m->mpc_apicid;
256 per_cpu(x86_bios_cpu_apicid, cpu) = m->mpc_apicid;
257 }
258#endif
259 cpu_set(cpu, cpu_possible_map);
260 cpu_set(cpu, cpu_present_map);
261} 267}
262 268
263static void __init MP_bus_info (struct mpc_config_bus *m) 269static void __init MP_bus_info (struct mpc_config_bus *m)