patch-2.4.21 linux-2.4.21/arch/ppc/xmon/xmon.c
Next file: linux-2.4.21/arch/ppc64/boot/Makefile
Previous file: linux-2.4.21/arch/ppc/xmon/subr_prf.c
Back to the patch index
Back to the overall index
- Lines: 159
- Date:
2003-06-13 07:51:31.000000000 -0700
- Orig file:
linux-2.4.20/arch/ppc/xmon/xmon.c
- Orig date:
2002-02-25 11:37:55.000000000 -0800
diff -urN linux-2.4.20/arch/ppc/xmon/xmon.c linux-2.4.21/arch/ppc/xmon/xmon.c
@@ -1,7 +1,4 @@
/*
- * BK Id: SCCS/s.xmon.c 1.18 12/01/01 20:09:07 benh
- */
-/*
* Routines providing a simple monitor for use on the PowerMac.
*
* Copyright (C) 1996 Paul Mackerras.
@@ -14,6 +11,12 @@
#include <asm/string.h>
#include <asm/prom.h>
#include <asm/bitops.h>
+#include <asm/bootx.h>
+#ifdef CONFIG_PMAC_BACKLIGHT
+#include <asm/backlight.h>
+#endif
+#include <asm/mmu.h>
+
#include "nonstdio.h"
#include "privinst.h"
@@ -24,6 +27,7 @@
static unsigned long cpus_in_xmon = 0;
static unsigned long got_xmon = 0;
static volatile int take_xmon = -1;
+static int xmon_owner = -1;
#endif /* CONFIG_SMP */
static unsigned adrs;
@@ -189,20 +193,31 @@
xmon_enter();
excprint(excp);
#ifdef CONFIG_SMP
- if (test_and_set_bit(smp_processor_id(), &cpus_in_xmon))
- for (;;)
- ;
- while (test_and_set_bit(0, &got_xmon)) {
- if (take_xmon == smp_processor_id()) {
- take_xmon = -1;
- break;
+ set_bit(smp_processor_id(), &cpus_in_xmon);
+ if (smp_processor_id() != xmon_owner) {
+ while (test_and_set_bit(0, &got_xmon)) {
+ if (take_xmon == smp_processor_id()) {
+ take_xmon = -1;
+ break;
+ }
}
+ xmon_owner = smp_processor_id();
}
/*
* XXX: breakpoints are removed while any cpu is in xmon
*/
#endif /* CONFIG_SMP */
remove_bpts();
+#ifdef CONFIG_PMAC_BACKLIGHT
+ if( setjmp(bus_error_jmp) == 0 ) {
+ debugger_fault_handler = handle_fault;
+ sync();
+ set_backlight_enable(1);
+ set_backlight_level(BACKLIGHT_MAX);
+ sync();
+ }
+ debugger_fault_handler = 0;
+#endif /* CONFIG_PMAC_BACKLIGHT */
cmd = cmds(excp);
if (cmd == 's') {
xmon_trace[smp_processor_id()] = SSTEP;
@@ -218,6 +233,7 @@
xmon_regs[smp_processor_id()] = 0;
#ifdef CONFIG_SMP
clear_bit(0, &got_xmon);
+ xmon_owner = -1;
clear_bit(smp_processor_id(), &cpus_in_xmon);
#endif /* CONFIG_SMP */
set_msr(msr); /* restore interrupt enable */
@@ -503,11 +519,13 @@
}
/* try to switch to cpu specified */
take_xmon = cpu;
+ xmon_owner = -1;
timeout = 10000000;
while (take_xmon >= 0) {
if (--timeout == 0) {
/* yes there's a race here */
take_xmon = -1;
+ xmon_owner = smp_processor_id();
printf("cpu %u didn't take control\n", cpu);
return;
}
@@ -516,6 +534,7 @@
while (test_and_set_bit(0, &got_xmon)) {
if (take_xmon == smp_processor_id()) {
take_xmon = -1;
+ xmon_owner = smp_processor_id();
break;
}
}
@@ -921,15 +940,22 @@
}
#endif
+#ifndef CONFIG_PPC_STD_MMU
+static void
+dump_hash_table()
+{
+ printf("This CPU doesn't have a hash table.\n");
+}
+#else
+
#ifndef CONFIG_PPC64BRIDGE
static void
dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
{
- extern void *Hash;
- extern unsigned long Hash_size;
- unsigned *htab = Hash;
- unsigned hsize = Hash_size;
- unsigned v, hmask, va, last_va;
+ void *htab = Hash;
+ unsigned long hsize = Hash_size;
+ unsigned long hmask;
+ unsigned v, va, last_va;
int found, last_found, i;
unsigned *hg, w1, last_w2, last_va0;
@@ -984,11 +1010,10 @@
static void
dump_hash_table_seg(unsigned seg, unsigned start, unsigned end)
{
- extern void *Hash;
- extern unsigned long Hash_size;
- unsigned *htab = Hash;
- unsigned hsize = Hash_size;
- unsigned v, hmask, va, last_va;
+ void *htab = Hash;
+ unsigned long hsize = Hash_size;
+ unsigned long hmask;
+ unsigned v, va, last_va;
int found, last_found, i;
unsigned *hg, w1, last_w2, last_va0;
@@ -1050,6 +1075,8 @@
int seg;
unsigned seg_start, seg_end;
+ if (Hash == NULL)
+ return;
hash_ctx = 0;
hash_start = 0;
hash_end = 0xfffff000;
@@ -1067,6 +1094,7 @@
seg_start = seg_end + 0x1000;
}
}
+#endif /* CONFIG_PPC_STD_MMU */
/*
* Stuff for reading and writing memory safely
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)