aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>2007-10-15 06:06:20 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-15 14:38:24 -0400
commit2de889235d0e820a6b256b834ee6a64e12fede08 (patch)
treecb7b58e6ed74f2c6fe8479acb28ff9c50781a2d6 /arch
parentc2af68e5f550a671ac9f67f566f04e1580a103a0 (diff)
update AU1000 get_ethernet_addr()
Update AU1000 get_ethernet_addr(). Three functions were brought together in one. Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/au1000/common/prom.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
index a8637cdb5b4b..5d6ddf1ed7a6 100644
--- a/arch/mips/au1000/common/prom.c
+++ b/arch/mips/au1000/common/prom.c
@@ -98,7 +98,7 @@ char *prom_getenv(char *envname)
98 return NULL; 98 return NULL;
99} 99}
100 100
101inline unsigned char str2hexnum(unsigned char c) 101static inline unsigned char str2hexnum(unsigned char c)
102{ 102{
103 if(c >= '0' && c <= '9') 103 if(c >= '0' && c <= '9')
104 return c - '0'; 104 return c - '0';
@@ -109,7 +109,7 @@ inline unsigned char str2hexnum(unsigned char c)
109 return 0; /* foo */ 109 return 0; /* foo */
110} 110}
111 111
112inline void str2eaddr(unsigned char *ea, unsigned char *str) 112static inline void str2eaddr(unsigned char *ea, unsigned char *str)
113{ 113{
114 int i; 114 int i;
115 115
@@ -124,35 +124,29 @@ inline void str2eaddr(unsigned char *ea, unsigned char *str)
124 } 124 }
125} 125}
126 126
127int get_ethernet_addr(char *ethernet_addr) 127int prom_get_ethernet_addr(char *ethernet_addr)
128{ 128{
129 char *ethaddr_str; 129 char *ethaddr_str;
130 char *argptr;
130 131
131 ethaddr_str = prom_getenv("ethaddr"); 132 /* Check the environment variables first */
133 ethaddr_str = prom_getenv("ethaddr");
132 if (!ethaddr_str) { 134 if (!ethaddr_str) {
133 printk("ethaddr not set in boot prom\n"); 135 /* Check command line */
134 return -1; 136 argptr = prom_getcmdline();
135 } 137 ethaddr_str = strstr(argptr, "ethaddr=");
136 str2eaddr(ethernet_addr, ethaddr_str); 138 if (!ethaddr_str)
137 139 return -1;
138#if 0
139 {
140 int i;
141 140
142 printk("get_ethernet_addr: "); 141 ethaddr_str += strlen("ethaddr=");
143 for (i=0; i<5; i++)
144 printk("%02x:", (unsigned char)*(ethernet_addr+i));
145 printk("%02x\n", *(ethernet_addr+i));
146 } 142 }
147#endif 143
144 str2eaddr(ethernet_addr, ethaddr_str);
148 145
149 return 0; 146 return 0;
150} 147}
148EXPORT_SYMBOL(prom_get_ethernet_addr);
151 149
152void __init prom_free_prom_memory(void) 150void __init prom_free_prom_memory(void)
153{ 151{
154} 152}
155
156EXPORT_SYMBOL(prom_getcmdline);
157EXPORT_SYMBOL(get_ethernet_addr);
158EXPORT_SYMBOL(str2eaddr);