diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-03-08 03:27:37 -0500 |
---|---|---|
committer | Paul Mundt <lethal@hera.kernel.org> | 2007-05-06 22:10:51 -0400 |
commit | fa5da2f7bdcf885efe65a37df13907c7d72296f6 (patch) | |
tree | 54104d5f660a1ec824505b28540eb2c5e4be390a /include | |
parent | 15700770ef7c5d12e2f1659d2ddbeb3f658d9f37 (diff) |
sh: Bring kgdb back from the dead.
This code has suffered quite a bit of bitrot, do some basic
tidying to get it to a reasonably functional state again.
This gets the basic support and the console working again.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sh/kgdb.h | 51 | ||||
-rw-r--r-- | include/asm-sh/se7751.h | 2 |
2 files changed, 6 insertions, 47 deletions
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h index 0095c665d272..74bd0953e5ce 100644 --- a/include/asm-sh/kgdb.h +++ b/include/asm-sh/kgdb.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define __KGDB_H | 17 | #define __KGDB_H |
18 | 18 | ||
19 | #include <asm/ptrace.h> | 19 | #include <asm/ptrace.h> |
20 | #include <asm/cacheflush.h> | ||
20 | 21 | ||
21 | struct console; | 22 | struct console; |
22 | 23 | ||
@@ -45,35 +46,21 @@ extern int kgdb_portnum; | |||
45 | extern int kgdb_baud; | 46 | extern int kgdb_baud; |
46 | extern char kgdb_parity; | 47 | extern char kgdb_parity; |
47 | extern char kgdb_bits; | 48 | extern char kgdb_bits; |
48 | extern int kgdb_console_setup(struct console *, char *); | ||
49 | 49 | ||
50 | /* Init and interface stuff */ | 50 | /* Init and interface stuff */ |
51 | extern int kgdb_init(void); | 51 | extern int kgdb_init(void); |
52 | extern int (*kgdb_serial_setup)(void); | ||
53 | extern int (*kgdb_getchar)(void); | 52 | extern int (*kgdb_getchar)(void); |
54 | extern void (*kgdb_putchar)(int); | 53 | extern void (*kgdb_putchar)(int); |
55 | 54 | ||
56 | struct kgdb_sermap { | ||
57 | char *name; | ||
58 | int namelen; | ||
59 | int (*setup_fn)(struct console *, char *); | ||
60 | struct kgdb_sermap *next; | ||
61 | }; | ||
62 | extern void kgdb_register_sermap(struct kgdb_sermap *map); | ||
63 | extern struct kgdb_sermap *kgdb_porttype; | ||
64 | |||
65 | /* Trap functions */ | 55 | /* Trap functions */ |
66 | typedef void (kgdb_debug_hook_t)(struct pt_regs *regs); | 56 | typedef void (kgdb_debug_hook_t)(struct pt_regs *regs); |
67 | typedef void (kgdb_bus_error_hook_t)(void); | 57 | typedef void (kgdb_bus_error_hook_t)(void); |
68 | extern kgdb_debug_hook_t *kgdb_debug_hook; | 58 | extern kgdb_debug_hook_t *kgdb_debug_hook; |
69 | extern kgdb_bus_error_hook_t *kgdb_bus_err_hook; | 59 | extern kgdb_bus_error_hook_t *kgdb_bus_err_hook; |
70 | 60 | ||
71 | extern void breakpoint(void); | ||
72 | |||
73 | /* Console */ | 61 | /* Console */ |
74 | struct console; | ||
75 | void kgdb_console_write(struct console *co, const char *s, unsigned count); | 62 | void kgdb_console_write(struct console *co, const char *s, unsigned count); |
76 | void kgdb_console_init(void); | 63 | extern int kgdb_console_setup(struct console *, char *); |
77 | 64 | ||
78 | /* Prototypes for jmp fns */ | 65 | /* Prototypes for jmp fns */ |
79 | #define _JBLEN 9 | 66 | #define _JBLEN 9 |
@@ -81,11 +68,8 @@ typedef int jmp_buf[_JBLEN]; | |||
81 | extern void longjmp(jmp_buf __jmpb, int __retval); | 68 | extern void longjmp(jmp_buf __jmpb, int __retval); |
82 | extern int setjmp(jmp_buf __jmpb); | 69 | extern int setjmp(jmp_buf __jmpb); |
83 | 70 | ||
84 | /* Variadic macro to print our own message to the console */ | ||
85 | #define KGDB_PRINTK(...) printk("KGDB: " __VA_ARGS__) | ||
86 | |||
87 | /* Forced breakpoint */ | 71 | /* Forced breakpoint */ |
88 | #define BREAKPOINT() \ | 72 | #define breakpoint() \ |
89 | do { \ | 73 | do { \ |
90 | if (kgdb_enabled) \ | 74 | if (kgdb_enabled) \ |
91 | __asm__ __volatile__("trapa #0x3c"); \ | 75 | __asm__ __volatile__("trapa #0x3c"); \ |
@@ -95,7 +79,6 @@ do { \ | |||
95 | #if defined(CONFIG_CPU_SH4) | 79 | #if defined(CONFIG_CPU_SH4) |
96 | #define kgdb_flush_icache_range(start, end) \ | 80 | #define kgdb_flush_icache_range(start, end) \ |
97 | { \ | 81 | { \ |
98 | extern void __flush_purge_region(void *, int); \ | ||
99 | __flush_purge_region((void*)(start), (int)(end) - (int)(start));\ | 82 | __flush_purge_region((void*)(start), (int)(end) - (int)(start));\ |
100 | flush_icache_range((start), (end)); \ | 83 | flush_icache_range((start), (end)); \ |
101 | } | 84 | } |
@@ -103,31 +86,6 @@ do { \ | |||
103 | #define kgdb_flush_icache_range(start, end) do { } while (0) | 86 | #define kgdb_flush_icache_range(start, end) do { } while (0) |
104 | #endif | 87 | #endif |
105 | 88 | ||
106 | /* Kernel assert macros */ | ||
107 | #ifdef CONFIG_KGDB_KERNEL_ASSERTS | ||
108 | |||
109 | /* Predefined conditions */ | ||
110 | #define KA_VALID_ERRNO(errno) ((errno) > 0 && (errno) <= EMEDIUMTYPE) | ||
111 | #define KA_VALID_PTR_ERR(ptr) KA_VALID_ERRNO(-PTR_ERR(ptr)) | ||
112 | #define KA_VALID_KPTR(ptr) (!(ptr) || \ | ||
113 | ((void *)(ptr) >= (void *)PAGE_OFFSET && \ | ||
114 | (void *)(ptr) < ERR_PTR(-EMEDIUMTYPE))) | ||
115 | #define KA_VALID_PTRORERR(errptr) \ | ||
116 | (KA_VALID_KPTR(errptr) || KA_VALID_PTR_ERR(errptr)) | ||
117 | #define KA_HELD_GKL() (current->lock_depth >= 0) | ||
118 | |||
119 | /* The actual assert */ | ||
120 | #define KGDB_ASSERT(condition, message) do { \ | ||
121 | if (!(condition) && (kgdb_enabled)) { \ | ||
122 | KGDB_PRINTK("Assertion failed at %s:%d: %s\n", \ | ||
123 | __FILE__, __LINE__, message);\ | ||
124 | BREAKPOINT(); \ | ||
125 | } \ | ||
126 | } while (0) | ||
127 | #else | ||
128 | #define KGDB_ASSERT(condition, message) | ||
129 | #endif | ||
130 | |||
131 | /* Taken from sh-stub.c of GDB 4.18 */ | 89 | /* Taken from sh-stub.c of GDB 4.18 */ |
132 | static const char hexchars[] = "0123456789abcdef"; | 90 | static const char hexchars[] = "0123456789abcdef"; |
133 | 91 | ||
@@ -142,5 +100,4 @@ static inline char lowhex(const int x) | |||
142 | { | 100 | { |
143 | return hexchars[x & 0xf]; | 101 | return hexchars[x & 0xf]; |
144 | } | 102 | } |
145 | |||
146 | #endif | 103 | #endif |
diff --git a/include/asm-sh/se7751.h b/include/asm-sh/se7751.h index 88cd379d9084..02ca9347f043 100644 --- a/include/asm-sh/se7751.h +++ b/include/asm-sh/se7751.h | |||
@@ -65,6 +65,8 @@ | |||
65 | 65 | ||
66 | #define IRQ_79C973 13 | 66 | #define IRQ_79C973 13 |
67 | 67 | ||
68 | void init_7751se_IRQ(void); | ||
69 | |||
68 | #define __IO_PREFIX sh7751se | 70 | #define __IO_PREFIX sh7751se |
69 | #include <asm/io_generic.h> | 71 | #include <asm/io_generic.h> |
70 | 72 | ||