mm-only debug patch...
[mmotm.git] / drivers / s390 / cio / qdio_debug.h
blob5d70bd162ae9598cc078fbc5c948b4d38fe28d74
1 /*
2 * drivers/s390/cio/qdio_debug.h
4 * Copyright IBM Corp. 2008
6 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
7 */
8 #ifndef QDIO_DEBUG_H
9 #define QDIO_DEBUG_H
11 #include <asm/debug.h>
12 #include <asm/qdio.h>
13 #include "qdio.h"
15 /* that gives us 15 characters in the text event views */
16 #define QDIO_DBF_LEN 16
18 extern debug_info_t *qdio_dbf_setup;
19 extern debug_info_t *qdio_dbf_error;
21 /* sort out low debug levels early to avoid wasted sprints */
22 static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
24 return (level <= dbf_grp->level);
27 #define DBF_ERR 3 /* error conditions */
28 #define DBF_WARN 4 /* warning conditions */
29 #define DBF_INFO 6 /* informational */
31 #undef DBF_EVENT
32 #undef DBF_ERROR
33 #undef DBF_DEV_EVENT
35 #define DBF_EVENT(text...) \
36 do { \
37 char debug_buffer[QDIO_DBF_LEN]; \
38 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
39 debug_text_event(qdio_dbf_setup, DBF_ERR, debug_buffer); \
40 } while (0)
42 #define DBF_HEX(addr, len) \
43 do { \
44 debug_event(qdio_dbf_setup, DBF_ERR, (void*)(addr), len); \
45 } while (0)
47 #define DBF_ERROR(text...) \
48 do { \
49 char debug_buffer[QDIO_DBF_LEN]; \
50 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
51 debug_text_event(qdio_dbf_error, DBF_ERR, debug_buffer); \
52 } while (0)
54 #define DBF_ERROR_HEX(addr, len) \
55 do { \
56 debug_event(qdio_dbf_error, DBF_ERR, (void*)(addr), len); \
57 } while (0)
60 #define DBF_DEV_EVENT(level, device, text...) \
61 do { \
62 char debug_buffer[QDIO_DBF_LEN]; \
63 if (qdio_dbf_passes(device->debug_area, level)) { \
64 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
65 debug_text_event(device->debug_area, level, debug_buffer); \
66 } \
67 } while (0)
69 #define DBF_DEV_HEX(level, device, addr, len) \
70 do { \
71 debug_event(device->debug_area, level, (void*)(addr), len); \
72 } while (0)
74 void qdio_allocate_dbf(struct qdio_initialize *init_data,
75 struct qdio_irq *irq_ptr);
76 void qdio_setup_debug_entries(struct qdio_irq *irq_ptr,
77 struct ccw_device *cdev);
78 void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr,
79 struct ccw_device *cdev);
80 int qdio_debug_init(void);
81 void qdio_debug_exit(void);
83 #endif