2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1995 Linus Torvalds
7 * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Ralf Baechle
8 * Copyright (C) 1996 Stoned Elipot
9 * Copyright (C) 1999 Silicon Graphics, Inc.
11 #include <linux/config.h>
12 #include <linux/errno.h>
13 #include <linux/init.h>
14 #include <linux/sched.h>
15 #include <linux/kernel.h>
17 #include <linux/stddef.h>
18 #include <linux/string.h>
19 #include <linux/unistd.h>
20 #include <linux/ptrace.h>
21 #include <linux/malloc.h>
22 #include <linux/user.h>
23 #include <linux/utsname.h>
24 #include <linux/a.out.h>
25 #include <linux/tty.h>
26 #ifdef CONFIG_BLK_DEV_RAM
27 #include <linux/blk.h>
31 #include <asm/bootinfo.h>
32 #include <asm/cachectl.h>
35 #include <asm/stackframe.h>
36 #include <asm/system.h>
37 #include <asm/pgalloc.h>
40 struct cpuinfo_mips cpu_data
[1];
44 struct screen_info screen_info
;
48 * Not all of the MIPS CPUs have the "wait" instruction available. This
49 * is set to true if it is available. The wait instruction stops the
50 * pipeline and reduces the power consumption of the CPU very much.
55 * Do we have a cyclecounter available?
57 char cyclecounter_available
;
60 * Set if box has EISA slots.
64 #ifdef CONFIG_BLK_DEV_FD
65 extern struct fd_ops no_fd_ops
;
66 struct fd_ops
*fd_ops
;
69 #ifdef CONFIG_BLK_DEV_IDE
70 extern struct ide_ops no_ide_ops
;
71 struct ide_ops
*ide_ops
;
74 extern struct rtc_ops no_rtc_ops
;
75 struct rtc_ops
*rtc_ops
;
77 extern struct kbd_ops no_kbd_ops
;
78 struct kbd_ops
*kbd_ops
;
83 * These are initialized so they are in the .data section
85 unsigned long mips_memory_upper
= KSEG0
;
86 unsigned long mips_cputype
= CPU_UNKNOWN
;
87 unsigned long mips_machtype
= MACH_UNKNOWN
;
88 unsigned long mips_machgroup
= MACH_GROUP_UNKNOWN
;
90 unsigned char aux_device_present
;
93 extern void load_mmu(void);
95 static char command_line
[CL_SIZE
] = { 0, };
96 char saved_command_line
[CL_SIZE
];
97 extern char arcs_cmdline
[CL_SIZE
];
100 * mips_io_port_base is the begin of the address space to which x86 style
101 * I/O ports are mapped.
103 #ifdef CONFIG_SGI_IP27
104 /* XXX Origin garbage has no business in this file */
105 unsigned long mips_io_port_base
= IO_BASE
;
108 extern void ip22_setup(void);
109 extern void ip27_setup(void);
111 static inline void cpu_probe(void)
113 unsigned int prid
= read_32bit_cp0_register(CP0_PRID
);
115 switch(prid
& 0xff00) {
117 if((prid
& 0xff) == PRID_REV_R4400
)
118 mips_cputype
= CPU_R4400SC
;
120 mips_cputype
= CPU_R4000SC
;
123 mips_cputype
= CPU_R4600
;
126 mips_cputype
= CPU_R4700
;
129 mips_cputype
= CPU_R5000
;
131 case PRID_IMP_NEVADA
:
132 mips_cputype
= CPU_NEVADA
;
135 mips_cputype
= CPU_R8000
;
137 case PRID_IMP_R10000
:
138 mips_cputype
= CPU_R10000
;
141 mips_cputype
= CPU_UNKNOWN
;
145 void __init
setup_arch(char **cmdline_p
)
147 #ifdef CONFIG_BLK_DEV_INITRD
149 unsigned long *initrd_header
;
152 pmd_t
*pmd
= kpmdtbl
;
158 #ifdef CONFIG_SGI_IP22
161 #ifdef CONFIG_SGI_IP27
165 strncpy (command_line
, arcs_cmdline
, CL_SIZE
);
166 memcpy(saved_command_line
, command_line
, CL_SIZE
);
167 saved_command_line
[CL_SIZE
-1] = '\0';
169 *cmdline_p
= command_line
;
171 #ifdef CONFIG_BLK_DEV_INITRD
172 #error "Initrd is broken, please fit it."
173 tmp
= (((unsigned long)&_end
+ PAGE_SIZE
-1) & PAGE_MASK
) - 8;
174 if (tmp
< (unsigned long)&_end
)
176 initrd_header
= (unsigned long *)tmp
;
177 if (initrd_header
[0] == 0x494E5244) {
178 initrd_start
= (unsigned long)&initrd_header
[2];
179 initrd_end
= initrd_start
+ initrd_header
[1];
180 initrd_below_start_ok
= 1;
181 if (initrd_end
> memory_end
) {
182 printk("initrd extends beyond end of memory "
183 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
184 initrd_end
,memory_end
);
187 *memory_start_p
= initrd_end
;
193 memset((void *)kptbl
, 0, PAGE_SIZE
<< KPTBL_PAGE_ORDER
);
194 memset((void *)kpmdtbl
, 0, PAGE_SIZE
);
195 pgd_set(swapper_pg_dir
, kpmdtbl
);
196 for (i
= 0; i
< (1 << KPTBL_PAGE_ORDER
); pmd
++,i
++,pte
+=PTRS_PER_PTE
)
197 pmd_val(*pmd
) = (unsigned long)pte
;