diff options
Diffstat (limited to 'include/linux/kgdb.h')
| -rw-r--r-- | include/linux/kgdb.h | 70 |
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 | ||
| 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; |
| @@ -101,6 +90,19 @@ struct kgdb_bkpt { | |||
| 101 | enum kgdb_bpstate state; | 90 | enum kgdb_bpstate state; |
| 102 | }; | 91 | }; |
| 103 | 92 | ||
| 93 | struct 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 | ||
| 102 | extern struct dbg_reg_def_t dbg_reg_def[]; | ||
| 103 | extern char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs); | ||
| 104 | extern 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 | */ |
| 203 | extern void kgdb_roundup_cpus(unsigned long flags); | 205 | extern 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 | */ | ||
| 215 | extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc); | ||
| 216 | |||
| 217 | |||
| 205 | /* Optional functions. */ | 218 | /* Optional functions. */ |
| 206 | extern int kgdb_validate_break_address(unsigned long addr); | 219 | extern int kgdb_validate_break_address(unsigned long addr); |
| 207 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); | 220 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); |
| 208 | extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); | 221 | extern 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 | */ | ||
| 231 | extern 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 | */ |
| 251 | struct kgdb_io { | 277 | struct 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 | ||
| 261 | extern struct kgdb_arch arch_kgdb_ops; | 288 | extern 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 | ||
| 265 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); | 292 | 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); | 293 | extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); |
| 294 | extern struct kgdb_io *dbg_io_ops; | ||
| 267 | 295 | ||
| 268 | extern int kgdb_hex2long(char **ptr, unsigned long *long_val); | 296 | extern int kgdb_hex2long(char **ptr, unsigned long *long_val); |
| 269 | extern int kgdb_mem2hex(char *mem, char *buf, int count); | 297 | extern char *kgdb_mem2hex(char *mem, char *buf, int count); |
| 270 | extern int kgdb_hex2mem(char *buf, char *mem, int count); | 298 | extern int kgdb_hex2mem(char *buf, char *mem, int count); |
| 271 | 299 | ||
| 272 | extern int kgdb_isremovedbreak(unsigned long addr); | 300 | extern int kgdb_isremovedbreak(unsigned long addr); |
| 301 | extern void kgdb_schedule_breakpoint(void); | ||
| 273 | 302 | ||
| 274 | extern int | 303 | extern int |
| 275 | kgdb_handle_exception(int ex_vector, int signo, int err_code, | 304 | kgdb_handle_exception(int ex_vector, int signo, int err_code, |
| @@ -278,5 +307,12 @@ extern int kgdb_nmicallback(int cpu, void *regs); | |||
| 278 | 307 | ||
| 279 | extern int kgdb_single_step; | 308 | extern int kgdb_single_step; |
| 280 | extern atomic_t kgdb_active; | 309 | extern atomic_t kgdb_active; |
| 281 | 310 | #define in_dbg_master() \ | |
| 311 | (raw_smp_processor_id() == atomic_read(&kgdb_active)) | ||
| 312 | extern bool dbg_is_early; | ||
| 313 | extern 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_ */ |
