aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 14:08:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 14:08:05 -0400
commit90b9a32d8f441369b2f97a765d2d957b531eb653 (patch)
tree3146d251a983ba12226e75c121613de6f051af8b /include/linux
parent8b108c609adefd98577c35f0a41497a610041a6c (diff)
parent4402c153cb9c549cd21d6007ef0dfac50c8d148d (diff)
Merge branch 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb
* 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb: (25 commits) kdb,debug_core: Allow the debug core to receive a panic notification MAINTAINERS: update kgdb, kdb, and debug_core info debug_core,kdb: Allow the debug core to process a recursive debug entry printk,kdb: capture printk() when in kdb shell kgdboc,kdb: Allow kdb to work on a non open console port kgdb: Add the ability to schedule a breakpoint via a tasklet mips,kgdb: kdb low level trap catch and stack trace powerpc,kgdb: Introduce low level trap catching x86,kgdb: Add low level debug hook kgdb: remove post_primary_code references kgdb,docs: Update the kgdb docs to include kdb kgdboc,keyboard: Keyboard driver for kdb with kgdb kgdb: gdb "monitor" -> kdb passthrough sparc,sunzilog: Add console polling support for sunzilog serial driver sh,sh-sci: Use NO_POLL_CHAR in the SCIF polled console code kgdb,8250,pl011: Return immediately from console poll kgdb: core changes to support kdb kdb: core for kgdb back end (2 of 2) kdb: core for kgdb back end (1 of 2) kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kdb.h117
-rw-r--r--include/linux/kgdb.h41
-rw-r--r--include/linux/serial_core.h1
3 files changed, 143 insertions, 16 deletions
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
new file mode 100644
index 000000000000..ccb2b3ec0fe8
--- /dev/null
+++ b/include/linux/kdb.h
@@ -0,0 +1,117 @@
1#ifndef _KDB_H
2#define _KDB_H
3
4/*
5 * Kernel Debugger Architecture Independent Global Headers
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
12 * Copyright (C) 2000 Stephane Eranian <eranian@hpl.hp.com>
13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
14 */
15
16#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h>
18#include <linux/sched.h>
19#include <asm/atomic.h>
20
21#define KDB_POLL_FUNC_MAX 5
22extern int kdb_poll_idx;
23
24/*
25 * kdb_initial_cpu is initialized to -1, and is set to the cpu
26 * number whenever the kernel debugger is entered.
27 */
28extern int kdb_initial_cpu;
29extern atomic_t kdb_event;
30
31/*
32 * kdb_diemsg
33 *
34 * Contains a pointer to the last string supplied to the
35 * kernel 'die' panic function.
36 */
37extern const char *kdb_diemsg;
38
39#define KDB_FLAG_EARLYKDB (1 << 0) /* set from boot parameter kdb=early */
40#define KDB_FLAG_CATASTROPHIC (1 << 1) /* A catastrophic event has occurred */
41#define KDB_FLAG_CMD_INTERRUPT (1 << 2) /* Previous command was interrupted */
42#define KDB_FLAG_NOIPI (1 << 3) /* Do not send IPIs */
43#define KDB_FLAG_ONLY_DO_DUMP (1 << 4) /* Only do a dump, used when
44 * kdb is off */
45#define KDB_FLAG_NO_CONSOLE (1 << 5) /* No console is available,
46 * kdb is disabled */
47#define KDB_FLAG_NO_VT_CONSOLE (1 << 6) /* No VT console is available, do
48 * not use keyboard */
49#define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do
50 * not use keyboard */
51
52extern int kdb_flags; /* Global flags, see kdb_state for per cpu state */
53
54extern void kdb_save_flags(void);
55extern void kdb_restore_flags(void);
56
57#define KDB_FLAG(flag) (kdb_flags & KDB_FLAG_##flag)
58#define KDB_FLAG_SET(flag) ((void)(kdb_flags |= KDB_FLAG_##flag))
59#define KDB_FLAG_CLEAR(flag) ((void)(kdb_flags &= ~KDB_FLAG_##flag))
60
61/*
62 * External entry point for the kernel debugger. The pt_regs
63 * at the time of entry are supplied along with the reason for
64 * entry to the kernel debugger.
65 */
66
67typedef enum {
68 KDB_REASON_ENTER = 1, /* KDB_ENTER() trap/fault - regs valid */
69 KDB_REASON_ENTER_SLAVE, /* KDB_ENTER_SLAVE() trap/fault - regs valid */
70 KDB_REASON_BREAK, /* Breakpoint inst. - regs valid */
71 KDB_REASON_DEBUG, /* Debug Fault - regs valid */
72 KDB_REASON_OOPS, /* Kernel Oops - regs valid */
73 KDB_REASON_SWITCH, /* CPU switch - regs valid*/
74 KDB_REASON_KEYBOARD, /* Keyboard entry - regs valid */
75 KDB_REASON_NMI, /* Non-maskable interrupt; regs valid */
76 KDB_REASON_RECURSE, /* Recursive entry to kdb;
77 * regs probably valid */
78 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
79} kdb_reason_t;
80
81extern int kdb_trap_printk;
82extern int vkdb_printf(const char *fmt, va_list args)
83 __attribute__ ((format (printf, 1, 0)));
84extern int kdb_printf(const char *, ...)
85 __attribute__ ((format (printf, 1, 2)));
86typedef int (*kdb_printf_t)(const char *, ...)
87 __attribute__ ((format (printf, 1, 2)));
88
89extern void kdb_init(int level);
90
91/* Access to kdb specific polling devices */
92typedef int (*get_char_func)(void);
93extern get_char_func kdb_poll_funcs[];
94extern int kdb_get_kbd_char(void);
95
96static inline
97int kdb_process_cpu(const struct task_struct *p)
98{
99 unsigned int cpu = task_thread_info(p)->cpu;
100 if (cpu > num_possible_cpus())
101 cpu = 0;
102 return cpu;
103}
104
105/* kdb access to register set for stack dumping */
106extern struct pt_regs *kdb_current_regs;
107
108#else /* ! CONFIG_KGDB_KDB */
109#define kdb_printf(...)
110#define kdb_init(x)
111#endif /* CONFIG_KGDB_KDB */
112enum {
113 KDB_NOT_INITIALIZED,
114 KDB_INIT_EARLY,
115 KDB_INIT_FULL,
116};
117#endif /* !_KDB_H */
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 19ec41a183f5..6c784ab6856a 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -16,10 +16,12 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/init.h> 18#include <linux/init.h>
19
20#include <asm/atomic.h> 19#include <asm/atomic.h>
20#ifdef CONFIG_HAVE_ARCH_KGDB
21#include <asm/kgdb.h> 21#include <asm/kgdb.h>
22#endif
22 23
24#ifdef CONFIG_KGDB
23struct pt_regs; 25struct pt_regs;
24 26
25/** 27/**
@@ -34,20 +36,6 @@ struct pt_regs;
34extern int kgdb_skipexception(int exception, struct pt_regs *regs); 36extern int kgdb_skipexception(int exception, struct pt_regs *regs);
35 37
36/** 38/**
37 * kgdb_post_primary_code - (optional) Save error vector/code numbers.
38 * @regs: Original pt_regs.
39 * @e_vector: Original error vector.
40 * @err_code: Original error code.
41 *
42 * This is usually needed on architectures which support SMP and
43 * KGDB. This function is called after all the secondary cpus have
44 * been put to a know spin state and the primary CPU has control over
45 * KGDB.
46 */
47extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector,
48 int err_code);
49
50/**
51 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook 39 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
52 * @regs: Current &struct pt_regs. 40 * @regs: Current &struct pt_regs.
53 * 41 *
@@ -72,6 +60,7 @@ struct uart_port;
72void kgdb_breakpoint(void); 60void kgdb_breakpoint(void);
73 61
74extern int kgdb_connected; 62extern int kgdb_connected;
63extern int kgdb_io_module_registered;
75 64
76extern atomic_t kgdb_setting_breakpoint; 65extern atomic_t kgdb_setting_breakpoint;
77extern atomic_t kgdb_cpu_doing_single_step; 66extern atomic_t kgdb_cpu_doing_single_step;
@@ -202,6 +191,17 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
202 */ 191 */
203extern void kgdb_roundup_cpus(unsigned long flags); 192extern void kgdb_roundup_cpus(unsigned long flags);
204 193
194/**
195 * kgdb_arch_set_pc - Generic call back to the program counter
196 * @regs: Current &struct pt_regs.
197 * @pc: The new value for the program counter
198 *
199 * This function handles updating the program counter and requires an
200 * architecture specific implementation.
201 */
202extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
203
204
205/* Optional functions. */ 205/* Optional functions. */
206extern int kgdb_validate_break_address(unsigned long addr); 206extern int kgdb_validate_break_address(unsigned long addr);
207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); 207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
@@ -247,6 +247,8 @@ struct kgdb_arch {
247 * the I/O driver. 247 * the I/O driver.
248 * @post_exception: Pointer to a function that will do any cleanup work 248 * @post_exception: Pointer to a function that will do any cleanup work
249 * for the I/O driver. 249 * for the I/O driver.
250 * @is_console: 1 if the end device is a console 0 if the I/O device is
251 * not a console
250 */ 252 */
251struct kgdb_io { 253struct kgdb_io {
252 const char *name; 254 const char *name;
@@ -256,6 +258,7 @@ struct kgdb_io {
256 int (*init) (void); 258 int (*init) (void);
257 void (*pre_exception) (void); 259 void (*pre_exception) (void);
258 void (*post_exception) (void); 260 void (*post_exception) (void);
261 int is_console;
259}; 262};
260 263
261extern struct kgdb_arch arch_kgdb_ops; 264extern struct kgdb_arch arch_kgdb_ops;
@@ -264,12 +267,14 @@ extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
264 267
265extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 268extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
266extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); 269extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
270extern struct kgdb_io *dbg_io_ops;
267 271
268extern int kgdb_hex2long(char **ptr, unsigned long *long_val); 272extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
269extern int kgdb_mem2hex(char *mem, char *buf, int count); 273extern int kgdb_mem2hex(char *mem, char *buf, int count);
270extern int kgdb_hex2mem(char *buf, char *mem, int count); 274extern int kgdb_hex2mem(char *buf, char *mem, int count);
271 275
272extern int kgdb_isremovedbreak(unsigned long addr); 276extern int kgdb_isremovedbreak(unsigned long addr);
277extern void kgdb_schedule_breakpoint(void);
273 278
274extern int 279extern int
275kgdb_handle_exception(int ex_vector, int signo, int err_code, 280kgdb_handle_exception(int ex_vector, int signo, int err_code,
@@ -278,5 +283,9 @@ extern int kgdb_nmicallback(int cpu, void *regs);
278 283
279extern int kgdb_single_step; 284extern int kgdb_single_step;
280extern atomic_t kgdb_active; 285extern atomic_t kgdb_active;
281 286#define in_dbg_master() \
287 (raw_smp_processor_id() == atomic_read(&kgdb_active))
288#else /* ! CONFIG_KGDB */
289#define in_dbg_master() (0)
290#endif /* ! CONFIG_KGDB */
282#endif /* _KGDB_H_ */ 291#endif /* _KGDB_H_ */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 09d0d2d5a08b..f10db6e5f3b5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -250,6 +250,7 @@ struct uart_ops {
250#endif 250#endif
251}; 251};
252 252
253#define NO_POLL_CHAR 0x00ff0000
253#define UART_CONFIG_TYPE (1 << 0) 254#define UART_CONFIG_TYPE (1 << 0)
254#define UART_CONFIG_IRQ (1 << 1) 255#define UART_CONFIG_IRQ (1 << 1)
255 256