diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2006-02-24 11:54:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-24 17:34:50 -0500 |
commit | 329dda083e496bc5ffbb4b1973243bd8a9420e24 (patch) | |
tree | 03a2e4b1ac12275d2faa10009170c91b66618fcd /arch | |
parent | 4853a615bbfb5aae4c3e2203b4b2742c109784c9 (diff) |
[PATCH] powerpc: Fix mem= cmdline handling on arch/powerpc for !MULTIPLATFORM
mem= command line option was being ignored in arch/powerpc if we were not
a CONFIG_MULTIPLATFORM (which is handled via prom_init stub). The initial
command line extraction and parsing needed to be moved earlier in the boot
process and have code to actual parse mem= and do something about it.
Also, fixed a compile warning in the file.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 294832a7e0a6..6dbd21726770 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void) | |||
816 | { | 816 | { |
817 | unsigned long start, mem, size; | 817 | unsigned long start, mem, size; |
818 | struct device_node **allnextp = &allnodes; | 818 | struct device_node **allnextp = &allnodes; |
819 | char *p = NULL; | ||
820 | int l = 0; | ||
821 | 819 | ||
822 | DBG(" -> unflatten_device_tree()\n"); | 820 | DBG(" -> unflatten_device_tree()\n"); |
823 | 821 | ||
@@ -857,19 +855,6 @@ void __init unflatten_device_tree(void) | |||
857 | if (of_chosen == NULL) | 855 | if (of_chosen == NULL) |
858 | of_chosen = of_find_node_by_path("/chosen@0"); | 856 | of_chosen = of_find_node_by_path("/chosen@0"); |
859 | 857 | ||
860 | /* Retreive command line */ | ||
861 | if (of_chosen != NULL) { | ||
862 | p = (char *)get_property(of_chosen, "bootargs", &l); | ||
863 | if (p != NULL && l > 0) | ||
864 | strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE)); | ||
865 | } | ||
866 | #ifdef CONFIG_CMDLINE | ||
867 | if (l == 0 || (l == 1 && (*p) == 0)) | ||
868 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
869 | #endif /* CONFIG_CMDLINE */ | ||
870 | |||
871 | DBG("Command line is: %s\n", cmd_line); | ||
872 | |||
873 | DBG(" <- unflatten_device_tree()\n"); | 858 | DBG(" <- unflatten_device_tree()\n"); |
874 | } | 859 | } |
875 | 860 | ||
@@ -940,6 +925,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
940 | { | 925 | { |
941 | u32 *prop; | 926 | u32 *prop; |
942 | unsigned long *lprop; | 927 | unsigned long *lprop; |
928 | unsigned long l; | ||
929 | char *p; | ||
943 | 930 | ||
944 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); | 931 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); |
945 | 932 | ||
@@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
1004 | crashk_res.end = crashk_res.start + *lprop - 1; | 991 | crashk_res.end = crashk_res.start + *lprop - 1; |
1005 | #endif | 992 | #endif |
1006 | 993 | ||
994 | /* Retreive command line */ | ||
995 | p = of_get_flat_dt_prop(node, "bootargs", &l); | ||
996 | if (p != NULL && l > 0) | ||
997 | strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); | ||
998 | |||
999 | #ifdef CONFIG_CMDLINE | ||
1000 | if (l == 0 || (l == 1 && (*p) == 0)) | ||
1001 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
1002 | #endif /* CONFIG_CMDLINE */ | ||
1003 | |||
1004 | DBG("Command line is: %s\n", cmd_line); | ||
1005 | |||
1006 | if (strstr(cmd_line, "mem=")) { | ||
1007 | char *p, *q; | ||
1008 | unsigned long maxmem = 0; | ||
1009 | |||
1010 | for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { | ||
1011 | q = p + 4; | ||
1012 | if (p > cmd_line && p[-1] != ' ') | ||
1013 | continue; | ||
1014 | maxmem = simple_strtoul(q, &q, 0); | ||
1015 | if (*q == 'k' || *q == 'K') { | ||
1016 | maxmem <<= 10; | ||
1017 | ++q; | ||
1018 | } else if (*q == 'm' || *q == 'M') { | ||
1019 | maxmem <<= 20; | ||
1020 | ++q; | ||
1021 | } else if (*q == 'g' || *q == 'G') { | ||
1022 | maxmem <<= 30; | ||
1023 | ++q; | ||
1024 | } | ||
1025 | } | ||
1026 | memory_limit = maxmem; | ||
1027 | } | ||
1028 | |||
1007 | /* break now */ | 1029 | /* break now */ |
1008 | return 1; | 1030 | return 1; |
1009 | } | 1031 | } |
@@ -1124,7 +1146,7 @@ static void __init early_reserve_mem(void) | |||
1124 | size_32 = *(reserve_map_32++); | 1146 | size_32 = *(reserve_map_32++); |
1125 | if (size_32 == 0) | 1147 | if (size_32 == 0) |
1126 | break; | 1148 | break; |
1127 | DBG("reserving: %lx -> %lx\n", base_32, size_32); | 1149 | DBG("reserving: %x -> %x\n", base_32, size_32); |
1128 | lmb_reserve(base_32, size_32); | 1150 | lmb_reserve(base_32, size_32); |
1129 | } | 1151 | } |
1130 | return; | 1152 | return; |