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>
38 #include <linux/sched.h>
40 #include <asm/addrspace.h>
41 #include <asm/bootinfo.h>
42 #include <asm/gt64120/gt64120.h>
45 /* Environment variable */
53 char **prom_argv, **prom_envp;
54 char arcs_cmdline[CL_SIZE];
58 char * __init prom_getcmdline(void)
60 return &(arcs_cmdline[0]);
63 void prom_free_prom_memory (void)
67 void __init prom_init_cmdline(void)
72 actr = 1; /* Always ignore argv[0] */
74 cp = &(arcs_cmdline[0]);
75 while(actr < prom_argc) {
76 strcpy(cp, prom_argv[actr]);
77 cp += strlen(prom_argv[actr]);
81 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
86 char *prom_getenv(char *envname)
89 * Return a pointer to the given environment variable.
92 t_env_var *env = (t_env_var *) prom_envp;
98 if (strncmp(envname, env->name, i) == 0) {
106 static inline unsigned char str2hexnum(unsigned char c)
108 if (c >= '0' && c <= '9')
110 if (c >= 'a' && c <= 'f')
115 static inline void str2eaddr(unsigned char *ea, unsigned char *str)
119 for (i = 0; i < 6; i++) {
122 if ((*str == '.') || (*str == ':'))
124 num = str2hexnum(*str++) << 4;
125 num |= (str2hexnum(*str++));
130 int get_ethernet_addr(char *ethernet_addr)
134 ethaddr_str = prom_getenv("ethaddr");
136 printk("ethaddr not set in boot prom\n");
139 str2eaddr(ethernet_addr, ethaddr_str);
141 if (init_debug > 1) {
143 printk("get_ethernet_addr: ");
144 for (i = 0; i < 5; i++)
146 (unsigned char) *(ethernet_addr + i));
147 printk("%02x\n", *(ethernet_addr + i));
153 const char *get_system_type(void)
155 return "Galileo EV96100";
158 void __init prom_init(int argc, char **argv, char **envp, int *prom_vec)
160 volatile unsigned char *uart;
167 mips_machgroup = MACH_GROUP_GALILEO;
168 mips_machtype = MACH_EV96100;
172 /* 32 MB upgradable */
173 add_memory_region(0, 32 << 20, BOOT_MEM_RAM);