Commit 988ce1a4 authored by Paul Mackerras's avatar Paul Mackerras

PPC32: Move xmon declarations to their own header file.

parent f9c39b08
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/btext.h> #include <asm/btext.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/xmon.h>
#ifdef CONFIG_8xx #ifdef CONFIG_8xx
#include <asm/commproc.h> #include <asm/commproc.h>
...@@ -306,7 +307,6 @@ EXPORT_SYMBOL(tb_ticks_per_jiffy); ...@@ -306,7 +307,6 @@ EXPORT_SYMBOL(tb_ticks_per_jiffy);
EXPORT_SYMBOL(get_wchan); EXPORT_SYMBOL(get_wchan);
EXPORT_SYMBOL(console_drivers); EXPORT_SYMBOL(console_drivers);
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
extern void xmon_printf(char *fmt, ...);
EXPORT_SYMBOL(xmon); EXPORT_SYMBOL(xmon);
EXPORT_SYMBOL(xmon_printf); EXPORT_SYMBOL(xmon_printf);
#endif #endif
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/pmac_feature.h> #include <asm/pmac_feature.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/xmon.h>
#if defined CONFIG_KGDB #if defined CONFIG_KGDB
#include <asm/kgdb.h> #include <asm/kgdb.h>
...@@ -46,9 +47,6 @@ extern void identify_cpu(unsigned long offset, unsigned long cpu); ...@@ -46,9 +47,6 @@ extern void identify_cpu(unsigned long offset, unsigned long cpu);
extern void do_cpu_ftr_fixups(unsigned long offset); extern void do_cpu_ftr_fixups(unsigned long offset);
extern void reloc_got2(unsigned long offset); extern void reloc_got2(unsigned long offset);
#ifdef CONFIG_XMON
extern void xmon_map_scc(void);
#endif
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
extern void kgdb_map_scc(void); extern void kgdb_map_scc(void);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <asm/time.h> #include <asm/time.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/xmon.h>
int smp_threads_ready; int smp_threads_ready;
volatile int smp_commenced; volatile int smp_commenced;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/xmon.h>
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
#include <asm/backlight.h> #include <asm/backlight.h>
#endif #endif
...@@ -43,15 +44,6 @@ ...@@ -43,15 +44,6 @@
extern int fix_alignment(struct pt_regs *); extern int fix_alignment(struct pt_regs *);
extern void bad_page_fault(struct pt_regs *, unsigned long, int sig); extern void bad_page_fault(struct pt_regs *, unsigned long, int sig);
#ifdef CONFIG_XMON
extern void xmon(struct pt_regs *regs);
extern int xmon_bpt(struct pt_regs *regs);
extern int xmon_sstep(struct pt_regs *regs);
extern int xmon_iabr_match(struct pt_regs *regs);
extern int xmon_dabr_match(struct pt_regs *regs);
extern void (*xmon_fault_handler)(struct pt_regs *regs);
#endif
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
void (*debugger)(struct pt_regs *regs) = xmon; void (*debugger)(struct pt_regs *regs) = xmon;
int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt; int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/console.h> #include <linux/console.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/initrd.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
#include <asm/btext.h> #include <asm/btext.h>
#include <asm/i8259.h> #include <asm/i8259.h>
#include <asm/open_pic.h> #include <asm/open_pic.h>
#include <asm/xmon.h>
unsigned long chrp_get_rtc_time(void); unsigned long chrp_get_rtc_time(void);
int chrp_set_rtc_time(unsigned long nowtime); int chrp_set_rtc_time(unsigned long nowtime);
...@@ -67,6 +69,13 @@ void btext_progress(char *, unsigned short); ...@@ -67,6 +69,13 @@ void btext_progress(char *, unsigned short);
extern unsigned long pmac_find_end_of_memory(void); extern unsigned long pmac_find_end_of_memory(void);
extern int of_show_percpuinfo(struct seq_file *, int); extern int of_show_percpuinfo(struct seq_file *, int);
/*
* XXX this should be in xmon.h, but putting it there means xmon.h
* has to include <linux/interrupt.h> (to get irqreturn_t), which
* causes all sorts of problems. -- paulus
*/
extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
extern dev_t boot_dev; extern dev_t boot_dev;
extern PTE *Hash, *Hash_end; extern PTE *Hash, *Hash_end;
......
...@@ -30,9 +30,17 @@ ...@@ -30,9 +30,17 @@
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/open_pic.h> #include <asm/open_pic.h>
#include <asm/xmon.h>
#include "pmac_pic.h" #include "pmac_pic.h"
/*
* XXX this should be in xmon.h, but putting it there means xmon.h
* has to include <linux/interrupt.h> (to get irqreturn_t), which
* causes all sorts of problems. -- paulus
*/
extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
struct pmac_irq_hw { struct pmac_irq_hw {
unsigned int event; unsigned int event;
unsigned int enable; unsigned int enable;
...@@ -177,7 +185,7 @@ struct hw_interrupt_type gatwick_pic = { ...@@ -177,7 +185,7 @@ struct hw_interrupt_type gatwick_pic = {
NULL NULL
}; };
static void gatwick_action(int cpl, void *dev_id, struct pt_regs *regs) static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
{ {
int irq, bits; int irq, bits;
...@@ -190,16 +198,11 @@ static void gatwick_action(int cpl, void *dev_id, struct pt_regs *regs) ...@@ -190,16 +198,11 @@ static void gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
if (bits == 0) if (bits == 0)
continue; continue;
irq += __ilog2(bits); irq += __ilog2(bits);
break; ppc_irq_dispatch_handler(regs, irq);
return IRQ_HANDLED;
} }
/* The previous version of this code allowed for this case, we printk("gatwick irq not from gatwick pic\n");
* don't. Put this here to check for it. return IRQ_NONE;
* -- Cort
*/
if ( irq_desc[irq].handler != &gatwick_pic )
printk("gatwick irq not from gatwick pic\n");
else
ppc_irq_dispatch_handler( regs, irq );
} }
int int
...@@ -393,7 +396,7 @@ pmac_pic_init(void) ...@@ -393,7 +396,7 @@ pmac_pic_init(void)
nmi_irq = pswitch->intrs[0].line; nmi_irq = pswitch->intrs[0].line;
openpic_init_nmi_irq(nmi_irq); openpic_init_nmi_irq(nmi_irq);
request_irq(nmi_irq, xmon_irq, 0, request_irq(nmi_irq, xmon_irq, 0,
"NMI - XMON", 0); "NMI - XMON", 0);
} }
} }
#endif /* CONFIG_XMON */ #endif /* CONFIG_XMON */
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/xmon.h>
#include "ppc8xx_pic.h" #include "ppc8xx_pic.h"
......
...@@ -15,7 +15,6 @@ extern FILE *xmon_stdin, *xmon_stdout; ...@@ -15,7 +15,6 @@ extern FILE *xmon_stdin, *xmon_stdout;
#define fflush(f) do {} while (0) #define fflush(f) do {} while (0)
#define fclose(f) do {} while (0) #define fclose(f) do {} while (0)
extern char *fgets(char *, int, void *); extern char *fgets(char *, int, void *);
extern void xmon_printf(const char *, ...);
extern void xmon_fprintf(void *, const char *, ...); extern void xmon_fprintf(void *, const char *, ...);
extern void xmon_sprintf(char *, const char *, ...); extern void xmon_sprintf(char *, const char *, ...);
extern void xmon_puts(char*); extern void xmon_puts(char*);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
static volatile unsigned char *sccc, *sccd; static volatile unsigned char *sccc, *sccd;
unsigned int TXRDY, RXRDY, DLAB; unsigned int TXRDY, RXRDY, DLAB;
extern void xmon_printf(const char *fmt, ...);
static int xmon_expect(const char *str, unsigned int timeout); static int xmon_expect(const char *str, unsigned int timeout);
static int use_serial; static int use_serial;
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/interrupt.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/string.h> #include <asm/string.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/bootx.h> #include <asm/bootx.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/xmon.h>
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
#include <asm/backlight.h> #include <asm/backlight.h>
#endif #endif
...@@ -103,7 +105,12 @@ static void cpu_cmd(void); ...@@ -103,7 +105,12 @@ static void cpu_cmd(void);
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
static int pretty_print_addr(unsigned long addr); static int pretty_print_addr(unsigned long addr);
static void csum(void); static void csum(void);
#ifdef CONFIG_BOOTX_TEXT
static void vidcmds(void);
#endif
static void bootcmds(void); static void bootcmds(void);
static void proccall(void);
static void printtime(void);
extern int print_insn_big_powerpc(FILE *, unsigned long, unsigned); extern int print_insn_big_powerpc(FILE *, unsigned long, unsigned);
extern void printf(const char *fmt, ...); extern void printf(const char *fmt, ...);
...@@ -116,6 +123,9 @@ extern void xmon_leave(void); ...@@ -116,6 +123,9 @@ extern void xmon_leave(void);
extern char* xmon_find_symbol(unsigned long addr, unsigned long* saddr); extern char* xmon_find_symbol(unsigned long addr, unsigned long* saddr);
extern unsigned long xmon_symbol_to_addr(char* symbol); extern unsigned long xmon_symbol_to_addr(char* symbol);
static unsigned start_tb[NR_CPUS][2];
static unsigned stop_tb[NR_CPUS][2];
#define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3]) #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ #define isxdigit(c) (('0' <= (c) && (c) <= '9') \
...@@ -165,6 +175,20 @@ extern inline void __delay(unsigned int loops) ...@@ -165,6 +175,20 @@ extern inline void __delay(unsigned int loops)
"r" (loops) : "ctr"); "r" (loops) : "ctr");
} }
static void get_tb(unsigned *p)
{
unsigned hi, lo, hiagain;
if ((get_pvr() >> 16) == 1)
return;
do {
asm volatile("mftbu %0; mftb %1; mftbu %2"
: "=r" (hi), "=r" (lo), "=r" (hiagain));
} while (hi != hiagain);
p[0] = hi;
p[1] = lo;
}
void void
xmon(struct pt_regs *excp) xmon(struct pt_regs *excp)
...@@ -172,6 +196,7 @@ xmon(struct pt_regs *excp) ...@@ -172,6 +196,7 @@ xmon(struct pt_regs *excp)
struct pt_regs regs; struct pt_regs regs;
int msr, cmd; int msr, cmd;
get_tb(stop_tb[smp_processor_id()]);
if (excp == NULL) { if (excp == NULL) {
asm volatile ("stw 0,0(%0)\n\ asm volatile ("stw 0,0(%0)\n\
lwz 0,0(1)\n\ lwz 0,0(1)\n\
...@@ -234,17 +259,18 @@ xmon(struct pt_regs *excp) ...@@ -234,17 +259,18 @@ xmon(struct pt_regs *excp)
clear_bit(smp_processor_id(), &cpus_in_xmon); clear_bit(smp_processor_id(), &cpus_in_xmon);
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
set_msr(msr); /* restore interrupt enable */ set_msr(msr); /* restore interrupt enable */
get_tb(start_tb[smp_processor_id()]);
} }
void irqreturn_t
xmon_irq(int irq, void *d, struct pt_regs *regs) xmon_irq(int irq, void *d, struct pt_regs *regs)
{ {
unsigned long flags; unsigned long flags;
local_save_flags(flags); local_irq_save(flags);
local_irq_disable();
printf("Keyboard interrupt\n"); printf("Keyboard interrupt\n");
xmon(regs); xmon(regs);
local_irq_restore(flags); local_irq_restore(flags);
return IRQ_HANDLED;
} }
int int
...@@ -481,13 +507,39 @@ cmds(struct pt_regs *excp) ...@@ -481,13 +507,39 @@ cmds(struct pt_regs *excp)
cpu_cmd(); cpu_cmd();
break; break;
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#ifdef CONFIG_BOOTX_TEXT
case 'v':
vidcmds();
break;
#endif
case 'z': case 'z':
bootcmds(); bootcmds();
break; break;
case 'p':
proccall();
break;
case 'T':
printtime();
break;
} }
} }
} }
extern unsigned tb_to_us;
#define mulhwu(x,y) \
({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;})
static void printtime(void)
{
unsigned int delta;
delta = stop_tb[smp_processor_id()][1]
- start_tb[smp_processor_id()][1];
delta = mulhwu(tb_to_us, delta);
printf("%u.%06u seconds\n", delta / 1000000, delta % 1000000);
}
static void bootcmds(void) static void bootcmds(void)
{ {
int cmd; int cmd;
...@@ -551,6 +603,44 @@ static void cpu_cmd(void) ...@@ -551,6 +603,44 @@ static void cpu_cmd(void)
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#ifdef CONFIG_BOOTX_TEXT
extern boot_infos_t disp_bi;
static void vidcmds(void)
{
int c = inchar();
unsigned int val, w;
extern int boot_text_mapped;
if (!boot_text_mapped)
return;
if (c != '\n' && scanhex(&val)) {
switch (c) {
case 'd':
w = disp_bi.dispDeviceRowBytes
/ (disp_bi.dispDeviceDepth >> 3);
disp_bi.dispDeviceDepth = val;
disp_bi.dispDeviceRowBytes = w * (val >> 3);
return;
case 'p':
disp_bi.dispDeviceRowBytes = val;
return;
case 'w':
disp_bi.dispDeviceRect[2] = val;
return;
case 'h':
disp_bi.dispDeviceRect[3] = val;
return;
}
}
printf("W = %d (0x%x) H = %d (0x%x) D = %d (0x%x) P = %d (0x%x)\n",
disp_bi.dispDeviceRect[2], disp_bi.dispDeviceRect[2],
disp_bi.dispDeviceRect[3], disp_bi.dispDeviceRect[3],
disp_bi.dispDeviceDepth, disp_bi.dispDeviceDepth,
disp_bi.dispDeviceRowBytes, disp_bi.dispDeviceRowBytes);
}
#endif /* CONFIG_BOOTX_TEXT */
static unsigned short fcstab[256] = { static unsigned short fcstab[256] = {
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
...@@ -927,34 +1017,6 @@ super_regs() ...@@ -927,34 +1017,6 @@ super_regs()
scannl(); scannl();
} }
#if 0
static void
openforth()
{
int c;
char *p;
char cmd[1024];
int args[5];
extern int (*prom_entry)(int *);
p = cmd;
c = skipbl();
while (c != '\n') {
*p++ = c;
c = inchar();
}
*p = 0;
args[0] = (int) "interpret";
args[1] = 1;
args[2] = 1;
args[3] = (int) cmd;
(*prom_entry)(args);
printf("\n");
if (args[4] != 0)
printf("error %x\n", args[4]);
}
#endif
#ifndef CONFIG_PPC_STD_MMU #ifndef CONFIG_PPC_STD_MMU
static void static void
dump_hash_table() dump_hash_table()
...@@ -1176,11 +1238,13 @@ mwrite(unsigned adrs, void *buf, int size) ...@@ -1176,11 +1238,13 @@ mwrite(unsigned adrs, void *buf, int size)
} }
static int fault_type; static int fault_type;
static int fault_except;
static char *fault_chars[] = { "--", "**", "##" }; static char *fault_chars[] = { "--", "**", "##" };
static void static void
handle_fault(struct pt_regs *regs) handle_fault(struct pt_regs *regs)
{ {
fault_except = TRAP(regs);
fault_type = TRAP(regs) == 0x200? 0: TRAP(regs) == 0x300? 1: 2; fault_type = TRAP(regs) == 0x200? 0: TRAP(regs) == 0x300? 1: 2;
longjmp(bus_error_jmp, 1); longjmp(bus_error_jmp, 1);
} }
...@@ -1578,6 +1642,41 @@ memzcan() ...@@ -1578,6 +1642,41 @@ memzcan()
printf("%.8x\n", a - mskip); printf("%.8x\n", a - mskip);
} }
void proccall(void)
{
unsigned int args[8];
unsigned int ret;
int i;
typedef unsigned int (*callfunc_t)(unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int);
callfunc_t func;
scanhex(&adrs);
if (termch != '\n')
termch = 0;
for (i = 0; i < 8; ++i)
args[i] = 0;
for (i = 0; i < 8; ++i) {
if (!scanhex(&args[i]) || termch == '\n')
break;
termch = 0;
}
func = (callfunc_t) adrs;
ret = 0;
if (setjmp(bus_error_jmp) == 0) {
debugger_fault_handler = handle_fault;
sync();
ret = func(args[0], args[1], args[2], args[3],
args[4], args[5], args[6], args[7]);
sync();
printf("return value is %x\n", ret);
} else {
printf("*** %x exception occurred\n", fault_except);
}
debugger_fault_handler = 0;
}
/* Input scanning routines */ /* Input scanning routines */
int int
skipbl() skipbl()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _PPC_BUG_H #define _PPC_BUG_H
#include <linux/config.h> #include <linux/config.h>
#include <asm/system.h> /* for xmon definition */ #include <asm/xmon.h>
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
extern void xmon(struct pt_regs *); extern void xmon(struct pt_regs *);
......
...@@ -50,8 +50,6 @@ ...@@ -50,8 +50,6 @@
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#ifdef __KERNEL__ #ifdef __KERNEL__
extern void xmon_irq(int, void *, struct pt_regs *);
extern void xmon(struct pt_regs *excp);
extern void print_backtrace(unsigned long *); extern void print_backtrace(unsigned long *);
extern void show_regs(struct pt_regs * regs); extern void show_regs(struct pt_regs * regs);
extern void flush_instruction_cache(void); extern void flush_instruction_cache(void);
......
#ifndef __PPC_XMON_H
#define __PPC_XMON_H
#ifdef __KERNEL__
struct pt_regs;
extern void xmon(struct pt_regs *excp);
extern void xmon_printf(const char *fmt, ...);
extern void xmon_map_scc(void);
extern int xmon_bpt(struct pt_regs *regs);
extern int xmon_sstep(struct pt_regs *regs);
extern int xmon_iabr_match(struct pt_regs *regs);
extern int xmon_dabr_match(struct pt_regs *regs);
extern void (*xmon_fault_handler)(struct pt_regs *regs);
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment