aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/kernel/setup.c')
-rw-r--r--arch/x86_64/kernel/setup.c241
1 files changed, 42 insertions, 199 deletions
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 4b39f0da17f3..f98e48cae6da 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -74,16 +74,6 @@ EXPORT_SYMBOL(boot_cpu_data);
74 74
75unsigned long mmu_cr4_features; 75unsigned long mmu_cr4_features;
76 76
77int 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
85int acpi_numa __initdata;
86
87/* Boot loader ID as an integer, for the benefit of proc_dointvec */ 77/* Boot loader ID as an integer, for the benefit of proc_dointvec */
88int bootloader_type; 78int bootloader_type;
89 79
@@ -107,7 +97,6 @@ struct sys_desc_table_struct {
107 97
108struct edid_info edid_info; 98struct edid_info edid_info;
109EXPORT_SYMBOL_GPL(edid_info); 99EXPORT_SYMBOL_GPL(edid_info);
110struct e820map e820;
111 100
112extern int root_mountflags; 101extern int root_mountflags;
113 102
@@ -276,185 +265,22 @@ static void __init probe_roms(void)
276 } 265 }
277} 266}
278 267
279/* Check for full argument with no trailing characters */ 268#ifdef CONFIG_PROC_VMCORE
280static int fullarg(char *p, char *arg) 269/* elfcorehdr= specifies the location of elf core header
270 * stored by the crashed kernel. This option will be passed
271 * by kexec loader to the capture kernel.
272 */
273static int __init setup_elfcorehdr(char *arg)
281{ 274{
282 int l = strlen(arg); 275 char *end;
283 return !memcmp(p, arg, l) && (p[l] == 0 || isspace(p[l])); 276 if (!arg)
277 return -EINVAL;
278 elfcorehdr_addr = memparse(arg, &end);
279 return end > arg ? 0 : -EINVAL;
284} 280}
285 281early_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#ifdef CONFIG_X86_IO_APIC
344 else if (fullarg(from, "acpi_skip_timer_override"))
345 acpi_skip_timer_override = 1;
346#endif
347#endif
348
349 if (fullarg(from, "disable_timer_pin_1"))
350 disable_timer_pin_1 = 1;
351 if (fullarg(from, "enable_timer_pin_1"))
352 disable_timer_pin_1 = -1;
353
354 if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) {
355 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
356 disable_apic = 1;
357 }
358
359 if (fullarg(from, "noapic"))
360 skip_ioapic_setup = 1;
361
362 if (fullarg(from,"apic")) {
363 skip_ioapic_setup = 0;
364 ioapic_force = 1;
365 }
366
367 if (!memcmp(from, "mem=", 4))
368 parse_memopt(from+4, &from);
369
370 if (!memcmp(from, "memmap=", 7)) {
371 /* exactmap option is for used defined memory */
372 if (!memcmp(from+7, "exactmap", 8)) {
373#ifdef CONFIG_CRASH_DUMP
374 /* If we are doing a crash dump, we
375 * still need to know the real mem
376 * size before original memory map is
377 * reset.
378 */
379 saved_max_pfn = e820_end_of_ram();
380#endif
381 from += 8+7;
382 end_pfn_map = 0;
383 e820.nr_map = 0;
384 userdef = 1;
385 }
386 else {
387 parse_memmapopt(from+7, &from);
388 userdef = 1;
389 }
390 }
391
392#ifdef CONFIG_NUMA
393 if (!memcmp(from, "numa=", 5))
394 numa_setup(from+5);
395#endif
396
397 if (!memcmp(from,"iommu=",6)) {
398 iommu_setup(from+6);
399 }
400
401 if (fullarg(from,"oops=panic"))
402 panic_on_oops = 1;
403
404 if (!memcmp(from, "noexec=", 7))
405 nonx_setup(from + 7);
406
407#ifdef CONFIG_KEXEC
408 /* crashkernel=size@addr specifies the location to reserve for
409 * a crash kernel. By reserving this memory we guarantee
410 * that linux never set's it up as a DMA target.
411 * Useful for holding code to do something appropriate
412 * after a kernel panic.
413 */
414 else if (!memcmp(from, "crashkernel=", 12)) {
415 unsigned long size, base;
416 size = memparse(from+12, &from);
417 if (*from == '@') {
418 base = memparse(from+1, &from);
419 /* FIXME: Do I want a sanity check
420 * to validate the memory range?
421 */
422 crashk_res.start = base;
423 crashk_res.end = base + size - 1;
424 }
425 }
426#endif
427
428#ifdef CONFIG_PROC_VMCORE
429 /* elfcorehdr= specifies the location of elf core header
430 * stored by the crashed kernel. This option will be passed
431 * by kexec loader to the capture kernel.
432 */
433 else if(!memcmp(from, "elfcorehdr=", 11))
434 elfcorehdr_addr = memparse(from+11, &from);
435#endif
436
437#ifdef CONFIG_HOTPLUG_CPU
438 else if (!memcmp(from, "additional_cpus=", 16))
439 setup_additional_cpus(from+16);
440#endif 282#endif
441 283
442 next_char:
443 c = *(from++);
444 if (!c)
445 break;
446 if (COMMAND_LINE_SIZE <= ++len)
447 break;
448 *(to++) = c;
449 }
450 if (userdef) {
451 printk(KERN_INFO "user-defined physical RAM map:\n");
452 e820_print_map("user");
453 }
454 *to = '\0';
455 *cmdline_p = command_line;
456}
457
458#ifndef CONFIG_NUMA 284#ifndef CONFIG_NUMA
459static void __init 285static void __init
460contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn) 286contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
@@ -521,6 +347,8 @@ static void discover_ebda(void)
521 347
522void __init setup_arch(char **cmdline_p) 348void __init setup_arch(char **cmdline_p)
523{ 349{
350 printk(KERN_INFO "Command line: %s\n", saved_command_line);
351
524 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 352 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
525 screen_info = SCREEN_INFO; 353 screen_info = SCREEN_INFO;
526 edid_info = EDID_INFO; 354 edid_info = EDID_INFO;
@@ -547,16 +375,21 @@ void __init setup_arch(char **cmdline_p)
547 data_resource.start = virt_to_phys(&_etext); 375 data_resource.start = virt_to_phys(&_etext);
548 data_resource.end = virt_to_phys(&_edata)-1; 376 data_resource.end = virt_to_phys(&_edata)-1;
549 377
550 parse_cmdline_early(cmdline_p);
551
552 early_identify_cpu(&boot_cpu_data); 378 early_identify_cpu(&boot_cpu_data);
553 379
380 strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
381 *cmdline_p = command_line;
382
383 parse_early_param();
384
385 finish_e820_parsing();
386
554 /* 387 /*
555 * partially used pages are not usable - thus 388 * partially used pages are not usable - thus
556 * we are rounding upwards: 389 * we are rounding upwards:
557 */ 390 */
558 end_pfn = e820_end_of_ram(); 391 end_pfn = e820_end_of_ram();
559 num_physpages = end_pfn; /* for pfn_valid */ 392 num_physpages = end_pfn;
560 393
561 check_efer(); 394 check_efer();
562 395
@@ -576,6 +409,11 @@ void __init setup_arch(char **cmdline_p)
576 acpi_boot_table_init(); 409 acpi_boot_table_init();
577#endif 410#endif
578 411
412 /* How many end-of-memory variables you have, grandma! */
413 max_low_pfn = end_pfn;
414 max_pfn = end_pfn;
415 high_memory = (void *)__va(end_pfn * PAGE_SIZE - 1) + 1;
416
579#ifdef CONFIG_ACPI_NUMA 417#ifdef CONFIG_ACPI_NUMA
580 /* 418 /*
581 * Parse SRAT to discover nodes. 419 * Parse SRAT to discover nodes.
@@ -625,12 +463,10 @@ void __init setup_arch(char **cmdline_p)
625 */ 463 */
626 acpi_reserve_bootmem(); 464 acpi_reserve_bootmem();
627#endif 465#endif
628#ifdef CONFIG_X86_LOCAL_APIC
629 /* 466 /*
630 * Find and reserve possible boot-time SMP configuration: 467 * Find and reserve possible boot-time SMP configuration:
631 */ 468 */
632 find_smp_config(); 469 find_smp_config();
633#endif
634#ifdef CONFIG_BLK_DEV_INITRD 470#ifdef CONFIG_BLK_DEV_INITRD
635 if (LOADER_TYPE && INITRD_START) { 471 if (LOADER_TYPE && INITRD_START) {
636 if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { 472 if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) {
@@ -657,7 +493,9 @@ void __init setup_arch(char **cmdline_p)
657 493
658 paging_init(); 494 paging_init();
659 495
660 check_ioapic(); 496#ifdef CONFIG_PCI
497 early_quirks();
498#endif
661 499
662 /* 500 /*
663 * set this early, so we dont allocate cpu0 501 * set this early, so we dont allocate cpu0
@@ -674,14 +512,12 @@ void __init setup_arch(char **cmdline_p)
674 512
675 init_cpu_to_node(); 513 init_cpu_to_node();
676 514
677#ifdef CONFIG_X86_LOCAL_APIC
678 /* 515 /*
679 * get boot-time SMP configuration: 516 * get boot-time SMP configuration:
680 */ 517 */
681 if (smp_found_config) 518 if (smp_found_config)
682 get_smp_config(); 519 get_smp_config();
683 init_apic_mappings(); 520 init_apic_mappings();
684#endif
685 521
686 /* 522 /*
687 * Request address space for all standard RAM and ROM resources 523 * Request address space for all standard RAM and ROM resources
@@ -839,7 +675,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
839#endif 675#endif
840} 676}
841 677
842static void __init init_amd(struct cpuinfo_x86 *c) 678static void __cpuinit init_amd(struct cpuinfo_x86 *c)
843{ 679{
844 unsigned level; 680 unsigned level;
845 681
@@ -895,6 +731,12 @@ static void __init init_amd(struct cpuinfo_x86 *c)
895 731
896 /* Fix cpuid4 emulation for more */ 732 /* Fix cpuid4 emulation for more */
897 num_cache_leaves = 3; 733 num_cache_leaves = 3;
734
735 /* When there is only one core no need to synchronize RDTSC */
736 if (num_possible_cpus() == 1)
737 set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
738 else
739 clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
898} 740}
899 741
900static void __cpuinit detect_ht(struct cpuinfo_x86 *c) 742static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@ -976,8 +818,7 @@ static void srat_detect_node(void)
976 node = first_node(node_online_map); 818 node = first_node(node_online_map);
977 numa_set_node(cpu, node); 819 numa_set_node(cpu, node);
978 820
979 if (acpi_numa > 0) 821 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
980 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
981#endif 822#endif
982} 823}
983 824
@@ -1011,6 +852,8 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
1011 if ((c->x86 == 0xf && c->x86_model >= 0x03) || 852 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
1012 (c->x86 == 0x6 && c->x86_model >= 0x0e)) 853 (c->x86 == 0x6 && c->x86_model >= 0x0e))
1013 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 854 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
855 if (c->x86 == 6)
856 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
1014 set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); 857 set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
1015 c->x86_max_cores = intel_num_cpu_cores(c); 858 c->x86_max_cores = intel_num_cpu_cores(c);
1016 859
@@ -1229,8 +1072,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1229 1072
1230 /* Intel-defined (#2) */ 1073 /* Intel-defined (#2) */
1231 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 1074 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
1232 "tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL, 1075 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
1233 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1076 NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL,
1234 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1077 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1235 1078
1236 /* VIA/Cyrix/Centaur-defined */ 1079 /* VIA/Cyrix/Centaur-defined */