2 * Copyright (c) 2013 Broadcom Corporation
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #if !defined(BRCMF_TRACEPOINT_H_) || defined(TRACE_HEADER_MULTI_READ)
17 #define BRCMF_TRACEPOINT_H_
19 #include <linux/types.h>
20 #include <linux/tracepoint.h>
22 #ifndef CONFIG_BRCM_TRACING
25 #define TRACE_EVENT(name, proto, ...) \
26 static inline void trace_ ## name(proto) {}
28 #undef DECLARE_EVENT_CLASS
29 #define DECLARE_EVENT_CLASS(...)
32 #define DEFINE_EVENT(evt_class, name, proto, ...) \
33 static inline void trace_ ## name(proto) {}
35 #endif /* CONFIG_BRCM_TRACING */
38 #define TRACE_SYSTEM brcmfmac
40 #define MAX_MSG_LEN 100
42 TRACE_EVENT(brcmf_err
,
43 TP_PROTO(const char *func
, struct va_format
*vaf
),
47 __dynamic_array(char, msg
, MAX_MSG_LEN
)
50 __assign_str(func
, func
);
51 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
52 MAX_MSG_LEN
, vaf
->fmt
,
53 *vaf
->va
) >= MAX_MSG_LEN
);
55 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
58 TRACE_EVENT(brcmf_dbg
,
59 TP_PROTO(u32 level
, const char *func
, struct va_format
*vaf
),
60 TP_ARGS(level
, func
, vaf
),
64 __dynamic_array(char, msg
, MAX_MSG_LEN
)
67 __entry
->level
= level
;
68 __assign_str(func
, func
);
69 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
70 MAX_MSG_LEN
, vaf
->fmt
,
71 *vaf
->va
) >= MAX_MSG_LEN
);
73 TP_printk("%s: %s", __get_str(func
), __get_str(msg
))
76 TRACE_EVENT(brcmf_hexdump
,
77 TP_PROTO(void *data
, size_t len
),
80 __field(unsigned long, len
)
81 __field(unsigned long, addr
)
82 __dynamic_array(u8
, hdata
, len
)
86 __entry
->addr
= (unsigned long)data
;
87 memcpy(__get_dynamic_array(hdata
), data
, len
);
89 TP_printk("hexdump [addr=%lx, length=%lu]", __entry
->addr
, __entry
->len
)
92 TRACE_EVENT(brcmf_bcdchdr
,
100 __dynamic_array(u8
, signal
, *((u8
*)data
+ 3) * 4)
103 __entry
->flags
= *(u8
*)data
;
104 __entry
->prio
= *((u8
*)data
+ 1);
105 __entry
->flags2
= *((u8
*)data
+ 2);
106 __entry
->siglen
= *((u8
*)data
+ 3) * 4;
107 memcpy(__get_dynamic_array(signal
),
108 (u8
*)data
+ 4, __entry
->siglen
);
110 TP_printk("bcdc: prio=%d siglen=%d", __entry
->prio
, __entry
->siglen
)
123 TRACE_EVENT(brcmf_sdpcm_hdr
,
124 TP_PROTO(u8 dir
, void *data
),
129 __dynamic_array(u8
, hdr
, dir
== SDPCM_GLOM
? 20 : 12)
132 memcpy(__get_dynamic_array(hdr
), data
, dir
== SDPCM_GLOM
? 20 : 12);
133 __entry
->len
= *(u8
*)data
| (*((u8
*)data
+ 1) << 8);
136 TP_printk("sdpcm: %s len %u, seq %d",
137 __entry
->dir
== SDPCM_RX
? "RX" : "TX",
138 __entry
->len
, ((u8
*)__get_dynamic_array(hdr
))[4])
141 #ifdef CONFIG_BRCM_TRACING
143 #undef TRACE_INCLUDE_PATH
144 #define TRACE_INCLUDE_PATH .
145 #undef TRACE_INCLUDE_FILE
146 #define TRACE_INCLUDE_FILE tracepoint
148 #include <trace/define_trace.h>
150 #endif /* CONFIG_BRCM_TRACING */
152 #endif /* BRCMF_TRACEPOINT_H_ */