aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup_32.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-25 20:52:35 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 07:10:47 -0400
commit76934ed4b33b65096296d3e7b3c046fd020019fc (patch)
treea9ec23237cf4e5df012d787da458b215a8d33555 /arch/x86/kernel/setup_32.c
parent46d671b525102ae005dc5e8389ca67c86ae012b1 (diff)
x86: merge 64bit setup_arch into setup_32
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup_32.c')
-rw-r--r--arch/x86/kernel/setup_32.c99
1 files changed, 91 insertions, 8 deletions
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 0b69483b0c3d..f3177bae300d 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -372,26 +372,38 @@ static void __init reserve_initrd(void)
372 * global efi_enabled. This allows the same kernel image to be used on existing 372 * global efi_enabled. This allows the same kernel image to be used on existing
373 * systems (with a traditional BIOS) as well as on EFI systems. 373 * systems (with a traditional BIOS) as well as on EFI systems.
374 */ 374 */
375/*
376 * setup_arch - architecture-specific boot-time initializations
377 *
378 * Note: On x86_64, fixmaps are ready for use even before this is called.
379 */
380
375void __init setup_arch(char **cmdline_p) 381void __init setup_arch(char **cmdline_p)
376{ 382{
383#ifdef CONFIG_X86_32
377 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); 384 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
378 pre_setup_arch_hook(); 385 pre_setup_arch_hook();
379 early_cpu_init(); 386 early_cpu_init();
380 early_ioremap_init(); 387 early_ioremap_init();
381 reserve_setup_data(); 388 reserve_setup_data();
389#else
390 printk(KERN_INFO "Command line: %s\n", boot_command_line);
391#endif
382 392
383 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); 393 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
384 screen_info = boot_params.screen_info; 394 screen_info = boot_params.screen_info;
385 edid_info = boot_params.edid_info; 395 edid_info = boot_params.edid_info;
396#ifdef CONFIG_X86_32
386 apm_info.bios = boot_params.apm_bios_info; 397 apm_info.bios = boot_params.apm_bios_info;
387 ist_info = boot_params.ist_info; 398 ist_info = boot_params.ist_info;
388 saved_video_mode = boot_params.hdr.vid_mode; 399 if (boot_params.sys_desc_table.length != 0) {
389 if( boot_params.sys_desc_table.length != 0 ) {
390 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2); 400 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
391 machine_id = boot_params.sys_desc_table.table[0]; 401 machine_id = boot_params.sys_desc_table.table[0];
392 machine_submodel_id = boot_params.sys_desc_table.table[1]; 402 machine_submodel_id = boot_params.sys_desc_table.table[1];
393 BIOS_revision = boot_params.sys_desc_table.table[2]; 403 BIOS_revision = boot_params.sys_desc_table.table[2];
394 } 404 }
405#endif
406 saved_video_mode = boot_params.hdr.vid_mode;
395 bootloader_type = boot_params.hdr.type_of_loader; 407 bootloader_type = boot_params.hdr.type_of_loader;
396 408
397#ifdef CONFIG_BLK_DEV_RAM 409#ifdef CONFIG_BLK_DEV_RAM
@@ -401,7 +413,12 @@ void __init setup_arch(char **cmdline_p)
401#endif 413#endif
402#ifdef CONFIG_EFI 414#ifdef CONFIG_EFI
403 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 415 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
404 "EL32", 4)) { 416#ifdef CONFIG_X86_32
417 "EL32",
418#else
419 "EL64",
420#endif
421 4)) {
405 efi_enabled = 1; 422 efi_enabled = 1;
406 efi_reserve_early(); 423 efi_reserve_early();
407 } 424 }
@@ -417,7 +434,11 @@ void __init setup_arch(char **cmdline_p)
417 init_mm.start_code = (unsigned long) _text; 434 init_mm.start_code = (unsigned long) _text;
418 init_mm.end_code = (unsigned long) _etext; 435 init_mm.end_code = (unsigned long) _etext;
419 init_mm.end_data = (unsigned long) _edata; 436 init_mm.end_data = (unsigned long) _edata;
437#ifdef CONFIG_X86_32
420 init_mm.brk = init_pg_tables_end + PAGE_OFFSET; 438 init_mm.brk = init_pg_tables_end + PAGE_OFFSET;
439#else
440 init_mm.brk = (unsigned long) &_end;
441#endif
421 442
422 code_resource.start = virt_to_phys(_text); 443 code_resource.start = virt_to_phys(_text);
423 code_resource.end = virt_to_phys(_etext)-1; 444 code_resource.end = virt_to_phys(_etext)-1;
@@ -426,6 +447,9 @@ void __init setup_arch(char **cmdline_p)
426 bss_resource.start = virt_to_phys(&__bss_start); 447 bss_resource.start = virt_to_phys(&__bss_start);
427 bss_resource.end = virt_to_phys(&__bss_stop)-1; 448 bss_resource.end = virt_to_phys(&__bss_stop)-1;
428 449
450#ifdef CONFIG_X86_64
451 early_cpu_init();
452#endif
429 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); 453 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
430 *cmdline_p = command_line; 454 *cmdline_p = command_line;
431 455
@@ -433,16 +457,27 @@ void __init setup_arch(char **cmdline_p)
433 457
434 parse_early_param(); 458 parse_early_param();
435 459
436 if (acpi_mps_check()){ 460 if (acpi_mps_check()) {
437#ifdef CONFIG_X86_LOCAL_APIC 461#ifdef CONFIG_X86_LOCAL_APIC
462#ifdef CONFIG_X86_32
438 enable_local_apic = -1; 463 enable_local_apic = -1;
464#else
465 disable_apic = 1;
466#endif
439#endif 467#endif
440 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC); 468 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
441 } 469 }
442 470
443 finish_e820_parsing(); 471 finish_e820_parsing();
444 472
473#ifdef CONFIG_X86_32
445 probe_roms(); 474 probe_roms();
475#else
476# ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
477 if (init_ohci1394_dma_early)
478 init_ohci1394_dma_on_all_controllers();
479# endif
480#endif
446 481
447 /* after parse_early_param, so could debug it */ 482 /* after parse_early_param, so could debug it */
448 insert_resource(&iomem_resource, &code_resource); 483 insert_resource(&iomem_resource, &code_resource);
@@ -452,6 +487,7 @@ void __init setup_arch(char **cmdline_p)
452 if (efi_enabled) 487 if (efi_enabled)
453 efi_init(); 488 efi_init();
454 489
490#ifdef CONFIG_X86_32
455 if (ppro_with_ram_bug()) { 491 if (ppro_with_ram_bug()) {
456 e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, 492 e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
457 E820_RESERVED); 493 E820_RESERVED);
@@ -459,6 +495,9 @@ void __init setup_arch(char **cmdline_p)
459 printk(KERN_INFO "fixed physical RAM map:\n"); 495 printk(KERN_INFO "fixed physical RAM map:\n");
460 e820_print_map("bad_ppro"); 496 e820_print_map("bad_ppro");
461 } 497 }
498#else
499 early_gart_iommu_check();
500#endif
462 501
463 e820_register_active_regions(0, 0, -1UL); 502 e820_register_active_regions(0, 0, -1UL);
464 /* 503 /*
@@ -477,14 +516,32 @@ void __init setup_arch(char **cmdline_p)
477 max_pfn = e820_end_of_ram(); 516 max_pfn = e820_end_of_ram();
478 } 517 }
479 518
519#ifdef CONFIG_X86_32
480 /* max_low_pfn get updated here */ 520 /* max_low_pfn get updated here */
481 find_low_pfn_range(); 521 find_low_pfn_range();
522#else
523 num_physpages = max_pfn;
524
525 check_efer();
526
527 /* How many end-of-memory variables you have, grandma! */
528 /* need this before calling reserve_initrd */
529 max_low_pfn = max_pfn;
530 high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
531#endif
482 532
483 /* max_pfn_mapped is updated here */ 533 /* max_pfn_mapped is updated here */
534#ifdef CONFIG_X86_64
535 max_pfn_mapped =
536#endif
484 max_pfn_mapped = init_memory_mapping(0, (max_low_pfn << PAGE_SHIFT)); 537 max_pfn_mapped = init_memory_mapping(0, (max_low_pfn << PAGE_SHIFT));
485 538
486 reserve_initrd(); 539 reserve_initrd();
487 540
541#ifdef CONFIG_X86_64
542 vsmp_init();
543#endif
544
488 dmi_scan_machine(); 545 dmi_scan_machine();
489 546
490 io_delay_init(); 547 io_delay_init();
@@ -494,6 +551,11 @@ void __init setup_arch(char **cmdline_p)
494 */ 551 */
495 acpi_boot_table_init(); 552 acpi_boot_table_init();
496 553
554#ifdef CONFIG_X86_64
555 /* Remove active ranges so rediscovery with NUMA-awareness happens */
556 remove_all_active_ranges();
557#endif
558
497#ifdef CONFIG_ACPI_NUMA 559#ifdef CONFIG_ACPI_NUMA
498 /* 560 /*
499 * Parse SRAT to discover nodes. 561 * Parse SRAT to discover nodes.
@@ -503,13 +565,18 @@ void __init setup_arch(char **cmdline_p)
503 565
504 initmem_init(0, max_pfn); 566 initmem_init(0, max_pfn);
505 567
568#ifdef CONFIG_X86_64
569 dma32_reserve_bootmem();
570#endif
571
506#ifdef CONFIG_ACPI_SLEEP 572#ifdef CONFIG_ACPI_SLEEP
507 /* 573 /*
508 * Reserve low memory region for sleep support. 574 * Reserve low memory region for sleep support.
509 */ 575 */
510 acpi_reserve_bootmem(); 576 acpi_reserve_bootmem();
511#endif 577#endif
512#ifdef CONFIG_X86_FIND_SMP_CONFIG 578#if defined(CONFIG_X86_FIND_SMP_CONFIG) && defined(CONFIG_X86_32) || \
579 defined(CONFIG_X86_MPPARSE) && defined(CONFIG_X86_64)
513 /* 580 /*
514 * Find and reserve possible boot-time SMP configuration: 581 * Find and reserve possible boot-time SMP configuration:
515 */ 582 */
@@ -523,7 +590,7 @@ void __init setup_arch(char **cmdline_p)
523 kvmclock_init(); 590 kvmclock_init();
524#endif 591#endif
525 592
526#ifdef CONFIG_VMI 593#if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
527 /* 594 /*
528 * Must be after max_low_pfn is determined, and before kernel 595 * Must be after max_low_pfn is determined, and before kernel
529 * pagetables are setup. 596 * pagetables are setup.
@@ -533,11 +600,15 @@ void __init setup_arch(char **cmdline_p)
533 600
534 paging_init(); 601 paging_init();
535 602
603#ifdef CONFIG_X86_64
604 map_vsyscall();
605#endif
606
536 /* 607 /*
537 * NOTE: On x86-32, only from this point on, fixmaps are ready for use. 608 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
538 */ 609 */
539 610
540#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT 611#if defined(CONFIG_PROVIDE_OHCI1394_DMA_INIT) && defined(CONFIG_X86_32)
541 if (init_ohci1394_dma_early) 612 if (init_ohci1394_dma_early)
542 init_ohci1394_dma_on_all_controllers(); 613 init_ohci1394_dma_on_all_controllers();
543#endif 614#endif
@@ -553,6 +624,10 @@ void __init setup_arch(char **cmdline_p)
553 */ 624 */
554 acpi_boot_init(); 625 acpi_boot_init();
555 626
627#ifdef CONFIG_X86_64
628 init_cpu_to_node();
629#endif
630
556#if defined(CONFIG_X86_MPPARSE) || defined(CONFIG_X86_VISWS) 631#if defined(CONFIG_X86_MPPARSE) || defined(CONFIG_X86_VISWS)
557 /* 632 /*
558 * get boot-time SMP configuration: 633 * get boot-time SMP configuration:
@@ -560,18 +635,26 @@ void __init setup_arch(char **cmdline_p)
560 if (smp_found_config) 635 if (smp_found_config)
561 get_smp_config(); 636 get_smp_config();
562#endif 637#endif
563#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) 638
639#ifdef CONFIG_X86_64
640 init_apic_mappings();
641 ioapic_init_mappings();
642#else
643# if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
564 if (def_to_bigsmp) 644 if (def_to_bigsmp)
565 printk(KERN_WARNING "More than 8 CPUs detected and " 645 printk(KERN_WARNING "More than 8 CPUs detected and "
566 "CONFIG_X86_PC cannot handle it.\nUse " 646 "CONFIG_X86_PC cannot handle it.\nUse "
567 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n"); 647 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
648# endif
568#endif 649#endif
569 kvm_guest_init(); 650 kvm_guest_init();
570 651
571 e820_reserve_resources(); 652 e820_reserve_resources();
572 e820_mark_nosave_regions(max_low_pfn); 653 e820_mark_nosave_regions(max_low_pfn);
573 654
655#ifdef CONFIG_X86_32
574 request_resource(&iomem_resource, &video_ram_resource); 656 request_resource(&iomem_resource, &video_ram_resource);
657#endif
575 reserve_standard_io_resources(); 658 reserve_standard_io_resources();
576 659
577 e820_setup_gap(); 660 e820_setup_gap();