1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright IBM Corp. 2008
5 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
10 #include <asm/debug.h>
14 /* that gives us 15 characters in the text event views */
15 #define QDIO_DBF_LEN 32
17 extern debug_info_t
*qdio_dbf_setup
;
18 extern debug_info_t
*qdio_dbf_error
;
20 #define DBF_ERR 3 /* error conditions */
21 #define DBF_WARN 4 /* warning conditions */
22 #define DBF_INFO 6 /* informational */
28 #define DBF_EVENT(text...) \
30 char debug_buffer[QDIO_DBF_LEN]; \
31 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
32 debug_text_event(qdio_dbf_setup, DBF_ERR, debug_buffer); \
35 static inline void DBF_HEX(void *addr
, int len
)
38 debug_event(qdio_dbf_setup
, DBF_ERR
, addr
, len
);
39 len
-= qdio_dbf_setup
->buf_size
;
40 addr
+= qdio_dbf_setup
->buf_size
;
44 #define DBF_ERROR(text...) \
46 char debug_buffer[QDIO_DBF_LEN]; \
47 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
48 debug_text_event(qdio_dbf_error, DBF_ERR, debug_buffer); \
51 static inline void DBF_ERROR_HEX(void *addr
, int len
)
54 debug_event(qdio_dbf_error
, DBF_ERR
, addr
, len
);
55 len
-= qdio_dbf_error
->buf_size
;
56 addr
+= qdio_dbf_error
->buf_size
;
60 #define DBF_DEV_EVENT(level, device, text...) \
62 char debug_buffer[QDIO_DBF_LEN]; \
63 if (debug_level_enabled(device->debug_area, level)) { \
64 snprintf(debug_buffer, QDIO_DBF_LEN, text); \
65 debug_text_event(device->debug_area, level, debug_buffer); \
69 static inline void DBF_DEV_HEX(struct qdio_irq
*dev
, void *addr
,
73 debug_event(dev
->debug_area
, level
, addr
, len
);
74 len
-= dev
->debug_area
->buf_size
;
75 addr
+= dev
->debug_area
->buf_size
;
79 int qdio_allocate_dbf(struct qdio_initialize
*init_data
,
80 struct qdio_irq
*irq_ptr
);
81 void qdio_setup_debug_entries(struct qdio_irq
*irq_ptr
,
82 struct ccw_device
*cdev
);
83 void qdio_shutdown_debug_entries(struct qdio_irq
*irq_ptr
);
84 int qdio_debug_init(void);
85 void qdio_debug_exit(void);