diff options
| author | Steve French <sfrench@us.ibm.com> | 2006-03-03 11:27:25 +0000 | 
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2006-03-03 11:27:25 +0000 | 
| commit | c6ee60b7c8bbc78e3b1776b2820a7e7f95f8996a (patch) | |
| tree | 99b48ef0f5217fddc0aa897d9e60d95ace7da6ff /arch/powerpc/kernel/prom.c | |
| parent | 13298defe5323c7fdcac268f588d8d1090758fb8 (diff) | |
| parent | c499ec24c31edf270e777a868ffd0daddcfe7ebd (diff) | |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
| -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 294832a7e0a..6dbd2172677 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -816,8 +816,6 @@ void __init unflatten_device_tree(void)  {  	unsigned long start, mem, size;  	struct device_node **allnextp = &allnodes; -	char *p = NULL; -	int l = 0;  	DBG(" -> unflatten_device_tree()\n"); @@ -857,19 +855,6 @@ void __init unflatten_device_tree(void)  	if (of_chosen == NULL)  		of_chosen = of_find_node_by_path("/chosen@0"); -	/* Retreive command line */ -	if (of_chosen != NULL) { -		p = (char *)get_property(of_chosen, "bootargs", &l); -		if (p != NULL && l > 0) -			strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE)); -	} -#ifdef CONFIG_CMDLINE -	if (l == 0 || (l == 1 && (*p) == 0)) -		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#endif /* CONFIG_CMDLINE */ - -	DBG("Command line is: %s\n", cmd_line); -  	DBG(" <- unflatten_device_tree()\n");  } @@ -940,6 +925,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node,  {  	u32 *prop;  	unsigned long *lprop; +	unsigned long l; +	char *p;  	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); @@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_chosen(unsigned long node,                 crashk_res.end = crashk_res.start + *lprop - 1;  #endif +	/* Retreive command line */ + 	p = of_get_flat_dt_prop(node, "bootargs", &l); +	if (p != NULL && l > 0) +		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); + +#ifdef CONFIG_CMDLINE +	if (l == 0 || (l == 1 && (*p) == 0)) +		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#endif /* CONFIG_CMDLINE */ + +	DBG("Command line is: %s\n", cmd_line); + +	if (strstr(cmd_line, "mem=")) { +		char *p, *q; +		unsigned long maxmem = 0; + +		for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { +			q = p + 4; +			if (p > cmd_line && p[-1] != ' ') +				continue; +			maxmem = simple_strtoul(q, &q, 0); +			if (*q == 'k' || *q == 'K') { +				maxmem <<= 10; +				++q; +			} else if (*q == 'm' || *q == 'M') { +				maxmem <<= 20; +				++q; +			} else if (*q == 'g' || *q == 'G') { +				maxmem <<= 30; +				++q; +			} +		} +		memory_limit = maxmem; +	} +  	/* break now */  	return 1;  } @@ -1124,7 +1146,7 @@ static void __init early_reserve_mem(void)  			size_32 = *(reserve_map_32++);  			if (size_32 == 0)  				break; -			DBG("reserving: %lx -> %lx\n", base_32, size_32); +			DBG("reserving: %x -> %x\n", base_32, size_32);  			lmb_reserve(base_32, size_32);  		}  		return;  | 
