1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright IBM Corp. 2001, 2007
4 * Authors: Peter Tiedemann (ptiedem@de.ibm.com)
12 * Debug Facility stuff
15 #include <asm/debug.h>
23 #define do_debug_ccw 1
26 #define do_debug_ccw 0
29 #define do_debug_data 1
31 #define do_debug_data 0
34 /* define dbf debug levels similar to kernel msg levels */
35 #define CTC_DBF_ALWAYS 0 /* always print this */
36 #define CTC_DBF_EMERG 0 /* system is unusable */
37 #define CTC_DBF_ALERT 1 /* action must be taken immediately */
38 #define CTC_DBF_CRIT 2 /* critical conditions */
39 #define CTC_DBF_ERROR 3 /* error conditions */
40 #define CTC_DBF_WARN 4 /* warning conditions */
41 #define CTC_DBF_NOTICE 5 /* normal but significant condition */
42 #define CTC_DBF_INFO 5 /* informational */
43 #define CTC_DBF_DEBUG 6 /* debug-level messages */
52 CTCM_DBF_INFOS
/* must be last element */
55 struct ctcm_dbf_info
{
56 char name
[DEBUG_MAX_NAME_LEN
];
64 extern struct ctcm_dbf_info ctcm_dbf
[CTCM_DBF_INFOS
];
66 int ctcm_register_dbf_views(void);
67 void ctcm_unregister_dbf_views(void);
68 void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix
, int level
, char *text
, ...);
70 static inline const char *strtail(const char *s
, int n
)
73 return (l
> n
) ? s
+ (l
- n
) : s
;
76 #define CTCM_FUNTAIL strtail((char *)__func__, 16)
78 #define CTCM_DBF_TEXT(name, level, text) \
80 debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
83 #define CTCM_DBF_HEX(name, level, addr, len) \
85 debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
86 level, (void *)(addr), len); \
89 #define CTCM_DBF_TEXT_(name, level, text...) \
90 ctcm_dbf_longtext(CTCM_DBF_##name, level, text)
93 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
94 * dev : netdevice with valid name field.
95 * text: any text string.
97 #define CTCM_DBF_DEV_NAME(cat, dev, text) \
99 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \
100 CTCM_FUNTAIL, dev->name, text); \
103 #define MPC_DBF_DEV_NAME(cat, dev, text) \
105 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \
106 CTCM_FUNTAIL, dev->name, text); \
109 #define CTCMY_DBF_DEV_NAME(cat, dev, text) \
111 if (IS_MPCDEV(dev)) \
112 MPC_DBF_DEV_NAME(cat, dev, text); \
114 CTCM_DBF_DEV_NAME(cat, dev, text); \
118 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
120 * text: any text string.
122 #define CTCM_DBF_DEV(cat, dev, text) \
124 CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \
125 CTCM_FUNTAIL, dev, text); \
128 #define MPC_DBF_DEV(cat, dev, text) \
130 CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \
131 CTCM_FUNTAIL, dev, text); \
134 #define CTCMY_DBF_DEV(cat, dev, text) \
136 if (IS_MPCDEV(dev)) \
137 MPC_DBF_DEV(cat, dev, text); \
139 CTCM_DBF_DEV(cat, dev, text); \