2 * Copyright IBM Corp. 2001, 2007
3 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
11 * Debug Facility stuff
14 #include <asm/debug.h>
22 #define do_debug_ccw 1
25 #define do_debug_ccw 0
28 #define do_debug_data 1
30 #define do_debug_data 0
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 */
51 CTCM_DBF_INFOS
/* must be last element */
54 struct ctcm_dbf_info
{
55 char name
[DEBUG_MAX_NAME_LEN
];
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
)
72 return (l
> n
) ? s
+ (l
- n
) : s
;
75 #define CTCM_FUNTAIL strtail((char *)__func__, 16)
77 #define CTCM_DBF_TEXT(name, level, text) \
79 debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
82 #define CTCM_DBF_HEX(name, level, addr, len) \
84 debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
85 level, (void *)(addr), len); \
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) \
98 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \
99 CTCM_FUNTAIL, dev->name, text); \
102 #define MPC_DBF_DEV_NAME(cat, dev, text) \
104 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \
105 CTCM_FUNTAIL, dev->name, text); \
108 #define CTCMY_DBF_DEV_NAME(cat, dev, text) \
110 if (IS_MPCDEV(dev)) \
111 MPC_DBF_DEV_NAME(cat, dev, text); \
113 CTCM_DBF_DEV_NAME(cat, dev, text); \
117 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
119 * text: any text string.
121 #define CTCM_DBF_DEV(cat, dev, text) \
123 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \
124 CTCM_FUNTAIL, dev, text); \
127 #define MPC_DBF_DEV(cat, dev, text) \
129 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \
130 CTCM_FUNTAIL, dev, text); \
133 #define CTCMY_DBF_DEV(cat, dev, text) \
135 if (IS_MPCDEV(dev)) \
136 MPC_DBF_DEV(cat, dev, text); \
138 CTCM_DBF_DEV(cat, dev, text); \