2 * drivers/s390/net/ctcm_dbug.h
4 * Copyright IBM Corp. 2001, 2007
5 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
13 * Debug Facility stuff
16 #include <asm/debug.h>
24 #define do_debug_ccw 1
27 #define do_debug_ccw 0
30 #define do_debug_data 1
32 #define do_debug_data 0
35 /* define dbf debug levels similar to kernel msg levels */
36 #define CTC_DBF_ALWAYS 0 /* always print this */
37 #define CTC_DBF_EMERG 0 /* system is unusable */
38 #define CTC_DBF_ALERT 1 /* action must be taken immediately */
39 #define CTC_DBF_CRIT 2 /* critical conditions */
40 #define CTC_DBF_ERROR 3 /* error conditions */
41 #define CTC_DBF_WARN 4 /* warning conditions */
42 #define CTC_DBF_NOTICE 5 /* normal but significant condition */
43 #define CTC_DBF_INFO 5 /* informational */
44 #define CTC_DBF_DEBUG 6 /* debug-level messages */
53 CTCM_DBF_INFOS
/* must be last element */
56 struct ctcm_dbf_info
{
57 char name
[DEBUG_MAX_NAME_LEN
];
65 extern struct ctcm_dbf_info ctcm_dbf
[CTCM_DBF_INFOS
];
67 int ctcm_register_dbf_views(void);
68 void ctcm_unregister_dbf_views(void);
69 void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix
, int level
, char *text
, ...);
71 static inline const char *strtail(const char *s
, int n
)
74 return (l
> n
) ? s
+ (l
- n
) : s
;
77 #define CTCM_FUNTAIL strtail((char *)__func__, 16)
79 #define CTCM_DBF_TEXT(name, level, text) \
81 debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
84 #define CTCM_DBF_HEX(name, level, addr, len) \
86 debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
87 level, (void *)(addr), len); \
90 #define CTCM_DBF_TEXT_(name, level, text...) \
91 ctcm_dbf_longtext(CTCM_DBF_##name, level, text)
94 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
95 * dev : netdevice with valid name field.
96 * text: any text string.
98 #define CTCM_DBF_DEV_NAME(cat, dev, text) \
100 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \
101 CTCM_FUNTAIL, dev->name, text); \
104 #define MPC_DBF_DEV_NAME(cat, dev, text) \
106 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \
107 CTCM_FUNTAIL, dev->name, text); \
110 #define CTCMY_DBF_DEV_NAME(cat, dev, text) \
112 if (IS_MPCDEV(dev)) \
113 MPC_DBF_DEV_NAME(cat, dev, text); \
115 CTCM_DBF_DEV_NAME(cat, dev, text); \
119 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
121 * text: any text string.
123 #define CTCM_DBF_DEV(cat, dev, text) \
125 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \
126 CTCM_FUNTAIL, dev, text); \
129 #define MPC_DBF_DEV(cat, dev, text) \
131 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \
132 CTCM_FUNTAIL, dev, text); \
135 #define CTCMY_DBF_DEV(cat, dev, text) \
137 if (IS_MPCDEV(dev)) \
138 MPC_DBF_DEV(cat, dev, text); \
140 CTCM_DBF_DEV(cat, dev, text); \