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