blob: 174f09e42f6bd06147b493b2203e2b0854ae11f7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * ip22-setup.c: SGI specific setup, including init of the feature struct.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
6 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#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>
16
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>
30
31unsigned long sgi_gfxaddr;
Ralf Baechle88eb4132007-08-22 16:29:56 +010032EXPORT_SYMBOL_GPL(sgi_gfxaddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
34/*
35 * Stop-A is originally a Sun thing that isn't standard on IP22 so to avoid
36 * accidents it's disabled by default on IP22.
37 *
38 * FIXME: provide a mechanism to change the value of stop_a_enabled.
39 */
40int stop_a_enabled;
41
42void ip22_do_break(void)
43{
44 if (!stop_a_enabled)
45 return;
46
47 printk("\n");
48 ArcEnterInteractiveMode();
49}
50
51EXPORT_SYMBOL(ip22_do_break);
52
53extern void ip22_be_init(void) __init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Ralf Baechle2925aba2006-06-18 01:32:22 +010055void __init plat_mem_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056{
57 char *ctype;
Ralf Baechlee9feeb22006-01-30 17:48:27 +000058 char *cserial;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60 board_be_init = ip22_be_init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
62 /* Init the INDY HPC I/O controller. Need to call this before
63 * fucking with the memory controller because it needs to know the
64 * boardID and whether this is a Guiness or a FullHouse machine.
65 */
66 sgihpc_init();
67
68 /* Init INDY memory controller. */
69 sgimc_init();
70
71#ifdef CONFIG_BOARD_SCACHE
72 /* Now enable boardcaches, if any. */
73 indy_sc_init();
74#endif
75
76 /* Set EISA IO port base for Indigo2
77 * ioremap cannot fail */
78 set_io_port_base((unsigned long)ioremap(0x00080000,
79 0x1fffffff - 0x00080000));
80 /* ARCS console environment variable is set to "g?" for
81 * graphics console, it is set to "d" for the first serial
82 * line and "d2" for the second serial line.
Ralf Baechlee9feeb22006-01-30 17:48:27 +000083 *
84 * Need to check if the case is 'g' but no keyboard:
85 * (ConsoleIn/Out = serial)
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 */
87 ctype = ArcGetEnvironmentVariable("console");
Ralf Baechlee9feeb22006-01-30 17:48:27 +000088 cserial = ArcGetEnvironmentVariable("ConsoleOut");
89
90 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 static char options[8];
92 char *baud = ArcGetEnvironmentVariable("dbaud");
93 if (baud)
94 strcpy(options, baud);
95 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
96 baud ? options : NULL);
97 } else if (!ctype || *ctype != 'g') {
Ralf Baechlee9feeb22006-01-30 17:48:27 +000098 /* Use ARC if we don't want serial ('d') or graphics ('g'). */
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
100 add_preferred_console("arc", 0, NULL);
101 }
102
103#ifdef CONFIG_KGDB
104 {
105 char *kgdb_ttyd = prom_getcmdline();
106
107 if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
108 int line;
109 kgdb_ttyd += strlen("kgdb=ttyd");
110 if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
111 printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
112 ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
113 line = *kgdb_ttyd == '2' ? 0 : 1;
114 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
115 "session\n", line ? 1 : 2);
116 rs_kgdb_hook(line);
117
118 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
119 "session, please connect your debugger\n", line ? 1:2);
120
121 kgdb_enabled = 1;
122 /* Breakpoints and stuff are in sgi_irq_setup() */
123 }
124 }
125#endif
126
127#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
128 {
129 ULONG *gfxinfo;
130 ULONG * (*__vec)(void) = (void *) (long)
131 *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
132
133 gfxinfo = __vec();
134 sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
135 && gfxinfo[1] <= 0xc0000000)
136 ? gfxinfo[1] - 0xa0000000 : 0);
137
138 /* newport addresses? */
139 if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
140 conswitchp = &newport_con;
141 }
142 }
143#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144}