aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2006-03-20 12:58:02 -0500
committerKumar Gala <galak@kernel.crashing.org>2006-03-20 12:58:02 -0500
commit1a02e59a2970f9ed28ab51d3b08624b79e54d848 (patch)
tree470cce472be3b08c160e0c569648e7228651b12a /arch/ppc
parentebcff3c773b42bce6182ec16485abca4e53fba97 (diff)
parent2c276603c3e5ebf38155a9d1fbbda656d52d138e (diff)
Merge branch 'master'
Diffstat (limited to 'arch/ppc')
-rw-r--r--arch/ppc/4xx_io/serial_sicc.c3
-rw-r--r--arch/ppc/kernel/asm-offsets.c1
-rw-r--r--arch/ppc/kernel/entry.S95
-rw-r--r--arch/ppc/kernel/head.S1
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c8
-rw-r--r--arch/ppc/kernel/smp-tbsync.c3
-rw-r--r--arch/ppc/platforms/4xx/virtex.h2
-rw-r--r--arch/ppc/platforms/cpci690.c2
-rw-r--r--arch/ppc/platforms/ev64260.c2
-rw-r--r--arch/ppc/platforms/ev64360.c2
-rw-r--r--arch/ppc/platforms/hdpu.c2
-rw-r--r--arch/ppc/platforms/katana.c5
-rw-r--r--arch/ppc/platforms/radstone_ppc7d.c5
-rw-r--r--arch/ppc/syslib/ocp.c3
-rw-r--r--arch/ppc/xmon/adb.c212
-rw-r--r--arch/ppc/xmon/start.c184
-rw-r--r--arch/ppc/xmon/xmon.c108
17 files changed, 41 insertions, 597 deletions
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
index 4dc6aa2abfc1..98b25fa0049a 100644
--- a/arch/ppc/4xx_io/serial_sicc.c
+++ b/arch/ppc/4xx_io/serial_sicc.c
@@ -1637,9 +1637,8 @@ static struct SICC_info *siccuart_get(int line)
1637 state->count++; 1637 state->count++;
1638 if (state->info) 1638 if (state->info)
1639 return state->info; 1639 return state->info;
1640 info = kmalloc(sizeof(struct SICC_info), GFP_KERNEL); 1640 info = kzalloc(sizeof(struct SICC_info), GFP_KERNEL);
1641 if (info) { 1641 if (info) {
1642 memset(info, 0, sizeof(struct SICC_info));
1643 init_waitqueue_head(&info->open_wait); 1642 init_waitqueue_head(&info->open_wait);
1644 init_waitqueue_head(&info->close_wait); 1643 init_waitqueue_head(&info->close_wait);
1645 init_waitqueue_head(&info->delta_msr_wait); 1644 init_waitqueue_head(&info->delta_msr_wait);
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
288syscall_exit_work: 288syscall_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
2930: 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:
3022: andi. r0,r9,(_TIF_PERSYSCALL_MASK) 3042: 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
3204: /* Anything which requires enabling interrupts? */ 3204: /* 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 3365:
332 /* Re-enable interrupts */
3335: ori r10,r10,MSR_EE
334 SYNC
335 MTMSRD(r10)
336
337 andi. r0,r9,_TIF_SAVE_NVGPRS
338 bne save_user_nvgprs
339
340save_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
3486: 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)
3547:
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
3638:
364 ori r10,r10,MSR_EE
365 SYNC
366 MTMSRD(r10) /* re-enable interrupts */
367 bl schedule
368 b 6b
369
370save_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
387save_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
397do_show_syscall: 342do_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
439ppc_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
689restore_user: 642restore_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);
93EXPORT_SYMBOL(strcpy); 93EXPORT_SYMBOL(strcpy);
94EXPORT_SYMBOL(strncpy); 94EXPORT_SYMBOL(strncpy);
95EXPORT_SYMBOL(strcat); 95EXPORT_SYMBOL(strcat);
96EXPORT_SYMBOL(strncat);
97EXPORT_SYMBOL(strchr);
98EXPORT_SYMBOL(strrchr);
99EXPORT_SYMBOL(strpbrk);
100EXPORT_SYMBOL(strstr);
101EXPORT_SYMBOL(strlen); 96EXPORT_SYMBOL(strlen);
102EXPORT_SYMBOL(strnlen);
103EXPORT_SYMBOL(strcmp); 97EXPORT_SYMBOL(strcmp);
104EXPORT_SYMBOL(strncmp);
105EXPORT_SYMBOL(strcasecmp); 98EXPORT_SYMBOL(strcasecmp);
106EXPORT_SYMBOL(__div64_32); 99EXPORT_SYMBOL(__div64_32);
107 100
@@ -253,7 +246,6 @@ EXPORT_SYMBOL(memcpy);
253EXPORT_SYMBOL(cacheable_memcpy); 246EXPORT_SYMBOL(cacheable_memcpy);
254EXPORT_SYMBOL(memset); 247EXPORT_SYMBOL(memset);
255EXPORT_SYMBOL(memmove); 248EXPORT_SYMBOL(memmove);
256EXPORT_SYMBOL(memscan);
257EXPORT_SYMBOL(memcmp); 249EXPORT_SYMBOL(memcmp);
258EXPORT_SYMBOL(memchr); 250EXPORT_SYMBOL(memchr);
259 251
diff --git a/arch/ppc/kernel/smp-tbsync.c b/arch/ppc/kernel/smp-tbsync.c
index 2c9cd95bcea6..6a5694fcc711 100644
--- a/arch/ppc/kernel/smp-tbsync.c
+++ b/arch/ppc/kernel/smp-tbsync.c
@@ -126,8 +126,7 @@ smp_generic_give_timebase( void )
126 printk("Synchronizing timebase\n"); 126 printk("Synchronizing timebase\n");
127 127
128 /* if this fails then this kernel won't work anyway... */ 128 /* if this fails then this kernel won't work anyway... */
129 tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL ); 129 tbsync = kzalloc( sizeof(*tbsync), GFP_KERNEL );
130 memset( tbsync, 0, sizeof(*tbsync) );
131 mb(); 130 mb();
132 running = 1; 131 running = 1;
133 132
diff --git a/arch/ppc/platforms/4xx/virtex.h b/arch/ppc/platforms/4xx/virtex.h
index 1a01b81cff11..c14325dfd7b1 100644
--- a/arch/ppc/platforms/4xx/virtex.h
+++ b/arch/ppc/platforms/4xx/virtex.h
@@ -27,7 +27,7 @@
27/* Device type enumeration for platform bus definitions */ 27/* Device type enumeration for platform bus definitions */
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
29enum ppc_sys_devices { 29enum ppc_sys_devices {
30 VIRTEX_UART, 30 VIRTEX_UART, NUM_PPC_SYS_DEVS,
31}; 31};
32#endif 32#endif
33 33
diff --git a/arch/ppc/platforms/cpci690.c b/arch/ppc/platforms/cpci690.c
index 55be550a0811..790475c22fd7 100644
--- a/arch/ppc/platforms/cpci690.c
+++ b/arch/ppc/platforms/cpci690.c
@@ -288,7 +288,7 @@ cpci690_fixup_mpsc_pdata(struct platform_device *pdev)
288 pdata->brg_clk_freq = cpci690_get_bus_freq(); 288 pdata->brg_clk_freq = cpci690_get_bus_freq();
289} 289}
290 290
291static int __init 291static int
292cpci690_platform_notify(struct device *dev) 292cpci690_platform_notify(struct device *dev)
293{ 293{
294 static struct { 294 static struct {
diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c
index 6444760caa3a..31e8e21e1d5c 100644
--- a/arch/ppc/platforms/ev64260.c
+++ b/arch/ppc/platforms/ev64260.c
@@ -414,7 +414,7 @@ ev64260_fixup_mpsc_pdata(struct platform_device *pdev)
414 return; 414 return;
415} 415}
416 416
417static int __init 417static int
418ev64260_platform_notify(struct device *dev) 418ev64260_platform_notify(struct device *dev)
419{ 419{
420 static struct { 420 static struct {
diff --git a/arch/ppc/platforms/ev64360.c b/arch/ppc/platforms/ev64360.c
index b5f52eba4fc1..104ac9b16e8b 100644
--- a/arch/ppc/platforms/ev64360.c
+++ b/arch/ppc/platforms/ev64360.c
@@ -298,7 +298,7 @@ ev64360_fixup_eth_pdata(struct platform_device *pdev)
298} 298}
299#endif 299#endif
300 300
301static int __init 301static int
302ev64360_platform_notify(struct device *dev) 302ev64360_platform_notify(struct device *dev)
303{ 303{
304 static struct { 304 static struct {
diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c
index 220674d883df..fc869bb5b2b4 100644
--- a/arch/ppc/platforms/hdpu.c
+++ b/arch/ppc/platforms/hdpu.c
@@ -351,7 +351,7 @@ static void __init hdpu_fixup_cpustate_pdata(struct platform_device *pd)
351} 351}
352#endif 352#endif
353 353
354static int __init hdpu_platform_notify(struct device *dev) 354static int hdpu_platform_notify(struct device *dev)
355{ 355{
356 static struct { 356 static struct {
357 char *bus_id; 357 char *bus_id;
diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c
index d2766617c3cb..ad21280e8920 100644
--- a/arch/ppc/platforms/katana.c
+++ b/arch/ppc/platforms/katana.c
@@ -596,7 +596,7 @@ katana_fixup_mv64xxx_pdata(struct platform_device *pdev)
596} 596}
597#endif 597#endif
598 598
599static int __init 599static int
600katana_platform_notify(struct device *dev) 600katana_platform_notify(struct device *dev)
601{ 601{
602 static struct { 602 static struct {
@@ -662,12 +662,11 @@ katana_setup_mtd(void)
662 662
663 ptbl_entries = (size >= (64*MB)) ? 6 : 4; 663 ptbl_entries = (size >= (64*MB)) ? 6 : 4;
664 664
665 if ((ptbl = kmalloc(ptbl_entries * sizeof(struct mtd_partition), 665 if ((ptbl = kcalloc(ptbl_entries, sizeof(struct mtd_partition),
666 GFP_KERNEL)) == NULL) { 666 GFP_KERNEL)) == NULL) {
667 printk(KERN_WARNING "Can't alloc MTD partition table\n"); 667 printk(KERN_WARNING "Can't alloc MTD partition table\n");
668 return -ENOMEM; 668 return -ENOMEM;
669 } 669 }
670 memset(ptbl, 0, ptbl_entries * sizeof(struct mtd_partition));
671 670
672 ptbl[0].name = "Monitor"; 671 ptbl[0].name = "Monitor";
673 ptbl[0].size = KATANA_MTD_MONITOR_SIZE; 672 ptbl[0].size = KATANA_MTD_MONITOR_SIZE;
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
index 1b1e7c5ef152..bc26b6d71c1d 100644
--- a/arch/ppc/platforms/radstone_ppc7d.c
+++ b/arch/ppc/platforms/radstone_ppc7d.c
@@ -683,11 +683,10 @@ ppc7d_fixup_i2c_pdata(struct platform_device *pdev)
683 683
684 pdata = pdev->dev.platform_data; 684 pdata = pdev->dev.platform_data;
685 if (pdata == NULL) { 685 if (pdata == NULL) {
686 pdata = kmalloc(sizeof(*pdata), GFP_KERNEL); 686 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
687 if (pdata == NULL) 687 if (pdata == NULL)
688 return; 688 return;
689 689
690 memset(pdata, 0, sizeof(*pdata));
691 pdev->dev.platform_data = pdata; 690 pdev->dev.platform_data = pdata;
692 } 691 }
693 692
@@ -710,7 +709,7 @@ ppc7d_fixup_i2c_pdata(struct platform_device *pdev)
710} 709}
711#endif 710#endif
712 711
713static int __init ppc7d_platform_notify(struct device *dev) 712static int ppc7d_platform_notify(struct device *dev)
714{ 713{
715 static struct { 714 static struct {
716 char *bus_id; 715 char *bus_id;
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
index 2fe28ded2c60..a4ecc2ee579f 100644
--- a/arch/ppc/syslib/ocp.c
+++ b/arch/ppc/syslib/ocp.c
@@ -451,10 +451,9 @@ ocp_driver_init(void)
451 DBG(("ocp: ocp_driver_init()...\n")); 451 DBG(("ocp: ocp_driver_init()...\n"));
452 452
453 /* Allocate/register primary OCP bus */ 453 /* Allocate/register primary OCP bus */
454 ocp_bus = kmalloc(sizeof(struct device), GFP_KERNEL); 454 ocp_bus = kzalloc(sizeof(struct device), GFP_KERNEL);
455 if (ocp_bus == NULL) 455 if (ocp_bus == NULL)
456 return 1; 456 return 1;
457 memset(ocp_bus, 0, sizeof(struct device));
458 strcpy(ocp_bus->bus_id, "ocp"); 457 strcpy(ocp_bus->bus_id, "ocp");
459 458
460 bus_register(&ocp_bus_type); 459 bus_register(&ocp_bus_type);
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
15static inline void eieio(void) { asm volatile ("eieio" : :); }
16
17#define N_ADB_LOG 1000
18struct adb_log {
19 unsigned char b;
20 unsigned char ifr;
21 unsigned char acr;
22 unsigned int time;
23} adb_log[N_ADB_LOG];
24int n_adb_log;
25
26void
27init_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
36void
37dump_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
52void
53adb_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
67int
68adb_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
82int
83adb_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
92void
93adb_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
126int
127adb_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
168void
169adbcmds(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;
26unsigned int TXRDY, RXRDY, DLAB; 21unsigned int TXRDY, RXRDY, DLAB;
27static int xmon_expect(const char *str, unsigned int timeout); 22static int xmon_expect(const char *str, unsigned int timeout);
28 23
29static int use_screen;
30static int via_modem; 24static int via_modem;
31static 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
49extern 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 */
57static 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
92static void sysrq_handle_xmon(int key, struct pt_regs *regs, 44static 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
146static int scc_initialized = 0; 82static int scc_initialized;
147 83
148void xmon_init_scc(void); 84void xmon_init_scc(void);
149extern void cuda_poll(void);
150
151static 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
163int 86int
164xmon_write(void *handle, void *ptr, int nb) 87xmon_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
214int xmon_wants_key; 128int xmon_wants_key;
215int xmon_adb_keycode;
216
217#ifdef CONFIG_BOOTX_TEXT
218static int xmon_adb_shiftstate;
219
220static 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
228static 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
236static int
237xmon_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
275int 131int
276xmon_read(void *handle, void *ptr, int nb) 132xmon_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
300xmon_read_poll(void) 149xmon_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)
310void 159void
311xmon_init_scc(void) 160xmon_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
338extern int (*prom_entry)(void *);
339
340int
341xmon_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
354void *xmon_stdin; 178void *xmon_stdin;
355void *xmon_stdout; 179void *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);
101static void cpu_cmd(void); 99static void cpu_cmd(void);
102#endif /* CONFIG_SMP */ 100#endif /* CONFIG_SMP */
103static void csum(void); 101static void csum(void);
104#ifdef CONFIG_BOOTX_TEXT
105static void vidcmds(void);
106#endif
107static void bootcmds(void); 102static void bootcmds(void);
108static void proccall(void); 103static void proccall(void);
109static void printtime(void); 104static 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
622extern boot_infos_t disp_bi;
623
624static 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
659static unsigned short fcstab[256] = { 612static 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
1024static void 976static void
1025dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) 977dump_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 */
1083static void
1084dump_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
1142static unsigned hash_ctx; 1034static unsigned hash_ctx;
1143static unsigned hash_start; 1035static unsigned hash_start;
1144static unsigned hash_end; 1036static unsigned hash_end;