diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-s390/debug.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index 6bbcdea42a86..92360d90144b 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef DEBUG_H | 9 | #ifndef DEBUG_H |
10 | #define DEBUG_H | 10 | #define DEBUG_H |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/fs.h> | ||
12 | #include <linux/string.h> | 14 | #include <linux/string.h> |
13 | 15 | ||
14 | /* Note: | 16 | /* Note: |
@@ -31,19 +33,18 @@ struct __debug_entry{ | |||
31 | } __attribute__((packed)); | 33 | } __attribute__((packed)); |
32 | 34 | ||
33 | 35 | ||
34 | #define __DEBUG_FEATURE_VERSION 1 /* version of debug feature */ | 36 | #define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */ |
35 | 37 | ||
36 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
37 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
38 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
39 | #include <linux/time.h> | 41 | #include <linux/time.h> |
40 | #include <linux/proc_fs.h> | ||
41 | 42 | ||
42 | #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ | 43 | #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ |
43 | #define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ | 44 | #define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ |
44 | #define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */ | 45 | #define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */ |
45 | #define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */ | 46 | #define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */ |
46 | #define DEBUG_MAX_PROCF_LEN 64 /* max length for a proc file name */ | 47 | #define DEBUG_MAX_NAME_LEN 64 /* max length for a debugfs file name */ |
47 | #define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */ | 48 | #define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */ |
48 | 49 | ||
49 | #define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */ | 50 | #define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */ |
@@ -64,16 +65,17 @@ typedef struct debug_info { | |||
64 | spinlock_t lock; | 65 | spinlock_t lock; |
65 | int level; | 66 | int level; |
66 | int nr_areas; | 67 | int nr_areas; |
67 | int page_order; | 68 | int pages_per_area; |
68 | int buf_size; | 69 | int buf_size; |
69 | int entry_size; | 70 | int entry_size; |
70 | debug_entry_t** areas; | 71 | debug_entry_t*** areas; |
71 | int active_area; | 72 | int active_area; |
72 | int *active_entry; | 73 | int *active_pages; |
73 | struct proc_dir_entry* proc_root_entry; | 74 | int *active_entries; |
74 | struct proc_dir_entry* proc_entries[DEBUG_MAX_VIEWS]; | 75 | struct dentry* debugfs_root_entry; |
76 | struct dentry* debugfs_entries[DEBUG_MAX_VIEWS]; | ||
75 | struct debug_view* views[DEBUG_MAX_VIEWS]; | 77 | struct debug_view* views[DEBUG_MAX_VIEWS]; |
76 | char name[DEBUG_MAX_PROCF_LEN]; | 78 | char name[DEBUG_MAX_NAME_LEN]; |
77 | } debug_info_t; | 79 | } debug_info_t; |
78 | 80 | ||
79 | typedef int (debug_header_proc_t) (debug_info_t* id, | 81 | typedef int (debug_header_proc_t) (debug_info_t* id, |
@@ -98,7 +100,7 @@ int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view, | |||
98 | int area, debug_entry_t* entry, char* out_buf); | 100 | int area, debug_entry_t* entry, char* out_buf); |
99 | 101 | ||
100 | struct debug_view { | 102 | struct debug_view { |
101 | char name[DEBUG_MAX_PROCF_LEN]; | 103 | char name[DEBUG_MAX_NAME_LEN]; |
102 | debug_prolog_proc_t* prolog_proc; | 104 | debug_prolog_proc_t* prolog_proc; |
103 | debug_header_proc_t* header_proc; | 105 | debug_header_proc_t* header_proc; |
104 | debug_format_proc_t* format_proc; | 106 | debug_format_proc_t* format_proc; |
@@ -120,7 +122,7 @@ debug_entry_t* debug_exception_common(debug_info_t* id, int level, | |||
120 | 122 | ||
121 | /* Debug Feature API: */ | 123 | /* Debug Feature API: */ |
122 | 124 | ||
123 | debug_info_t* debug_register(char* name, int pages_index, int nr_areas, | 125 | debug_info_t* debug_register(char* name, int pages, int nr_areas, |
124 | int buf_size); | 126 | int buf_size); |
125 | 127 | ||
126 | void debug_unregister(debug_info_t* id); | 128 | void debug_unregister(debug_info_t* id); |
@@ -132,7 +134,8 @@ void debug_stop_all(void); | |||
132 | extern inline debug_entry_t* | 134 | extern inline debug_entry_t* |
133 | debug_event(debug_info_t* id, int level, void* data, int length) | 135 | debug_event(debug_info_t* id, int level, void* data, int length) |
134 | { | 136 | { |
135 | if ((!id) || (level > id->level)) return NULL; | 137 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
138 | return NULL; | ||
136 | return debug_event_common(id,level,data,length); | 139 | return debug_event_common(id,level,data,length); |
137 | } | 140 | } |
138 | 141 | ||
@@ -140,7 +143,8 @@ extern inline debug_entry_t* | |||
140 | debug_int_event(debug_info_t* id, int level, unsigned int tag) | 143 | debug_int_event(debug_info_t* id, int level, unsigned int tag) |
141 | { | 144 | { |
142 | unsigned int t=tag; | 145 | unsigned int t=tag; |
143 | if ((!id) || (level > id->level)) return NULL; | 146 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
147 | return NULL; | ||
144 | return debug_event_common(id,level,&t,sizeof(unsigned int)); | 148 | return debug_event_common(id,level,&t,sizeof(unsigned int)); |
145 | } | 149 | } |
146 | 150 | ||
@@ -148,14 +152,16 @@ extern inline debug_entry_t * | |||
148 | debug_long_event (debug_info_t* id, int level, unsigned long tag) | 152 | debug_long_event (debug_info_t* id, int level, unsigned long tag) |
149 | { | 153 | { |
150 | unsigned long t=tag; | 154 | unsigned long t=tag; |
151 | if ((!id) || (level > id->level)) return NULL; | 155 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
156 | return NULL; | ||
152 | return debug_event_common(id,level,&t,sizeof(unsigned long)); | 157 | return debug_event_common(id,level,&t,sizeof(unsigned long)); |
153 | } | 158 | } |
154 | 159 | ||
155 | extern inline debug_entry_t* | 160 | extern inline debug_entry_t* |
156 | debug_text_event(debug_info_t* id, int level, const char* txt) | 161 | debug_text_event(debug_info_t* id, int level, const char* txt) |
157 | { | 162 | { |
158 | if ((!id) || (level > id->level)) return NULL; | 163 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
164 | return NULL; | ||
159 | return debug_event_common(id,level,txt,strlen(txt)); | 165 | return debug_event_common(id,level,txt,strlen(txt)); |
160 | } | 166 | } |
161 | 167 | ||
@@ -167,7 +173,8 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...) | |||
167 | extern inline debug_entry_t* | 173 | extern inline debug_entry_t* |
168 | debug_exception(debug_info_t* id, int level, void* data, int length) | 174 | debug_exception(debug_info_t* id, int level, void* data, int length) |
169 | { | 175 | { |
170 | if ((!id) || (level > id->level)) return NULL; | 176 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
177 | return NULL; | ||
171 | return debug_exception_common(id,level,data,length); | 178 | return debug_exception_common(id,level,data,length); |
172 | } | 179 | } |
173 | 180 | ||
@@ -175,7 +182,8 @@ extern inline debug_entry_t* | |||
175 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) | 182 | debug_int_exception(debug_info_t* id, int level, unsigned int tag) |
176 | { | 183 | { |
177 | unsigned int t=tag; | 184 | unsigned int t=tag; |
178 | if ((!id) || (level > id->level)) return NULL; | 185 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
186 | return NULL; | ||
179 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); | 187 | return debug_exception_common(id,level,&t,sizeof(unsigned int)); |
180 | } | 188 | } |
181 | 189 | ||
@@ -183,14 +191,16 @@ extern inline debug_entry_t * | |||
183 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) | 191 | debug_long_exception (debug_info_t* id, int level, unsigned long tag) |
184 | { | 192 | { |
185 | unsigned long t=tag; | 193 | unsigned long t=tag; |
186 | if ((!id) || (level > id->level)) return NULL; | 194 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
195 | return NULL; | ||
187 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); | 196 | return debug_exception_common(id,level,&t,sizeof(unsigned long)); |
188 | } | 197 | } |
189 | 198 | ||
190 | extern inline debug_entry_t* | 199 | extern inline debug_entry_t* |
191 | debug_text_exception(debug_info_t* id, int level, const char* txt) | 200 | debug_text_exception(debug_info_t* id, int level, const char* txt) |
192 | { | 201 | { |
193 | if ((!id) || (level > id->level)) return NULL; | 202 | if ((!id) || (level > id->level) || (id->pages_per_area == 0)) |
203 | return NULL; | ||
194 | return debug_exception_common(id,level,txt,strlen(txt)); | 204 | return debug_exception_common(id,level,txt,strlen(txt)); |
195 | } | 205 | } |
196 | 206 | ||