[U-Boot-Users] [PATCH] MPC85xx KGDB support
Kumar Gala
galak at kernel.crashing.org
Tue Jan 8 06:52:55 CET 2008
On Nov 1, 2007, at 10:16 PM, Chen Gong wrote:
> ---
> cpu/mpc85xx/Makefile | 4 +-
> drivers/serial.c | 28 +++++++++++++++++++
> include/configs/MPC8548CDS.h | 3 +-
> lib_ppc/kgdb.c | 62 ++++++++++++++++++++++++++++++++
> +---------
> 4 files changed, 81 insertions(+), 16 deletions(-)
>
> diff --git a/cpu/mpc85xx/Makefile b/cpu/mpc85xx/Makefile
> index 32091fa..f5cb148 100644
> --- a/cpu/mpc85xx/Makefile
> +++ b/cpu/mpc85xx/Makefile
> @@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
>
> LIB = $(obj)lib$(CPU).a
>
> -START = start.o resetvec.o
> +START = start.o resetvec.o kgdb.o
> COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o \
> pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o
>
> @@ -39,7 +39,7 @@ START := $(addprefix $(obj),$(START))
> all: $(obj).depend $(START) $(LIB)
>
> $(LIB): $(OBJS)
> - $(AR) $(ARFLAGS) $@ $(OBJS)
> + $(AR) $(ARFLAGS) $@ $(OBJS) $(obj)kgdb.o
these makefile changes seem bogus. There isn't a kgdb source file in
cpu/mpc85xx/ (at least your patch isn't adding one).
>
>
> #########################################################################
>
> diff --git a/drivers/serial.c b/drivers/serial.c
> index 76425d8..42585d7 100644
> --- a/drivers/serial.c
> +++ b/drivers/serial.c
> @@ -307,6 +307,34 @@ serial_setbrg(void)
> }
> #endif
>
> +#if defined(CONFIG_CMD_KGDB)
> +void kgdb_serial_init (void)
> +{
> + /* here presume you have been initialzed appropriate COM# */
> + _serial_puts("[on serial] ",CONFIG_KGDB_SER_INDEX);
> +}
> +
> +void putDebugChar (int c)
> +{
> + _serial_putc(c, CONFIG_KGDB_SER_INDEX);
> +}
> +
> +void putDebugStr (const char *str)
> +{
> + _serial_puts(str, CONFIG_KGDB_SER_INDEX);
> +}
> +
> +int getDebugChar (void)
> +{
> + return _serial_getc(CONFIG_KGDB_SER_INDEX);
> +}
> +
> +void kgdb_interruptible (int yes)
> +{
> + return;
> +}
> +#endif
> +
> #if defined(CONFIG_SERIAL_MULTI)
>
> DECLARE_ESERIAL_FUNCTIONS(1);
> diff --git a/include/configs/MPC8548CDS.h b/include/configs/
> MPC8548CDS.h
> index 6083715..396feeb 100644
> --- a/include/configs/MPC8548CDS.h
> +++ b/include/configs/MPC8548CDS.h
> @@ -482,6 +482,7 @@ extern unsigned long get_clock_freq(void);
> #define CONFIG_CMD_PING
> #define CONFIG_CMD_I2C
> #define CONFIG_CMD_MII
> +#define CONFIG_CMD_KGDB
I dont think we want to turn this on by default.
>
>
> #if defined(CONFIG_PCI)
> #define CONFIG_CMD_PCI
> @@ -529,7 +530,7 @@ extern unsigned long get_clock_freq(void);
> #define BOOTFLAG_WARM 0x02 /* Software reboot */
>
> #if defined(CONFIG_CMD_KGDB)
> -#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial
> port */
> +#define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial
> port */
> #define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
> #endif
>
> diff --git a/lib_ppc/kgdb.c b/lib_ppc/kgdb.c
> index 78c2f0c..7acdebc 100644
> --- a/lib_ppc/kgdb.c
> +++ b/lib_ppc/kgdb.c
> @@ -60,20 +60,46 @@ static struct hard_trap_info
> unsigned int tt; /* Trap type code for powerpc */
> unsigned char signo; /* Signal that we map this trap into */
> } hard_trap_info[] = {
> - { 0x200, SIGSEGV }, /* machine check */
> - { 0x300, SIGSEGV }, /* address error (store) */
> - { 0x400, SIGBUS }, /* instruction bus error */
> - { 0x500, SIGINT }, /* interrupt */
> - { 0x600, SIGBUS }, /* alingment */
> - { 0x700, SIGTRAP }, /* breakpoint trap */
> - { 0x800, SIGFPE }, /* fpu unavail */
> - { 0x900, SIGALRM }, /* decrementer */
> - { 0xa00, SIGILL }, /* reserved */
> - { 0xb00, SIGILL }, /* reserved */
> - { 0xc00, SIGCHLD }, /* syscall */
> - { 0xd00, SIGTRAP }, /* single-step/watch */
> - { 0xe00, SIGFPE }, /* fp assist */
> +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
> + { 0x100, SIGINT }, /* critical input interrupt */
> + { 0x200, SIGSEGV }, /* machine check */
> + { 0x300, SIGSEGV }, /* data storage */
> + { 0x400, SIGBUS }, /* instruction storage */
> + { 0x500, SIGINT }, /* interrupt */
> + { 0x600, SIGBUS }, /* alignment */
> + { 0x700, SIGILL }, /* program */
> + { 0x800, SIGILL }, /* reserved */
> + { 0x900, SIGILL }, /* reserved */
> + { 0xa00, SIGILL }, /* reserved */
> + { 0xb00, SIGILL }, /* reserved */
> + { 0xc00, SIGCHLD }, /* syscall */
> + { 0xd00, SIGILL }, /* reserved */
> + { 0xe00, SIGILL }, /* reserved */
> + { 0xf00, SIGILL }, /* reserved */
> + /*
> + * 0x1000 PIT
> + * 0x1010 FIT
> + * 0x1020 watchdog
> + * 0x1100 data TLB miss
> + * 0x1200 instruction TLB miss
> + */
> + { 0x2002, SIGTRAP}, /* debug */
> +#else
> + { 0x200, SIGSEGV }, /* machine check */
> + { 0x300, SIGSEGV }, /* address error (store) */
> + { 0x400, SIGBUS }, /* instruction bus error */
> + { 0x500, SIGINT }, /* interrupt */
> + { 0x600, SIGBUS }, /* alingment */
> + { 0x700, SIGTRAP }, /* breakpoint trap */
> + { 0x800, SIGFPE }, /* fpu unavail */
> + { 0x900, SIGALRM }, /* decrementer */
> + { 0xa00, SIGILL }, /* reserved */
> + { 0xb00, SIGILL }, /* reserved */
> + { 0xc00, SIGCHLD }, /* syscall */
> + { 0xd00, SIGTRAP }, /* single-step/watch */
> + { 0xe00, SIGFPE }, /* fp assist */
> { 0, 0} /* Must be last */
> +#endif
> };
>
> static int
> @@ -100,7 +126,12 @@ kgdb_enter(struct pt_regs *regs, kgdb_data *kdp)
> /* Skip over breakpoint trap insn */
> regs->nip += 4;
> }
> +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
> + mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~DBCR_IC);
> + regs->msr &= ~MSR_DE;
> +#else
> regs->msr &= ~MSR_SE;
> +#endif
>
> /* reply to host that an exception has occurred */
> kdp->sigval = computeSignal(regs->trap);
> @@ -130,7 +161,12 @@ kgdb_exit(struct pt_regs *regs, kgdb_data *kdp)
> break;
>
> case KGDBEXIT_SINGLE:
> +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
> + mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR_IC);
> + regs->msr |= MSR_DE;
> +#else
> regs->msr |= MSR_SE;
> +#endif
> #if 0
> set_msr(msr | MSR_SE);
> #endif
> --
> 1.5.2
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a
> browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
More information about the U-Boot
mailing list