firewire.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. // Copyright (c) 2024 Takashi Sakamoto
  3. #undef TRACE_SYSTEM
  4. #define TRACE_SYSTEM firewire
  5. #if !defined(_FIREWIRE_TRACE_EVENT_H) || defined(TRACE_HEADER_MULTI_READ)
  6. #define _FIREWIRE_TRACE_EVENT_H
  7. #include <linux/tracepoint.h>
  8. #include <linux/firewire.h>
  9. #include <linux/firewire-constants.h>
  10. // Some macros are defined in 'drivers/firewire/packet-header-definitions.h'.
  11. // The content of TP_printk field is preprocessed, then put to the module binary.
  12. #define ASYNC_HEADER_GET_DESTINATION(header) \
  13. (((header)[0] & ASYNC_HEADER_Q0_DESTINATION_MASK) >> ASYNC_HEADER_Q0_DESTINATION_SHIFT)
  14. #define ASYNC_HEADER_GET_TLABEL(header) \
  15. (((header)[0] & ASYNC_HEADER_Q0_TLABEL_MASK) >> ASYNC_HEADER_Q0_TLABEL_SHIFT)
  16. #define ASYNC_HEADER_GET_TCODE(header) \
  17. (((header)[0] & ASYNC_HEADER_Q0_TCODE_MASK) >> ASYNC_HEADER_Q0_TCODE_SHIFT)
  18. #define ASYNC_HEADER_GET_SOURCE(header) \
  19. (((header)[1] & ASYNC_HEADER_Q1_SOURCE_MASK) >> ASYNC_HEADER_Q1_SOURCE_SHIFT)
  20. #define ASYNC_HEADER_GET_OFFSET(header) \
  21. ((((unsigned long long)((header)[1] & ASYNC_HEADER_Q1_OFFSET_HIGH_MASK)) >> ASYNC_HEADER_Q1_OFFSET_HIGH_SHIFT) << 32)| \
  22. (header)[2]
  23. #define ASYNC_HEADER_GET_RCODE(header) \
  24. (((header)[1] & ASYNC_HEADER_Q1_RCODE_MASK) >> ASYNC_HEADER_Q1_RCODE_SHIFT)
  25. #define QUADLET_SIZE 4
  26. DECLARE_EVENT_CLASS(async_outbound_initiate_template,
  27. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count),
  28. TP_ARGS(transaction, card_index, generation, scode, header, data, data_count),
  29. TP_STRUCT__entry(
  30. __field(u64, transaction)
  31. __field(u8, card_index)
  32. __field(u8, generation)
  33. __field(u8, scode)
  34. __array(u32, header, ASYNC_HEADER_QUADLET_COUNT)
  35. __dynamic_array(u32, data, data_count)
  36. ),
  37. TP_fast_assign(
  38. __entry->transaction = transaction;
  39. __entry->card_index = card_index;
  40. __entry->generation = generation;
  41. __entry->scode = scode;
  42. memcpy(__entry->header, header, QUADLET_SIZE * ASYNC_HEADER_QUADLET_COUNT);
  43. memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data));
  44. ),
  45. // This format is for the request subaction.
  46. TP_printk(
  47. "transaction=0x%llx card_index=%u generation=%u scode=%u dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x offset=0x%012llx header=%s data=%s",
  48. __entry->transaction,
  49. __entry->card_index,
  50. __entry->generation,
  51. __entry->scode,
  52. ASYNC_HEADER_GET_DESTINATION(__entry->header),
  53. ASYNC_HEADER_GET_TLABEL(__entry->header),
  54. ASYNC_HEADER_GET_TCODE(__entry->header),
  55. ASYNC_HEADER_GET_SOURCE(__entry->header),
  56. ASYNC_HEADER_GET_OFFSET(__entry->header),
  57. __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE),
  58. __print_array(__get_dynamic_array(data),
  59. __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE)
  60. )
  61. );
  62. // The value of status is one of ack codes and rcodes specific to Linux FireWire subsystem.
  63. DECLARE_EVENT_CLASS(async_outbound_complete_template,
  64. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp),
  65. TP_ARGS(transaction, card_index, generation, scode, status, timestamp),
  66. TP_STRUCT__entry(
  67. __field(u64, transaction)
  68. __field(u8, card_index)
  69. __field(u8, generation)
  70. __field(u8, scode)
  71. __field(u8, status)
  72. __field(u16, timestamp)
  73. ),
  74. TP_fast_assign(
  75. __entry->transaction = transaction;
  76. __entry->card_index = card_index;
  77. __entry->generation = generation;
  78. __entry->scode = scode;
  79. __entry->status = status;
  80. __entry->timestamp = timestamp;
  81. ),
  82. TP_printk(
  83. "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x",
  84. __entry->transaction,
  85. __entry->card_index,
  86. __entry->generation,
  87. __entry->scode,
  88. __entry->status,
  89. __entry->timestamp
  90. )
  91. );
  92. // The value of status is one of ack codes and rcodes specific to Linux FireWire subsystem.
  93. DECLARE_EVENT_CLASS(async_inbound_template,
  94. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count),
  95. TP_ARGS(transaction, card_index, generation, scode, status, timestamp, header, data, data_count),
  96. TP_STRUCT__entry(
  97. __field(u64, transaction)
  98. __field(u8, card_index)
  99. __field(u8, generation)
  100. __field(u8, scode)
  101. __field(u8, status)
  102. __field(u16, timestamp)
  103. __array(u32, header, ASYNC_HEADER_QUADLET_COUNT)
  104. __dynamic_array(u32, data, data_count)
  105. ),
  106. TP_fast_assign(
  107. __entry->transaction = transaction;
  108. __entry->card_index = card_index;
  109. __entry->generation = generation;
  110. __entry->scode = scode;
  111. __entry->status = status;
  112. __entry->timestamp = timestamp;
  113. memcpy(__entry->header, header, QUADLET_SIZE * ASYNC_HEADER_QUADLET_COUNT);
  114. memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data));
  115. ),
  116. // This format is for the response subaction.
  117. TP_printk(
  118. "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x rcode=%u header=%s data=%s",
  119. __entry->transaction,
  120. __entry->card_index,
  121. __entry->generation,
  122. __entry->scode,
  123. __entry->status,
  124. __entry->timestamp,
  125. ASYNC_HEADER_GET_DESTINATION(__entry->header),
  126. ASYNC_HEADER_GET_TLABEL(__entry->header),
  127. ASYNC_HEADER_GET_TCODE(__entry->header),
  128. ASYNC_HEADER_GET_SOURCE(__entry->header),
  129. ASYNC_HEADER_GET_RCODE(__entry->header),
  130. __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE),
  131. __print_array(__get_dynamic_array(data),
  132. __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE)
  133. )
  134. );
  135. DEFINE_EVENT(async_outbound_initiate_template, async_request_outbound_initiate,
  136. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count),
  137. TP_ARGS(transaction, card_index, generation, scode, header, data, data_count)
  138. );
  139. DEFINE_EVENT(async_outbound_complete_template, async_request_outbound_complete,
  140. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp),
  141. TP_ARGS(transaction, card_index, generation, scode, status, timestamp)
  142. );
  143. DEFINE_EVENT(async_inbound_template, async_response_inbound,
  144. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count),
  145. TP_ARGS(transaction, card_index, generation, scode, status, timestamp, header, data, data_count)
  146. );
  147. DEFINE_EVENT_PRINT(async_inbound_template, async_request_inbound,
  148. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count),
  149. TP_ARGS(transaction, card_index, generation, scode, status, timestamp, header, data, data_count),
  150. TP_printk(
  151. "transaction=0x%llx card_index=%u generation=%u scode=%u status=%u timestamp=0x%04x dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x offset=0x%012llx header=%s data=%s",
  152. __entry->transaction,
  153. __entry->card_index,
  154. __entry->generation,
  155. __entry->scode,
  156. __entry->status,
  157. __entry->timestamp,
  158. ASYNC_HEADER_GET_DESTINATION(__entry->header),
  159. ASYNC_HEADER_GET_TLABEL(__entry->header),
  160. ASYNC_HEADER_GET_TCODE(__entry->header),
  161. ASYNC_HEADER_GET_SOURCE(__entry->header),
  162. ASYNC_HEADER_GET_OFFSET(__entry->header),
  163. __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE),
  164. __print_array(__get_dynamic_array(data),
  165. __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE)
  166. )
  167. );
  168. DEFINE_EVENT_PRINT(async_outbound_initiate_template, async_response_outbound_initiate,
  169. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, const u32 *header, const u32 *data, unsigned int data_count),
  170. TP_ARGS(transaction, card_index, generation, scode, header, data, data_count),
  171. TP_printk(
  172. "transaction=0x%llx card_index=%u generation=%u scode=%u dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x rcode=%u header=%s data=%s",
  173. __entry->transaction,
  174. __entry->card_index,
  175. __entry->generation,
  176. __entry->scode,
  177. ASYNC_HEADER_GET_DESTINATION(__entry->header),
  178. ASYNC_HEADER_GET_TLABEL(__entry->header),
  179. ASYNC_HEADER_GET_TCODE(__entry->header),
  180. ASYNC_HEADER_GET_SOURCE(__entry->header),
  181. ASYNC_HEADER_GET_RCODE(__entry->header),
  182. __print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE),
  183. __print_array(__get_dynamic_array(data),
  184. __get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE)
  185. )
  186. );
  187. DEFINE_EVENT(async_outbound_complete_template, async_response_outbound_complete,
  188. TP_PROTO(u64 transaction, unsigned int card_index, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp),
  189. TP_ARGS(transaction, card_index, generation, scode, status, timestamp)
  190. );
  191. #undef ASYNC_HEADER_GET_DESTINATION
  192. #undef ASYNC_HEADER_GET_TLABEL
  193. #undef ASYNC_HEADER_GET_TCODE
  194. #undef ASYNC_HEADER_GET_SOURCE
  195. #undef ASYNC_HEADER_GET_OFFSET
  196. #undef ASYNC_HEADER_GET_RCODE
  197. TRACE_EVENT(async_phy_outbound_initiate,
  198. TP_PROTO(u64 packet, unsigned int card_index, unsigned int generation, u32 first_quadlet, u32 second_quadlet),
  199. TP_ARGS(packet, card_index, generation, first_quadlet, second_quadlet),
  200. TP_STRUCT__entry(
  201. __field(u64, packet)
  202. __field(u8, card_index)
  203. __field(u8, generation)
  204. __field(u32, first_quadlet)
  205. __field(u32, second_quadlet)
  206. ),
  207. TP_fast_assign(
  208. __entry->packet = packet;
  209. __entry->card_index = card_index;
  210. __entry->generation = generation;
  211. __entry->first_quadlet = first_quadlet;
  212. __entry->second_quadlet = second_quadlet
  213. ),
  214. TP_printk(
  215. "packet=0x%llx card_index=%u generation=%u first_quadlet=0x%08x second_quadlet=0x%08x",
  216. __entry->packet,
  217. __entry->card_index,
  218. __entry->generation,
  219. __entry->first_quadlet,
  220. __entry->second_quadlet
  221. )
  222. );
  223. TRACE_EVENT(async_phy_outbound_complete,
  224. TP_PROTO(u64 packet, unsigned int card_index, unsigned int generation, unsigned int status, unsigned int timestamp),
  225. TP_ARGS(packet, card_index, generation, status, timestamp),
  226. TP_STRUCT__entry(
  227. __field(u64, packet)
  228. __field(u8, card_index)
  229. __field(u8, generation)
  230. __field(u8, status)
  231. __field(u16, timestamp)
  232. ),
  233. TP_fast_assign(
  234. __entry->packet = packet;
  235. __entry->card_index = card_index;
  236. __entry->generation = generation;
  237. __entry->status = status;
  238. __entry->timestamp = timestamp;
  239. ),
  240. TP_printk(
  241. "packet=0x%llx card_index=%u generation=%u status=%u timestamp=0x%04x",
  242. __entry->packet,
  243. __entry->card_index,
  244. __entry->generation,
  245. __entry->status,
  246. __entry->timestamp
  247. )
  248. );
  249. TRACE_EVENT(async_phy_inbound,
  250. TP_PROTO(u64 packet, unsigned int card_index, unsigned int generation, unsigned int status, unsigned int timestamp, u32 first_quadlet, u32 second_quadlet),
  251. TP_ARGS(packet, card_index, generation, status, timestamp, first_quadlet, second_quadlet),
  252. TP_STRUCT__entry(
  253. __field(u64, packet)
  254. __field(u8, card_index)
  255. __field(u8, generation)
  256. __field(u8, status)
  257. __field(u16, timestamp)
  258. __field(u32, first_quadlet)
  259. __field(u32, second_quadlet)
  260. ),
  261. TP_fast_assign(
  262. __entry->packet = packet;
  263. __entry->generation = generation;
  264. __entry->status = status;
  265. __entry->timestamp = timestamp;
  266. __entry->first_quadlet = first_quadlet;
  267. __entry->second_quadlet = second_quadlet
  268. ),
  269. TP_printk(
  270. "packet=0x%llx card_index=%u generation=%u status=%u timestamp=0x%04x first_quadlet=0x%08x second_quadlet=0x%08x",
  271. __entry->packet,
  272. __entry->card_index,
  273. __entry->generation,
  274. __entry->status,
  275. __entry->timestamp,
  276. __entry->first_quadlet,
  277. __entry->second_quadlet
  278. )
  279. );
  280. DECLARE_EVENT_CLASS(bus_reset_arrange_template,
  281. TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset),
  282. TP_ARGS(card_index, generation, short_reset),
  283. TP_STRUCT__entry(
  284. __field(u8, card_index)
  285. __field(u8, generation)
  286. __field(bool, short_reset)
  287. ),
  288. TP_fast_assign(
  289. __entry->card_index = card_index;
  290. __entry->generation = generation;
  291. __entry->short_reset = short_reset;
  292. ),
  293. TP_printk(
  294. "card_index=%u generation=%u short_reset=%s",
  295. __entry->card_index,
  296. __entry->generation,
  297. __entry->short_reset ? "true" : "false"
  298. )
  299. );
  300. DEFINE_EVENT(bus_reset_arrange_template, bus_reset_initiate,
  301. TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset),
  302. TP_ARGS(card_index, generation, short_reset)
  303. );
  304. DEFINE_EVENT(bus_reset_arrange_template, bus_reset_schedule,
  305. TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset),
  306. TP_ARGS(card_index, generation, short_reset)
  307. );
  308. DEFINE_EVENT(bus_reset_arrange_template, bus_reset_postpone,
  309. TP_PROTO(unsigned int card_index, unsigned int generation, bool short_reset),
  310. TP_ARGS(card_index, generation, short_reset)
  311. );
  312. TRACE_EVENT(bus_reset_handle,
  313. TP_PROTO(unsigned int card_index, unsigned int generation, unsigned int node_id, bool bm_abdicate, u32 *self_ids, unsigned int self_id_count),
  314. TP_ARGS(card_index, generation, node_id, bm_abdicate, self_ids, self_id_count),
  315. TP_STRUCT__entry(
  316. __field(u8, card_index)
  317. __field(u8, generation)
  318. __field(u8, node_id)
  319. __field(bool, bm_abdicate)
  320. __dynamic_array(u32, self_ids, self_id_count)
  321. ),
  322. TP_fast_assign(
  323. __entry->card_index = card_index;
  324. __entry->generation = generation;
  325. __entry->node_id = node_id;
  326. __entry->bm_abdicate = bm_abdicate;
  327. memcpy(__get_dynamic_array(self_ids), self_ids, __get_dynamic_array_len(self_ids));
  328. ),
  329. TP_printk(
  330. "card_index=%u generation=%u node_id=0x%04x bm_abdicate=%s self_ids=%s",
  331. __entry->card_index,
  332. __entry->generation,
  333. __entry->node_id,
  334. __entry->bm_abdicate ? "true" : "false",
  335. __print_array(__get_dynamic_array(self_ids),
  336. __get_dynamic_array_len(self_ids) / QUADLET_SIZE, QUADLET_SIZE)
  337. )
  338. );
  339. // Some macros are defined in 'drivers/firewire/phy-packet-definitions.h'.
  340. // The content of TP_printk field is preprocessed, then put to the module binary.
  341. #define PHY_PACKET_SELF_ID_GET_PHY_ID(quads) \
  342. ((((const u32 *)quads)[0] & SELF_ID_PHY_ID_MASK) >> SELF_ID_PHY_ID_SHIFT)
  343. #define PHY_PACKET_SELF_ID_GET_LINK_ACTIVE(quads) \
  344. ((((const u32 *)quads)[0] & SELF_ID_ZERO_LINK_ACTIVE_MASK) >> SELF_ID_ZERO_LINK_ACTIVE_SHIFT)
  345. #define PHY_PACKET_SELF_ID_GET_GAP_COUNT(quads) \
  346. ((((const u32 *)quads)[0] & SELF_ID_ZERO_GAP_COUNT_MASK) >> SELF_ID_ZERO_GAP_COUNT_SHIFT)
  347. #define PHY_PACKET_SELF_ID_GET_SCODE(quads) \
  348. ((((const u32 *)quads)[0] & SELF_ID_ZERO_SCODE_MASK) >> SELF_ID_ZERO_SCODE_SHIFT)
  349. #define PHY_PACKET_SELF_ID_GET_CONTENDER(quads) \
  350. ((((const u32 *)quads)[0] & SELF_ID_ZERO_CONTENDER_MASK) >> SELF_ID_ZERO_CONTENDER_SHIFT)
  351. #define PHY_PACKET_SELF_ID_GET_POWER_CLASS(quads) \
  352. ((((const u32 *)quads)[0] & SELF_ID_ZERO_POWER_CLASS_MASK) >> SELF_ID_ZERO_POWER_CLASS_SHIFT)
  353. #define PHY_PACKET_SELF_ID_GET_INITIATED_RESET(quads) \
  354. ((((const u32 *)quads)[0] & SELF_ID_ZERO_INITIATED_RESET_MASK) >> SELF_ID_ZERO_INITIATED_RESET_SHIFT)
  355. TRACE_EVENT(self_id_sequence,
  356. TP_PROTO(unsigned int card_index, const u32 *self_id_sequence, unsigned int quadlet_count, unsigned int generation),
  357. TP_ARGS(card_index, self_id_sequence, quadlet_count, generation),
  358. TP_STRUCT__entry(
  359. __field(u8, card_index)
  360. __field(u8, generation)
  361. __dynamic_array(u8, port_status, self_id_sequence_get_port_capacity(quadlet_count))
  362. __dynamic_array(u32, self_id_sequence, quadlet_count)
  363. ),
  364. TP_fast_assign(
  365. __entry->card_index = card_index;
  366. __entry->generation = generation;
  367. {
  368. u8 *port_status = __get_dynamic_array(port_status);
  369. unsigned int port_index;
  370. for (port_index = 0; port_index < __get_dynamic_array_len(port_status); ++port_index) {
  371. port_status[port_index] =
  372. self_id_sequence_get_port_status(self_id_sequence,
  373. quadlet_count, port_index);
  374. }
  375. }
  376. memcpy(__get_dynamic_array(self_id_sequence), self_id_sequence,
  377. __get_dynamic_array_len(self_id_sequence));
  378. ),
  379. TP_printk(
  380. "card_index=%u generation=%u phy_id=0x%02x link_active=%s gap_count=%u scode=%u contender=%s power_class=%u initiated_reset=%s port_status=%s self_id_sequence=%s",
  381. __entry->card_index,
  382. __entry->generation,
  383. PHY_PACKET_SELF_ID_GET_PHY_ID(__get_dynamic_array(self_id_sequence)),
  384. PHY_PACKET_SELF_ID_GET_LINK_ACTIVE(__get_dynamic_array(self_id_sequence)) ? "true" : "false",
  385. PHY_PACKET_SELF_ID_GET_GAP_COUNT(__get_dynamic_array(self_id_sequence)),
  386. PHY_PACKET_SELF_ID_GET_SCODE(__get_dynamic_array(self_id_sequence)),
  387. PHY_PACKET_SELF_ID_GET_CONTENDER(__get_dynamic_array(self_id_sequence)) ? "true" : "false",
  388. PHY_PACKET_SELF_ID_GET_POWER_CLASS(__get_dynamic_array(self_id_sequence)),
  389. PHY_PACKET_SELF_ID_GET_INITIATED_RESET(__get_dynamic_array(self_id_sequence)) ? "true" : "false",
  390. __print_array(__get_dynamic_array(port_status), __get_dynamic_array_len(port_status), 1),
  391. __print_array(__get_dynamic_array(self_id_sequence),
  392. __get_dynamic_array_len(self_id_sequence) / QUADLET_SIZE, QUADLET_SIZE)
  393. )
  394. );
  395. #undef PHY_PACKET_SELF_ID_GET_PHY_ID
  396. #undef PHY_PACKET_SELF_ID_GET_LINK_ACTIVE
  397. #undef PHY_PACKET_SELF_ID_GET_GAP_COUNT
  398. #undef PHY_PACKET_SELF_ID_GET_SCODE
  399. #undef PHY_PACKET_SELF_ID_GET_CONTENDER
  400. #undef PHY_PACKET_SELF_ID_GET_POWER_CLASS
  401. #undef PHY_PACKET_SELF_ID_GET_INITIATED_RESET
  402. TRACE_EVENT_CONDITION(isoc_outbound_allocate,
  403. TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int scode),
  404. TP_ARGS(ctx, channel, scode),
  405. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT),
  406. TP_STRUCT__entry(
  407. __field(u64, context)
  408. __field(u8, card_index)
  409. __field(u8, channel)
  410. __field(u8, scode)
  411. ),
  412. TP_fast_assign(
  413. __entry->context = (uintptr_t)ctx;
  414. __entry->card_index = ctx->card->index;
  415. __entry->channel = channel;
  416. __entry->scode = scode;
  417. ),
  418. TP_printk(
  419. "context=0x%llx card_index=%u channel=%u scode=%u",
  420. __entry->context,
  421. __entry->card_index,
  422. __entry->channel,
  423. __entry->scode
  424. )
  425. );
  426. TRACE_EVENT_CONDITION(isoc_inbound_single_allocate,
  427. TP_PROTO(const struct fw_iso_context *ctx, unsigned int channel, unsigned int header_size),
  428. TP_ARGS(ctx, channel, header_size),
  429. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE),
  430. TP_STRUCT__entry(
  431. __field(u64, context)
  432. __field(u8, card_index)
  433. __field(u8, channel)
  434. __field(u8, header_size)
  435. ),
  436. TP_fast_assign(
  437. __entry->context = (uintptr_t)ctx;
  438. __entry->card_index = ctx->card->index;
  439. __entry->channel = channel;
  440. __entry->header_size = header_size;
  441. ),
  442. TP_printk(
  443. "context=0x%llx card_index=%u channel=%u header_size=%u",
  444. __entry->context,
  445. __entry->card_index,
  446. __entry->channel,
  447. __entry->header_size
  448. )
  449. );
  450. TRACE_EVENT_CONDITION(isoc_inbound_multiple_allocate,
  451. TP_PROTO(const struct fw_iso_context *ctx),
  452. TP_ARGS(ctx),
  453. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL),
  454. TP_STRUCT__entry(
  455. __field(u64, context)
  456. __field(u8, card_index)
  457. ),
  458. TP_fast_assign(
  459. __entry->context = (uintptr_t)ctx;
  460. __entry->card_index = ctx->card->index;
  461. ),
  462. TP_printk(
  463. "context=0x%llx card_index=%u",
  464. __entry->context,
  465. __entry->card_index
  466. )
  467. );
  468. DECLARE_EVENT_CLASS(isoc_destroy_template,
  469. TP_PROTO(const struct fw_iso_context *ctx),
  470. TP_ARGS(ctx),
  471. TP_STRUCT__entry(
  472. __field(u64, context)
  473. __field(u8, card_index)
  474. ),
  475. TP_fast_assign(
  476. __entry->context = (uintptr_t)ctx;
  477. __entry->card_index = ctx->card->index;
  478. ),
  479. TP_printk(
  480. "context=0x%llx card_index=%u",
  481. __entry->context,
  482. __entry->card_index
  483. )
  484. )
  485. DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_outbound_destroy,
  486. TP_PROTO(const struct fw_iso_context *ctx),
  487. TP_ARGS(ctx),
  488. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
  489. );
  490. DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_single_destroy,
  491. TP_PROTO(const struct fw_iso_context *ctx),
  492. TP_ARGS(ctx),
  493. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
  494. );
  495. DEFINE_EVENT_CONDITION(isoc_destroy_template, isoc_inbound_multiple_destroy,
  496. TP_PROTO(const struct fw_iso_context *ctx),
  497. TP_ARGS(ctx),
  498. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
  499. );
  500. TRACE_EVENT(isoc_inbound_multiple_channels,
  501. TP_PROTO(const struct fw_iso_context *ctx, u64 channels),
  502. TP_ARGS(ctx, channels),
  503. TP_STRUCT__entry(
  504. __field(u64, context)
  505. __field(u8, card_index)
  506. __field(u64, channels)
  507. ),
  508. TP_fast_assign(
  509. __entry->context = (uintptr_t)ctx;
  510. __entry->card_index = ctx->card->index;
  511. __entry->channels = channels;
  512. ),
  513. TP_printk(
  514. "context=0x%llx card_index=%u channels=0x%016llx",
  515. __entry->context,
  516. __entry->card_index,
  517. __entry->channels
  518. )
  519. );
  520. TRACE_EVENT_CONDITION(isoc_outbound_start,
  521. TP_PROTO(const struct fw_iso_context *ctx, int cycle_match),
  522. TP_ARGS(ctx, cycle_match),
  523. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT),
  524. TP_STRUCT__entry(
  525. __field(u64, context)
  526. __field(u8, card_index)
  527. __field(bool, cycle_match)
  528. __field(u16, cycle)
  529. ),
  530. TP_fast_assign(
  531. __entry->context = (uintptr_t)ctx;
  532. __entry->card_index = ctx->card->index;
  533. __entry->cycle_match = cycle_match < 0 ? false : true;
  534. __entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0;
  535. ),
  536. TP_printk(
  537. "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x",
  538. __entry->context,
  539. __entry->card_index,
  540. __entry->cycle_match ? "true" : "false",
  541. __entry->cycle
  542. )
  543. );
  544. DECLARE_EVENT_CLASS(isoc_inbound_start_template,
  545. TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags),
  546. TP_ARGS(ctx, cycle_match, sync, tags),
  547. TP_STRUCT__entry(
  548. __field(u64, context)
  549. __field(u8, card_index)
  550. __field(bool, cycle_match)
  551. __field(u16, cycle)
  552. __field(u8, sync)
  553. __field(u8, tags)
  554. ),
  555. TP_fast_assign(
  556. __entry->context = (uintptr_t)ctx;
  557. __entry->card_index = ctx->card->index;
  558. __entry->cycle_match = cycle_match < 0 ? false : true;
  559. __entry->cycle = __entry->cycle_match ? (u16)cycle_match : 0;
  560. __entry->sync = sync;
  561. __entry->tags = tags;
  562. ),
  563. TP_printk(
  564. "context=0x%llx card_index=%u cycle_match=%s cycle=0x%04x sync=%u tags=%s",
  565. __entry->context,
  566. __entry->card_index,
  567. __entry->cycle_match ? "true" : "false",
  568. __entry->cycle,
  569. __entry->sync,
  570. __print_flags(__entry->tags, "|",
  571. { FW_ISO_CONTEXT_MATCH_TAG0, "0" },
  572. { FW_ISO_CONTEXT_MATCH_TAG1, "1" },
  573. { FW_ISO_CONTEXT_MATCH_TAG2, "2" },
  574. { FW_ISO_CONTEXT_MATCH_TAG3, "3" }
  575. )
  576. )
  577. );
  578. DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_single_start,
  579. TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags),
  580. TP_ARGS(ctx, cycle_match, sync, tags),
  581. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
  582. );
  583. DEFINE_EVENT_CONDITION(isoc_inbound_start_template, isoc_inbound_multiple_start,
  584. TP_PROTO(const struct fw_iso_context *ctx, int cycle_match, unsigned int sync, unsigned int tags),
  585. TP_ARGS(ctx, cycle_match, sync, tags),
  586. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
  587. );
  588. DECLARE_EVENT_CLASS(isoc_stop_template,
  589. TP_PROTO(const struct fw_iso_context *ctx),
  590. TP_ARGS(ctx),
  591. TP_STRUCT__entry(
  592. __field(u64, context)
  593. __field(u8, card_index)
  594. ),
  595. TP_fast_assign(
  596. __entry->context = (uintptr_t)ctx;
  597. __entry->card_index = ctx->card->index;
  598. ),
  599. TP_printk(
  600. "context=0x%llx card_index=%u",
  601. __entry->context,
  602. __entry->card_index
  603. )
  604. )
  605. DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_outbound_stop,
  606. TP_PROTO(const struct fw_iso_context *ctx),
  607. TP_ARGS(ctx),
  608. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
  609. );
  610. DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_single_stop,
  611. TP_PROTO(const struct fw_iso_context *ctx),
  612. TP_ARGS(ctx),
  613. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
  614. );
  615. DEFINE_EVENT_CONDITION(isoc_stop_template, isoc_inbound_multiple_stop,
  616. TP_PROTO(const struct fw_iso_context *ctx),
  617. TP_ARGS(ctx),
  618. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
  619. );
  620. DECLARE_EVENT_CLASS(isoc_flush_template,
  621. TP_PROTO(const struct fw_iso_context *ctx),
  622. TP_ARGS(ctx),
  623. TP_STRUCT__entry(
  624. __field(u64, context)
  625. __field(u8, card_index)
  626. ),
  627. TP_fast_assign(
  628. __entry->context = (uintptr_t)ctx;
  629. __entry->card_index = ctx->card->index;
  630. ),
  631. TP_printk(
  632. "context=0x%llx card_index=%u",
  633. __entry->context,
  634. __entry->card_index
  635. )
  636. );
  637. DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_outbound_flush,
  638. TP_PROTO(const struct fw_iso_context *ctx),
  639. TP_ARGS(ctx),
  640. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
  641. );
  642. DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_inbound_single_flush,
  643. TP_PROTO(const struct fw_iso_context *ctx),
  644. TP_ARGS(ctx),
  645. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
  646. );
  647. DEFINE_EVENT_CONDITION(isoc_flush_template, isoc_inbound_multiple_flush,
  648. TP_PROTO(const struct fw_iso_context *ctx),
  649. TP_ARGS(ctx),
  650. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
  651. );
  652. DECLARE_EVENT_CLASS(isoc_flush_completions_template,
  653. TP_PROTO(const struct fw_iso_context *ctx),
  654. TP_ARGS(ctx),
  655. TP_STRUCT__entry(
  656. __field(u64, context)
  657. __field(u8, card_index)
  658. ),
  659. TP_fast_assign(
  660. __entry->context = (uintptr_t)ctx;
  661. __entry->card_index = ctx->card->index;
  662. ),
  663. TP_printk(
  664. "context=0x%llx card_index=%u",
  665. __entry->context,
  666. __entry->card_index
  667. )
  668. );
  669. DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_outbound_flush_completions,
  670. TP_PROTO(const struct fw_iso_context *ctx),
  671. TP_ARGS(ctx),
  672. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
  673. );
  674. DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_single_flush_completions,
  675. TP_PROTO(const struct fw_iso_context *ctx),
  676. TP_ARGS(ctx),
  677. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
  678. );
  679. DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_multiple_flush_completions,
  680. TP_PROTO(const struct fw_iso_context *ctx),
  681. TP_ARGS(ctx),
  682. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
  683. );
  684. #define TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet) \
  685. TP_STRUCT__entry( \
  686. __field(u64, context) \
  687. __field(u8, card_index) \
  688. __field(u32, buffer_offset) \
  689. __field(bool, interrupt) \
  690. __field(bool, skip) \
  691. __field(u8, sy) \
  692. __field(u8, tag) \
  693. __dynamic_array(u32, header, packet->header_length / QUADLET_SIZE) \
  694. )
  695. #define TP_fast_assign_iso_packet(ctx, buffer_offset, packet) \
  696. TP_fast_assign( \
  697. __entry->context = (uintptr_t)ctx; \
  698. __entry->card_index = ctx->card->index; \
  699. __entry->buffer_offset = buffer_offset; \
  700. __entry->interrupt = packet->interrupt; \
  701. __entry->skip = packet->skip; \
  702. __entry->sy = packet->sy; \
  703. __entry->tag = packet->tag; \
  704. memcpy(__get_dynamic_array(header), packet->header, \
  705. __get_dynamic_array_len(header)); \
  706. )
  707. TRACE_EVENT_CONDITION(isoc_outbound_queue,
  708. TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet),
  709. TP_ARGS(ctx, buffer_offset, packet),
  710. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT),
  711. TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet),
  712. TP_fast_assign_iso_packet(ctx, buffer_offset, packet),
  713. TP_printk(
  714. "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s sy=%d tag=%u header=%s",
  715. __entry->context,
  716. __entry->card_index,
  717. __entry->buffer_offset,
  718. __entry->interrupt ? "true" : "false",
  719. __entry->skip ? "true" : "false",
  720. __entry->sy,
  721. __entry->tag,
  722. __print_array(__get_dynamic_array(header),
  723. __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE)
  724. )
  725. );
  726. TRACE_EVENT_CONDITION(isoc_inbound_single_queue,
  727. TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet),
  728. TP_ARGS(ctx, buffer_offset, packet),
  729. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE),
  730. TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet),
  731. TP_fast_assign_iso_packet(ctx, buffer_offset, packet),
  732. TP_printk(
  733. "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s",
  734. __entry->context,
  735. __entry->card_index,
  736. __entry->buffer_offset,
  737. __entry->interrupt ? "true" : "false",
  738. __entry->skip ? "true" : "false"
  739. )
  740. );
  741. TRACE_EVENT_CONDITION(isoc_inbound_multiple_queue,
  742. TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet),
  743. TP_ARGS(ctx, buffer_offset, packet),
  744. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL),
  745. TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet),
  746. TP_fast_assign_iso_packet(ctx, buffer_offset, packet),
  747. TP_printk(
  748. "context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s",
  749. __entry->context,
  750. __entry->card_index,
  751. __entry->buffer_offset,
  752. __entry->interrupt ? "true" : "false"
  753. )
  754. );
  755. #undef TP_STRUCT__entry_iso_packet
  756. #undef TP_fast_assign_iso_packet
  757. #ifndef show_cause
  758. enum fw_iso_context_completions_cause {
  759. FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH = 0,
  760. FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT,
  761. FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW,
  762. };
  763. #define show_cause(cause) \
  764. __print_symbolic(cause, \
  765. { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH, "FLUSH" }, \
  766. { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT, "INTERRUPT" }, \
  767. { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, "HEADER_OVERFLOW" } \
  768. )
  769. #endif
  770. DECLARE_EVENT_CLASS(isoc_single_completions_template,
  771. TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length),
  772. TP_ARGS(ctx, timestamp, cause, header, header_length),
  773. TP_STRUCT__entry(
  774. __field(u64, context)
  775. __field(u8, card_index)
  776. __field(u16, timestamp)
  777. __field(u8, cause)
  778. __dynamic_array(u32, header, header_length / QUADLET_SIZE)
  779. ),
  780. TP_fast_assign(
  781. __entry->context = (uintptr_t)ctx;
  782. __entry->card_index = ctx->card->index;
  783. __entry->timestamp = timestamp;
  784. __entry->cause = cause;
  785. memcpy(__get_dynamic_array(header), header, __get_dynamic_array_len(header));
  786. ),
  787. TP_printk(
  788. "context=0x%llx card_index=%u timestamp=0x%04x cause=%s header=%s",
  789. __entry->context,
  790. __entry->card_index,
  791. __entry->timestamp,
  792. show_cause(__entry->cause),
  793. __print_array(__get_dynamic_array(header),
  794. __get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE)
  795. )
  796. )
  797. DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_outbound_completions,
  798. TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length),
  799. TP_ARGS(ctx, timestamp, cause, header, header_length),
  800. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT)
  801. );
  802. DEFINE_EVENT_CONDITION(isoc_single_completions_template, isoc_inbound_single_completions,
  803. TP_PROTO(const struct fw_iso_context *ctx, u16 timestamp, enum fw_iso_context_completions_cause cause, const u32 *header, unsigned int header_length),
  804. TP_ARGS(ctx, timestamp, cause, header, header_length),
  805. TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE)
  806. );
  807. TRACE_EVENT(isoc_inbound_multiple_completions,
  808. TP_PROTO(const struct fw_iso_context *ctx, unsigned int completed, enum fw_iso_context_completions_cause cause),
  809. TP_ARGS(ctx, completed, cause),
  810. TP_STRUCT__entry(
  811. __field(u64, context)
  812. __field(u8, card_index)
  813. __field(u16, completed)
  814. __field(u8, cause)
  815. ),
  816. TP_fast_assign(
  817. __entry->context = (uintptr_t)ctx;
  818. __entry->card_index = ctx->card->index;
  819. __entry->completed = completed;
  820. __entry->cause = cause;
  821. ),
  822. TP_printk(
  823. "context=0x%llx card_index=%u completed=%u cause=%s",
  824. __entry->context,
  825. __entry->card_index,
  826. __entry->completed,
  827. show_cause(__entry->cause)
  828. )
  829. );
  830. #undef QUADLET_SIZE
  831. #endif // _FIREWIRE_TRACE_EVENT_H
  832. #include <trace/define_trace.h>