public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] param: Adapt MN10300 to the new parameter handling regime
@ 2008-12-03 16:32 David Howells
  2008-12-03 16:32 ` [PATCH 2/3] [PATCH] param: Stop gcc from inlining empty weak functions David Howells
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David Howells @ 2008-12-03 16:32 UTC (permalink / raw)
  To: rusty; +Cc: dhowells, linux-kernel

Make MN10300 use the new core parameter code.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mn10300/kernel/setup.c |   50 +++++++++++++++----------------------------
 1 files changed, 18 insertions(+), 32 deletions(-)


diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index e8c5d0b..310d542 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -60,6 +60,7 @@ static struct resource data_resource = {
 static unsigned long __initdata phys_memory_base;
 static unsigned long __initdata phys_memory_end;
 static unsigned long __initdata memory_end;
+static unsigned long __initdata memory_param;
 unsigned long memory_size;
 
 struct thread_info *__current_ti = &init_thread_union.thread_info;
@@ -79,41 +80,17 @@ void __init arch_get_boot_command_line(void)
 }
 
 /*
- * FIXME: use core_param
+ * handle a specific memory limit handed over the kernel command line
  */
-static void __init parse_mem_cmdline(void)
+static int __init mem_parameter(char *data)
 {
-	char *from, *to, c;
+	if (!data || !*data)
+		return 0;
 
-	/* see if there's an explicit memory size option */
-	from = redboot_command_line;
-	to = redboot_command_line;
-	c = ' ';
-
-	for (;;) {
-		if (c == ' ' && !memcmp(from, "mem=", 4)) {
-			if (to != redboot_command_line)
-				to--;
-			memory_size = memparse(from + 4, &from);
-		}
-
-		c = *(from++);
-		if (!c)
-			break;
-
-		*(to++) = c;
-	}
-
-	*to = '\0';
-
-	if (memory_size == 0)
-		panic("Memory size not known\n");
-
-	memory_end = (unsigned long) CONFIG_KERNEL_RAM_BASE_ADDRESS +
-		memory_size;
-	if (memory_end > phys_memory_end)
-		memory_end = phys_memory_end;
+	memory_param = memparse(data, NULL);
+	return 0;
 }
+early_param("mem", mem_parameter);
 
 /*
  * architecture specific setup
@@ -125,7 +102,6 @@ void __init setup_arch(void)
 
 	cpu_init();
 	unit_setup();
-	parse_mem_cmdline();
 
 	init_mm.start_code = (unsigned long)&_text;
 	init_mm.end_code = (unsigned long) &_etext;
@@ -223,6 +199,16 @@ void __init cpu_init(void)
 
 	phys_memory_end = phys_memory_base + memory_size;
 
+	if (memory_param)
+		memory_size = memory_param;
+	if (memory_size == 0)
+		panic("Memory size not known\n");
+
+	memory_end = (unsigned long) CONFIG_KERNEL_RAM_BASE_ADDRESS +
+		memory_size;
+	if (memory_end > phys_memory_end)
+		memory_end = phys_memory_end;
+
 #ifdef CONFIG_FPU
 	fpu_init_state();
 #endif


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-10 10:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 16:32 [PATCH 1/3] param: Adapt MN10300 to the new parameter handling regime David Howells
2008-12-03 16:32 ` [PATCH 2/3] [PATCH] param: Stop gcc from inlining empty weak functions David Howells
2008-12-05  8:28   ` Rusty Russell
2008-12-05 12:02     ` David Howells
2008-12-03 16:32 ` [PATCH 3/3] [PATCH] param: Adapt FRV to the new parameter handling regime David Howells
2008-12-05  8:25 ` [PATCH 1/3] param: Adapt MN10300 " Rusty Russell
2008-12-05 11:58   ` David Howells
2008-12-05 12:55     ` Rusty Russell
2008-12-05 13:07       ` David Howells
2008-12-07  9:21       ` Rusty Russell
2008-12-10 10:39         ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox