x86: cpa self-test, WARN_ON()
[wrt350n-kernel.git] / arch / mips / sgi-ip22 / ip22-setup.c
blob5f389ee26fca034eb5c8f0cc6b961a15d9b3a6fe
1 /*
2 * ip22-setup.c: SGI specific setup, including init of the feature struct.
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
6 */
7 #include <linux/ds1286.h>
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/kdev_t.h>
11 #include <linux/types.h>
12 #include <linux/module.h>
13 #include <linux/console.h>
14 #include <linux/sched.h>
15 #include <linux/tty.h>
17 #include <asm/addrspace.h>
18 #include <asm/bcache.h>
19 #include <asm/bootinfo.h>
20 #include <asm/irq.h>
21 #include <asm/reboot.h>
22 #include <asm/time.h>
23 #include <asm/gdb-stub.h>
24 #include <asm/io.h>
25 #include <asm/traps.h>
26 #include <asm/sgialib.h>
27 #include <asm/sgi/mc.h>
28 #include <asm/sgi/hpc3.h>
29 #include <asm/sgi/ip22.h>
31 unsigned long sgi_gfxaddr;
32 EXPORT_SYMBOL_GPL(sgi_gfxaddr);
34 extern void ip22_be_init(void) __init;
36 void __init plat_mem_setup(void)
38 char *ctype;
39 char *cserial;
41 board_be_init = ip22_be_init;
43 /* Init the INDY HPC I/O controller. Need to call this before
44 * fucking with the memory controller because it needs to know the
45 * boardID and whether this is a Guiness or a FullHouse machine.
47 sgihpc_init();
49 /* Init INDY memory controller. */
50 sgimc_init();
52 #ifdef CONFIG_BOARD_SCACHE
53 /* Now enable boardcaches, if any. */
54 indy_sc_init();
55 #endif
57 /* Set EISA IO port base for Indigo2
58 * ioremap cannot fail */
59 set_io_port_base((unsigned long)ioremap(0x00080000,
60 0x1fffffff - 0x00080000));
61 /* ARCS console environment variable is set to "g?" for
62 * graphics console, it is set to "d" for the first serial
63 * line and "d2" for the second serial line.
65 * Need to check if the case is 'g' but no keyboard:
66 * (ConsoleIn/Out = serial)
68 ctype = ArcGetEnvironmentVariable("console");
69 cserial = ArcGetEnvironmentVariable("ConsoleOut");
71 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
72 static char options[8];
73 char *baud = ArcGetEnvironmentVariable("dbaud");
74 if (baud)
75 strcpy(options, baud);
76 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
77 baud ? options : NULL);
78 } else if (!ctype || *ctype != 'g') {
79 /* Use ARC if we don't want serial ('d') or graphics ('g'). */
80 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
81 add_preferred_console("arc", 0, NULL);
84 #ifdef CONFIG_KGDB
86 char *kgdb_ttyd = prom_getcmdline();
88 if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
89 int line;
90 kgdb_ttyd += strlen("kgdb=ttyd");
91 if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
92 printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
93 ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
94 line = *kgdb_ttyd == '2' ? 0 : 1;
95 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
96 "session\n", line ? 1 : 2);
97 rs_kgdb_hook(line);
99 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
100 "session, please connect your debugger\n", line ? 1:2);
102 kgdb_enabled = 1;
103 /* Breakpoints and stuff are in sgi_irq_setup() */
106 #endif
108 #if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
110 ULONG *gfxinfo;
111 ULONG * (*__vec)(void) = (void *) (long)
112 *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
114 gfxinfo = __vec();
115 sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
116 && gfxinfo[1] <= 0xc0000000)
117 ? gfxinfo[1] - 0xa0000000 : 0);
119 /* newport addresses? */
120 if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
121 conswitchp = &newport_con;
124 #endif