hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/s390/include/asm/debug.h
....@@ -2,17 +2,17 @@
22 /*
33 * S/390 debug facility
44 *
5
- * Copyright IBM Corp. 1999, 2000
5
+ * Copyright IBM Corp. 1999, 2020
66 */
7
-#ifndef DEBUG_H
8
-#define DEBUG_H
7
+#ifndef _ASM_S390_DEBUG_H
8
+#define _ASM_S390_DEBUG_H
99
1010 #include <linux/string.h>
1111 #include <linux/spinlock.h>
1212 #include <linux/kernel.h>
1313 #include <linux/time.h>
1414 #include <linux/refcount.h>
15
-#include <uapi/asm/debug.h>
15
+#include <linux/fs.h>
1616
1717 #define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
1818 #define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
....@@ -25,6 +25,16 @@
2525
2626 #define DEBUG_DATA(entry) (char *)(entry + 1) /* data is stored behind */
2727 /* the entry information */
28
+
29
+#define __DEBUG_FEATURE_VERSION 3 /* version of debug feature */
30
+
31
+struct __debug_entry {
32
+ unsigned long clock : 60;
33
+ unsigned long exception : 1;
34
+ unsigned long level : 3;
35
+ void *caller;
36
+ unsigned short cpu;
37
+} __packed;
2838
2939 typedef struct __debug_entry debug_entry_t;
3040
....@@ -82,7 +92,6 @@
8292 };
8393
8494 extern struct debug_view debug_hex_ascii_view;
85
-extern struct debug_view debug_raw_view;
8695 extern struct debug_view debug_sprintf_view;
8796
8897 /* do NOT use the _common functions */
....@@ -107,13 +116,37 @@
107116 void debug_set_level(debug_info_t *id, int new_level);
108117
109118 void debug_set_critical(void);
119
+
110120 void debug_stop_all(void);
111121
122
+/**
123
+ * debug_level_enabled() - Returns true if debug events for the specified
124
+ * level would be logged. Otherwise returns false.
125
+ *
126
+ * @id: handle for debug log
127
+ * @level: debug level
128
+ *
129
+ * Return:
130
+ * - %true if level is less or equal to the current debug level.
131
+ */
112132 static inline bool debug_level_enabled(debug_info_t *id, int level)
113133 {
114134 return level <= id->level;
115135 }
116136
137
+/**
138
+ * debug_event() - writes binary debug entry to active debug area
139
+ * (if level <= actual debug level)
140
+ *
141
+ * @id: handle for debug log
142
+ * @level: debug level
143
+ * @data: pointer to data for debug entry
144
+ * @length: length of data in bytes
145
+ *
146
+ * Return:
147
+ * - Address of written debug entry
148
+ * - %NULL if error
149
+ */
117150 static inline debug_entry_t *debug_event(debug_info_t *id, int level,
118151 void *data, int length)
119152 {
....@@ -122,6 +155,18 @@
122155 return debug_event_common(id, level, data, length);
123156 }
124157
158
+/**
159
+ * debug_int_event() - writes unsigned integer debug entry to active debug area
160
+ * (if level <= actual debug level)
161
+ *
162
+ * @id: handle for debug log
163
+ * @level: debug level
164
+ * @tag: integer value for debug entry
165
+ *
166
+ * Return:
167
+ * - Address of written debug entry
168
+ * - %NULL if error
169
+ */
125170 static inline debug_entry_t *debug_int_event(debug_info_t *id, int level,
126171 unsigned int tag)
127172 {
....@@ -132,6 +177,18 @@
132177 return debug_event_common(id, level, &t, sizeof(unsigned int));
133178 }
134179
180
+/**
181
+ * debug_long_event() - writes unsigned long debug entry to active debug area
182
+ * (if level <= actual debug level)
183
+ *
184
+ * @id: handle for debug log
185
+ * @level: debug level
186
+ * @tag: long integer value for debug entry
187
+ *
188
+ * Return:
189
+ * - Address of written debug entry
190
+ * - %NULL if error
191
+ */
135192 static inline debug_entry_t *debug_long_event(debug_info_t *id, int level,
136193 unsigned long tag)
137194 {
....@@ -142,6 +199,18 @@
142199 return debug_event_common(id, level, &t, sizeof(unsigned long));
143200 }
144201
202
+/**
203
+ * debug_text_event() - writes string debug entry in ascii format to active
204
+ * debug area (if level <= actual debug level)
205
+ *
206
+ * @id: handle for debug log
207
+ * @level: debug level
208
+ * @txt: string for debug entry
209
+ *
210
+ * Return:
211
+ * - Address of written debug entry
212
+ * - %NULL if error
213
+ */
145214 static inline debug_entry_t *debug_text_event(debug_info_t *id, int level,
146215 const char *txt)
147216 {
....@@ -152,12 +221,28 @@
152221
153222 /*
154223 * IMPORTANT: Use "%s" in sprintf format strings with care! Only pointers are
155
- * stored in the s390dbf. See Documentation/s390/s390dbf.txt for more details!
224
+ * stored in the s390dbf. See Documentation/s390/s390dbf.rst for more details!
156225 */
157226 extern debug_entry_t *
158227 __debug_sprintf_event(debug_info_t *id, int level, char *string, ...)
159228 __attribute__ ((format(printf, 3, 4)));
160229
230
+/**
231
+ * debug_sprintf_event() - writes debug entry with format string
232
+ * and varargs (longs) to active debug area
233
+ * (if level $<=$ actual debug level).
234
+ *
235
+ * @_id: handle for debug log
236
+ * @_level: debug level
237
+ * @_fmt: format string for debug entry
238
+ * @...: varargs used as in sprintf()
239
+ *
240
+ * Return:
241
+ * - Address of written debug entry
242
+ * - %NULL if error
243
+ *
244
+ * floats and long long datatypes cannot be used as varargs.
245
+ */
161246 #define debug_sprintf_event(_id, _level, _fmt, ...) \
162247 ({ \
163248 debug_entry_t *__ret; \
....@@ -172,6 +257,20 @@
172257 __ret; \
173258 })
174259
260
+/**
261
+ * debug_exception() - writes binary debug entry to active debug area
262
+ * (if level <= actual debug level)
263
+ * and switches to next debug area
264
+ *
265
+ * @id: handle for debug log
266
+ * @level: debug level
267
+ * @data: pointer to data for debug entry
268
+ * @length: length of data in bytes
269
+ *
270
+ * Return:
271
+ * - Address of written debug entry
272
+ * - %NULL if error
273
+ */
175274 static inline debug_entry_t *debug_exception(debug_info_t *id, int level,
176275 void *data, int length)
177276 {
....@@ -180,6 +279,19 @@
180279 return debug_exception_common(id, level, data, length);
181280 }
182281
282
+/**
283
+ * debug_int_exception() - writes unsigned int debug entry to active debug area
284
+ * (if level <= actual debug level)
285
+ * and switches to next debug area
286
+ *
287
+ * @id: handle for debug log
288
+ * @level: debug level
289
+ * @tag: integer value for debug entry
290
+ *
291
+ * Return:
292
+ * - Address of written debug entry
293
+ * - %NULL if error
294
+ */
183295 static inline debug_entry_t *debug_int_exception(debug_info_t *id, int level,
184296 unsigned int tag)
185297 {
....@@ -190,6 +302,19 @@
190302 return debug_exception_common(id, level, &t, sizeof(unsigned int));
191303 }
192304
305
+/**
306
+ * debug_long_exception() - writes long debug entry to active debug area
307
+ * (if level <= actual debug level)
308
+ * and switches to next debug area
309
+ *
310
+ * @id: handle for debug log
311
+ * @level: debug level
312
+ * @tag: long integer value for debug entry
313
+ *
314
+ * Return:
315
+ * - Address of written debug entry
316
+ * - %NULL if error
317
+ */
193318 static inline debug_entry_t *debug_long_exception (debug_info_t *id, int level,
194319 unsigned long tag)
195320 {
....@@ -200,6 +325,20 @@
200325 return debug_exception_common(id, level, &t, sizeof(unsigned long));
201326 }
202327
328
+/**
329
+ * debug_text_exception() - writes string debug entry in ascii format to active
330
+ * debug area (if level <= actual debug level)
331
+ * and switches to next debug area
332
+ * area
333
+ *
334
+ * @id: handle for debug log
335
+ * @level: debug level
336
+ * @txt: string for debug entry
337
+ *
338
+ * Return:
339
+ * - Address of written debug entry
340
+ * - %NULL if error
341
+ */
203342 static inline debug_entry_t *debug_text_exception(debug_info_t *id, int level,
204343 const char *txt)
205344 {
....@@ -210,12 +349,30 @@
210349
211350 /*
212351 * IMPORTANT: Use "%s" in sprintf format strings with care! Only pointers are
213
- * stored in the s390dbf. See Documentation/s390/s390dbf.txt for more details!
352
+ * stored in the s390dbf. See Documentation/s390/s390dbf.rst for more details!
214353 */
215354 extern debug_entry_t *
216355 __debug_sprintf_exception(debug_info_t *id, int level, char *string, ...)
217356 __attribute__ ((format(printf, 3, 4)));
218357
358
+
359
+/**
360
+ * debug_sprintf_exception() - writes debug entry with format string and
361
+ * varargs (longs) to active debug area
362
+ * (if level <= actual debug level)
363
+ * and switches to next debug area.
364
+ *
365
+ * @_id: handle for debug log
366
+ * @_level: debug level
367
+ * @_fmt: format string for debug entry
368
+ * @...: varargs used as in sprintf()
369
+ *
370
+ * Return:
371
+ * - Address of written debug entry
372
+ * - %NULL if error
373
+ *
374
+ * floats and long long datatypes cannot be used as varargs.
375
+ */
219376 #define debug_sprintf_exception(_id, _level, _fmt, ...) \
220377 ({ \
221378 debug_entry_t *__ret; \
....@@ -231,6 +388,7 @@
231388 })
232389
233390 int debug_register_view(debug_info_t *id, struct debug_view *view);
391
+
234392 int debug_unregister_view(debug_info_t *id, struct debug_view *view);
235393
236394 /*
....@@ -267,4 +425,4 @@
267425 #define PRINT_FATAL(x...) printk(KERN_DEBUG PRINTK_HEADER x)
268426 #endif /* DASD_DEBUG */
269427
270
-#endif /* DEBUG_H */
428
+#endif /* _ASM_S390_DEBUG_H */