Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
779e6e1c | 2 | /* |
779e6e1c JG |
3 | * Copyright IBM Corp. 2008 |
4 | * | |
5 | * Author: Jan Glauber (jang@linux.vnet.ibm.com) | |
6 | */ | |
7 | #ifndef QDIO_DEBUG_H | |
8 | #define QDIO_DEBUG_H | |
9 | ||
10 | #include <asm/debug.h> | |
11 | #include <asm/qdio.h> | |
12 | #include "qdio.h" | |
13 | ||
22f99347 | 14 | /* that gives us 15 characters in the text event views */ |
6423ef69 | 15 | #define QDIO_DBF_LEN 32 |
22f99347 JG |
16 | |
17 | extern debug_info_t *qdio_dbf_setup; | |
18 | extern debug_info_t *qdio_dbf_error; | |
19 | ||
22f99347 JG |
20 | #define DBF_ERR 3 /* error conditions */ |
21 | #define DBF_WARN 4 /* warning conditions */ | |
22 | #define DBF_INFO 6 /* informational */ | |
23 | ||
24 | #undef DBF_EVENT | |
25 | #undef DBF_ERROR | |
26 | #undef DBF_DEV_EVENT | |
27 | ||
28 | #define DBF_EVENT(text...) \ | |
779e6e1c | 29 | do { \ |
22f99347 JG |
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); \ | |
779e6e1c | 33 | } while (0) |
22f99347 | 34 | |
d3feb481 JG |
35 | static inline void DBF_HEX(void *addr, int len) |
36 | { | |
94158e54 | 37 | debug_event(qdio_dbf_setup, DBF_ERR, addr, len); |
d3feb481 | 38 | } |
779e6e1c | 39 | |
22f99347 JG |
40 | #define DBF_ERROR(text...) \ |
41 | do { \ | |
42 | char debug_buffer[QDIO_DBF_LEN]; \ | |
43 | snprintf(debug_buffer, QDIO_DBF_LEN, text); \ | |
44 | debug_text_event(qdio_dbf_error, DBF_ERR, debug_buffer); \ | |
45 | } while (0) | |
779e6e1c | 46 | |
d3feb481 JG |
47 | static inline void DBF_ERROR_HEX(void *addr, int len) |
48 | { | |
94158e54 | 49 | debug_event(qdio_dbf_error, DBF_ERR, addr, len); |
d3feb481 | 50 | } |
779e6e1c | 51 | |
22f99347 JG |
52 | #define DBF_DEV_EVENT(level, device, text...) \ |
53 | do { \ | |
54 | char debug_buffer[QDIO_DBF_LEN]; \ | |
8e6a8285 | 55 | if (debug_level_enabled(device->debug_area, level)) { \ |
22f99347 JG |
56 | snprintf(debug_buffer, QDIO_DBF_LEN, text); \ |
57 | debug_text_event(device->debug_area, level, debug_buffer); \ | |
58 | } \ | |
59 | } while (0) | |
779e6e1c | 60 | |
d3feb481 JG |
61 | static inline void DBF_DEV_HEX(struct qdio_irq *dev, void *addr, |
62 | int len, int level) | |
63 | { | |
94158e54 | 64 | debug_event(dev->debug_area, level, addr, len); |
d3feb481 | 65 | } |
779e6e1c | 66 | |
3db1db93 | 67 | int qdio_allocate_dbf(struct qdio_irq *irq_ptr); |
b2745655 | 68 | void qdio_setup_debug_entries(struct qdio_irq *irq_ptr); |
aa2383f8 | 69 | void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr); |
779e6e1c JG |
70 | int qdio_debug_init(void); |
71 | void qdio_debug_exit(void); | |
22f99347 | 72 | |
779e6e1c | 73 | #endif |