Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Sergei Shtylylov <sshtylyov@ru.mvista.com>
To: linux-mips@linux-mips.org
Cc: Freddy Spierenburg <freddy@dusktilldawn.nl>,
	Jordan Crouse <jordan.crouse@amd.com>,
	Manish Lachwani <mlachwani@mvista.com>
Subject: [PATCH] Au1xx0: fix prom_getenv() to handle YAMON style environment
Date: Mon, 27 Mar 2006 22:44:41 +0400	[thread overview]
Message-ID: <44283299.1080308@ru.mvista.com> (raw)
In-Reply-To: <4427A31F.9080801@ru.mvista.com>

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

Hello.

     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.

WBR, Sergei



[-- Attachment #2: Au1xx0-fix-prom_getenv.patch --]
[-- Type: text/plain, Size: 1383 bytes --]

diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index 9c171af..ae7d8c5 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -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
  *
@@ -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)
@@ -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)



  reply	other threads:[~2006-03-27 18:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-27  7:43 [PATCH] small time list process error in prom_getenv() Freddy Spierenburg
2006-03-27  8:32 ` Sergei Shtylylov
2006-03-27 18:44   ` Sergei Shtylylov [this message]
2006-03-28 14:54   ` [PATCH] rtc.h: fixes to make genrtc.c compilable Ralf Rösch
2006-03-28 15:12   ` Ralf Rösch
2006-03-28 15:14     ` Sergei Shtylylov
2006-03-30 15:02   ` [PATCH] small time list process error in prom_getenv() Sergei Shtylyov
2006-03-31 21:20   ` [PATCH] Au1550: make OSS drivers look pretty on loading Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44283299.1080308@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=freddy@dusktilldawn.nl \
    --cc=jordan.crouse@amd.com \
    --cc=linux-mips@linux-mips.org \
    --cc=mlachwani@mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox