Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fef6d6a7 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Ralf Baechle
Browse files

[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: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 6ebba0e2
Loading
Loading
Loading
Loading
+9 −15
Original line number Original line Diff line number Diff line
/*
/*
 *
 *
 * BRIEF MODULE DESCRIPTION
 * BRIEF MODULE DESCRIPTION
 *    PROM library initialisation code, assuming a version of
 *    PROM library initialisation code, assuming YAMON is the boot loader.
 *    pmon is the boot code.
 *
 *
 * Copyright 2000,2001 MontaVista Software Inc.
 * Copyright 2000, 2001, 2006 MontaVista Software Inc.
 * Author: MontaVista Software, Inc.
 * Author: MontaVista Software, Inc.
 *         	ppopov@mvista.com or source@mvista.com
 *         	ppopov@mvista.com or source@mvista.com
 *
 *
@@ -50,7 +49,7 @@ extern char **prom_argv, **prom_envp;
typedef struct
typedef struct
{
{
	char *name;
	char *name;
/*    char *val; */
	char *val;
} t_env_var;
} t_env_var;




@@ -85,21 +84,16 @@ char *prom_getenv(char *envname)
{
{
	/*
	/*
	 * Return a pointer to the given environment variable.
	 * 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;
	t_env_var *env = (t_env_var *)prom_envp;
	int i;

	i = strlen(envname);


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


inline unsigned char str2hexnum(unsigned char c)
inline unsigned char str2hexnum(unsigned char c)