diff options
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/ppc/kernel/entry.S | 95 | ||||
-rw-r--r-- | arch/ppc/kernel/head.S | 1 | ||||
-rw-r--r-- | arch/ppc/kernel/ppc_ksyms.c | 8 | ||||
-rw-r--r-- | arch/ppc/xmon/adb.c | 212 | ||||
-rw-r--r-- | arch/ppc/xmon/start.c | 184 | ||||
-rw-r--r-- | arch/ppc/xmon/xmon.c | 108 |
7 files changed, 29 insertions, 580 deletions
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index 7964bf660e92..77e4dc780f8c 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c | |||
@@ -131,7 +131,6 @@ main(void) | |||
131 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); | 131 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); |
132 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); | 132 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); |
133 | 133 | ||
134 | DEFINE(TI_SIGFRAME, offsetof(struct thread_info, nvgprs_frame)); | ||
135 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); | 134 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); |
136 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); | 135 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); |
137 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); | 136 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); |
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index a48b950722a1..3a2815978488 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -227,7 +227,7 @@ ret_from_syscall: | |||
227 | MTMSRD(r10) | 227 | MTMSRD(r10) |
228 | lwz r9,TI_FLAGS(r12) | 228 | lwz r9,TI_FLAGS(r12) |
229 | li r8,-_LAST_ERRNO | 229 | li r8,-_LAST_ERRNO |
230 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL) | 230 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) |
231 | bne- syscall_exit_work | 231 | bne- syscall_exit_work |
232 | cmplw 0,r3,r8 | 232 | cmplw 0,r3,r8 |
233 | blt+ syscall_exit_cont | 233 | blt+ syscall_exit_cont |
@@ -287,8 +287,10 @@ syscall_dotrace: | |||
287 | 287 | ||
288 | syscall_exit_work: | 288 | syscall_exit_work: |
289 | andi. r0,r9,_TIF_RESTOREALL | 289 | andi. r0,r9,_TIF_RESTOREALL |
290 | bne- 2f | 290 | beq+ 0f |
291 | cmplw 0,r3,r8 | 291 | REST_NVGPRS(r1) |
292 | b 2f | ||
293 | 0: cmplw 0,r3,r8 | ||
292 | blt+ 1f | 294 | blt+ 1f |
293 | andi. r0,r9,_TIF_NOERROR | 295 | andi. r0,r9,_TIF_NOERROR |
294 | bne- 1f | 296 | bne- 1f |
@@ -302,9 +304,7 @@ syscall_exit_work: | |||
302 | 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) | 304 | 2: andi. r0,r9,(_TIF_PERSYSCALL_MASK) |
303 | beq 4f | 305 | beq 4f |
304 | 306 | ||
305 | /* Clear per-syscall TIF flags if any are set, but _leave_ | 307 | /* Clear per-syscall TIF flags if any are set. */ |
306 | _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that | ||
307 | yet. */ | ||
308 | 308 | ||
309 | li r11,_TIF_PERSYSCALL_MASK | 309 | li r11,_TIF_PERSYSCALL_MASK |
310 | addi r12,r12,TI_FLAGS | 310 | addi r12,r12,TI_FLAGS |
@@ -318,8 +318,13 @@ syscall_exit_work: | |||
318 | subi r12,r12,TI_FLAGS | 318 | subi r12,r12,TI_FLAGS |
319 | 319 | ||
320 | 4: /* Anything which requires enabling interrupts? */ | 320 | 4: /* Anything which requires enabling interrupts? */ |
321 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS) | 321 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) |
322 | beq 7f | 322 | beq ret_from_except |
323 | |||
324 | /* Re-enable interrupts */ | ||
325 | ori r10,r10,MSR_EE | ||
326 | SYNC | ||
327 | MTMSRD(r10) | ||
323 | 328 | ||
324 | /* Save NVGPRS if they're not saved already */ | 329 | /* Save NVGPRS if they're not saved already */ |
325 | lwz r4,TRAP(r1) | 330 | lwz r4,TRAP(r1) |
@@ -328,71 +333,11 @@ syscall_exit_work: | |||
328 | SAVE_NVGPRS(r1) | 333 | SAVE_NVGPRS(r1) |
329 | li r4,0xc00 | 334 | li r4,0xc00 |
330 | stw r4,TRAP(r1) | 335 | stw r4,TRAP(r1) |
331 | 336 | 5: | |
332 | /* Re-enable interrupts */ | ||
333 | 5: ori r10,r10,MSR_EE | ||
334 | SYNC | ||
335 | MTMSRD(r10) | ||
336 | |||
337 | andi. r0,r9,_TIF_SAVE_NVGPRS | ||
338 | bne save_user_nvgprs | ||
339 | |||
340 | save_user_nvgprs_cont: | ||
341 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP) | ||
342 | beq 7f | ||
343 | |||
344 | addi r3,r1,STACK_FRAME_OVERHEAD | 337 | addi r3,r1,STACK_FRAME_OVERHEAD |
345 | bl do_syscall_trace_leave | 338 | bl do_syscall_trace_leave |
346 | REST_NVGPRS(r1) | 339 | b ret_from_except_full |
347 | |||
348 | 6: lwz r3,GPR3(r1) | ||
349 | LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ | ||
350 | SYNC | ||
351 | MTMSRD(r10) /* disable interrupts again */ | ||
352 | rlwinm r12,r1,0,0,18 /* current_thread_info() */ | ||
353 | lwz r9,TI_FLAGS(r12) | ||
354 | 7: | ||
355 | andi. r0,r9,_TIF_NEED_RESCHED | ||
356 | bne 8f | ||
357 | lwz r5,_MSR(r1) | ||
358 | andi. r5,r5,MSR_PR | ||
359 | beq ret_from_except | ||
360 | andi. r0,r9,_TIF_SIGPENDING | ||
361 | beq ret_from_except | ||
362 | b do_user_signal | ||
363 | 8: | ||
364 | ori r10,r10,MSR_EE | ||
365 | SYNC | ||
366 | MTMSRD(r10) /* re-enable interrupts */ | ||
367 | bl schedule | ||
368 | b 6b | ||
369 | |||
370 | save_user_nvgprs: | ||
371 | lwz r8,TI_SIGFRAME(r12) | ||
372 | |||
373 | .macro savewords start, end | ||
374 | 1: stw \start,4*(\start)(r8) | ||
375 | .section __ex_table,"a" | ||
376 | .align 2 | ||
377 | .long 1b,save_user_nvgprs_fault | ||
378 | .previous | ||
379 | .if \end - \start | ||
380 | savewords "(\start+1)",\end | ||
381 | .endif | ||
382 | .endm | ||
383 | savewords 14,31 | ||
384 | b save_user_nvgprs_cont | ||
385 | |||
386 | |||
387 | save_user_nvgprs_fault: | ||
388 | li r3,11 /* SIGSEGV */ | ||
389 | lwz r4,TI_TASK(r12) | ||
390 | bl force_sigsegv | ||
391 | 340 | ||
392 | rlwinm r12,r1,0,0,18 /* current_thread_info() */ | ||
393 | lwz r9,TI_FLAGS(r12) | ||
394 | b save_user_nvgprs_cont | ||
395 | |||
396 | #ifdef SHOW_SYSCALLS | 341 | #ifdef SHOW_SYSCALLS |
397 | do_show_syscall: | 342 | do_show_syscall: |
398 | #ifdef SHOW_SYSCALLS_TASK | 343 | #ifdef SHOW_SYSCALLS_TASK |
@@ -490,6 +435,14 @@ ppc_clone: | |||
490 | stw r0,TRAP(r1) /* register set saved */ | 435 | stw r0,TRAP(r1) /* register set saved */ |
491 | b sys_clone | 436 | b sys_clone |
492 | 437 | ||
438 | .globl ppc_swapcontext | ||
439 | ppc_swapcontext: | ||
440 | SAVE_NVGPRS(r1) | ||
441 | lwz r0,TRAP(r1) | ||
442 | rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ | ||
443 | stw r0,TRAP(r1) /* register set saved */ | ||
444 | b sys_swapcontext | ||
445 | |||
493 | /* | 446 | /* |
494 | * Top-level page fault handling. | 447 | * Top-level page fault handling. |
495 | * This is in assembler because if do_page_fault tells us that | 448 | * This is in assembler because if do_page_fault tells us that |
@@ -683,7 +636,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ | |||
683 | /* Check current_thread_info()->flags */ | 636 | /* Check current_thread_info()->flags */ |
684 | rlwinm r9,r1,0,0,18 | 637 | rlwinm r9,r1,0,0,18 |
685 | lwz r9,TI_FLAGS(r9) | 638 | lwz r9,TI_FLAGS(r9) |
686 | andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL) | 639 | andi. r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED) |
687 | bne do_work | 640 | bne do_work |
688 | 641 | ||
689 | restore_user: | 642 | restore_user: |
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S index c5a890dca9cf..53ea845fb911 100644 --- a/arch/ppc/kernel/head.S +++ b/arch/ppc/kernel/head.S | |||
@@ -751,6 +751,7 @@ AltiVecUnavailable: | |||
751 | #ifdef CONFIG_ALTIVEC | 751 | #ifdef CONFIG_ALTIVEC |
752 | bne load_up_altivec /* if from user, just load it up */ | 752 | bne load_up_altivec /* if from user, just load it up */ |
753 | #endif /* CONFIG_ALTIVEC */ | 753 | #endif /* CONFIG_ALTIVEC */ |
754 | addi r3,r1,STACK_FRAME_OVERHEAD | ||
754 | EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) | 755 | EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) |
755 | 756 | ||
756 | #ifdef CONFIG_PPC64BRIDGE | 757 | #ifdef CONFIG_PPC64BRIDGE |
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 15bd9b448a48..82adb4601348 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -93,15 +93,8 @@ EXPORT_SYMBOL(test_and_change_bit); | |||
93 | EXPORT_SYMBOL(strcpy); | 93 | EXPORT_SYMBOL(strcpy); |
94 | EXPORT_SYMBOL(strncpy); | 94 | EXPORT_SYMBOL(strncpy); |
95 | EXPORT_SYMBOL(strcat); | 95 | EXPORT_SYMBOL(strcat); |
96 | EXPORT_SYMBOL(strncat); | ||
97 | EXPORT_SYMBOL(strchr); | ||
98 | EXPORT_SYMBOL(strrchr); | ||
99 | EXPORT_SYMBOL(strpbrk); | ||
100 | EXPORT_SYMBOL(strstr); | ||
101 | EXPORT_SYMBOL(strlen); | 96 | EXPORT_SYMBOL(strlen); |
102 | EXPORT_SYMBOL(strnlen); | ||
103 | EXPORT_SYMBOL(strcmp); | 97 | EXPORT_SYMBOL(strcmp); |
104 | EXPORT_SYMBOL(strncmp); | ||
105 | EXPORT_SYMBOL(strcasecmp); | 98 | EXPORT_SYMBOL(strcasecmp); |
106 | EXPORT_SYMBOL(__div64_32); | 99 | EXPORT_SYMBOL(__div64_32); |
107 | 100 | ||
@@ -253,7 +246,6 @@ EXPORT_SYMBOL(memcpy); | |||
253 | EXPORT_SYMBOL(cacheable_memcpy); | 246 | EXPORT_SYMBOL(cacheable_memcpy); |
254 | EXPORT_SYMBOL(memset); | 247 | EXPORT_SYMBOL(memset); |
255 | EXPORT_SYMBOL(memmove); | 248 | EXPORT_SYMBOL(memmove); |
256 | EXPORT_SYMBOL(memscan); | ||
257 | EXPORT_SYMBOL(memcmp); | 249 | EXPORT_SYMBOL(memcmp); |
258 | EXPORT_SYMBOL(memchr); | 250 | EXPORT_SYMBOL(memchr); |
259 | 251 | ||
diff --git a/arch/ppc/xmon/adb.c b/arch/ppc/xmon/adb.c deleted file mode 100644 index e91384dcccac..000000000000 --- a/arch/ppc/xmon/adb.c +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1996 Paul Mackerras. | ||
3 | */ | ||
4 | #include "nonstdio.h" | ||
5 | #include "privinst.h" | ||
6 | |||
7 | #define scanhex xmon_scanhex | ||
8 | #define skipbl xmon_skipbl | ||
9 | |||
10 | #define ADB_B (*(volatile unsigned char *)0xf3016000) | ||
11 | #define ADB_SR (*(volatile unsigned char *)0xf3017400) | ||
12 | #define ADB_ACR (*(volatile unsigned char *)0xf3017600) | ||
13 | #define ADB_IFR (*(volatile unsigned char *)0xf3017a00) | ||
14 | |||
15 | static inline void eieio(void) { asm volatile ("eieio" : :); } | ||
16 | |||
17 | #define N_ADB_LOG 1000 | ||
18 | struct adb_log { | ||
19 | unsigned char b; | ||
20 | unsigned char ifr; | ||
21 | unsigned char acr; | ||
22 | unsigned int time; | ||
23 | } adb_log[N_ADB_LOG]; | ||
24 | int n_adb_log; | ||
25 | |||
26 | void | ||
27 | init_adb_log(void) | ||
28 | { | ||
29 | adb_log[0].b = ADB_B; | ||
30 | adb_log[0].ifr = ADB_IFR; | ||
31 | adb_log[0].acr = ADB_ACR; | ||
32 | adb_log[0].time = get_dec(); | ||
33 | n_adb_log = 0; | ||
34 | } | ||
35 | |||
36 | void | ||
37 | dump_adb_log(void) | ||
38 | { | ||
39 | unsigned t, t0; | ||
40 | struct adb_log *ap; | ||
41 | int i; | ||
42 | |||
43 | ap = adb_log; | ||
44 | t0 = ap->time; | ||
45 | for (i = 0; i <= n_adb_log; ++i, ++ap) { | ||
46 | t = t0 - ap->time; | ||
47 | printf("b=%x ifr=%x acr=%x at %d.%.7d\n", ap->b, ap->ifr, ap->acr, | ||
48 | t / 1000000000, (t % 1000000000) / 100); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | void | ||
53 | adb_chklog(void) | ||
54 | { | ||
55 | struct adb_log *ap = &adb_log[n_adb_log + 1]; | ||
56 | |||
57 | ap->b = ADB_B; | ||
58 | ap->ifr = ADB_IFR; | ||
59 | ap->acr = ADB_ACR; | ||
60 | if (ap->b != ap[-1].b || (ap->ifr & 4) != (ap[-1].ifr & 4) | ||
61 | || ap->acr != ap[-1].acr) { | ||
62 | ap->time = get_dec(); | ||
63 | ++n_adb_log; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | int | ||
68 | adb_bitwait(int bmask, int bval, int fmask, int fval) | ||
69 | { | ||
70 | int i; | ||
71 | struct adb_log *ap; | ||
72 | |||
73 | for (i = 10000; i > 0; --i) { | ||
74 | adb_chklog(); | ||
75 | ap = &adb_log[n_adb_log]; | ||
76 | if ((ap->b & bmask) == bval && (ap->ifr & fmask) == fval) | ||
77 | return 0; | ||
78 | } | ||
79 | return -1; | ||
80 | } | ||
81 | |||
82 | int | ||
83 | adb_wait(void) | ||
84 | { | ||
85 | if (adb_bitwait(0, 0, 4, 4) < 0) { | ||
86 | printf("adb: ready wait timeout\n"); | ||
87 | return -1; | ||
88 | } | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | void | ||
93 | adb_readin(void) | ||
94 | { | ||
95 | int i, j; | ||
96 | unsigned char d[64]; | ||
97 | |||
98 | if (ADB_B & 8) { | ||
99 | printf("ADB_B: %x\n", ADB_B); | ||
100 | return; | ||
101 | } | ||
102 | i = 0; | ||
103 | adb_wait(); | ||
104 | j = ADB_SR; | ||
105 | eieio(); | ||
106 | ADB_B &= ~0x20; | ||
107 | eieio(); | ||
108 | for (;;) { | ||
109 | if (adb_wait() < 0) | ||
110 | break; | ||
111 | d[i++] = ADB_SR; | ||
112 | eieio(); | ||
113 | if (ADB_B & 8) | ||
114 | break; | ||
115 | ADB_B ^= 0x10; | ||
116 | eieio(); | ||
117 | } | ||
118 | ADB_B |= 0x30; | ||
119 | if (adb_wait() == 0) | ||
120 | j = ADB_SR; | ||
121 | for (j = 0; j < i; ++j) | ||
122 | printf("%.2x ", d[j]); | ||
123 | printf("\n"); | ||
124 | } | ||
125 | |||
126 | int | ||
127 | adb_write(unsigned char *d, int i) | ||
128 | { | ||
129 | int j; | ||
130 | unsigned x; | ||
131 | |||
132 | if ((ADB_B & 8) == 0) { | ||
133 | printf("r: "); | ||
134 | adb_readin(); | ||
135 | } | ||
136 | for (;;) { | ||
137 | ADB_ACR = 0x1c; | ||
138 | eieio(); | ||
139 | ADB_SR = d[0]; | ||
140 | eieio(); | ||
141 | ADB_B &= ~0x20; | ||
142 | eieio(); | ||
143 | if (ADB_B & 8) | ||
144 | break; | ||
145 | ADB_ACR = 0xc; | ||
146 | eieio(); | ||
147 | ADB_B |= 0x20; | ||
148 | eieio(); | ||
149 | adb_readin(); | ||
150 | } | ||
151 | adb_wait(); | ||
152 | for (j = 1; j < i; ++j) { | ||
153 | ADB_SR = d[j]; | ||
154 | eieio(); | ||
155 | ADB_B ^= 0x10; | ||
156 | eieio(); | ||
157 | if (adb_wait() < 0) | ||
158 | break; | ||
159 | } | ||
160 | ADB_ACR = 0xc; | ||
161 | eieio(); | ||
162 | x = ADB_SR; | ||
163 | eieio(); | ||
164 | ADB_B |= 0x30; | ||
165 | return j; | ||
166 | } | ||
167 | |||
168 | void | ||
169 | adbcmds(void) | ||
170 | { | ||
171 | char cmd; | ||
172 | unsigned rtcu, rtcl, dec, pdec, x; | ||
173 | int i, j; | ||
174 | unsigned char d[64]; | ||
175 | |||
176 | cmd = skipbl(); | ||
177 | switch (cmd) { | ||
178 | case 't': | ||
179 | for (;;) { | ||
180 | rtcl = get_rtcl(); | ||
181 | rtcu = get_rtcu(); | ||
182 | dec = get_dec(); | ||
183 | printf("rtc u=%u l=%u dec=%x (%d = %d.%.7d)\n", | ||
184 | rtcu, rtcl, dec, pdec - dec, (pdec - dec) / 1000000000, | ||
185 | ((pdec - dec) % 1000000000) / 100); | ||
186 | pdec = dec; | ||
187 | if (cmd == 'x') | ||
188 | break; | ||
189 | while (xmon_read(stdin, &cmd, 1) != 1) | ||
190 | ; | ||
191 | } | ||
192 | break; | ||
193 | case 'r': | ||
194 | init_adb_log(); | ||
195 | while (adb_bitwait(8, 0, 0, 0) == 0) | ||
196 | adb_readin(); | ||
197 | break; | ||
198 | case 'w': | ||
199 | i = 0; | ||
200 | while (scanhex(&x)) | ||
201 | d[i++] = x; | ||
202 | init_adb_log(); | ||
203 | j = adb_write(d, i); | ||
204 | printf("sent %d bytes\n", j); | ||
205 | while (adb_bitwait(8, 0, 0, 0) == 0) | ||
206 | adb_readin(); | ||
207 | break; | ||
208 | case 'l': | ||
209 | dump_adb_log(); | ||
210 | break; | ||
211 | } | ||
212 | } | ||
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c index 4344cbe9b5c5..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,22 +79,9 @@ 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 | extern void cuda_poll(void); | ||
150 | |||
151 | static inline void do_poll_adb(void) | ||
152 | { | ||
153 | #ifdef CONFIG_ADB_PMU | ||
154 | if (sys_ctrler == SYS_CTRLER_PMU) | ||
155 | pmu_poll_adb(); | ||
156 | #endif /* CONFIG_ADB_PMU */ | ||
157 | #ifdef CONFIG_ADB_CUDA | ||
158 | if (sys_ctrler == SYS_CTRLER_CUDA) | ||
159 | cuda_poll(); | ||
160 | #endif /* CONFIG_ADB_CUDA */ | ||
161 | } | ||
162 | 85 | ||
163 | int | 86 | int |
164 | xmon_write(void *handle, void *ptr, int nb) | 87 | xmon_write(void *handle, void *ptr, int nb) |
@@ -176,20 +99,12 @@ xmon_write(void *handle, void *ptr, int nb) | |||
176 | break; | 99 | break; |
177 | #endif | 100 | #endif |
178 | 101 | ||
179 | #ifdef CONFIG_BOOTX_TEXT | ||
180 | if (use_screen) { | ||
181 | /* write it on the screen */ | ||
182 | for (i = 0; i < nb; ++i) | ||
183 | btext_drawchar(*p++); | ||
184 | goto out; | ||
185 | } | ||
186 | #endif | ||
187 | if (!scc_initialized) | 102 | if (!scc_initialized) |
188 | xmon_init_scc(); | 103 | xmon_init_scc(); |
189 | ct = 0; | 104 | ct = 0; |
190 | for (i = 0; i < nb; ++i) { | 105 | for (i = 0; i < nb; ++i) { |
191 | while ((*sccc & TXRDY) == 0) | 106 | while ((*sccc & TXRDY) == 0) |
192 | do_poll_adb(); | 107 | ; |
193 | c = p[i]; | 108 | c = p[i]; |
194 | if (c == '\n' && !ct) { | 109 | if (c == '\n' && !ct) { |
195 | c = '\r'; | 110 | c = '\r'; |
@@ -203,7 +118,6 @@ xmon_write(void *handle, void *ptr, int nb) | |||
203 | eieio(); | 118 | eieio(); |
204 | } | 119 | } |
205 | 120 | ||
206 | out: | ||
207 | #ifdef CONFIG_SMP | 121 | #ifdef CONFIG_SMP |
208 | if (!locked) | 122 | if (!locked) |
209 | clear_bit(0, &xmon_write_lock); | 123 | clear_bit(0, &xmon_write_lock); |
@@ -212,65 +126,7 @@ xmon_write(void *handle, void *ptr, int nb) | |||
212 | } | 126 | } |
213 | 127 | ||
214 | int xmon_wants_key; | 128 | int xmon_wants_key; |
215 | int xmon_adb_keycode; | ||
216 | |||
217 | #ifdef CONFIG_BOOTX_TEXT | ||
218 | static int xmon_adb_shiftstate; | ||
219 | |||
220 | static unsigned char xmon_keytab[128] = | ||
221 | "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */ | ||
222 | "yt123465=97-80]o" /* 0x10 - 0x1f */ | ||
223 | "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */ | ||
224 | "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */ | ||
225 | "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ | ||
226 | "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ | ||
227 | |||
228 | static unsigned char xmon_shift_keytab[128] = | ||
229 | "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */ | ||
230 | "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */ | ||
231 | "U{IP\rLJ\"K:|<?NM>" /* 0x20 - 0x2f */ | ||
232 | "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */ | ||
233 | "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ | ||
234 | "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ | ||
235 | |||
236 | static int | ||
237 | xmon_get_adb_key(void) | ||
238 | { | ||
239 | int k, t, on; | ||
240 | 129 | ||
241 | xmon_wants_key = 1; | ||
242 | for (;;) { | ||
243 | xmon_adb_keycode = -1; | ||
244 | t = 0; | ||
245 | on = 0; | ||
246 | do { | ||
247 | if (--t < 0) { | ||
248 | on = 1 - on; | ||
249 | btext_drawchar(on? 0xdb: 0x20); | ||
250 | btext_drawchar('\b'); | ||
251 | t = 200000; | ||
252 | } | ||
253 | do_poll_adb(); | ||
254 | } while (xmon_adb_keycode == -1); | ||
255 | k = xmon_adb_keycode; | ||
256 | if (on) | ||
257 | btext_drawstring(" \b"); | ||
258 | |||
259 | /* test for shift keys */ | ||
260 | if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) { | ||
261 | xmon_adb_shiftstate = (k & 0x80) == 0; | ||
262 | continue; | ||
263 | } | ||
264 | if (k >= 0x80) | ||
265 | continue; /* ignore up transitions */ | ||
266 | k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k]; | ||
267 | if (k != 0) | ||
268 | break; | ||
269 | } | ||
270 | xmon_wants_key = 0; | ||
271 | return k; | ||
272 | } | ||
273 | #endif /* CONFIG_BOOTX_TEXT */ | ||
274 | 130 | ||
275 | int | 131 | int |
276 | xmon_read(void *handle, void *ptr, int nb) | 132 | xmon_read(void *handle, void *ptr, int nb) |
@@ -278,18 +134,11 @@ xmon_read(void *handle, void *ptr, int nb) | |||
278 | char *p = ptr; | 134 | char *p = ptr; |
279 | int i; | 135 | int i; |
280 | 136 | ||
281 | #ifdef CONFIG_BOOTX_TEXT | ||
282 | if (use_screen) { | ||
283 | for (i = 0; i < nb; ++i) | ||
284 | *p++ = xmon_get_adb_key(); | ||
285 | return i; | ||
286 | } | ||
287 | #endif | ||
288 | if (!scc_initialized) | 137 | if (!scc_initialized) |
289 | xmon_init_scc(); | 138 | xmon_init_scc(); |
290 | for (i = 0; i < nb; ++i) { | 139 | for (i = 0; i < nb; ++i) { |
291 | while ((*sccc & RXRDY) == 0) | 140 | while ((*sccc & RXRDY) == 0) |
292 | do_poll_adb(); | 141 | ; |
293 | buf_access(); | 142 | buf_access(); |
294 | *p++ = *sccd; | 143 | *p++ = *sccd; |
295 | } | 144 | } |
@@ -300,7 +149,7 @@ int | |||
300 | xmon_read_poll(void) | 149 | xmon_read_poll(void) |
301 | { | 150 | { |
302 | if ((*sccc & RXRDY) == 0) { | 151 | if ((*sccc & RXRDY) == 0) { |
303 | do_poll_adb(); | 152 | ; |
304 | return -1; | 153 | return -1; |
305 | } | 154 | } |
306 | buf_access(); | 155 | buf_access(); |
@@ -310,15 +159,6 @@ xmon_read_poll(void) | |||
310 | void | 159 | void |
311 | xmon_init_scc(void) | 160 | xmon_init_scc(void) |
312 | { | 161 | { |
313 | if ( _machine == _MACH_chrp ) | ||
314 | { | ||
315 | sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */ | ||
316 | sccd[0] = 12; eieio(); /* DLL = 9600 baud */ | ||
317 | sccd[1] = 0; eieio(); | ||
318 | sccd[2] = 0; eieio(); /* FCR = 0 */ | ||
319 | sccd[3] = 3; eieio(); /* LCR = 8N1 */ | ||
320 | sccd[1] = 0; eieio(); /* IER = 0 */ | ||
321 | } | ||
322 | scc_initialized = 1; | 162 | scc_initialized = 1; |
323 | if (via_modem) { | 163 | if (via_modem) { |
324 | for (;;) { | 164 | for (;;) { |
@@ -334,22 +174,6 @@ xmon_init_scc(void) | |||
334 | } | 174 | } |
335 | } | 175 | } |
336 | 176 | ||
337 | #if 0 | ||
338 | extern int (*prom_entry)(void *); | ||
339 | |||
340 | int | ||
341 | xmon_exit(void) | ||
342 | { | ||
343 | struct prom_args { | ||
344 | char *service; | ||
345 | } args; | ||
346 | |||
347 | for (;;) { | ||
348 | args.service = "exit"; | ||
349 | (*prom_entry)(&args); | ||
350 | } | ||
351 | } | ||
352 | #endif | ||
353 | 177 | ||
354 | void *xmon_stdin; | 178 | void *xmon_stdin; |
355 | void *xmon_stdout; | 179 | void *xmon_stdout; |
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c index bdaf6597b4c2..06fa44b5c647 100644 --- a/arch/ppc/xmon/xmon.c +++ b/arch/ppc/xmon/xmon.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <linux/kallsyms.h> | 12 | #include <linux/kallsyms.h> |
13 | #include <asm/ptrace.h> | 13 | #include <asm/ptrace.h> |
14 | #include <asm/string.h> | 14 | #include <asm/string.h> |
15 | #include <asm/prom.h> | ||
16 | #include <asm/bootx.h> | ||
17 | #include <asm/machdep.h> | 15 | #include <asm/machdep.h> |
18 | #include <asm/xmon.h> | 16 | #include <asm/xmon.h> |
19 | #include "nonstdio.h" | 17 | #include "nonstdio.h" |
@@ -101,9 +99,6 @@ void cacheflush(void); | |||
101 | static void cpu_cmd(void); | 99 | static void cpu_cmd(void); |
102 | #endif /* CONFIG_SMP */ | 100 | #endif /* CONFIG_SMP */ |
103 | static void csum(void); | 101 | static void csum(void); |
104 | #ifdef CONFIG_BOOTX_TEXT | ||
105 | static void vidcmds(void); | ||
106 | #endif | ||
107 | static void bootcmds(void); | 102 | static void bootcmds(void); |
108 | static void proccall(void); | 103 | static void proccall(void); |
109 | static void printtime(void); | 104 | static void printtime(void); |
@@ -522,11 +517,6 @@ cmds(struct pt_regs *excp) | |||
522 | cpu_cmd(); | 517 | cpu_cmd(); |
523 | break; | 518 | break; |
524 | #endif /* CONFIG_SMP */ | 519 | #endif /* CONFIG_SMP */ |
525 | #ifdef CONFIG_BOOTX_TEXT | ||
526 | case 'v': | ||
527 | vidcmds(); | ||
528 | break; | ||
529 | #endif | ||
530 | case 'z': | 520 | case 'z': |
531 | bootcmds(); | 521 | bootcmds(); |
532 | break; | 522 | break; |
@@ -618,43 +608,6 @@ static void cpu_cmd(void) | |||
618 | } | 608 | } |
619 | #endif /* CONFIG_SMP */ | 609 | #endif /* CONFIG_SMP */ |
620 | 610 | ||
621 | #ifdef CONFIG_BOOTX_TEXT | ||
622 | extern boot_infos_t disp_bi; | ||
623 | |||
624 | static void vidcmds(void) | ||
625 | { | ||
626 | int c = inchar(); | ||
627 | unsigned int val, w; | ||
628 | extern int boot_text_mapped; | ||
629 | |||
630 | if (!boot_text_mapped) | ||
631 | return; | ||
632 | if (c != '\n' && scanhex(&val)) { | ||
633 | switch (c) { | ||
634 | case 'd': | ||
635 | w = disp_bi.dispDeviceRowBytes | ||
636 | / (disp_bi.dispDeviceDepth >> 3); | ||
637 | disp_bi.dispDeviceDepth = val; | ||
638 | disp_bi.dispDeviceRowBytes = w * (val >> 3); | ||
639 | return; | ||
640 | case 'p': | ||
641 | disp_bi.dispDeviceRowBytes = val; | ||
642 | return; | ||
643 | case 'w': | ||
644 | disp_bi.dispDeviceRect[2] = val; | ||
645 | return; | ||
646 | case 'h': | ||
647 | disp_bi.dispDeviceRect[3] = val; | ||
648 | return; | ||
649 | } | ||
650 | } | ||
651 | printf("W = %d (0x%x) H = %d (0x%x) D = %d (0x%x) P = %d (0x%x)\n", | ||
652 | disp_bi.dispDeviceRect[2], disp_bi.dispDeviceRect[2], | ||
653 | disp_bi.dispDeviceRect[3], disp_bi.dispDeviceRect[3], | ||
654 | disp_bi.dispDeviceDepth, disp_bi.dispDeviceDepth, | ||
655 | disp_bi.dispDeviceRowBytes, disp_bi.dispDeviceRowBytes); | ||
656 | } | ||
657 | #endif /* CONFIG_BOOTX_TEXT */ | ||
658 | 611 | ||
659 | static unsigned short fcstab[256] = { | 612 | static unsigned short fcstab[256] = { |
660 | 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, | 613 | 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, |
@@ -1020,7 +973,6 @@ dump_hash_table(void) | |||
1020 | } | 973 | } |
1021 | #else | 974 | #else |
1022 | 975 | ||
1023 | #ifndef CONFIG_PPC64BRIDGE | ||
1024 | static void | 976 | static void |
1025 | dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) | 977 | dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) |
1026 | { | 978 | { |
@@ -1079,66 +1031,6 @@ dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) | |||
1079 | printf(" ... %x\n", last_va); | 1031 | printf(" ... %x\n", last_va); |
1080 | } | 1032 | } |
1081 | 1033 | ||
1082 | #else /* CONFIG_PPC64BRIDGE */ | ||
1083 | static void | ||
1084 | dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) | ||
1085 | { | ||
1086 | extern void *Hash; | ||
1087 | extern unsigned long Hash_size; | ||
1088 | unsigned *htab = Hash; | ||
1089 | unsigned hsize = Hash_size; | ||
1090 | unsigned v, hmask, va, last_va; | ||
1091 | int found, last_found, i; | ||
1092 | unsigned *hg, w1, last_w2, last_va0; | ||
1093 | |||
1094 | last_found = 0; | ||
1095 | hmask = hsize / 128 - 1; | ||
1096 | va = start; | ||
1097 | start = (start >> 12) & 0xffff; | ||
1098 | end = (end >> 12) & 0xffff; | ||
1099 | for (v = start; v < end; ++v) { | ||
1100 | found = 0; | ||
1101 | hg = htab + (((v ^ seg) & hmask) * 32); | ||
1102 | w1 = 1 | (seg << 12) | ((v & 0xf800) >> 4); | ||
1103 | for (i = 0; i < 8; ++i, hg += 4) { | ||
1104 | if (hg[1] == w1) { | ||
1105 | found = 1; | ||
1106 | break; | ||
1107 | } | ||
1108 | } | ||
1109 | if (!found) { | ||
1110 | w1 ^= 2; | ||
1111 | hg = htab + ((~(v ^ seg) & hmask) * 32); | ||
1112 | for (i = 0; i < 8; ++i, hg += 4) { | ||
1113 | if (hg[1] == w1) { | ||
1114 | found = 1; | ||
1115 | break; | ||
1116 | } | ||
1117 | } | ||
1118 | } | ||
1119 | if (!(last_found && found && (hg[3] & ~0x180) == last_w2 + 4096)) { | ||
1120 | if (last_found) { | ||
1121 | if (last_va != last_va0) | ||
1122 | printf(" ... %x", last_va); | ||
1123 | printf("\n"); | ||
1124 | } | ||
1125 | if (found) { | ||
1126 | printf("%x to %x", va, hg[3]); | ||
1127 | last_va0 = va; | ||
1128 | } | ||
1129 | last_found = found; | ||
1130 | } | ||
1131 | if (found) { | ||
1132 | last_w2 = hg[3] & ~0x180; | ||
1133 | last_va = va; | ||
1134 | } | ||
1135 | va += 4096; | ||
1136 | } | ||
1137 | if (last_found) | ||
1138 | printf(" ... %x\n", last_va); | ||
1139 | } | ||
1140 | #endif /* CONFIG_PPC64BRIDGE */ | ||
1141 | |||
1142 | static unsigned hash_ctx; | 1034 | static unsigned hash_ctx; |
1143 | static unsigned hash_start; | 1035 | static unsigned hash_start; |
1144 | static unsigned hash_end; | 1036 | static unsigned hash_end; |