diff options
Diffstat (limited to 'arch/ppc/xmon/start.c')
-rw-r--r-- | arch/ppc/xmon/start.c | 169 |
1 files changed, 3 insertions, 166 deletions
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c index 484f5bb1aa3e..ff86b2d814cb 100644 --- a/arch/ppc/xmon/start.c +++ b/arch/ppc/xmon/start.c | |||
@@ -6,16 +6,11 @@ | |||
6 | #include <asm/machdep.h> | 6 | #include <asm/machdep.h> |
7 | #include <asm/io.h> | 7 | #include <asm/io.h> |
8 | #include <asm/page.h> | 8 | #include <asm/page.h> |
9 | #include <linux/adb.h> | ||
10 | #include <linux/pmu.h> | ||
11 | #include <linux/cuda.h> | ||
12 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
13 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
14 | #include <linux/sysrq.h> | 11 | #include <linux/sysrq.h> |
15 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
16 | #include <asm/xmon.h> | 13 | #include <asm/xmon.h> |
17 | #include <asm/prom.h> | ||
18 | #include <asm/bootx.h> | ||
19 | #include <asm/machdep.h> | 14 | #include <asm/machdep.h> |
20 | #include <asm/errno.h> | 15 | #include <asm/errno.h> |
21 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
@@ -26,9 +21,7 @@ static volatile unsigned char *sccc, *sccd; | |||
26 | unsigned int TXRDY, RXRDY, DLAB; | 21 | unsigned int TXRDY, RXRDY, DLAB; |
27 | static int xmon_expect(const char *str, unsigned int timeout); | 22 | static int xmon_expect(const char *str, unsigned int timeout); |
28 | 23 | ||
29 | static int use_screen; | ||
30 | static int via_modem; | 24 | static int via_modem; |
31 | static int xmon_use_sccb; | ||
32 | 25 | ||
33 | #define TB_SPEED 25000000 | 26 | #define TB_SPEED 25000000 |
34 | 27 | ||
@@ -46,47 +39,6 @@ void buf_access(void) | |||
46 | sccd[3] &= ~DLAB; /* reset DLAB */ | 39 | sccd[3] &= ~DLAB; /* reset DLAB */ |
47 | } | 40 | } |
48 | 41 | ||
49 | extern int adb_init(void); | ||
50 | |||
51 | #ifdef CONFIG_PPC_CHRP | ||
52 | /* | ||
53 | * This looks in the "ranges" property for the primary PCI host bridge | ||
54 | * to find the physical address of the start of PCI/ISA I/O space. | ||
55 | * It is basically a cut-down version of pci_process_bridge_OF_ranges. | ||
56 | */ | ||
57 | static unsigned long chrp_find_phys_io_base(void) | ||
58 | { | ||
59 | struct device_node *node; | ||
60 | unsigned int *ranges; | ||
61 | unsigned long base = CHRP_ISA_IO_BASE; | ||
62 | int rlen = 0; | ||
63 | int np; | ||
64 | |||
65 | node = find_devices("isa"); | ||
66 | if (node != NULL) { | ||
67 | node = node->parent; | ||
68 | if (node == NULL || node->type == NULL | ||
69 | || strcmp(node->type, "pci") != 0) | ||
70 | node = NULL; | ||
71 | } | ||
72 | if (node == NULL) | ||
73 | node = find_devices("pci"); | ||
74 | if (node == NULL) | ||
75 | return base; | ||
76 | |||
77 | ranges = (unsigned int *) get_property(node, "ranges", &rlen); | ||
78 | np = prom_n_addr_cells(node) + 5; | ||
79 | while ((rlen -= np * sizeof(unsigned int)) >= 0) { | ||
80 | if ((ranges[0] >> 24) == 1 && ranges[2] == 0) { | ||
81 | /* I/O space starting at 0, grab the phys base */ | ||
82 | base = ranges[np - 3]; | ||
83 | break; | ||
84 | } | ||
85 | ranges += np; | ||
86 | } | ||
87 | return base; | ||
88 | } | ||
89 | #endif /* CONFIG_PPC_CHRP */ | ||
90 | 42 | ||
91 | #ifdef CONFIG_MAGIC_SYSRQ | 43 | #ifdef CONFIG_MAGIC_SYSRQ |
92 | static void sysrq_handle_xmon(int key, struct pt_regs *regs, | 44 | static void sysrq_handle_xmon(int key, struct pt_regs *regs, |
@@ -109,22 +61,6 @@ xmon_map_scc(void) | |||
109 | #ifdef CONFIG_PPC_MULTIPLATFORM | 61 | #ifdef CONFIG_PPC_MULTIPLATFORM |
110 | volatile unsigned char *base; | 62 | volatile unsigned char *base; |
111 | 63 | ||
112 | #ifdef CONFIG_PPC_CHRP | ||
113 | base = (volatile unsigned char *) isa_io_base; | ||
114 | if (_machine == _MACH_chrp) | ||
115 | base = (volatile unsigned char *) | ||
116 | ioremap(chrp_find_phys_io_base(), 0x1000); | ||
117 | |||
118 | sccc = base + 0x3fd; | ||
119 | sccd = base + 0x3f8; | ||
120 | if (xmon_use_sccb) { | ||
121 | sccc -= 0x100; | ||
122 | sccd -= 0x100; | ||
123 | } | ||
124 | TXRDY = 0x20; | ||
125 | RXRDY = 1; | ||
126 | DLAB = 0x80; | ||
127 | #endif /* CONFIG_PPC_CHRP */ | ||
128 | #elif defined(CONFIG_GEMINI) | 64 | #elif defined(CONFIG_GEMINI) |
129 | /* should already be mapped by the kernel boot */ | 65 | /* should already be mapped by the kernel boot */ |
130 | sccc = (volatile unsigned char *) 0xffeffb0d; | 66 | sccc = (volatile unsigned char *) 0xffeffb0d; |
@@ -143,7 +79,7 @@ xmon_map_scc(void) | |||
143 | register_sysrq_key('x', &sysrq_xmon_op); | 79 | register_sysrq_key('x', &sysrq_xmon_op); |
144 | } | 80 | } |
145 | 81 | ||
146 | static int scc_initialized = 0; | 82 | static int scc_initialized; |
147 | 83 | ||
148 | void xmon_init_scc(void); | 84 | void xmon_init_scc(void); |
149 | 85 | ||
@@ -163,14 +99,6 @@ xmon_write(void *handle, void *ptr, int nb) | |||
163 | break; | 99 | break; |
164 | #endif | 100 | #endif |
165 | 101 | ||
166 | #ifdef CONFIG_BOOTX_TEXT | ||
167 | if (use_screen) { | ||
168 | /* write it on the screen */ | ||
169 | for (i = 0; i < nb; ++i) | ||
170 | btext_drawchar(*p++); | ||
171 | goto out; | ||
172 | } | ||
173 | #endif | ||
174 | if (!scc_initialized) | 102 | if (!scc_initialized) |
175 | xmon_init_scc(); | 103 | xmon_init_scc(); |
176 | ct = 0; | 104 | ct = 0; |
@@ -190,7 +118,6 @@ xmon_write(void *handle, void *ptr, int nb) | |||
190 | eieio(); | 118 | eieio(); |
191 | } | 119 | } |
192 | 120 | ||
193 | out: | ||
194 | #ifdef CONFIG_SMP | 121 | #ifdef CONFIG_SMP |
195 | if (!locked) | 122 | if (!locked) |
196 | clear_bit(0, &xmon_write_lock); | 123 | clear_bit(0, &xmon_write_lock); |
@@ -199,65 +126,7 @@ xmon_write(void *handle, void *ptr, int nb) | |||
199 | } | 126 | } |
200 | 127 | ||
201 | int xmon_wants_key; | 128 | int xmon_wants_key; |
202 | int xmon_adb_keycode; | ||
203 | |||
204 | #ifdef CONFIG_BOOTX_TEXT | ||
205 | static int xmon_adb_shiftstate; | ||
206 | |||
207 | static unsigned char xmon_keytab[128] = | ||
208 | "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */ | ||
209 | "yt123465=97-80]o" /* 0x10 - 0x1f */ | ||
210 | "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */ | ||
211 | "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */ | ||
212 | "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ | ||
213 | "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ | ||
214 | |||
215 | static unsigned char xmon_shift_keytab[128] = | ||
216 | "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */ | ||
217 | "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */ | ||
218 | "U{IP\rLJ\"K:|<?NM>" /* 0x20 - 0x2f */ | ||
219 | "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */ | ||
220 | "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ | ||
221 | "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ | ||
222 | |||
223 | static int | ||
224 | xmon_get_adb_key(void) | ||
225 | { | ||
226 | int k, t, on; | ||
227 | 129 | ||
228 | xmon_wants_key = 1; | ||
229 | for (;;) { | ||
230 | xmon_adb_keycode = -1; | ||
231 | t = 0; | ||
232 | on = 0; | ||
233 | do { | ||
234 | if (--t < 0) { | ||
235 | on = 1 - on; | ||
236 | btext_drawchar(on? 0xdb: 0x20); | ||
237 | btext_drawchar('\b'); | ||
238 | t = 200000; | ||
239 | } | ||
240 | do_poll_adb(); | ||
241 | } while (xmon_adb_keycode == -1); | ||
242 | k = xmon_adb_keycode; | ||
243 | if (on) | ||
244 | btext_drawstring(" \b"); | ||
245 | |||
246 | /* test for shift keys */ | ||
247 | if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) { | ||
248 | xmon_adb_shiftstate = (k & 0x80) == 0; | ||
249 | continue; | ||
250 | } | ||
251 | if (k >= 0x80) | ||
252 | continue; /* ignore up transitions */ | ||
253 | k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k]; | ||
254 | if (k != 0) | ||
255 | break; | ||
256 | } | ||
257 | xmon_wants_key = 0; | ||
258 | return k; | ||
259 | } | ||
260 | #endif /* CONFIG_BOOTX_TEXT */ | ||
261 | 130 | ||
262 | int | 131 | int |
263 | xmon_read(void *handle, void *ptr, int nb) | 132 | xmon_read(void *handle, void *ptr, int nb) |
@@ -265,18 +134,11 @@ xmon_read(void *handle, void *ptr, int nb) | |||
265 | char *p = ptr; | 134 | char *p = ptr; |
266 | int i; | 135 | int i; |
267 | 136 | ||
268 | #ifdef CONFIG_BOOTX_TEXT | ||
269 | if (use_screen) { | ||
270 | for (i = 0; i < nb; ++i) | ||
271 | *p++ = xmon_get_adb_key(); | ||
272 | return i; | ||
273 | } | ||
274 | #endif | ||
275 | if (!scc_initialized) | 137 | if (!scc_initialized) |
276 | xmon_init_scc(); | 138 | xmon_init_scc(); |
277 | for (i = 0; i < nb; ++i) { | 139 | for (i = 0; i < nb; ++i) { |
278 | while ((*sccc & RXRDY) == 0) | 140 | while ((*sccc & RXRDY) == 0) |
279 | do_poll_adb(); | 141 | ; |
280 | buf_access(); | 142 | buf_access(); |
281 | *p++ = *sccd; | 143 | *p++ = *sccd; |
282 | } | 144 | } |
@@ -287,7 +149,7 @@ int | |||
287 | xmon_read_poll(void) | 149 | xmon_read_poll(void) |
288 | { | 150 | { |
289 | if ((*sccc & RXRDY) == 0) { | 151 | if ((*sccc & RXRDY) == 0) { |
290 | do_poll_adb(); | 152 | ; |
291 | return -1; | 153 | return -1; |
292 | } | 154 | } |
293 | buf_access(); | 155 | buf_access(); |
@@ -297,15 +159,6 @@ xmon_read_poll(void) | |||
297 | void | 159 | void |
298 | xmon_init_scc(void) | 160 | xmon_init_scc(void) |
299 | { | 161 | { |
300 | if ( _machine == _MACH_chrp ) | ||
301 | { | ||
302 | sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */ | ||
303 | sccd[0] = 12; eieio(); /* DLL = 9600 baud */ | ||
304 | sccd[1] = 0; eieio(); | ||
305 | sccd[2] = 0; eieio(); /* FCR = 0 */ | ||
306 | sccd[3] = 3; eieio(); /* LCR = 8N1 */ | ||
307 | sccd[1] = 0; eieio(); /* IER = 0 */ | ||
308 | } | ||
309 | scc_initialized = 1; | 162 | scc_initialized = 1; |
310 | if (via_modem) { | 163 | if (via_modem) { |
311 | for (;;) { | 164 | for (;;) { |
@@ -321,22 +174,6 @@ xmon_init_scc(void) | |||
321 | } | 174 | } |
322 | } | 175 | } |
323 | 176 | ||
324 | #if 0 | ||
325 | extern int (*prom_entry)(void *); | ||
326 | |||
327 | int | ||
328 | xmon_exit(void) | ||
329 | { | ||
330 | struct prom_args { | ||
331 | char *service; | ||
332 | } args; | ||
333 | |||
334 | for (;;) { | ||
335 | args.service = "exit"; | ||
336 | (*prom_entry)(&args); | ||
337 | } | ||
338 | } | ||
339 | #endif | ||
340 | 177 | ||
341 | void *xmon_stdin; | 178 | void *xmon_stdin; |
342 | void *xmon_stdout; | 179 | void *xmon_stdout; |