xref: /rk3399_rockchip-uboot/include/kgdb.h (revision 0f9cfa09df48b86ce5f8baefb3300417cc5b845b)
1*0f9cfa09Swdenk #ifndef __KGDB_H__
2*0f9cfa09Swdenk #define __KGDB_H__
3*0f9cfa09Swdenk 
4*0f9cfa09Swdenk #include <asm/ptrace.h>
5*0f9cfa09Swdenk 
6*0f9cfa09Swdenk #define KGDBERR_BADPARAMS	1
7*0f9cfa09Swdenk #define KGDBERR_NOTHEXDIG	2
8*0f9cfa09Swdenk #define KGDBERR_MEMFAULT	3
9*0f9cfa09Swdenk #define KGDBERR_NOSPACE		4
10*0f9cfa09Swdenk #define KGDBERR_ALIGNFAULT	5
11*0f9cfa09Swdenk 
12*0f9cfa09Swdenk #define KGDBDATA_MAXREGS	8
13*0f9cfa09Swdenk #define KGDBDATA_MAXPRIV	8
14*0f9cfa09Swdenk 
15*0f9cfa09Swdenk #define KGDBEXIT_TYPEMASK	0xff
16*0f9cfa09Swdenk 
17*0f9cfa09Swdenk #define KGDBEXIT_KILL		0
18*0f9cfa09Swdenk #define KGDBEXIT_CONTINUE	1
19*0f9cfa09Swdenk #define KGDBEXIT_SINGLE		2
20*0f9cfa09Swdenk 
21*0f9cfa09Swdenk #define KGDBEXIT_WITHADDR	0x100
22*0f9cfa09Swdenk 
23*0f9cfa09Swdenk typedef
24*0f9cfa09Swdenk 	struct {
25*0f9cfa09Swdenk 		int num;
26*0f9cfa09Swdenk 		unsigned long val;
27*0f9cfa09Swdenk 	}
28*0f9cfa09Swdenk kgdb_reg;
29*0f9cfa09Swdenk 
30*0f9cfa09Swdenk typedef
31*0f9cfa09Swdenk 	struct {
32*0f9cfa09Swdenk 		int sigval;
33*0f9cfa09Swdenk 		int extype;
34*0f9cfa09Swdenk 		unsigned long exaddr;
35*0f9cfa09Swdenk 		int nregs;
36*0f9cfa09Swdenk 		kgdb_reg regs[KGDBDATA_MAXREGS];
37*0f9cfa09Swdenk 		unsigned long private[KGDBDATA_MAXPRIV];
38*0f9cfa09Swdenk 	}
39*0f9cfa09Swdenk kgdb_data;
40*0f9cfa09Swdenk 
41*0f9cfa09Swdenk /* these functions are provided by the generic kgdb support */
42*0f9cfa09Swdenk extern void kgdb_init(void);
43*0f9cfa09Swdenk extern void kgdb_error(int);
44*0f9cfa09Swdenk extern int kgdb_output_string(const char *, unsigned int);
45*0f9cfa09Swdenk extern void breakpoint(void);
46*0f9cfa09Swdenk 
47*0f9cfa09Swdenk /* these functions are provided by the platform specific kgdb support */
48*0f9cfa09Swdenk extern void kgdb_flush_cache_range(void *, void *);
49*0f9cfa09Swdenk extern void kgdb_flush_cache_all(void);
50*0f9cfa09Swdenk extern int kgdb_setjmp(long *);
51*0f9cfa09Swdenk extern void kgdb_longjmp(long *, int);
52*0f9cfa09Swdenk extern void kgdb_enter(struct pt_regs *, kgdb_data *);
53*0f9cfa09Swdenk extern void kgdb_exit(struct pt_regs *, kgdb_data *);
54*0f9cfa09Swdenk extern int kgdb_getregs(struct pt_regs *, char *, int);
55*0f9cfa09Swdenk extern void kgdb_putreg(struct pt_regs *, int, char *, int);
56*0f9cfa09Swdenk extern void kgdb_putregs(struct pt_regs *, char *, int);
57*0f9cfa09Swdenk extern int kgdb_trap(struct pt_regs *);
58*0f9cfa09Swdenk extern void kgdb_breakpoint(int argc, char *argv[]);
59*0f9cfa09Swdenk 
60*0f9cfa09Swdenk /* these functions are provided by the platform serial driver */
61*0f9cfa09Swdenk extern void kgdb_serial_init(void);
62*0f9cfa09Swdenk extern int getDebugChar(void);
63*0f9cfa09Swdenk extern void putDebugChar(int);
64*0f9cfa09Swdenk extern void putDebugStr(const char *);
65*0f9cfa09Swdenk extern void kgdb_interruptible(int);
66*0f9cfa09Swdenk 
67*0f9cfa09Swdenk /* this is referenced in the trap handler for the platform */
68*0f9cfa09Swdenk extern int (*debugger_exception_handler)(struct pt_regs *);
69*0f9cfa09Swdenk 
70*0f9cfa09Swdenk #endif /* __KGDB_H__ */
71