2 * drivers/s390/cio/qdio_debug.h
4 * Copyright IBM Corp. 2008
6 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
11 #include <asm/debug.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 */
35 #define DBF_EVENT(text...) \
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); \
42 #define DBF_HEX(addr, len) \
44 debug_event(qdio_dbf_setup, DBF_ERR, (void*)(addr), len); \
47 #define DBF_ERROR(text...) \
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); \
54 #define DBF_ERROR_HEX(addr, len) \
56 debug_event(qdio_dbf_error, DBF_ERR, (void*)(addr), len); \
60 #define DBF_DEV_EVENT(level, device, text...) \
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); \
69 #define DBF_DEV_HEX(level, device, addr, len) \
71 debug_event(device->debug_area, level, (void*)(addr), len); \
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);