initial commit with v3.6.7
[linux-3.6.7-moxart.git] / drivers / s390 / cio / qdio_debug.h
blobe1f646800ddb7e7cc1ae6a6daa0a03f766ce3a4e
1 /*
2 * Copyright IBM Corp. 2008
4 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
5 */
6 #ifndef QDIO_DEBUG_H
7 #define QDIO_DEBUG_H
9 #include <asm/debug.h>
10 #include <asm/qdio.h>
11 #include "qdio.h"
13 /* that gives us 15 characters in the text event views */
14 #define QDIO_DBF_LEN 16
16 extern debug_info_t *qdio_dbf_setup;
17 extern debug_info_t *qdio_dbf_error;
19 /* sort out low debug levels early to avoid wasted sprints */
20 static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
22 return (level <= dbf_grp->level);
25 #define DBF_ERR 3 /* error conditions */
26 #define DBF_WARN 4 /* warning conditions */
27 #define DBF_INFO 6 /* informational */
29 #undef DBF_EVENT
30 #undef DBF_ERROR
31 #undef DBF_DEV_EVENT
33 #define DBF_EVENT(text...) \
34 do { \
35 char debug_buffer[QDIO_DBF_LEN]; \
36 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
37 debug_text_event(qdio_dbf_setup, DBF_ERR, debug_buffer); \
38 } while (0)
40 #define DBF_HEX(addr, len) \
41 do { \
42 debug_event(qdio_dbf_setup, DBF_ERR, (void*)(addr), len); \
43 } while (0)
45 #define DBF_ERROR(text...) \
46 do { \
47 char debug_buffer[QDIO_DBF_LEN]; \
48 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
49 debug_text_event(qdio_dbf_error, DBF_ERR, debug_buffer); \
50 } while (0)
52 #define DBF_ERROR_HEX(addr, len) \
53 do { \
54 debug_event(qdio_dbf_error, DBF_ERR, (void*)(addr), len); \
55 } while (0)
58 #define DBF_DEV_EVENT(level, device, text...) \
59 do { \
60 char debug_buffer[QDIO_DBF_LEN]; \
61 if (qdio_dbf_passes(device->debug_area, level)) { \
62 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
63 debug_text_event(device->debug_area, level, debug_buffer); \
64 } \
65 } while (0)
67 #define DBF_DEV_HEX(level, device, addr, len) \
68 do { \
69 debug_event(device->debug_area, level, (void*)(addr), len); \
70 } while (0)
72 void qdio_allocate_dbf(struct qdio_initialize *init_data,
73 struct qdio_irq *irq_ptr);
74 void qdio_setup_debug_entries(struct qdio_irq *irq_ptr,
75 struct ccw_device *cdev);
76 void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr,
77 struct ccw_device *cdev);
78 int qdio_debug_init(void);
79 void qdio_debug_exit(void);
81 #endif