| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef CIO_DEBUG_H | 
|  | 2 | #define CIO_DEBUG_H | 
|  | 3 |  | 
|  | 4 | #include <asm/debug.h> | 
|  | 5 |  | 
| Peter Oberparleiter | 06fbcb1 | 2006-04-10 22:53:46 -0700 | [diff] [blame] | 6 | /* for use of debug feature */ | 
|  | 7 | extern debug_info_t *cio_debug_msg_id; | 
|  | 8 | extern debug_info_t *cio_debug_trace_id; | 
|  | 9 | extern debug_info_t *cio_debug_crw_id; | 
|  | 10 |  | 
| Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 11 | #define CIO_TRACE_EVENT(imp, txt) do {				\ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | debug_text_event(cio_debug_trace_id, imp, txt); \ | 
|  | 13 | } while (0) | 
|  | 14 |  | 
| Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 15 | #define CIO_MSG_EVENT(imp, args...) do {				\ | 
|  | 16 | debug_sprintf_event(cio_debug_msg_id, imp , ##args);	\ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | } while (0) | 
|  | 18 |  | 
| Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 19 | #define CIO_CRW_EVENT(imp, args...) do {				\ | 
|  | 20 | debug_sprintf_event(cio_debug_crw_id, imp , ##args);	\ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | } while (0) | 
|  | 22 |  | 
| Cornelia Huck | bc698bc | 2008-01-26 14:10:42 +0100 | [diff] [blame] | 23 | static inline void CIO_HEX_EVENT(int level, void *data, int length) | 
| Peter Oberparleiter | 06fbcb1 | 2006-04-10 22:53:46 -0700 | [diff] [blame] | 24 | { | 
| Cornelia Huck | 303fa9e | 2007-07-27 12:29:20 +0200 | [diff] [blame] | 25 | if (unlikely(!cio_debug_trace_id)) | 
|  | 26 | return; | 
| Peter Oberparleiter | 06fbcb1 | 2006-04-10 22:53:46 -0700 | [diff] [blame] | 27 | while (length > 0) { | 
|  | 28 | debug_event(cio_debug_trace_id, level, data, length); | 
|  | 29 | length -= cio_debug_trace_id->buf_size; | 
|  | 30 | data += cio_debug_trace_id->buf_size; | 
|  | 31 | } | 
|  | 32 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #endif |