aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/e820_32.c60
-rw-r--r--arch/x86/kernel/setup_32.c50
2 files changed, 60 insertions, 50 deletions
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
index ed733e7cf4e6..31ea2bb8c91a 100644
--- a/arch/x86/kernel/e820_32.c
+++ b/arch/x86/kernel/e820_32.c
@@ -30,7 +30,6 @@ unsigned long pci_mem_start = 0x10000000;
30#ifdef CONFIG_PCI 30#ifdef CONFIG_PCI
31EXPORT_SYMBOL(pci_mem_start); 31EXPORT_SYMBOL(pci_mem_start);
32#endif 32#endif
33extern int user_defined_memmap;
34 33
35static struct resource system_rom_resource = { 34static struct resource system_rom_resource = {
36 .name = "System ROM", 35 .name = "System ROM",
@@ -584,7 +583,7 @@ void __init e820_register_memory(void)
584 pci_mem_start, gapstart, gapsize); 583 pci_mem_start, gapstart, gapsize);
585} 584}
586 585
587void __init print_memory_map(char *who) 586static void __init print_memory_map(char *who)
588{ 587{
589 int i; 588 int i;
590 589
@@ -692,6 +691,54 @@ e820_all_mapped(unsigned long s, unsigned long e, unsigned type)
692 return 0; 691 return 0;
693} 692}
694 693
694/* Overridden in paravirt.c if CONFIG_PARAVIRT */
695char * __init __attribute__((weak)) memory_setup(void)
696{
697 return machine_specific_memory_setup();
698}
699
700void __init setup_memory_map(void)
701{
702 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
703 print_memory_map(memory_setup());
704}
705
706static int __initdata user_defined_memmap;
707
708/*
709 * "mem=nopentium" disables the 4MB page tables.
710 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
711 * to <mem>, overriding the bios size.
712 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
713 * <start> to <start>+<mem>, overriding the bios size.
714 *
715 * HPA tells me bootloaders need to parse mem=, so no new
716 * option should be mem= [also see Documentation/i386/boot.txt]
717 */
718static int __init parse_mem(char *arg)
719{
720 if (!arg)
721 return -EINVAL;
722
723 if (strcmp(arg, "nopentium") == 0) {
724 setup_clear_cpu_cap(X86_FEATURE_PSE);
725 } else {
726 /* If the user specifies memory size, we
727 * limit the BIOS-provided memory map to
728 * that size. exactmap can be used to specify
729 * the exact map. mem=number can be used to
730 * trim the existing memory map.
731 */
732 unsigned long long mem_size;
733
734 mem_size = memparse(arg, &arg);
735 limit_regions(mem_size);
736 user_defined_memmap = 1;
737 }
738 return 0;
739}
740early_param("mem", parse_mem);
741
695static int __init parse_memmap(char *arg) 742static int __init parse_memmap(char *arg)
696{ 743{
697 if (!arg) 744 if (!arg)
@@ -762,6 +809,15 @@ void __init update_memory_range(u64 start, u64 size, unsigned old_type,
762 new_type); 809 new_type);
763 } 810 }
764} 811}
812
813void __init finish_e820_parsing(void)
814{
815 if (user_defined_memmap) {
816 printk(KERN_INFO "user-defined physical RAM map:\n");
817 print_memory_map("user");
818 }
819}
820
765void __init update_e820(void) 821void __init update_e820(void)
766{ 822{
767 u8 nr_map; 823 u8 nr_map;
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 2c5f8b213e86..b54c79c91efd 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -237,42 +237,6 @@ static inline void copy_edd(void)
237} 237}
238#endif 238#endif
239 239
240int __initdata user_defined_memmap;
241
242/*
243 * "mem=nopentium" disables the 4MB page tables.
244 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
245 * to <mem>, overriding the bios size.
246 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
247 * <start> to <start>+<mem>, overriding the bios size.
248 *
249 * HPA tells me bootloaders need to parse mem=, so no new
250 * option should be mem= [also see Documentation/i386/boot.txt]
251 */
252static int __init parse_mem(char *arg)
253{
254 if (!arg)
255 return -EINVAL;
256
257 if (strcmp(arg, "nopentium") == 0) {
258 setup_clear_cpu_cap(X86_FEATURE_PSE);
259 } else {
260 /* If the user specifies memory size, we
261 * limit the BIOS-provided memory map to
262 * that size. exactmap can be used to specify
263 * the exact map. mem=number can be used to
264 * trim the existing memory map.
265 */
266 unsigned long long mem_size;
267
268 mem_size = memparse(arg, &arg);
269 limit_regions(mem_size);
270 user_defined_memmap = 1;
271 }
272 return 0;
273}
274early_param("mem", parse_mem);
275
276#ifdef CONFIG_PROC_VMCORE 240#ifdef CONFIG_PROC_VMCORE
277/* elfcorehdr= specifies the location of elf core header 241/* elfcorehdr= specifies the location of elf core header
278 * stored by the crashed kernel. 242 * stored by the crashed kernel.
@@ -725,12 +689,6 @@ static void set_mca_bus(int x)
725static void set_mca_bus(int x) { } 689static void set_mca_bus(int x) { }
726#endif 690#endif
727 691
728/* Overridden in paravirt.c if CONFIG_PARAVIRT */
729char * __init __attribute__((weak)) memory_setup(void)
730{
731 return machine_specific_memory_setup();
732}
733
734#ifdef CONFIG_NUMA 692#ifdef CONFIG_NUMA
735/* 693/*
736 * In the golden day, when everything among i386 and x86_64 will be 694 * In the golden day, when everything among i386 and x86_64 will be
@@ -786,8 +744,7 @@ void __init setup_arch(char **cmdline_p)
786#endif 744#endif
787 ARCH_SETUP 745 ARCH_SETUP
788 746
789 printk(KERN_INFO "BIOS-provided physical RAM map:\n"); 747 setup_memory_map();
790 print_memory_map(memory_setup());
791 748
792 copy_edd(); 749 copy_edd();
793 750
@@ -807,10 +764,7 @@ void __init setup_arch(char **cmdline_p)
807 764
808 parse_early_param(); 765 parse_early_param();
809 766
810 if (user_defined_memmap) { 767 finish_e820_parsing();
811 printk(KERN_INFO "user-defined physical RAM map:\n");
812 print_memory_map("user");
813 }
814 768
815 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); 769 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
816 *cmdline_p = command_line; 770 *cmdline_p = command_line;