xref: /openbmc/u-boot/include/kgdb.h (revision 2271d3ddccfbd4a7640121669ff9b013b1fea361)
10f9cfa09Swdenk #ifndef __KGDB_H__
20f9cfa09Swdenk #define __KGDB_H__
30f9cfa09Swdenk 
40f9cfa09Swdenk #include <asm/ptrace.h>
50f9cfa09Swdenk 
60f9cfa09Swdenk #define KGDBERR_BADPARAMS	1
70f9cfa09Swdenk #define KGDBERR_NOTHEXDIG	2
80f9cfa09Swdenk #define KGDBERR_MEMFAULT	3
90f9cfa09Swdenk #define KGDBERR_NOSPACE		4
100f9cfa09Swdenk #define KGDBERR_ALIGNFAULT	5
110f9cfa09Swdenk 
120f9cfa09Swdenk #define KGDBDATA_MAXREGS	8
130f9cfa09Swdenk #define KGDBDATA_MAXPRIV	8
140f9cfa09Swdenk 
150f9cfa09Swdenk #define KGDBEXIT_TYPEMASK	0xff
160f9cfa09Swdenk 
170f9cfa09Swdenk #define KGDBEXIT_KILL		0
180f9cfa09Swdenk #define KGDBEXIT_CONTINUE	1
190f9cfa09Swdenk #define KGDBEXIT_SINGLE		2
200f9cfa09Swdenk 
210f9cfa09Swdenk #define KGDBEXIT_WITHADDR	0x100
220f9cfa09Swdenk 
230f9cfa09Swdenk typedef
240f9cfa09Swdenk 	struct {
250f9cfa09Swdenk 		int num;
260f9cfa09Swdenk 		unsigned long val;
270f9cfa09Swdenk 	}
280f9cfa09Swdenk kgdb_reg;
290f9cfa09Swdenk 
300f9cfa09Swdenk typedef
310f9cfa09Swdenk 	struct {
320f9cfa09Swdenk 		int sigval;
330f9cfa09Swdenk 		int extype;
340f9cfa09Swdenk 		unsigned long exaddr;
350f9cfa09Swdenk 		int nregs;
360f9cfa09Swdenk 		kgdb_reg regs[KGDBDATA_MAXREGS];
370f9cfa09Swdenk 		unsigned long private[KGDBDATA_MAXPRIV];
380f9cfa09Swdenk 	}
390f9cfa09Swdenk kgdb_data;
400f9cfa09Swdenk 
410f9cfa09Swdenk /* these functions are provided by the generic kgdb support */
420f9cfa09Swdenk extern void kgdb_init(void);
430f9cfa09Swdenk extern void kgdb_error(int);
440f9cfa09Swdenk extern int kgdb_output_string(const char *, unsigned int);
450f9cfa09Swdenk extern void breakpoint(void);
460f9cfa09Swdenk 
470f9cfa09Swdenk /* these functions are provided by the platform specific kgdb support */
480f9cfa09Swdenk extern void kgdb_flush_cache_range(void *, void *);
490f9cfa09Swdenk extern void kgdb_flush_cache_all(void);
500f9cfa09Swdenk extern int kgdb_setjmp(long *);
510f9cfa09Swdenk extern void kgdb_longjmp(long *, int);
520f9cfa09Swdenk extern void kgdb_enter(struct pt_regs *, kgdb_data *);
530f9cfa09Swdenk extern void kgdb_exit(struct pt_regs *, kgdb_data *);
540f9cfa09Swdenk extern int kgdb_getregs(struct pt_regs *, char *, int);
550f9cfa09Swdenk extern void kgdb_putreg(struct pt_regs *, int, char *, int);
560f9cfa09Swdenk extern void kgdb_putregs(struct pt_regs *, char *, int);
570f9cfa09Swdenk extern int kgdb_trap(struct pt_regs *);
58*54841ab5SWolfgang Denk extern void kgdb_breakpoint(int argc, char * const argv[]);
590f9cfa09Swdenk 
600f9cfa09Swdenk /* these functions are provided by the platform serial driver */
610f9cfa09Swdenk extern void kgdb_serial_init(void);
620f9cfa09Swdenk extern int getDebugChar(void);
630f9cfa09Swdenk extern void putDebugChar(int);
640f9cfa09Swdenk extern void putDebugStr(const char *);
650f9cfa09Swdenk extern void kgdb_interruptible(int);
660f9cfa09Swdenk 
670f9cfa09Swdenk /* this is referenced in the trap handler for the platform */
680f9cfa09Swdenk extern int (*debugger_exception_handler)(struct pt_regs *);
690f9cfa09Swdenk 
700f9cfa09Swdenk #endif /* __KGDB_H__ */
71