[MIPS] Au1xx0: fix prom_getenv() to handle YAMON style environment Alchemy boards use YAMON which passes the environment variables as the tuples of strings (the name followed by the value) unlike PMON which passes "name=<val>" strings. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by Sergei Shtylyov and committed by Ralf Baechle fef6d6a7 6ebba0e2

+9 -15
+9 -15
arch/mips/au1000/common/prom.c
··· 1 /* 2 * 3 * BRIEF MODULE DESCRIPTION 4 - * PROM library initialisation code, assuming a version of 5 - * pmon is the boot code. 6 * 7 - * Copyright 2000,2001 MontaVista Software Inc. 8 * Author: MontaVista Software, Inc. 9 * ppopov@mvista.com or source@mvista.com 10 * ··· 48 49 typedef struct 50 { 51 - char *name; 52 - /* char *val; */ 53 - }t_env_var; 54 55 56 char * prom_getcmdline(void) ··· 84 { 85 /* 86 * Return a pointer to the given environment variable. 87 - * Environment variables are stored in the form of "memsize=64". 88 */ 89 90 t_env_var *env = (t_env_var *)prom_envp; 91 - int i; 92 93 - i = strlen(envname); 94 - 95 - while(env->name) { 96 - if(strncmp(envname, env->name, i) == 0) { 97 - return(env->name + strlen(envname) + 1); 98 - } 99 env++; 100 } 101 - return(NULL); 102 } 103 104 inline unsigned char str2hexnum(unsigned char c)
··· 1 /* 2 * 3 * BRIEF MODULE DESCRIPTION 4 + * PROM library initialisation code, assuming YAMON is the boot loader. 5 * 6 + * Copyright 2000, 2001, 2006 MontaVista Software Inc. 7 * Author: MontaVista Software, Inc. 8 * ppopov@mvista.com or source@mvista.com 9 * ··· 49 50 typedef struct 51 { 52 + char *name; 53 + char *val; 54 + } t_env_var; 55 56 57 char * prom_getcmdline(void) ··· 85 { 86 /* 87 * Return a pointer to the given environment variable. 88 */ 89 90 t_env_var *env = (t_env_var *)prom_envp; 91 92 + while (env->name) { 93 + if (strcmp(envname, env->name) == 0) 94 + return env->val; 95 env++; 96 } 97 + return NULL; 98 } 99 100 inline unsigned char str2hexnum(unsigned char c)