PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / s390 / net / ctcm_dbug.h
blob47bf0501995e8cfa3834ff18b6e817a45d80e19a
1 /*
2 * Copyright IBM Corp. 2001, 2007
3 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
5 */
7 #ifndef _CTCM_DBUG_H_
8 #define _CTCM_DBUG_H_
11 * Debug Facility stuff
14 #include <asm/debug.h>
16 #ifdef DEBUG
17 #define do_debug 1
18 #else
19 #define do_debug 0
20 #endif
21 #ifdef DEBUGCCW
22 #define do_debug_ccw 1
23 #define DEBUGDATA 1
24 #else
25 #define do_debug_ccw 0
26 #endif
27 #ifdef DEBUGDATA
28 #define do_debug_data 1
29 #else
30 #define do_debug_data 0
31 #endif
33 /* define dbf debug levels similar to kernel msg levels */
34 #define CTC_DBF_ALWAYS 0 /* always print this */
35 #define CTC_DBF_EMERG 0 /* system is unusable */
36 #define CTC_DBF_ALERT 1 /* action must be taken immediately */
37 #define CTC_DBF_CRIT 2 /* critical conditions */
38 #define CTC_DBF_ERROR 3 /* error conditions */
39 #define CTC_DBF_WARN 4 /* warning conditions */
40 #define CTC_DBF_NOTICE 5 /* normal but significant condition */
41 #define CTC_DBF_INFO 5 /* informational */
42 #define CTC_DBF_DEBUG 6 /* debug-level messages */
44 enum ctcm_dbf_names {
45 CTCM_DBF_SETUP,
46 CTCM_DBF_ERROR,
47 CTCM_DBF_TRACE,
48 CTCM_DBF_MPC_SETUP,
49 CTCM_DBF_MPC_ERROR,
50 CTCM_DBF_MPC_TRACE,
51 CTCM_DBF_INFOS /* must be last element */
54 struct ctcm_dbf_info {
55 char name[DEBUG_MAX_NAME_LEN];
56 int pages;
57 int areas;
58 int len;
59 int level;
60 debug_info_t *id;
63 extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS];
65 int ctcm_register_dbf_views(void);
66 void ctcm_unregister_dbf_views(void);
67 void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...);
69 static inline const char *strtail(const char *s, int n)
71 int l = strlen(s);
72 return (l > n) ? s + (l - n) : s;
75 #define CTCM_FUNTAIL strtail((char *)__func__, 16)
77 #define CTCM_DBF_TEXT(name, level, text) \
78 do { \
79 debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
80 } while (0)
82 #define CTCM_DBF_HEX(name, level, addr, len) \
83 do { \
84 debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
85 level, (void *)(addr), len); \
86 } while (0)
88 #define CTCM_DBF_TEXT_(name, level, text...) \
89 ctcm_dbf_longtext(CTCM_DBF_##name, level, text)
92 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
93 * dev : netdevice with valid name field.
94 * text: any text string.
96 #define CTCM_DBF_DEV_NAME(cat, dev, text) \
97 do { \
98 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \
99 CTCM_FUNTAIL, dev->name, text); \
100 } while (0)
102 #define MPC_DBF_DEV_NAME(cat, dev, text) \
103 do { \
104 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \
105 CTCM_FUNTAIL, dev->name, text); \
106 } while (0)
108 #define CTCMY_DBF_DEV_NAME(cat, dev, text) \
109 do { \
110 if (IS_MPCDEV(dev)) \
111 MPC_DBF_DEV_NAME(cat, dev, text); \
112 else \
113 CTCM_DBF_DEV_NAME(cat, dev, text); \
114 } while (0)
117 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
118 * dev : netdevice.
119 * text: any text string.
121 #define CTCM_DBF_DEV(cat, dev, text) \
122 do { \
123 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \
124 CTCM_FUNTAIL, dev, text); \
125 } while (0)
127 #define MPC_DBF_DEV(cat, dev, text) \
128 do { \
129 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \
130 CTCM_FUNTAIL, dev, text); \
131 } while (0)
133 #define CTCMY_DBF_DEV(cat, dev, text) \
134 do { \
135 if (IS_MPCDEV(dev)) \
136 MPC_DBF_DEV(cat, dev, text); \
137 else \
138 CTCM_DBF_DEV(cat, dev, text); \
139 } while (0)
141 #endif