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)
7 #include <linux/config.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/console.h>
13 #include <linux/sched.h>
14 #include <linux/tty.h>
16 #include <asm/addrspace.h>
17 #include <asm/bcache.h>
18 #include <asm/bootinfo.h>
20 #include <asm/reboot.h>
21 #include <asm/ds1286.h>
23 #include <asm/gdb-stub.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>
32 extern void rs_kgdb_hook(int);
33 extern void breakpoint(void);
34 static int remote_debug = 0;
37 #if defined(CONFIG_IP22_SERIAL_CONSOLE) || defined(CONFIG_ARC_CONSOLE)
38 extern void console_setup(char *);
41 extern struct rtc_ops ip22_rtc_ops;
43 #define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
45 unsigned long sgi_gfxaddr;
48 * Stop-A is originally a Sun thing that isn't standard on IP22 so to avoid
49 * accidents it's disabled by default on IP22.
51 * FIXME: provide a mechanism to change the value of stop_a_enabled.
56 void ip22_do_break(void)
62 ArcEnterInteractiveMode();
65 extern void ip22_be_init(void) __init;
66 extern void ip22_time_init(void) __init;
68 void __init ip22_setup(void)
75 board_be_init = ip22_be_init;
78 /* Init the INDY HPC I/O controller. Need to call this before
79 * fucking with the memory controller because it needs to know the
80 * boardID and whether this is a Guiness or a FullHouse machine.
84 /* Init INDY memory controller. */
87 #ifdef CONFIG_BOARD_SCACHE
88 /* Now enable boardcaches, if any. */
94 /* Set the IO space to some sane value */
95 set_io_port_base (KSEG1ADDR (0x00080000));
97 /* ARCS console environment variable is set to "g?" for
98 * graphics console, it is set to "d" for the first serial
99 * line and "d2" for the second serial line.
101 ctype = ArcGetEnvironmentVariable("console");
102 if (ctype && *ctype == 'd') {
103 #ifdef CONFIG_IP22_SERIAL_CONSOLE
104 if (*(ctype + 1) == '2')
105 console_setup("ttyS1");
107 console_setup("ttyS0");
110 #ifdef CONFIG_ARC_CONSOLE
111 else if (!ctype || *ctype != 'g') {
112 /* Use ARC if we don't want serial ('d') or Newport ('g'). */
113 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
114 console_setup("arc");
119 kgdb_ttyd = prom_getcmdline();
120 if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
122 kgdb_ttyd += strlen("kgdb=ttyd");
123 if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
124 printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
125 ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
126 line = *kgdb_ttyd == '2' ? 0 : 1;
127 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
128 "session\n", line ? 1 : 2);
131 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
132 "session, please connect your debugger\n", line ? 1:2);
135 /* Breakpoints and stuff are in sgi_irq_setup() */
140 #ifdef CONFIG_SGI_NEWPORT_CONSOLE
141 if (ctype && *ctype == 'g'){
142 unsigned long *gfxinfo;
143 long (*__vec)(void) =
144 (void *) *(long *)(long)((PROMBLOCK)->pvector + 0x20);
146 gfxinfo = (unsigned long *)__vec();
147 sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
148 && gfxinfo[1] <= 0xc0000000)
149 ? gfxinfo[1] - 0xa0000000 : 0);
151 /* newport addresses? */
152 if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
153 conswitchp = &newport_con;
155 screen_info = (struct screen_info) {
156 0, 0, /* orig-x, orig-y */
158 0, /* orig_video_page */
159 0, /* orig_video_mode */
160 160, /* orig_video_cols */
161 0, 0, 0, /* unused, ega_bx, unused */
162 64, /* orig_video_lines */
163 0, /* orig_video_isVGA */
164 16 /* orig_video_points */
169 #ifdef CONFIG_DUMMY_CONSOLE
170 /* Either if newport console wasn't used or failed to initialize. */
171 #ifdef CONFIG_SGI_NEWPORT_CONSOLE
172 if(conswitchp != &newport_con)
174 conswitchp = &dummy_con;
177 rtc_ops = &ip22_rtc_ops;
178 #ifdef CONFIG_PSMOUSE
179 aux_device_present = 0xaa;