Skip to content

Commit

Permalink
[MIPS] Au1xx0: fix prom_getenv() to handle YAMON style environment
Browse files Browse the repository at this point in the history
    
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>
  • Loading branch information
Sergei Shtylyov authored and Ralf Baechle committed Jun 5, 2006
1 parent 6ebba0e commit fef6d6a
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions arch/mips/au1000/common/prom.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
*
* BRIEF MODULE DESCRIPTION
* PROM library initialisation code, assuming a version of
* pmon is the boot code.
* PROM library initialisation code, assuming YAMON is the boot loader.
*
* Copyright 2000,2001 MontaVista Software Inc.
* Copyright 2000, 2001, 2006 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* ppopov@mvista.com or source@mvista.com
*
Expand Down Expand Up @@ -49,9 +48,9 @@ extern char **prom_argv, **prom_envp;

typedef struct
{
char *name;
/* char *val; */
}t_env_var;
char *name;
char *val;
} t_env_var;


char * prom_getcmdline(void)
Expand Down Expand Up @@ -85,21 +84,16 @@ char *prom_getenv(char *envname)
{
/*
* Return a pointer to the given environment variable.
* Environment variables are stored in the form of "memsize=64".
*/

t_env_var *env = (t_env_var *)prom_envp;
int i;

i = strlen(envname);

while(env->name) {
if(strncmp(envname, env->name, i) == 0) {
return(env->name + strlen(envname) + 1);
}
while (env->name) {
if (strcmp(envname, env->name) == 0)
return env->val;
env++;
}
return(NULL);
return NULL;
}

inline unsigned char str2hexnum(unsigned char c)
Expand Down

0 comments on commit fef6d6a

Please sign in to comment.