diff options
author | Domen Puncer <domen.puncer@ultra.si> | 2006-07-03 08:17:09 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-07-13 21:26:02 +0100 |
commit | 6fe725c01c0c547c4287ba3de5ebc8f884178409 (patch) | |
tree | f398808f0e9503e341d7e00523065985d78adf38 /arch/mips/au1000 | |
parent | c36cd4bab5084798b401d529129a950f4a48662d (diff) | |
download | kernel_samsung_aries-6fe725c01c0c547c4287ba3de5ebc8f884178409.zip kernel_samsung_aries-6fe725c01c0c547c4287ba3de5ebc8f884178409.tar.gz kernel_samsung_aries-6fe725c01c0c547c4287ba3de5ebc8f884178409.tar.bz2 |
[MIPS] au1xxx: Support both YAMON and U-Boot
Signed-off-by: Domen Puncer <domen.puncer@ultra.si>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/au1000')
-rw-r--r-- | arch/mips/au1000/common/prom.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c index ae7d8c5..b4b010a 100644 --- a/arch/mips/au1000/common/prom.c +++ b/arch/mips/au1000/common/prom.c @@ -1,7 +1,7 @@ /* * * 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. * Author: MontaVista Software, Inc. @@ -46,12 +46,6 @@ extern int prom_argc; extern char **prom_argv, **prom_envp; -typedef struct -{ - char *name; - char *val; -} t_env_var; - char * prom_getcmdline(void) { @@ -84,13 +78,21 @@ char *prom_getenv(char *envname) { /* * 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; - - while (env->name) { - if (strcmp(envname, env->name) == 0) - return env->val; + char **env = prom_envp; + int i = strlen(envname); + int yamon = (*env && strchr(*env, '=') == NULL); + + 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++; } return NULL; |