diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-10 15:55:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 04:35:38 -0400 |
commit | ab4a465e96adf2f3a8aaa95384bacfa9ab661e35 (patch) | |
tree | a4c72ba76c93ff362b404106f6a6ce756a2075cf /arch/x86/kernel/e820.c | |
parent | df5f6c212cc049d1989b5ce71bb863a367c261e9 (diff) |
x86: e820 merge parsing of the mem=/memmap= boot parameters
since we now have 32-bit support for e820_register_active_regions(),
we can merge the parsing of the mem=/memmap= boot parameters.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/e820.c')
-rw-r--r-- | arch/x86/kernel/e820.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 68aba413d403..4f2cd5d179e2 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -890,3 +890,89 @@ u64 __init e820_hole_size(u64 start, u64 end) | |||
890 | } | 890 | } |
891 | return end - start - ((u64)ram << PAGE_SHIFT); | 891 | return end - start - ((u64)ram << PAGE_SHIFT); |
892 | } | 892 | } |
893 | |||
894 | static void early_panic(char *msg) | ||
895 | { | ||
896 | early_printk(msg); | ||
897 | panic(msg); | ||
898 | } | ||
899 | |||
900 | /* "mem=nopentium" disables the 4MB page tables. */ | ||
901 | static int __init parse_memopt(char *p) | ||
902 | { | ||
903 | u64 mem_size; | ||
904 | |||
905 | if (!p) | ||
906 | return -EINVAL; | ||
907 | |||
908 | #ifdef CONFIG_X86_32 | ||
909 | if (!strcmp(p, "nopentium")) { | ||
910 | setup_clear_cpu_cap(X86_FEATURE_PSE); | ||
911 | return 0; | ||
912 | } | ||
913 | #endif | ||
914 | |||
915 | mem_size = memparse(p, &p); | ||
916 | end_user_pfn = mem_size>>PAGE_SHIFT; | ||
917 | return 0; | ||
918 | } | ||
919 | early_param("mem", parse_memopt); | ||
920 | |||
921 | static int userdef __initdata; | ||
922 | |||
923 | static int __init parse_memmap_opt(char *p) | ||
924 | { | ||
925 | char *oldp; | ||
926 | u64 start_at, mem_size; | ||
927 | |||
928 | if (!strcmp(p, "exactmap")) { | ||
929 | #ifdef CONFIG_CRASH_DUMP | ||
930 | /* | ||
931 | * If we are doing a crash dump, we still need to know | ||
932 | * the real mem size before original memory map is | ||
933 | * reset. | ||
934 | */ | ||
935 | e820_register_active_regions(0, 0, -1UL); | ||
936 | saved_max_pfn = e820_end_of_ram(); | ||
937 | remove_all_active_ranges(); | ||
938 | #endif | ||
939 | e820.nr_map = 0; | ||
940 | userdef = 1; | ||
941 | return 0; | ||
942 | } | ||
943 | |||
944 | oldp = p; | ||
945 | mem_size = memparse(p, &p); | ||
946 | if (p == oldp) | ||
947 | return -EINVAL; | ||
948 | |||
949 | userdef = 1; | ||
950 | if (*p == '@') { | ||
951 | start_at = memparse(p+1, &p); | ||
952 | add_memory_region(start_at, mem_size, E820_RAM); | ||
953 | } else if (*p == '#') { | ||
954 | start_at = memparse(p+1, &p); | ||
955 | add_memory_region(start_at, mem_size, E820_ACPI); | ||
956 | } else if (*p == '$') { | ||
957 | start_at = memparse(p+1, &p); | ||
958 | add_memory_region(start_at, mem_size, E820_RESERVED); | ||
959 | } else { | ||
960 | end_user_pfn = (mem_size >> PAGE_SHIFT); | ||
961 | } | ||
962 | return *p == '\0' ? 0 : -EINVAL; | ||
963 | } | ||
964 | early_param("memmap", parse_memmap_opt); | ||
965 | |||
966 | void __init finish_e820_parsing(void) | ||
967 | { | ||
968 | if (userdef) { | ||
969 | int nr = e820.nr_map; | ||
970 | |||
971 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0) | ||
972 | early_panic("Invalid user supplied memory map"); | ||
973 | e820.nr_map = nr; | ||
974 | |||
975 | printk(KERN_INFO "user-defined physical RAM map:\n"); | ||
976 | e820_print_map("user"); | ||
977 | } | ||
978 | } | ||