diff options
-rw-r--r-- | arch/x86/kernel/e820_32.c | 60 | ||||
-rw-r--r-- | arch/x86/kernel/setup_32.c | 50 | ||||
-rw-r--r-- | include/asm-x86/e820_32.h | 4 |
3 files changed, 63 insertions, 51 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 |
31 | EXPORT_SYMBOL(pci_mem_start); | 31 | EXPORT_SYMBOL(pci_mem_start); |
32 | #endif | 32 | #endif |
33 | extern int user_defined_memmap; | ||
34 | 33 | ||
35 | static struct resource system_rom_resource = { | 34 | static 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 | ||
587 | void __init print_memory_map(char *who) | 586 | static 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 */ | ||
695 | char * __init __attribute__((weak)) memory_setup(void) | ||
696 | { | ||
697 | return machine_specific_memory_setup(); | ||
698 | } | ||
699 | |||
700 | void __init setup_memory_map(void) | ||
701 | { | ||
702 | printk(KERN_INFO "BIOS-provided physical RAM map:\n"); | ||
703 | print_memory_map(memory_setup()); | ||
704 | } | ||
705 | |||
706 | static 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 | */ | ||
718 | static 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 | } | ||
740 | early_param("mem", parse_mem); | ||
741 | |||
695 | static int __init parse_memmap(char *arg) | 742 | static 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 | |||
813 | void __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 | |||
765 | void __init update_e820(void) | 821 | void __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 | ||
240 | int __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 | */ | ||
252 | static 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 | } | ||
274 | early_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) | |||
725 | static void set_mca_bus(int x) { } | 689 | static void set_mca_bus(int x) { } |
726 | #endif | 690 | #endif |
727 | 691 | ||
728 | /* Overridden in paravirt.c if CONFIG_PARAVIRT */ | ||
729 | char * __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; |
diff --git a/include/asm-x86/e820_32.h b/include/asm-x86/e820_32.h index a9f7c6ec32bf..e1f10c60901f 100644 --- a/include/asm-x86/e820_32.h +++ b/include/asm-x86/e820_32.h | |||
@@ -18,6 +18,9 @@ | |||
18 | 18 | ||
19 | #ifndef __ASSEMBLY__ | 19 | #ifndef __ASSEMBLY__ |
20 | 20 | ||
21 | extern void setup_memory_map(void); | ||
22 | extern void finish_e820_parsing(void); | ||
23 | |||
21 | extern struct e820map e820; | 24 | extern struct e820map e820; |
22 | extern void update_e820(void); | 25 | extern void update_e820(void); |
23 | 26 | ||
@@ -32,7 +35,6 @@ extern void update_memory_range(u64 start, u64 size, unsigned old_type, | |||
32 | unsigned new_type); | 35 | unsigned new_type); |
33 | extern void e820_register_memory(void); | 36 | extern void e820_register_memory(void); |
34 | extern void limit_regions(unsigned long long size); | 37 | extern void limit_regions(unsigned long long size); |
35 | extern void print_memory_map(char *who); | ||
36 | extern void init_iomem_resources(struct resource *code_resource, | 38 | extern void init_iomem_resources(struct resource *code_resource, |
37 | struct resource *data_resource, | 39 | struct resource *data_resource, |
38 | struct resource *bss_resource); | 40 | struct resource *bss_resource); |