Commit 6fe725c0 authored by Domen Puncer's avatar Domen Puncer Committed by Ralf Baechle

[MIPS] au1xxx: Support both YAMON and U-Boot

Signed-off-by: default avatarDomen Puncer <domen.puncer@ultra.si>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c36cd4ba
/* /*
* *
* BRIEF MODULE DESCRIPTION * BRIEF MODULE DESCRIPTION
* PROM library initialisation code, assuming YAMON is the boot loader. * PROM library initialisation code, supports YAMON and U-Boot.
* *
* Copyright 2000, 2001, 2006 MontaVista Software Inc. * Copyright 2000, 2001, 2006 MontaVista Software Inc.
* Author: MontaVista Software, Inc. * Author: MontaVista Software, Inc.
...@@ -46,12 +46,6 @@ ...@@ -46,12 +46,6 @@
extern int prom_argc; extern int prom_argc;
extern char **prom_argv, **prom_envp; extern char **prom_argv, **prom_envp;
typedef struct
{
char *name;
char *val;
} t_env_var;
char * prom_getcmdline(void) char * prom_getcmdline(void)
{ {
...@@ -84,13 +78,21 @@ char *prom_getenv(char *envname) ...@@ -84,13 +78,21 @@ char *prom_getenv(char *envname)
{ {
/* /*
* Return a pointer to the given environment variable. * Return a pointer to the given environment variable.
* YAMON uses "name", "value" pairs, while U-Boot uses "name=value".
*/ */
t_env_var *env = (t_env_var *)prom_envp; char **env = prom_envp;
int i = strlen(envname);
while (env->name) { int yamon = (*env && strchr(*env, '=') == NULL);
if (strcmp(envname, env->name) == 0)
return env->val; while (*env) {
if (yamon) {
if (strcmp(envname, *env++) == 0)
return *env;
} else {
if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=')
return *env + i + 1;
}
env++; env++;
} }
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment