1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2013 Broadcom Corporation
5 #if !defined(BRCMF_TRACEPOINT_H_) || defined(TRACE_HEADER_MULTI_READ)
6 #define BRCMF_TRACEPOINT_H_
8 #include <linux/types.h>
9 #include <linux/tracepoint.h>
11 #ifndef CONFIG_BRCM_TRACING
14 #define TRACE_EVENT(name, proto, ...) \
15 static inline void trace_ ## name(proto) {}
17 #undef DECLARE_EVENT_CLASS
18 #define DECLARE_EVENT_CLASS(...)
21 #define DEFINE_EVENT(evt_class, name, proto, ...) \
22 static inline void trace_ ## name(proto) {}
24 #endif /* CONFIG_BRCM_TRACING */
27 #define TRACE_SYSTEM brcmfmac
29 #define MAX_MSG_LEN 100
31 TRACE_EVENT(brcmf_err
,
32 TP_PROTO(const char *func
, struct va_format
*vaf
),
36 __dynamic_array(char, msg
, MAX_MSG_LEN
)
39 __assign_str(func
, func
);
40 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
41 MAX_MSG_LEN
, vaf
->fmt
,
42 *vaf
->va
) >= MAX_MSG_LEN
);
44 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
47 TRACE_EVENT(brcmf_dbg
,
48 TP_PROTO(u32 level
, const char *func
, struct va_format
*vaf
),
49 TP_ARGS(level
, func
, vaf
),
53 __dynamic_array(char, msg
, MAX_MSG_LEN
)
56 __entry
->level
= level
;
57 __assign_str(func
, func
);
58 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
59 MAX_MSG_LEN
, vaf
->fmt
,
60 *vaf
->va
) >= MAX_MSG_LEN
);
62 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
65 TRACE_EVENT(brcmf_hexdump
,
66 TP_PROTO(void *data
, size_t len
),
69 __field(unsigned long, len
)
70 __field(unsigned long, addr
)
71 __dynamic_array(u8
, hdata
, len
)
75 __entry
->addr
= (unsigned long)data
;
76 memcpy(__get_dynamic_array(hdata
), data
, len
);
78 TP_printk("hexdump [addr=%lx, length=%lu]", __entry
->addr
, __entry
->len
)
81 TRACE_EVENT(brcmf_bcdchdr
,
89 __dynamic_array(u8
, signal
, *((u8
*)data
+ 3) * 4)
92 __entry
->flags
= *(u8
*)data
;
93 __entry
->prio
= *((u8
*)data
+ 1);
94 __entry
->flags2
= *((u8
*)data
+ 2);
95 __entry
->siglen
= *((u8
*)data
+ 3) * 4;
96 memcpy(__get_dynamic_array(signal
),
97 (u8
*)data
+ 4, __entry
->siglen
);
99 TP_printk("bcdc: prio=%d siglen=%d", __entry
->prio
, __entry
->siglen
)
112 TRACE_EVENT(brcmf_sdpcm_hdr
,
113 TP_PROTO(u8 dir
, void *data
),
118 __dynamic_array(u8
, hdr
, dir
== SDPCM_GLOM
? 20 : 12)
121 memcpy(__get_dynamic_array(hdr
), data
, dir
== SDPCM_GLOM
? 20 : 12);
122 __entry
->len
= *(u8
*)data
| (*((u8
*)data
+ 1) << 8);
125 TP_printk("sdpcm: %s len %u, seq %d",
126 __entry
->dir
== SDPCM_RX
? "RX" : "TX",
127 __entry
->len
, ((u8
*)__get_dynamic_array(hdr
))[4])
130 #ifdef CONFIG_BRCM_TRACING
132 #undef TRACE_INCLUDE_PATH
133 #define TRACE_INCLUDE_PATH .
134 #undef TRACE_INCLUDE_FILE
135 #define TRACE_INCLUDE_FILE tracepoint
137 #include <trace/define_trace.h>
139 #endif /* CONFIG_BRCM_TRACING */
141 #endif /* BRCMF_TRACEPOINT_H_ */