Commit 17ce452f authored by Jason Wessel's avatar Jason Wessel

kgdb, powerpc: arch specific powerpc kgdb support

This patch removes the old kgdb reminants from ARCH=powerpc and
implements the new style arch specific stub for the common kgdb core
interface.

It is possible to have xmon and kgdb in the same kernel, but you
cannot use both at the same time because there is only one set of
debug hooks.

The arch specific kgdb implementation saves the previous state of the
debug hooks and restores them if you unconfigure the kgdb I/O driver.
Kgdb should have no impact on a kernel that has no kgdb I/O driver
configured.
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
parent 5cbad0eb
......@@ -112,6 +112,7 @@ config PPC
select HAVE_FTRACE
select HAVE_IDE
select HAVE_KPROBES
select HAVE_ARCH_KGDB
select HAVE_KRETPROBES
select HAVE_LMB
select HAVE_DMA_ATTRS if PPC64
......
......@@ -41,22 +41,6 @@ config HCALL_STATS
This option will add a small amount of overhead to all hypervisor
calls.
config DEBUGGER
bool "Enable debugger hooks"
depends on DEBUG_KERNEL
help
Include in-kernel hooks for kernel debuggers. Unless you are
intending to debug the kernel, say N here.
config KGDB
bool "Include kgdb kernel debugger"
depends on DEBUGGER && (BROKEN || PPC_GEN550 || 4xx)
select DEBUG_INFO
help
Include in-kernel hooks for kgdb, the Linux kernel source level
debugger. See <http://kgdb.sourceforge.net/> for more information.
Unless you are intending to debug the kernel, say N here.
config CODE_PATCHING_SELFTEST
bool "Run self-tests of the code-patching code."
depends on DEBUG_KERNEL
......@@ -67,36 +51,9 @@ config FTR_FIXUP_SELFTEST
depends on DEBUG_KERNEL
default n
choice
prompt "Serial Port"
depends on KGDB
default KGDB_TTYS1
config KGDB_TTYS0
bool "ttyS0"
config KGDB_TTYS1
bool "ttyS1"
config KGDB_TTYS2
bool "ttyS2"
config KGDB_TTYS3
bool "ttyS3"
endchoice
config KGDB_CONSOLE
bool "Enable serial console thru kgdb port"
depends on KGDB && 8xx || CPM2
help
If you enable this, all serial console messages will be sent
over the gdb stub.
If unsure, say N.
config XMON
bool "Include xmon kernel debugger"
depends on DEBUGGER
depends on DEBUG_KERNEL
help
Include in-kernel hooks for the xmon kernel monitor/debugger.
Unless you are intending to debug the kernel, say N here.
......@@ -126,6 +83,11 @@ config XMON_DISASSEMBLY
to say Y here, unless you're building for a memory-constrained
system.
config DEBUGGER
bool
depends on KGDB || XMON
default y
config IRQSTACKS
bool "Use separate kernel stacks when processing interrupts"
help
......
......@@ -74,6 +74,7 @@ obj-y += time.o prom.o traps.o setup-common.o \
misc_$(CONFIG_WORD_SIZE).o
obj-$(CONFIG_PPC32) += entry_32.o setup_32.o
obj-$(CONFIG_PPC64) += dma_64.o iommu.o
obj-$(CONFIG_KGDB) += kgdb.o
obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
obj-$(CONFIG_MODULES) += ppc_ksyms.o
obj-$(CONFIG_BOOTX_TEXT) += btext.o
......
This diff is collapsed.
......@@ -43,10 +43,6 @@
#define DBG(fmt...)
#if defined CONFIG_KGDB
#include <asm/kgdb.h>
#endif
extern void bootx_init(unsigned long r4, unsigned long phys);
int boot_cpuid;
......@@ -302,18 +298,6 @@ void __init setup_arch(char **cmdline_p)
xmon_setup();
#if defined(CONFIG_KGDB)
if (ppc_md.kgdb_map_scc)
ppc_md.kgdb_map_scc();
set_debug_traps();
if (strstr(cmd_line, "gdb")) {
if (ppc_md.progress)
ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000);
printk("kgdb breakpoint activated\n");
breakpoint();
}
#endif
/*
* Set cache line size based on type of cpu as a default.
* Systems with OF can look in the properties on the cpu node(s)
......
......@@ -97,8 +97,6 @@ extern struct machdep_calls pmac_md;
int sccdbg;
#endif
extern void zs_kgdb_hook(int tty_num);
sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
EXPORT_SYMBOL(sys_ctrler);
......@@ -329,10 +327,6 @@ static void __init pmac_setup_arch(void)
l2cr_init();
#endif /* CONFIG_PPC32 */
#ifdef CONFIG_KGDB
zs_kgdb_hook(0);
#endif
find_via_cuda();
find_via_pmu();
smu_init();
......
/*
* kgdb.h: Defines and declarations for serial line source level
* remote debugging of the Linux kernel using gdb.
* include/asm-powerpc/kgdb.h
*
* The PowerPC (32/64) specific defines / externs for KGDB. Based on
* the previous 32bit and 64bit specific files, which had the following
* copyrights:
*
* PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com)
* PPC Mods (C) 2004 Tom Rini (trini@mvista.com)
* PPC Mods (C) 2003 John Whitney (john.whitney@timesys.com)
* PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu)
*
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* Author: Tom Rini <trini@kernel.crashing.org>
*
* 2006 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#ifdef __KERNEL__
#ifndef _PPC_KGDB_H
#define _PPC_KGDB_H
#ifndef __POWERPC_KGDB_H__
#define __POWERPC_KGDB_H__
#ifndef __ASSEMBLY__
/* Things specific to the gen550 backend. */
struct uart_port;
extern void gen550_progress(char *, unsigned short);
extern void gen550_kgdb_map_scc(void);
extern void gen550_init(int, struct uart_port *);
/* Things specific to the pmac backend. */
extern void zs_kgdb_hook(int tty_num);
/* To init the kgdb engine. (called by serial hook)*/
extern void set_debug_traps(void);
/* To enter the debugger explicitly. */
extern void breakpoint(void);
/* For taking exceptions
* these are defined in traps.c
*/
extern int (*debugger)(struct pt_regs *regs);
extern int (*debugger_bpt)(struct pt_regs *regs);
extern int (*debugger_sstep)(struct pt_regs *regs);
extern int (*debugger_iabr_match)(struct pt_regs *regs);
extern int (*debugger_dabr_match)(struct pt_regs *regs);
extern void (*debugger_fault_handler)(struct pt_regs *regs);
/* What we bring to the party */
int kgdb_bpt(struct pt_regs *regs);
int kgdb_sstep(struct pt_regs *regs);
void kgdb(struct pt_regs *regs);
int kgdb_iabr_match(struct pt_regs *regs);
int kgdb_dabr_match(struct pt_regs *regs);
#define BREAK_INSTR_SIZE 4
#define BUFMAX ((NUMREGBYTES * 2) + 512)
#define OUTBUFMAX ((NUMREGBYTES * 2) + 512)
static inline void arch_kgdb_breakpoint(void)
{
asm(".long 0x7d821008"); /* twge r2, r2 */
}
#define CACHE_FLUSH_IS_SAFE 1
/* The number bytes of registers we have to save depends on a few
* things. For 64bit we default to not including vector registers and
* vector state registers. */
#ifdef CONFIG_PPC64
/*
* external low-level support routines (ie macserial.c)
* 64 bit (8 byte) registers:
* 32 gpr, 32 fpr, nip, msr, link, ctr
* 32 bit (4 byte) registers:
* ccr, xer, fpscr
*/
extern void kgdb_interruptible(int); /* control interrupts from serial */
extern void putDebugChar(char); /* write a single character */
extern char getDebugChar(void); /* read and return a single char */
#define NUMREGBYTES ((68 * 8) + (3 * 4))
#define NUMCRITREGBYTES 184
#else /* CONFIG_PPC32 */
/* On non-E500 family PPC32 we determine the size by picking the last
* register we need, but on E500 we skip sections so we list what we
* need to store, and add it up. */
#ifndef CONFIG_E500
#define MAXREG (PT_FPSCR+1)
#else
/* 32 GPRs (8 bytes), nip, msr, ccr, link, ctr, xer, acc (8 bytes), spefscr*/
#define MAXREG ((32*2)+6+2+1)
#endif
#define NUMREGBYTES (MAXREG * sizeof(int))
/* CR/LR, R1, R2, R13-R31 inclusive. */
#define NUMCRITREGBYTES (23 * sizeof(int))
#endif /* 32/64 */
#endif /* !(__ASSEMBLY__) */
#endif /* !(_PPC_KGDB_H) */
#endif /* !__POWERPC_KGDB_H__ */
#endif /* __KERNEL__ */
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