patch-2.4.19 linux-2.4.19/arch/mips/au1000/common/prom.c
Next file: linux-2.4.19/arch/mips/au1000/common/reset.c
Previous file: linux-2.4.19/arch/mips/au1000/common/power.c
Back to the patch index
Back to the overall index
- Lines: 108
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/arch/mips/au1000/common/prom.c
- Orig date:
Sun Sep 9 10:43:01 2001
diff -urN linux-2.4.18/arch/mips/au1000/common/prom.c linux-2.4.19/arch/mips/au1000/common/prom.c
@@ -4,7 +4,7 @@
* PROM library initialisation code, assuming a version of
* pmon is the boot code.
*
- * Copyright 2000 MontaVista Software Inc.
+ * Copyright 2000,2001 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* ppopov@mvista.com or source@mvista.com
*
@@ -35,7 +35,7 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <linux/config.h>
+#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/string.h>
@@ -44,22 +44,23 @@
/* #define DEBUG_CMDLINE */
-char arcs_cmdline[COMMAND_LINE_SIZE];
-int prom_argc;
-char **prom_argv, **prom_envp;
+char arcs_cmdline[CL_SIZE];
+extern int prom_argc;
+extern char **prom_argv, **prom_envp;
-typedef struct {
- char *name;
-/* char *val; */
-} t_env_var;
+typedef struct
+{
+ char *name;
+/* char *val; */
+}t_env_var;
-char * __init prom_getcmdline(void)
+char * prom_getcmdline(void)
{
return &(arcs_cmdline[0]);
}
-void __init prom_init_cmdline(void)
+void prom_init_cmdline(void)
{
char *cp;
int actr;
@@ -101,7 +102,7 @@
return(NULL);
}
-static inline unsigned char str2hexnum(unsigned char c)
+inline unsigned char str2hexnum(unsigned char c)
{
if(c >= '0' && c <= '9')
return c - '0';
@@ -110,11 +111,43 @@
return 0; /* foo */
}
-int __init page_is_ram(unsigned long pagenr)
+inline void str2eaddr(unsigned char *ea, unsigned char *str)
{
- return 1;
-}
+ int i;
-void prom_free_prom_memory (void)
+ for(i = 0; i < 6; i++) {
+ unsigned char num;
+
+ if((*str == '.') || (*str == ':'))
+ str++;
+ num = str2hexnum(*str++) << 4;
+ num |= (str2hexnum(*str++));
+ ea[i] = num;
+ }
+}
+
+int get_ethernet_addr(char *ethernet_addr)
{
+ int i;
+ char *ethaddr_str;
+
+ ethaddr_str = prom_getenv("ethaddr");
+ if (!ethaddr_str) {
+ printk("ethaddr not set in boot prom\n");
+ return -1;
+ }
+ str2eaddr(ethernet_addr, ethaddr_str);
+
+#if 0
+ printk("get_ethernet_addr: ");
+ for (i=0; i<5; i++)
+ printk("%02x:", (unsigned char)*(ethernet_addr+i));
+ printk("%02x\n", *(ethernet_addr+i));
+#endif
+
+ return 0;
}
+
+void prom_free_prom_memory (void) {}
+EXPORT_SYMBOL(prom_getcmdline);
+EXPORT_SYMBOL(get_ethernet_addr);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)