aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/setup.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-28 08:29:59 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-28 08:29:59 -0400
commit185a257f2f73bcd89050ad02da5bedbc28fc43fa (patch)
tree5e32586114534ed3f2165614cba3d578f5d87307 /arch/i386/kernel/setup.c
parent3f1a9aaeffd8d1cbc5ab9776c45cbd66af1c9699 (diff)
parenta77c64c1a641950626181b4857abb701d8f38ccc (diff)
Merge branch 'master' into gfs2
Diffstat (limited to 'arch/i386/kernel/setup.c')
-rw-r--r--arch/i386/kernel/setup.c408
1 files changed, 157 insertions, 251 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index f1682206d304..814cdebf7377 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -53,6 +53,7 @@
53#include <asm/apic.h> 53#include <asm/apic.h>
54#include <asm/e820.h> 54#include <asm/e820.h>
55#include <asm/mpspec.h> 55#include <asm/mpspec.h>
56#include <asm/mmzone.h>
56#include <asm/setup.h> 57#include <asm/setup.h>
57#include <asm/arch_hooks.h> 58#include <asm/arch_hooks.h>
58#include <asm/sections.h> 59#include <asm/sections.h>
@@ -89,18 +90,6 @@ EXPORT_SYMBOL(boot_cpu_data);
89 90
90unsigned long mmu_cr4_features; 91unsigned long mmu_cr4_features;
91 92
92#ifdef CONFIG_ACPI
93 int acpi_disabled = 0;
94#else
95 int acpi_disabled = 1;
96#endif
97EXPORT_SYMBOL(acpi_disabled);
98
99#ifdef CONFIG_ACPI
100int __initdata acpi_force = 0;
101extern acpi_interrupt_flags acpi_sci_flags;
102#endif
103
104/* for MCA, but anyone else can use it if they want */ 93/* for MCA, but anyone else can use it if they want */
105unsigned int machine_id; 94unsigned int machine_id;
106#ifdef CONFIG_MCA 95#ifdef CONFIG_MCA
@@ -148,7 +137,6 @@ EXPORT_SYMBOL(ist_info);
148struct e820map e820; 137struct e820map e820;
149 138
150extern void early_cpu_init(void); 139extern void early_cpu_init(void);
151extern void generic_apic_probe(char *);
152extern int root_mountflags; 140extern int root_mountflags;
153 141
154unsigned long saved_videomode; 142unsigned long saved_videomode;
@@ -700,238 +688,150 @@ static inline void copy_edd(void)
700} 688}
701#endif 689#endif
702 690
703static void __init parse_cmdline_early (char ** cmdline_p) 691static int __initdata user_defined_memmap = 0;
704{
705 char c = ' ', *to = command_line, *from = saved_command_line;
706 int len = 0;
707 int userdef = 0;
708 692
709 /* Save unparsed command line copy for /proc/cmdline */ 693/*
710 saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; 694 * "mem=nopentium" disables the 4MB page tables.
695 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
696 * to <mem>, overriding the bios size.
697 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
698 * <start> to <start>+<mem>, overriding the bios size.
699 *
700 * HPA tells me bootloaders need to parse mem=, so no new
701 * option should be mem= [also see Documentation/i386/boot.txt]
702 */
703static int __init parse_mem(char *arg)
704{
705 if (!arg)
706 return -EINVAL;
711 707
712 for (;;) { 708 if (strcmp(arg, "nopentium") == 0) {
713 if (c != ' ') 709 clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
714 goto next_char; 710 disable_pse = 1;
715 /* 711 } else {
716 * "mem=nopentium" disables the 4MB page tables. 712 /* If the user specifies memory size, we
717 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM 713 * limit the BIOS-provided memory map to
718 * to <mem>, overriding the bios size. 714 * that size. exactmap can be used to specify
719 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from 715 * the exact map. mem=number can be used to
720 * <start> to <start>+<mem>, overriding the bios size. 716 * trim the existing memory map.
721 *
722 * HPA tells me bootloaders need to parse mem=, so no new
723 * option should be mem= [also see Documentation/i386/boot.txt]
724 */ 717 */
725 if (!memcmp(from, "mem=", 4)) { 718 unsigned long long mem_size;
726 if (to != command_line)
727 to--;
728 if (!memcmp(from+4, "nopentium", 9)) {
729 from += 9+4;
730 clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
731 disable_pse = 1;
732 } else {
733 /* If the user specifies memory size, we
734 * limit the BIOS-provided memory map to
735 * that size. exactmap can be used to specify
736 * the exact map. mem=number can be used to
737 * trim the existing memory map.
738 */
739 unsigned long long mem_size;
740
741 mem_size = memparse(from+4, &from);
742 limit_regions(mem_size);
743 userdef=1;
744 }
745 }
746
747 else if (!memcmp(from, "memmap=", 7)) {
748 if (to != command_line)
749 to--;
750 if (!memcmp(from+7, "exactmap", 8)) {
751#ifdef CONFIG_CRASH_DUMP
752 /* If we are doing a crash dump, we
753 * still need to know the real mem
754 * size before original memory map is
755 * reset.
756 */
757 find_max_pfn();
758 saved_max_pfn = max_pfn;
759#endif
760 from += 8+7;
761 e820.nr_map = 0;
762 userdef = 1;
763 } else {
764 /* If the user specifies memory size, we
765 * limit the BIOS-provided memory map to
766 * that size. exactmap can be used to specify
767 * the exact map. mem=number can be used to
768 * trim the existing memory map.
769 */
770 unsigned long long start_at, mem_size;
771 719
772 mem_size = memparse(from+7, &from); 720 mem_size = memparse(arg, &arg);
773 if (*from == '@') { 721 limit_regions(mem_size);
774 start_at = memparse(from+1, &from); 722 user_defined_memmap = 1;
775 add_memory_region(start_at, mem_size, E820_RAM); 723 }
776 } else if (*from == '#') { 724 return 0;
777 start_at = memparse(from+1, &from); 725}
778 add_memory_region(start_at, mem_size, E820_ACPI); 726early_param("mem", parse_mem);
779 } else if (*from == '$') {
780 start_at = memparse(from+1, &from);
781 add_memory_region(start_at, mem_size, E820_RESERVED);
782 } else {
783 limit_regions(mem_size);
784 userdef=1;
785 }
786 }
787 }
788
789 else if (!memcmp(from, "noexec=", 7))
790 noexec_setup(from + 7);
791 727
728static int __init parse_memmap(char *arg)
729{
730 if (!arg)
731 return -EINVAL;
792 732
793#ifdef CONFIG_X86_SMP 733 if (strcmp(arg, "exactmap") == 0) {
794 /* 734#ifdef CONFIG_CRASH_DUMP
795 * If the BIOS enumerates physical processors before logical, 735 /* If we are doing a crash dump, we
796 * maxcpus=N at enumeration-time can be used to disable HT. 736 * still need to know the real mem
737 * size before original memory map is
738 * reset.
797 */ 739 */
798 else if (!memcmp(from, "maxcpus=", 8)) { 740 find_max_pfn();
799 extern unsigned int maxcpus; 741 saved_max_pfn = max_pfn;
800
801 maxcpus = simple_strtoul(from + 8, NULL, 0);
802 }
803#endif 742#endif
804 743 e820.nr_map = 0;
805#ifdef CONFIG_ACPI 744 user_defined_memmap = 1;
806 /* "acpi=off" disables both ACPI table parsing and interpreter */ 745 } else {
807 else if (!memcmp(from, "acpi=off", 8)) { 746 /* If the user specifies memory size, we
808 disable_acpi(); 747 * limit the BIOS-provided memory map to
809 } 748 * that size. exactmap can be used to specify
810 749 * the exact map. mem=number can be used to
811 /* acpi=force to over-ride black-list */ 750 * trim the existing memory map.
812 else if (!memcmp(from, "acpi=force", 10)) { 751 */
813 acpi_force = 1; 752 unsigned long long start_at, mem_size;
814 acpi_ht = 1; 753
815 acpi_disabled = 0; 754 mem_size = memparse(arg, &arg);
816 } 755 if (*arg == '@') {
817 756 start_at = memparse(arg+1, &arg);
818 /* acpi=strict disables out-of-spec workarounds */ 757 add_memory_region(start_at, mem_size, E820_RAM);
819 else if (!memcmp(from, "acpi=strict", 11)) { 758 } else if (*arg == '#') {
820 acpi_strict = 1; 759 start_at = memparse(arg+1, &arg);
821 } 760 add_memory_region(start_at, mem_size, E820_ACPI);
822 761 } else if (*arg == '$') {
823 /* Limit ACPI just to boot-time to enable HT */ 762 start_at = memparse(arg+1, &arg);
824 else if (!memcmp(from, "acpi=ht", 7)) { 763 add_memory_region(start_at, mem_size, E820_RESERVED);
825 if (!acpi_force) 764 } else {
826 disable_acpi(); 765 limit_regions(mem_size);
827 acpi_ht = 1; 766 user_defined_memmap = 1;
828 }
829
830 /* "pci=noacpi" disable ACPI IRQ routing and PCI scan */
831 else if (!memcmp(from, "pci=noacpi", 10)) {
832 acpi_disable_pci();
833 }
834 /* "acpi=noirq" disables ACPI interrupt routing */
835 else if (!memcmp(from, "acpi=noirq", 10)) {
836 acpi_noirq_set();
837 } 767 }
768 }
769 return 0;
770}
771early_param("memmap", parse_memmap);
838 772
839 else if (!memcmp(from, "acpi_sci=edge", 13)) 773#ifdef CONFIG_PROC_VMCORE
840 acpi_sci_flags.trigger = 1; 774/* elfcorehdr= specifies the location of elf core header
841 775 * stored by the crashed kernel.
842 else if (!memcmp(from, "acpi_sci=level", 14)) 776 */
843 acpi_sci_flags.trigger = 3; 777static int __init parse_elfcorehdr(char *arg)
844 778{
845 else if (!memcmp(from, "acpi_sci=high", 13)) 779 if (!arg)
846 acpi_sci_flags.polarity = 1; 780 return -EINVAL;
847 781
848 else if (!memcmp(from, "acpi_sci=low", 12)) 782 elfcorehdr_addr = memparse(arg, &arg);
849 acpi_sci_flags.polarity = 3; 783 return 0;
784}
785early_param("elfcorehdr", parse_elfcorehdr);
786#endif /* CONFIG_PROC_VMCORE */
850 787
851#ifdef CONFIG_X86_IO_APIC 788/*
852 else if (!memcmp(from, "acpi_skip_timer_override", 24)) 789 * highmem=size forces highmem to be exactly 'size' bytes.
853 acpi_skip_timer_override = 1; 790 * This works even on boxes that have no highmem otherwise.
791 * This also works to reduce highmem size on bigger boxes.
792 */
793static int __init parse_highmem(char *arg)
794{
795 if (!arg)
796 return -EINVAL;
854 797
855 if (!memcmp(from, "disable_timer_pin_1", 19)) 798 highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT;
856 disable_timer_pin_1 = 1; 799 return 0;
857 if (!memcmp(from, "enable_timer_pin_1", 18)) 800}
858 disable_timer_pin_1 = -1; 801early_param("highmem", parse_highmem);
859 802
860 /* disable IO-APIC */ 803/*
861 else if (!memcmp(from, "noapic", 6)) 804 * vmalloc=size forces the vmalloc area to be exactly 'size'
862 disable_ioapic_setup(); 805 * bytes. This can be used to increase (or decrease) the
863#endif /* CONFIG_X86_IO_APIC */ 806 * vmalloc area - the default is 128m.
864#endif /* CONFIG_ACPI */ 807 */
808static int __init parse_vmalloc(char *arg)
809{
810 if (!arg)
811 return -EINVAL;
865 812
866#ifdef CONFIG_X86_LOCAL_APIC 813 __VMALLOC_RESERVE = memparse(arg, &arg);
867 /* enable local APIC */ 814 return 0;
868 else if (!memcmp(from, "lapic", 5)) 815}
869 lapic_enable(); 816early_param("vmalloc", parse_vmalloc);
870 817
871 /* disable local APIC */ 818/*
872 else if (!memcmp(from, "nolapic", 6)) 819 * reservetop=size reserves a hole at the top of the kernel address space which
873 lapic_disable(); 820 * a hypervisor can load into later. Needed for dynamically loaded hypervisors,
874#endif /* CONFIG_X86_LOCAL_APIC */ 821 * so relocating the fixmap can be done before paging initialization.
822 */
823static int __init parse_reservetop(char *arg)
824{
825 unsigned long address;
875 826
876#ifdef CONFIG_KEXEC 827 if (!arg)
877 /* crashkernel=size@addr specifies the location to reserve for 828 return -EINVAL;
878 * a crash kernel. By reserving this memory we guarantee
879 * that linux never set's it up as a DMA target.
880 * Useful for holding code to do something appropriate
881 * after a kernel panic.
882 */
883 else if (!memcmp(from, "crashkernel=", 12)) {
884 unsigned long size, base;
885 size = memparse(from+12, &from);
886 if (*from == '@') {
887 base = memparse(from+1, &from);
888 /* FIXME: Do I want a sanity check
889 * to validate the memory range?
890 */
891 crashk_res.start = base;
892 crashk_res.end = base + size - 1;
893 }
894 }
895#endif
896#ifdef CONFIG_PROC_VMCORE
897 /* elfcorehdr= specifies the location of elf core header
898 * stored by the crashed kernel.
899 */
900 else if (!memcmp(from, "elfcorehdr=", 11))
901 elfcorehdr_addr = memparse(from+11, &from);
902#endif
903 829
904 /* 830 address = memparse(arg, &arg);
905 * highmem=size forces highmem to be exactly 'size' bytes. 831 reserve_top_address(address);
906 * This works even on boxes that have no highmem otherwise. 832 return 0;
907 * This also works to reduce highmem size on bigger boxes.
908 */
909 else if (!memcmp(from, "highmem=", 8))
910 highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT;
911
912 /*
913 * vmalloc=size forces the vmalloc area to be exactly 'size'
914 * bytes. This can be used to increase (or decrease) the
915 * vmalloc area - the default is 128m.
916 */
917 else if (!memcmp(from, "vmalloc=", 8))
918 __VMALLOC_RESERVE = memparse(from+8, &from);
919
920 next_char:
921 c = *(from++);
922 if (!c)
923 break;
924 if (COMMAND_LINE_SIZE <= ++len)
925 break;
926 *(to++) = c;
927 }
928 *to = '\0';
929 *cmdline_p = command_line;
930 if (userdef) {
931 printk(KERN_INFO "user-defined physical RAM map:\n");
932 print_memory_map("user");
933 }
934} 833}
834early_param("reservetop", parse_reservetop);
935 835
936/* 836/*
937 * Callback for efi_memory_walk. 837 * Callback for efi_memory_walk.
@@ -1170,6 +1070,14 @@ static unsigned long __init setup_memory(void)
1170 } 1070 }
1171 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 1071 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
1172 pages_to_mb(highend_pfn - highstart_pfn)); 1072 pages_to_mb(highend_pfn - highstart_pfn));
1073 num_physpages = highend_pfn;
1074 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
1075#else
1076 num_physpages = max_low_pfn;
1077 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
1078#endif
1079#ifdef CONFIG_FLATMEM
1080 max_mapnr = num_physpages;
1173#endif 1081#endif
1174 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 1082 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
1175 pages_to_mb(max_low_pfn)); 1083 pages_to_mb(max_low_pfn));
@@ -1181,22 +1089,20 @@ static unsigned long __init setup_memory(void)
1181 1089
1182void __init zone_sizes_init(void) 1090void __init zone_sizes_init(void)
1183{ 1091{
1184 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
1185 unsigned int max_dma, low;
1186
1187 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
1188 low = max_low_pfn;
1189
1190 if (low < max_dma)
1191 zones_size[ZONE_DMA] = low;
1192 else {
1193 zones_size[ZONE_DMA] = max_dma;
1194 zones_size[ZONE_NORMAL] = low - max_dma;
1195#ifdef CONFIG_HIGHMEM 1092#ifdef CONFIG_HIGHMEM
1196 zones_size[ZONE_HIGHMEM] = highend_pfn - low; 1093 unsigned long max_zone_pfns[MAX_NR_ZONES] = {
1094 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
1095 max_low_pfn,
1096 highend_pfn};
1097 add_active_range(0, 0, highend_pfn);
1098#else
1099 unsigned long max_zone_pfns[MAX_NR_ZONES] = {
1100 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
1101 max_low_pfn};
1102 add_active_range(0, 0, max_low_pfn);
1197#endif 1103#endif
1198 } 1104
1199 free_area_init(zones_size); 1105 free_area_init_nodes(max_zone_pfns);
1200} 1106}
1201#else 1107#else
1202extern unsigned long __init setup_memory(void); 1108extern unsigned long __init setup_memory(void);
@@ -1258,7 +1164,7 @@ void __init setup_bootmem_allocator(void)
1258 */ 1164 */
1259 find_smp_config(); 1165 find_smp_config();
1260#endif 1166#endif
1261 1167 numa_kva_reserve();
1262#ifdef CONFIG_BLK_DEV_INITRD 1168#ifdef CONFIG_BLK_DEV_INITRD
1263 if (LOADER_TYPE && INITRD_START) { 1169 if (LOADER_TYPE && INITRD_START) {
1264 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 1170 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
@@ -1499,17 +1405,15 @@ void __init setup_arch(char **cmdline_p)
1499 data_resource.start = virt_to_phys(_etext); 1405 data_resource.start = virt_to_phys(_etext);
1500 data_resource.end = virt_to_phys(_edata)-1; 1406 data_resource.end = virt_to_phys(_edata)-1;
1501 1407
1502 parse_cmdline_early(cmdline_p); 1408 parse_early_param();
1503 1409
1504#ifdef CONFIG_EARLY_PRINTK 1410 if (user_defined_memmap) {
1505 { 1411 printk(KERN_INFO "user-defined physical RAM map:\n");
1506 char *s = strstr(*cmdline_p, "earlyprintk="); 1412 print_memory_map("user");
1507 if (s) {
1508 setup_early_printk(strchr(s, '=') + 1);
1509 printk("early console enabled\n");
1510 }
1511 } 1413 }
1512#endif 1414
1415 strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
1416 *cmdline_p = command_line;
1513 1417
1514 max_low_pfn = setup_memory(); 1418 max_low_pfn = setup_memory();
1515 1419
@@ -1538,7 +1442,7 @@ void __init setup_arch(char **cmdline_p)
1538 dmi_scan_machine(); 1442 dmi_scan_machine();
1539 1443
1540#ifdef CONFIG_X86_GENERICARCH 1444#ifdef CONFIG_X86_GENERICARCH
1541 generic_apic_probe(*cmdline_p); 1445 generic_apic_probe();
1542#endif 1446#endif
1543 if (efi_enabled) 1447 if (efi_enabled)
1544 efi_map_memmap(); 1448 efi_map_memmap();
@@ -1550,9 +1454,11 @@ void __init setup_arch(char **cmdline_p)
1550 acpi_boot_table_init(); 1454 acpi_boot_table_init();
1551#endif 1455#endif
1552 1456
1457#ifdef CONFIG_PCI
1553#ifdef CONFIG_X86_IO_APIC 1458#ifdef CONFIG_X86_IO_APIC
1554 check_acpi_pci(); /* Checks more than just ACPI actually */ 1459 check_acpi_pci(); /* Checks more than just ACPI actually */
1555#endif 1460#endif
1461#endif
1556 1462
1557#ifdef CONFIG_ACPI 1463#ifdef CONFIG_ACPI
1558 acpi_boot_init(); 1464 acpi_boot_init();