aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kgdb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kgdb.h')
-rw-r--r--include/linux/kgdb.h41
1 files changed, 25 insertions, 16 deletions
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_ */