diff options
Diffstat (limited to 'include/linux/kgdb.h')
-rw-r--r-- | include/linux/kgdb.h | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 19ec41a183f5..9340f34d1bb5 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 | ||
23 | struct pt_regs; | 25 | struct pt_regs; |
24 | 26 | ||
25 | /** | 27 | /** |
@@ -34,20 +36,6 @@ struct pt_regs; | |||
34 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); | 36 | extern 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 | */ | ||
47 | extern 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; | |||
72 | void kgdb_breakpoint(void); | 60 | void kgdb_breakpoint(void); |
73 | 61 | ||
74 | extern int kgdb_connected; | 62 | extern int kgdb_connected; |
63 | extern int kgdb_io_module_registered; | ||
75 | 64 | ||
76 | extern atomic_t kgdb_setting_breakpoint; | 65 | extern atomic_t kgdb_setting_breakpoint; |
77 | extern atomic_t kgdb_cpu_doing_single_step; | 66 | extern atomic_t kgdb_cpu_doing_single_step; |
@@ -202,12 +191,34 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
202 | */ | 191 | */ |
203 | extern void kgdb_roundup_cpus(unsigned long flags); | 192 | extern 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 | */ | ||
202 | extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc); | ||
203 | |||
204 | |||
205 | /* Optional functions. */ | 205 | /* Optional functions. */ |
206 | extern int kgdb_validate_break_address(unsigned long addr); | 206 | extern int kgdb_validate_break_address(unsigned long addr); |
207 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); | 207 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); |
208 | extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); | 208 | extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); |
209 | 209 | ||
210 | /** | 210 | /** |
211 | * kgdb_arch_late - Perform any architecture specific initalization. | ||
212 | * | ||
213 | * This function will handle the late initalization of any | ||
214 | * architecture specific callbacks. This is an optional function for | ||
215 | * handling things like late initialization of hw breakpoints. The | ||
216 | * default implementation does nothing. | ||
217 | */ | ||
218 | extern void kgdb_arch_late(void); | ||
219 | |||
220 | |||
221 | /** | ||
211 | * struct kgdb_arch - Describe architecture specific values. | 222 | * struct kgdb_arch - Describe architecture specific values. |
212 | * @gdb_bpt_instr: The instruction to trigger a breakpoint. | 223 | * @gdb_bpt_instr: The instruction to trigger a breakpoint. |
213 | * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. | 224 | * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. |
@@ -247,6 +258,8 @@ struct kgdb_arch { | |||
247 | * the I/O driver. | 258 | * the I/O driver. |
248 | * @post_exception: Pointer to a function that will do any cleanup work | 259 | * @post_exception: Pointer to a function that will do any cleanup work |
249 | * for the I/O driver. | 260 | * for the I/O driver. |
261 | * @is_console: 1 if the end device is a console 0 if the I/O device is | ||
262 | * not a console | ||
250 | */ | 263 | */ |
251 | struct kgdb_io { | 264 | struct kgdb_io { |
252 | const char *name; | 265 | const char *name; |
@@ -256,6 +269,7 @@ struct kgdb_io { | |||
256 | int (*init) (void); | 269 | int (*init) (void); |
257 | void (*pre_exception) (void); | 270 | void (*pre_exception) (void); |
258 | void (*post_exception) (void); | 271 | void (*post_exception) (void); |
272 | int is_console; | ||
259 | }; | 273 | }; |
260 | 274 | ||
261 | extern struct kgdb_arch arch_kgdb_ops; | 275 | extern struct kgdb_arch arch_kgdb_ops; |
@@ -264,12 +278,14 @@ extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); | |||
264 | 278 | ||
265 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); | 279 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); |
266 | extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); | 280 | extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); |
281 | extern struct kgdb_io *dbg_io_ops; | ||
267 | 282 | ||
268 | extern int kgdb_hex2long(char **ptr, unsigned long *long_val); | 283 | extern int kgdb_hex2long(char **ptr, unsigned long *long_val); |
269 | extern int kgdb_mem2hex(char *mem, char *buf, int count); | 284 | extern int kgdb_mem2hex(char *mem, char *buf, int count); |
270 | extern int kgdb_hex2mem(char *buf, char *mem, int count); | 285 | extern int kgdb_hex2mem(char *buf, char *mem, int count); |
271 | 286 | ||
272 | extern int kgdb_isremovedbreak(unsigned long addr); | 287 | extern int kgdb_isremovedbreak(unsigned long addr); |
288 | extern void kgdb_schedule_breakpoint(void); | ||
273 | 289 | ||
274 | extern int | 290 | extern int |
275 | kgdb_handle_exception(int ex_vector, int signo, int err_code, | 291 | kgdb_handle_exception(int ex_vector, int signo, int err_code, |
@@ -278,5 +294,12 @@ extern int kgdb_nmicallback(int cpu, void *regs); | |||
278 | 294 | ||
279 | extern int kgdb_single_step; | 295 | extern int kgdb_single_step; |
280 | extern atomic_t kgdb_active; | 296 | extern atomic_t kgdb_active; |
281 | 297 | #define in_dbg_master() \ | |
298 | (raw_smp_processor_id() == atomic_read(&kgdb_active)) | ||
299 | extern bool dbg_is_early; | ||
300 | extern void __init dbg_late_init(void); | ||
301 | #else /* ! CONFIG_KGDB */ | ||
302 | #define in_dbg_master() (0) | ||
303 | #define dbg_late_init() | ||
304 | #endif /* ! CONFIG_KGDB */ | ||
282 | #endif /* _KGDB_H_ */ | 305 | #endif /* _KGDB_H_ */ |