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.h70
1 files changed, 53 insertions, 17 deletions
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 19ec41a183f5..cc96f0f23e04 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;
@@ -101,6 +90,19 @@ struct kgdb_bkpt {
101 enum kgdb_bpstate state; 90 enum kgdb_bpstate state;
102}; 91};
103 92
93struct dbg_reg_def_t {
94 char *name;
95 int size;
96 int offset;
97};
98
99#ifndef DBG_MAX_REG_NUM
100#define DBG_MAX_REG_NUM 0
101#else
102extern struct dbg_reg_def_t dbg_reg_def[];
103extern char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs);
104extern int dbg_set_reg(int regno, void *mem, struct pt_regs *regs);
105#endif
104#ifndef KGDB_MAX_BREAKPOINTS 106#ifndef KGDB_MAX_BREAKPOINTS
105# define KGDB_MAX_BREAKPOINTS 1000 107# define KGDB_MAX_BREAKPOINTS 1000
106#endif 108#endif
@@ -202,12 +204,34 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
202 */ 204 */
203extern void kgdb_roundup_cpus(unsigned long flags); 205extern void kgdb_roundup_cpus(unsigned long flags);
204 206
207/**
208 * kgdb_arch_set_pc - Generic call back to the program counter
209 * @regs: Current &struct pt_regs.
210 * @pc: The new value for the program counter
211 *
212 * This function handles updating the program counter and requires an
213 * architecture specific implementation.
214 */
215extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
216
217
205/* Optional functions. */ 218/* Optional functions. */
206extern int kgdb_validate_break_address(unsigned long addr); 219extern int kgdb_validate_break_address(unsigned long addr);
207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); 220extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
208extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); 221extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
209 222
210/** 223/**
224 * kgdb_arch_late - Perform any architecture specific initalization.
225 *
226 * This function will handle the late initalization of any
227 * architecture specific callbacks. This is an optional function for
228 * handling things like late initialization of hw breakpoints. The
229 * default implementation does nothing.
230 */
231extern void kgdb_arch_late(void);
232
233
234/**
211 * struct kgdb_arch - Describe architecture specific values. 235 * struct kgdb_arch - Describe architecture specific values.
212 * @gdb_bpt_instr: The instruction to trigger a breakpoint. 236 * @gdb_bpt_instr: The instruction to trigger a breakpoint.
213 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. 237 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
@@ -247,6 +271,8 @@ struct kgdb_arch {
247 * the I/O driver. 271 * the I/O driver.
248 * @post_exception: Pointer to a function that will do any cleanup work 272 * @post_exception: Pointer to a function that will do any cleanup work
249 * for the I/O driver. 273 * for the I/O driver.
274 * @is_console: 1 if the end device is a console 0 if the I/O device is
275 * not a console
250 */ 276 */
251struct kgdb_io { 277struct kgdb_io {
252 const char *name; 278 const char *name;
@@ -256,6 +282,7 @@ struct kgdb_io {
256 int (*init) (void); 282 int (*init) (void);
257 void (*pre_exception) (void); 283 void (*pre_exception) (void);
258 void (*post_exception) (void); 284 void (*post_exception) (void);
285 int is_console;
259}; 286};
260 287
261extern struct kgdb_arch arch_kgdb_ops; 288extern struct kgdb_arch arch_kgdb_ops;
@@ -264,12 +291,14 @@ extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
264 291
265extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 292extern 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); 293extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
294extern struct kgdb_io *dbg_io_ops;
267 295
268extern int kgdb_hex2long(char **ptr, unsigned long *long_val); 296extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
269extern int kgdb_mem2hex(char *mem, char *buf, int count); 297extern char *kgdb_mem2hex(char *mem, char *buf, int count);
270extern int kgdb_hex2mem(char *buf, char *mem, int count); 298extern int kgdb_hex2mem(char *buf, char *mem, int count);
271 299
272extern int kgdb_isremovedbreak(unsigned long addr); 300extern int kgdb_isremovedbreak(unsigned long addr);
301extern void kgdb_schedule_breakpoint(void);
273 302
274extern int 303extern int
275kgdb_handle_exception(int ex_vector, int signo, int err_code, 304kgdb_handle_exception(int ex_vector, int signo, int err_code,
@@ -278,5 +307,12 @@ extern int kgdb_nmicallback(int cpu, void *regs);
278 307
279extern int kgdb_single_step; 308extern int kgdb_single_step;
280extern atomic_t kgdb_active; 309extern atomic_t kgdb_active;
281 310#define in_dbg_master() \
311 (raw_smp_processor_id() == atomic_read(&kgdb_active))
312extern bool dbg_is_early;
313extern void __init dbg_late_init(void);
314#else /* ! CONFIG_KGDB */
315#define in_dbg_master() (0)
316#define dbg_late_init()
317#endif /* ! CONFIG_KGDB */
282#endif /* _KGDB_H_ */ 318#endif /* _KGDB_H_ */