aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/setup.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 04:52:32 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:32 -0400
commit2c8c0e6b8d7700a990da8d24eff767f9ca223b96 (patch)
treeb5477ee2558efff235c483d1619ce892db479d18 /arch/x86_64/kernel/setup.c
parent1a3f239ddf9208f2e52d36fef1c1c4518cbbbabe (diff)
[PATCH] Convert x86-64 to early param
Instead of hackish manual parsing Requires earlier i386 patchkit, but also fixes i386 early_printk again. I removed some obsolete really early parameters which didn't do anything useful. Also made a few parameters that needed it early (mostly oops printing setup) Also removed one panic check that wasn't visible without early console anyways (the early console is now initialized after that panic) This cleans up a lot of code. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/kernel/setup.c')
-rw-r--r--arch/x86_64/kernel/setup.c197
1 files changed, 18 insertions, 179 deletions
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 73f1cdd140fe..f55540a6084e 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -76,11 +76,6 @@ unsigned long mmu_cr4_features;
76 76
77int acpi_disabled; 77int acpi_disabled;
78EXPORT_SYMBOL(acpi_disabled); 78EXPORT_SYMBOL(acpi_disabled);
79#ifdef CONFIG_ACPI
80extern int __initdata acpi_ht;
81extern acpi_interrupt_flags acpi_sci_flags;
82int __initdata acpi_force = 0;
83#endif
84 79
85int acpi_numa __initdata; 80int acpi_numa __initdata;
86 81
@@ -276,183 +271,22 @@ static void __init probe_roms(void)
276 } 271 }
277} 272}
278 273
279/* Check for full argument with no trailing characters */ 274#ifdef CONFIG_PROC_VMCORE
280static int fullarg(char *p, char *arg) 275/* elfcorehdr= specifies the location of elf core header
276 * stored by the crashed kernel. This option will be passed
277 * by kexec loader to the capture kernel.
278 */
279static int __init setup_elfcorehdr(char *arg)
281{ 280{
282 int l = strlen(arg); 281 char *end;
283 return !memcmp(p, arg, l) && (p[l] == 0 || isspace(p[l])); 282 if (!arg)
283 return -EINVAL;
284 elfcorehdr_addr = memparse(arg, &end);
285 return end > arg ? 0 : -EINVAL;
284} 286}
285 287early_param("elfcorehdr", setup_elfcorehdr);
286static __init void parse_cmdline_early (char ** cmdline_p)
287{
288 char c = ' ', *to = command_line, *from = COMMAND_LINE;
289 int len = 0;
290 int userdef = 0;
291
292 for (;;) {
293 if (c != ' ')
294 goto next_char;
295
296#ifdef CONFIG_SMP
297 /*
298 * If the BIOS enumerates physical processors before logical,
299 * maxcpus=N at enumeration-time can be used to disable HT.
300 */
301 else if (!memcmp(from, "maxcpus=", 8)) {
302 extern unsigned int maxcpus;
303
304 maxcpus = simple_strtoul(from + 8, NULL, 0);
305 }
306#endif
307#ifdef CONFIG_ACPI
308 /* "acpi=off" disables both ACPI table parsing and interpreter init */
309 if (fullarg(from,"acpi=off"))
310 disable_acpi();
311
312 if (fullarg(from, "acpi=force")) {
313 /* add later when we do DMI horrors: */
314 acpi_force = 1;
315 acpi_disabled = 0;
316 }
317
318 /* acpi=ht just means: do ACPI MADT parsing
319 at bootup, but don't enable the full ACPI interpreter */
320 if (fullarg(from, "acpi=ht")) {
321 if (!acpi_force)
322 disable_acpi();
323 acpi_ht = 1;
324 }
325 else if (fullarg(from, "pci=noacpi"))
326 acpi_disable_pci();
327 else if (fullarg(from, "acpi=noirq"))
328 acpi_noirq_set();
329
330 else if (fullarg(from, "acpi_sci=edge"))
331 acpi_sci_flags.trigger = 1;
332 else if (fullarg(from, "acpi_sci=level"))
333 acpi_sci_flags.trigger = 3;
334 else if (fullarg(from, "acpi_sci=high"))
335 acpi_sci_flags.polarity = 1;
336 else if (fullarg(from, "acpi_sci=low"))
337 acpi_sci_flags.polarity = 3;
338
339 /* acpi=strict disables out-of-spec workarounds */
340 else if (fullarg(from, "acpi=strict")) {
341 acpi_strict = 1;
342 }
343 else if (fullarg(from, "acpi_skip_timer_override"))
344 acpi_skip_timer_override = 1;
345#endif 288#endif
346 289
347 if (fullarg(from, "disable_timer_pin_1"))
348 disable_timer_pin_1 = 1;
349 if (fullarg(from, "enable_timer_pin_1"))
350 disable_timer_pin_1 = -1;
351
352 if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) {
353 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
354 disable_apic = 1;
355 }
356
357 if (fullarg(from, "noapic"))
358 skip_ioapic_setup = 1;
359
360 if (fullarg(from,"apic")) {
361 skip_ioapic_setup = 0;
362 ioapic_force = 1;
363 }
364
365 if (!memcmp(from, "mem=", 4))
366 parse_memopt(from+4, &from);
367
368 if (!memcmp(from, "memmap=", 7)) {
369 /* exactmap option is for used defined memory */
370 if (!memcmp(from+7, "exactmap", 8)) {
371#ifdef CONFIG_CRASH_DUMP
372 /* If we are doing a crash dump, we
373 * still need to know the real mem
374 * size before original memory map is
375 * reset.
376 */
377 saved_max_pfn = e820_end_of_ram();
378#endif
379 from += 8+7;
380 end_pfn_map = 0;
381 e820.nr_map = 0;
382 userdef = 1;
383 }
384 else {
385 parse_memmapopt(from+7, &from);
386 userdef = 1;
387 }
388 }
389
390#ifdef CONFIG_NUMA
391 if (!memcmp(from, "numa=", 5))
392 numa_setup(from+5);
393#endif
394
395 if (!memcmp(from,"iommu=",6)) {
396 iommu_setup(from+6);
397 }
398
399 if (fullarg(from,"oops=panic"))
400 panic_on_oops = 1;
401
402 if (!memcmp(from, "noexec=", 7))
403 nonx_setup(from + 7);
404
405#ifdef CONFIG_KEXEC
406 /* crashkernel=size@addr specifies the location to reserve for
407 * a crash kernel. By reserving this memory we guarantee
408 * that linux never set's it up as a DMA target.
409 * Useful for holding code to do something appropriate
410 * after a kernel panic.
411 */
412 else if (!memcmp(from, "crashkernel=", 12)) {
413 unsigned long size, base;
414 size = memparse(from+12, &from);
415 if (*from == '@') {
416 base = memparse(from+1, &from);
417 /* FIXME: Do I want a sanity check
418 * to validate the memory range?
419 */
420 crashk_res.start = base;
421 crashk_res.end = base + size - 1;
422 }
423 }
424#endif
425
426#ifdef CONFIG_PROC_VMCORE
427 /* elfcorehdr= specifies the location of elf core header
428 * stored by the crashed kernel. This option will be passed
429 * by kexec loader to the capture kernel.
430 */
431 else if(!memcmp(from, "elfcorehdr=", 11))
432 elfcorehdr_addr = memparse(from+11, &from);
433#endif
434
435#ifdef CONFIG_HOTPLUG_CPU
436 else if (!memcmp(from, "additional_cpus=", 16))
437 setup_additional_cpus(from+16);
438#endif
439
440 next_char:
441 c = *(from++);
442 if (!c)
443 break;
444 if (COMMAND_LINE_SIZE <= ++len)
445 break;
446 *(to++) = c;
447 }
448 if (userdef) {
449 printk(KERN_INFO "user-defined physical RAM map:\n");
450 e820_print_map("user");
451 }
452 *to = '\0';
453 *cmdline_p = command_line;
454}
455
456#ifndef CONFIG_NUMA 290#ifndef CONFIG_NUMA
457static void __init 291static void __init
458contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn) 292contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
@@ -547,7 +381,12 @@ void __init setup_arch(char **cmdline_p)
547 381
548 early_identify_cpu(&boot_cpu_data); 382 early_identify_cpu(&boot_cpu_data);
549 383
550 parse_cmdline_early(cmdline_p); 384 strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
385 *cmdline_p = command_line;
386
387 parse_early_param();
388
389 finish_e820_parsing();
551 390
552 /* 391 /*
553 * partially used pages are not usable - thus 392 * partially used pages are not usable - thus