2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
6 * This file was derived from Carsten Langgaard's
7 * arch/mips/mips-boards/generic/generic.c
9 * Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 #include <linux/init.h>
34 #include <linux/sched.h>
35 #include <linux/bootmem.h>
36 #include <linux/string.h>
37 #include <linux/kernel.h>
39 #include <asm/addrspace.h>
40 #include <asm/bootinfo.h>
41 #include <asm/gt64120.h>
44 /* Environment variable */
52 char **prom_argv
, **prom_envp
;
56 char * __init
prom_getcmdline(void)
58 return &(arcs_cmdline
[0]);
61 unsigned long __init
prom_free_prom_memory(void)
66 void __init
prom_init_cmdline(void)
71 actr
= 1; /* Always ignore argv[0] */
73 cp
= &(arcs_cmdline
[0]);
74 while(actr
< prom_argc
) {
75 strcpy(cp
, prom_argv
[actr
]);
76 cp
+= strlen(prom_argv
[actr
]);
80 if (cp
!= &(arcs_cmdline
[0])) /* get rid of trailing space */
85 char *prom_getenv(char *envname
)
88 * Return a pointer to the given environment variable.
91 t_env_var
*env
= (t_env_var
*) prom_envp
;
97 if (strncmp(envname
, env
->name
, i
) == 0) {
105 static inline unsigned char str2hexnum(unsigned char c
)
107 if (c
>= '0' && c
<= '9')
109 if (c
>= 'a' && c
<= 'f')
114 static inline void str2eaddr(unsigned char *ea
, unsigned char *str
)
118 for (i
= 0; i
< 6; i
++) {
121 if ((*str
== '.') || (*str
== ':'))
123 num
= str2hexnum(*str
++) << 4;
124 num
|= (str2hexnum(*str
++));
129 int get_ethernet_addr(char *ethernet_addr
)
133 ethaddr_str
= prom_getenv("ethaddr");
135 printk("ethaddr not set in boot prom\n");
138 str2eaddr(ethernet_addr
, ethaddr_str
);
140 if (init_debug
> 1) {
142 printk("get_ethernet_addr: ");
143 for (i
= 0; i
< 5; i
++)
145 (unsigned char) *(ethernet_addr
+ i
));
146 printk("%02x\n", *(ethernet_addr
+ i
));
152 const char *get_system_type(void)
154 return "Galileo EV96100";
157 void __init
prom_init(void)
159 volatile unsigned char *uart
;
163 prom_argv
= (char **) fw_arg1
;
164 prom_envp
= (char **) fw_arg2
;
166 mips_machgroup
= MACH_GROUP_GALILEO
;
167 mips_machtype
= MACH_EV96100
;
171 /* 32 MB upgradable */
172 add_memory_region(0, 32 << 20, BOOT_MEM_RAM
);