1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Trace points for SSAM/SSH. 4 * 5 * Copyright (C) 2020 Maximilian Luz <luzmaximilian@gmail.com> 6 */ 7 8 #undef TRACE_SYSTEM 9 #define TRACE_SYSTEM surface_aggregator 10 11 #if !defined(_SURFACE_AGGREGATOR_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 12 #define _SURFACE_AGGREGATOR_TRACE_H 13 14 #include <linux/surface_aggregator/serial_hub.h> 15 16 #include <asm/unaligned.h> 17 #include <linux/tracepoint.h> 18 19 TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_DATA_SEQ); 20 TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_DATA_NSQ); 21 TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_ACK); 22 TRACE_DEFINE_ENUM(SSH_FRAME_TYPE_NAK); 23 24 TRACE_DEFINE_ENUM(SSH_PACKET_SF_LOCKED_BIT); 25 TRACE_DEFINE_ENUM(SSH_PACKET_SF_QUEUED_BIT); 26 TRACE_DEFINE_ENUM(SSH_PACKET_SF_PENDING_BIT); 27 TRACE_DEFINE_ENUM(SSH_PACKET_SF_TRANSMITTING_BIT); 28 TRACE_DEFINE_ENUM(SSH_PACKET_SF_TRANSMITTED_BIT); 29 TRACE_DEFINE_ENUM(SSH_PACKET_SF_ACKED_BIT); 30 TRACE_DEFINE_ENUM(SSH_PACKET_SF_CANCELED_BIT); 31 TRACE_DEFINE_ENUM(SSH_PACKET_SF_COMPLETED_BIT); 32 33 TRACE_DEFINE_ENUM(SSH_PACKET_TY_FLUSH_BIT); 34 TRACE_DEFINE_ENUM(SSH_PACKET_TY_SEQUENCED_BIT); 35 TRACE_DEFINE_ENUM(SSH_PACKET_TY_BLOCKING_BIT); 36 37 TRACE_DEFINE_ENUM(SSH_PACKET_FLAGS_SF_MASK); 38 TRACE_DEFINE_ENUM(SSH_PACKET_FLAGS_TY_MASK); 39 40 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_LOCKED_BIT); 41 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_QUEUED_BIT); 42 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_PENDING_BIT); 43 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_TRANSMITTING_BIT); 44 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_TRANSMITTED_BIT); 45 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_RSPRCVD_BIT); 46 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_CANCELED_BIT); 47 TRACE_DEFINE_ENUM(SSH_REQUEST_SF_COMPLETED_BIT); 48 49 TRACE_DEFINE_ENUM(SSH_REQUEST_TY_FLUSH_BIT); 50 TRACE_DEFINE_ENUM(SSH_REQUEST_TY_HAS_RESPONSE_BIT); 51 52 TRACE_DEFINE_ENUM(SSH_REQUEST_FLAGS_SF_MASK); 53 TRACE_DEFINE_ENUM(SSH_REQUEST_FLAGS_TY_MASK); 54 55 TRACE_DEFINE_ENUM(SSAM_SSH_TC_SAM); 56 TRACE_DEFINE_ENUM(SSAM_SSH_TC_BAT); 57 TRACE_DEFINE_ENUM(SSAM_SSH_TC_TMP); 58 TRACE_DEFINE_ENUM(SSAM_SSH_TC_PMC); 59 TRACE_DEFINE_ENUM(SSAM_SSH_TC_FAN); 60 TRACE_DEFINE_ENUM(SSAM_SSH_TC_PoM); 61 TRACE_DEFINE_ENUM(SSAM_SSH_TC_DBG); 62 TRACE_DEFINE_ENUM(SSAM_SSH_TC_KBD); 63 TRACE_DEFINE_ENUM(SSAM_SSH_TC_FWU); 64 TRACE_DEFINE_ENUM(SSAM_SSH_TC_UNI); 65 TRACE_DEFINE_ENUM(SSAM_SSH_TC_LPC); 66 TRACE_DEFINE_ENUM(SSAM_SSH_TC_TCL); 67 TRACE_DEFINE_ENUM(SSAM_SSH_TC_SFL); 68 TRACE_DEFINE_ENUM(SSAM_SSH_TC_KIP); 69 TRACE_DEFINE_ENUM(SSAM_SSH_TC_EXT); 70 TRACE_DEFINE_ENUM(SSAM_SSH_TC_BLD); 71 TRACE_DEFINE_ENUM(SSAM_SSH_TC_BAS); 72 TRACE_DEFINE_ENUM(SSAM_SSH_TC_SEN); 73 TRACE_DEFINE_ENUM(SSAM_SSH_TC_SRQ); 74 TRACE_DEFINE_ENUM(SSAM_SSH_TC_MCU); 75 TRACE_DEFINE_ENUM(SSAM_SSH_TC_HID); 76 TRACE_DEFINE_ENUM(SSAM_SSH_TC_TCH); 77 TRACE_DEFINE_ENUM(SSAM_SSH_TC_BKL); 78 TRACE_DEFINE_ENUM(SSAM_SSH_TC_TAM); 79 TRACE_DEFINE_ENUM(SSAM_SSH_TC_ACC); 80 TRACE_DEFINE_ENUM(SSAM_SSH_TC_UFI); 81 TRACE_DEFINE_ENUM(SSAM_SSH_TC_USC); 82 TRACE_DEFINE_ENUM(SSAM_SSH_TC_PEN); 83 TRACE_DEFINE_ENUM(SSAM_SSH_TC_VID); 84 TRACE_DEFINE_ENUM(SSAM_SSH_TC_AUD); 85 TRACE_DEFINE_ENUM(SSAM_SSH_TC_SMC); 86 TRACE_DEFINE_ENUM(SSAM_SSH_TC_KPD); 87 TRACE_DEFINE_ENUM(SSAM_SSH_TC_REG); 88 89 #define SSAM_PTR_UID_LEN 9 90 #define SSAM_U8_FIELD_NOT_APPLICABLE ((u16)-1) 91 #define SSAM_SEQ_NOT_APPLICABLE ((u16)-1) 92 #define SSAM_RQID_NOT_APPLICABLE ((u32)-1) 93 #define SSAM_SSH_TC_NOT_APPLICABLE 0 94 95 #ifndef _SURFACE_AGGREGATOR_TRACE_HELPERS 96 #define _SURFACE_AGGREGATOR_TRACE_HELPERS 97 98 /** 99 * ssam_trace_ptr_uid() - Convert the pointer to a non-pointer UID string. 100 * @ptr: The pointer to convert. 101 * @uid_str: A buffer of length SSAM_PTR_UID_LEN where the UID will be stored. 102 * 103 * Converts the given pointer into a UID string that is safe to be shared 104 * with userspace and logs, i.e. doesn't give away the real memory location. 105 */ 106 static inline void ssam_trace_ptr_uid(const void *ptr, char *uid_str) 107 { 108 char buf[2 * sizeof(void *) + 1]; 109 110 BUILD_BUG_ON(ARRAY_SIZE(buf) < SSAM_PTR_UID_LEN); 111 112 snprintf(buf, ARRAY_SIZE(buf), "%p", ptr); 113 memcpy(uid_str, &buf[ARRAY_SIZE(buf) - SSAM_PTR_UID_LEN], 114 SSAM_PTR_UID_LEN); 115 } 116 117 /** 118 * ssam_trace_get_packet_seq() - Read the packet's sequence ID. 119 * @p: The packet. 120 * 121 * Return: Returns the packet's sequence ID (SEQ) field if present, or 122 * %SSAM_SEQ_NOT_APPLICABLE if not (e.g. flush packet). 123 */ 124 static inline u16 ssam_trace_get_packet_seq(const struct ssh_packet *p) 125 { 126 if (!p->data.ptr || p->data.len < SSH_MESSAGE_LENGTH(0)) 127 return SSAM_SEQ_NOT_APPLICABLE; 128 129 return p->data.ptr[SSH_MSGOFFSET_FRAME(seq)]; 130 } 131 132 /** 133 * ssam_trace_get_request_id() - Read the packet's request ID. 134 * @p: The packet. 135 * 136 * Return: Returns the packet's request ID (RQID) field if the packet 137 * represents a request with command data, or %SSAM_RQID_NOT_APPLICABLE if not 138 * (e.g. flush request, control packet). 139 */ 140 static inline u32 ssam_trace_get_request_id(const struct ssh_packet *p) 141 { 142 if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) 143 return SSAM_RQID_NOT_APPLICABLE; 144 145 return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(rqid)]); 146 } 147 148 /** 149 * ssam_trace_get_request_tc() - Read the packet's request target category. 150 * @p: The packet. 151 * 152 * Return: Returns the packet's request target category (TC) field if the 153 * packet represents a request with command data, or %SSAM_TC_NOT_APPLICABLE 154 * if not (e.g. flush request, control packet). 155 */ 156 static inline u32 ssam_trace_get_request_tc(const struct ssh_packet *p) 157 { 158 if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) 159 return SSAM_SSH_TC_NOT_APPLICABLE; 160 161 return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(tc)]); 162 } 163 164 #endif /* _SURFACE_AGGREGATOR_TRACE_HELPERS */ 165 166 #define ssam_trace_get_command_field_u8(packet, field) \ 167 ((!(packet) || (packet)->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) \ 168 ? 0 : (packet)->data.ptr[SSH_MSGOFFSET_COMMAND(field)]) 169 170 #define ssam_show_generic_u8_field(value) \ 171 __print_symbolic(value, \ 172 { SSAM_U8_FIELD_NOT_APPLICABLE, "N/A" } \ 173 ) 174 175 #define ssam_show_frame_type(ty) \ 176 __print_symbolic(ty, \ 177 { SSH_FRAME_TYPE_DATA_SEQ, "DSEQ" }, \ 178 { SSH_FRAME_TYPE_DATA_NSQ, "DNSQ" }, \ 179 { SSH_FRAME_TYPE_ACK, "ACK" }, \ 180 { SSH_FRAME_TYPE_NAK, "NAK" } \ 181 ) 182 183 #define ssam_show_packet_type(type) \ 184 __print_flags(flags & SSH_PACKET_FLAGS_TY_MASK, "", \ 185 { BIT(SSH_PACKET_TY_FLUSH_BIT), "F" }, \ 186 { BIT(SSH_PACKET_TY_SEQUENCED_BIT), "S" }, \ 187 { BIT(SSH_PACKET_TY_BLOCKING_BIT), "B" } \ 188 ) 189 190 #define ssam_show_packet_state(state) \ 191 __print_flags(flags & SSH_PACKET_FLAGS_SF_MASK, "", \ 192 { BIT(SSH_PACKET_SF_LOCKED_BIT), "L" }, \ 193 { BIT(SSH_PACKET_SF_QUEUED_BIT), "Q" }, \ 194 { BIT(SSH_PACKET_SF_PENDING_BIT), "P" }, \ 195 { BIT(SSH_PACKET_SF_TRANSMITTING_BIT), "S" }, \ 196 { BIT(SSH_PACKET_SF_TRANSMITTED_BIT), "T" }, \ 197 { BIT(SSH_PACKET_SF_ACKED_BIT), "A" }, \ 198 { BIT(SSH_PACKET_SF_CANCELED_BIT), "C" }, \ 199 { BIT(SSH_PACKET_SF_COMPLETED_BIT), "F" } \ 200 ) 201 202 #define ssam_show_packet_seq(seq) \ 203 __print_symbolic(seq, \ 204 { SSAM_SEQ_NOT_APPLICABLE, "N/A" } \ 205 ) 206 207 #define ssam_show_request_type(flags) \ 208 __print_flags((flags) & SSH_REQUEST_FLAGS_TY_MASK, "", \ 209 { BIT(SSH_REQUEST_TY_FLUSH_BIT), "F" }, \ 210 { BIT(SSH_REQUEST_TY_HAS_RESPONSE_BIT), "R" } \ 211 ) 212 213 #define ssam_show_request_state(flags) \ 214 __print_flags((flags) & SSH_REQUEST_FLAGS_SF_MASK, "", \ 215 { BIT(SSH_REQUEST_SF_LOCKED_BIT), "L" }, \ 216 { BIT(SSH_REQUEST_SF_QUEUED_BIT), "Q" }, \ 217 { BIT(SSH_REQUEST_SF_PENDING_BIT), "P" }, \ 218 { BIT(SSH_REQUEST_SF_TRANSMITTING_BIT), "S" }, \ 219 { BIT(SSH_REQUEST_SF_TRANSMITTED_BIT), "T" }, \ 220 { BIT(SSH_REQUEST_SF_RSPRCVD_BIT), "A" }, \ 221 { BIT(SSH_REQUEST_SF_CANCELED_BIT), "C" }, \ 222 { BIT(SSH_REQUEST_SF_COMPLETED_BIT), "F" } \ 223 ) 224 225 #define ssam_show_request_id(rqid) \ 226 __print_symbolic(rqid, \ 227 { SSAM_RQID_NOT_APPLICABLE, "N/A" } \ 228 ) 229 230 #define ssam_show_ssh_tc(rqid) \ 231 __print_symbolic(rqid, \ 232 { SSAM_SSH_TC_NOT_APPLICABLE, "N/A" }, \ 233 { SSAM_SSH_TC_SAM, "SAM" }, \ 234 { SSAM_SSH_TC_BAT, "BAT" }, \ 235 { SSAM_SSH_TC_TMP, "TMP" }, \ 236 { SSAM_SSH_TC_PMC, "PMC" }, \ 237 { SSAM_SSH_TC_FAN, "FAN" }, \ 238 { SSAM_SSH_TC_PoM, "PoM" }, \ 239 { SSAM_SSH_TC_DBG, "DBG" }, \ 240 { SSAM_SSH_TC_KBD, "KBD" }, \ 241 { SSAM_SSH_TC_FWU, "FWU" }, \ 242 { SSAM_SSH_TC_UNI, "UNI" }, \ 243 { SSAM_SSH_TC_LPC, "LPC" }, \ 244 { SSAM_SSH_TC_TCL, "TCL" }, \ 245 { SSAM_SSH_TC_SFL, "SFL" }, \ 246 { SSAM_SSH_TC_KIP, "KIP" }, \ 247 { SSAM_SSH_TC_EXT, "EXT" }, \ 248 { SSAM_SSH_TC_BLD, "BLD" }, \ 249 { SSAM_SSH_TC_BAS, "BAS" }, \ 250 { SSAM_SSH_TC_SEN, "SEN" }, \ 251 { SSAM_SSH_TC_SRQ, "SRQ" }, \ 252 { SSAM_SSH_TC_MCU, "MCU" }, \ 253 { SSAM_SSH_TC_HID, "HID" }, \ 254 { SSAM_SSH_TC_TCH, "TCH" }, \ 255 { SSAM_SSH_TC_BKL, "BKL" }, \ 256 { SSAM_SSH_TC_TAM, "TAM" }, \ 257 { SSAM_SSH_TC_ACC, "ACC" }, \ 258 { SSAM_SSH_TC_UFI, "UFI" }, \ 259 { SSAM_SSH_TC_USC, "USC" }, \ 260 { SSAM_SSH_TC_PEN, "PEN" }, \ 261 { SSAM_SSH_TC_VID, "VID" }, \ 262 { SSAM_SSH_TC_AUD, "AUD" }, \ 263 { SSAM_SSH_TC_SMC, "SMC" }, \ 264 { SSAM_SSH_TC_KPD, "KPD" }, \ 265 { SSAM_SSH_TC_REG, "REG" } \ 266 ) 267 268 DECLARE_EVENT_CLASS(ssam_frame_class, 269 TP_PROTO(const struct ssh_frame *frame), 270 271 TP_ARGS(frame), 272 273 TP_STRUCT__entry( 274 __field(u8, type) 275 __field(u8, seq) 276 __field(u16, len) 277 ), 278 279 TP_fast_assign( 280 __entry->type = frame->type; 281 __entry->seq = frame->seq; 282 __entry->len = get_unaligned_le16(&frame->len); 283 ), 284 285 TP_printk("ty=%s, seq=%#04x, len=%u", 286 ssam_show_frame_type(__entry->type), 287 __entry->seq, 288 __entry->len 289 ) 290 ); 291 292 #define DEFINE_SSAM_FRAME_EVENT(name) \ 293 DEFINE_EVENT(ssam_frame_class, ssam_##name, \ 294 TP_PROTO(const struct ssh_frame *frame), \ 295 TP_ARGS(frame) \ 296 ) 297 298 DECLARE_EVENT_CLASS(ssam_command_class, 299 TP_PROTO(const struct ssh_command *cmd, u16 len), 300 301 TP_ARGS(cmd, len), 302 303 TP_STRUCT__entry( 304 __field(u16, rqid) 305 __field(u16, len) 306 __field(u8, tc) 307 __field(u8, cid) 308 __field(u8, iid) 309 ), 310 311 TP_fast_assign( 312 __entry->rqid = get_unaligned_le16(&cmd->rqid); 313 __entry->tc = cmd->tc; 314 __entry->cid = cmd->cid; 315 __entry->iid = cmd->iid; 316 __entry->len = len; 317 ), 318 319 TP_printk("rqid=%#06x, tc=%s, cid=%#04x, iid=%#04x, len=%u", 320 __entry->rqid, 321 ssam_show_ssh_tc(__entry->tc), 322 __entry->cid, 323 __entry->iid, 324 __entry->len 325 ) 326 ); 327 328 #define DEFINE_SSAM_COMMAND_EVENT(name) \ 329 DEFINE_EVENT(ssam_command_class, ssam_##name, \ 330 TP_PROTO(const struct ssh_command *cmd, u16 len), \ 331 TP_ARGS(cmd, len) \ 332 ) 333 334 DECLARE_EVENT_CLASS(ssam_packet_class, 335 TP_PROTO(const struct ssh_packet *packet), 336 337 TP_ARGS(packet), 338 339 TP_STRUCT__entry( 340 __field(unsigned long, state) 341 __array(char, uid, SSAM_PTR_UID_LEN) 342 __field(u8, priority) 343 __field(u16, length) 344 __field(u16, seq) 345 ), 346 347 TP_fast_assign( 348 __entry->state = READ_ONCE(packet->state); 349 ssam_trace_ptr_uid(packet, __entry->uid); 350 __entry->priority = READ_ONCE(packet->priority); 351 __entry->length = packet->data.len; 352 __entry->seq = ssam_trace_get_packet_seq(packet); 353 ), 354 355 TP_printk("uid=%s, seq=%s, ty=%s, pri=%#04x, len=%u, sta=%s", 356 __entry->uid, 357 ssam_show_packet_seq(__entry->seq), 358 ssam_show_packet_type(__entry->state), 359 __entry->priority, 360 __entry->length, 361 ssam_show_packet_state(__entry->state) 362 ) 363 ); 364 365 #define DEFINE_SSAM_PACKET_EVENT(name) \ 366 DEFINE_EVENT(ssam_packet_class, ssam_##name, \ 367 TP_PROTO(const struct ssh_packet *packet), \ 368 TP_ARGS(packet) \ 369 ) 370 371 DECLARE_EVENT_CLASS(ssam_packet_status_class, 372 TP_PROTO(const struct ssh_packet *packet, int status), 373 374 TP_ARGS(packet, status), 375 376 TP_STRUCT__entry( 377 __field(unsigned long, state) 378 __field(int, status) 379 __array(char, uid, SSAM_PTR_UID_LEN) 380 __field(u8, priority) 381 __field(u16, length) 382 __field(u16, seq) 383 ), 384 385 TP_fast_assign( 386 __entry->state = READ_ONCE(packet->state); 387 __entry->status = status; 388 ssam_trace_ptr_uid(packet, __entry->uid); 389 __entry->priority = READ_ONCE(packet->priority); 390 __entry->length = packet->data.len; 391 __entry->seq = ssam_trace_get_packet_seq(packet); 392 ), 393 394 TP_printk("uid=%s, seq=%s, ty=%s, pri=%#04x, len=%u, sta=%s, status=%d", 395 __entry->uid, 396 ssam_show_packet_seq(__entry->seq), 397 ssam_show_packet_type(__entry->state), 398 __entry->priority, 399 __entry->length, 400 ssam_show_packet_state(__entry->state), 401 __entry->status 402 ) 403 ); 404 405 #define DEFINE_SSAM_PACKET_STATUS_EVENT(name) \ 406 DEFINE_EVENT(ssam_packet_status_class, ssam_##name, \ 407 TP_PROTO(const struct ssh_packet *packet, int status), \ 408 TP_ARGS(packet, status) \ 409 ) 410 411 DECLARE_EVENT_CLASS(ssam_request_class, 412 TP_PROTO(const struct ssh_request *request), 413 414 TP_ARGS(request), 415 416 TP_STRUCT__entry( 417 __field(unsigned long, state) 418 __field(u32, rqid) 419 __array(char, uid, SSAM_PTR_UID_LEN) 420 __field(u8, tc) 421 __field(u16, cid) 422 __field(u16, iid) 423 ), 424 425 TP_fast_assign( 426 const struct ssh_packet *p = &request->packet; 427 428 /* Use packet for UID so we can match requests to packets. */ 429 __entry->state = READ_ONCE(request->state); 430 __entry->rqid = ssam_trace_get_request_id(p); 431 ssam_trace_ptr_uid(p, __entry->uid); 432 __entry->tc = ssam_trace_get_request_tc(p); 433 __entry->cid = ssam_trace_get_command_field_u8(p, cid); 434 __entry->iid = ssam_trace_get_command_field_u8(p, iid); 435 ), 436 437 TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tc=%s, cid=%s, iid=%s", 438 __entry->uid, 439 ssam_show_request_id(__entry->rqid), 440 ssam_show_request_type(__entry->state), 441 ssam_show_request_state(__entry->state), 442 ssam_show_ssh_tc(__entry->tc), 443 ssam_show_generic_u8_field(__entry->cid), 444 ssam_show_generic_u8_field(__entry->iid) 445 ) 446 ); 447 448 #define DEFINE_SSAM_REQUEST_EVENT(name) \ 449 DEFINE_EVENT(ssam_request_class, ssam_##name, \ 450 TP_PROTO(const struct ssh_request *request), \ 451 TP_ARGS(request) \ 452 ) 453 454 DECLARE_EVENT_CLASS(ssam_request_status_class, 455 TP_PROTO(const struct ssh_request *request, int status), 456 457 TP_ARGS(request, status), 458 459 TP_STRUCT__entry( 460 __field(unsigned long, state) 461 __field(u32, rqid) 462 __field(int, status) 463 __array(char, uid, SSAM_PTR_UID_LEN) 464 __field(u8, tc) 465 __field(u16, cid) 466 __field(u16, iid) 467 ), 468 469 TP_fast_assign( 470 const struct ssh_packet *p = &request->packet; 471 472 /* Use packet for UID so we can match requests to packets. */ 473 __entry->state = READ_ONCE(request->state); 474 __entry->rqid = ssam_trace_get_request_id(p); 475 __entry->status = status; 476 ssam_trace_ptr_uid(p, __entry->uid); 477 __entry->tc = ssam_trace_get_request_tc(p); 478 __entry->cid = ssam_trace_get_command_field_u8(p, cid); 479 __entry->iid = ssam_trace_get_command_field_u8(p, iid); 480 ), 481 482 TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tc=%s, cid=%s, iid=%s, status=%d", 483 __entry->uid, 484 ssam_show_request_id(__entry->rqid), 485 ssam_show_request_type(__entry->state), 486 ssam_show_request_state(__entry->state), 487 ssam_show_ssh_tc(__entry->tc), 488 ssam_show_generic_u8_field(__entry->cid), 489 ssam_show_generic_u8_field(__entry->iid), 490 __entry->status 491 ) 492 ); 493 494 #define DEFINE_SSAM_REQUEST_STATUS_EVENT(name) \ 495 DEFINE_EVENT(ssam_request_status_class, ssam_##name, \ 496 TP_PROTO(const struct ssh_request *request, int status),\ 497 TP_ARGS(request, status) \ 498 ) 499 500 DECLARE_EVENT_CLASS(ssam_alloc_class, 501 TP_PROTO(void *ptr, size_t len), 502 503 TP_ARGS(ptr, len), 504 505 TP_STRUCT__entry( 506 __field(size_t, len) 507 __array(char, uid, SSAM_PTR_UID_LEN) 508 ), 509 510 TP_fast_assign( 511 __entry->len = len; 512 ssam_trace_ptr_uid(ptr, __entry->uid); 513 ), 514 515 TP_printk("uid=%s, len=%zu", __entry->uid, __entry->len) 516 ); 517 518 #define DEFINE_SSAM_ALLOC_EVENT(name) \ 519 DEFINE_EVENT(ssam_alloc_class, ssam_##name, \ 520 TP_PROTO(void *ptr, size_t len), \ 521 TP_ARGS(ptr, len) \ 522 ) 523 524 DECLARE_EVENT_CLASS(ssam_free_class, 525 TP_PROTO(void *ptr), 526 527 TP_ARGS(ptr), 528 529 TP_STRUCT__entry( 530 __array(char, uid, SSAM_PTR_UID_LEN) 531 ), 532 533 TP_fast_assign( 534 ssam_trace_ptr_uid(ptr, __entry->uid); 535 ), 536 537 TP_printk("uid=%s", __entry->uid) 538 ); 539 540 #define DEFINE_SSAM_FREE_EVENT(name) \ 541 DEFINE_EVENT(ssam_free_class, ssam_##name, \ 542 TP_PROTO(void *ptr), \ 543 TP_ARGS(ptr) \ 544 ) 545 546 DECLARE_EVENT_CLASS(ssam_pending_class, 547 TP_PROTO(unsigned int pending), 548 549 TP_ARGS(pending), 550 551 TP_STRUCT__entry( 552 __field(unsigned int, pending) 553 ), 554 555 TP_fast_assign( 556 __entry->pending = pending; 557 ), 558 559 TP_printk("pending=%u", __entry->pending) 560 ); 561 562 #define DEFINE_SSAM_PENDING_EVENT(name) \ 563 DEFINE_EVENT(ssam_pending_class, ssam_##name, \ 564 TP_PROTO(unsigned int pending), \ 565 TP_ARGS(pending) \ 566 ) 567 568 DECLARE_EVENT_CLASS(ssam_data_class, 569 TP_PROTO(size_t length), 570 571 TP_ARGS(length), 572 573 TP_STRUCT__entry( 574 __field(size_t, length) 575 ), 576 577 TP_fast_assign( 578 __entry->length = length; 579 ), 580 581 TP_printk("length=%zu", __entry->length) 582 ); 583 584 #define DEFINE_SSAM_DATA_EVENT(name) \ 585 DEFINE_EVENT(ssam_data_class, ssam_##name, \ 586 TP_PROTO(size_t length), \ 587 TP_ARGS(length) \ 588 ) 589 590 DEFINE_SSAM_FRAME_EVENT(rx_frame_received); 591 DEFINE_SSAM_COMMAND_EVENT(rx_response_received); 592 DEFINE_SSAM_COMMAND_EVENT(rx_event_received); 593 594 DEFINE_SSAM_PACKET_EVENT(packet_release); 595 DEFINE_SSAM_PACKET_EVENT(packet_submit); 596 DEFINE_SSAM_PACKET_EVENT(packet_resubmit); 597 DEFINE_SSAM_PACKET_EVENT(packet_timeout); 598 DEFINE_SSAM_PACKET_EVENT(packet_cancel); 599 DEFINE_SSAM_PACKET_STATUS_EVENT(packet_complete); 600 DEFINE_SSAM_PENDING_EVENT(ptl_timeout_reap); 601 602 DEFINE_SSAM_REQUEST_EVENT(request_submit); 603 DEFINE_SSAM_REQUEST_EVENT(request_timeout); 604 DEFINE_SSAM_REQUEST_EVENT(request_cancel); 605 DEFINE_SSAM_REQUEST_STATUS_EVENT(request_complete); 606 DEFINE_SSAM_PENDING_EVENT(rtl_timeout_reap); 607 608 DEFINE_SSAM_PACKET_EVENT(ei_tx_drop_ack_packet); 609 DEFINE_SSAM_PACKET_EVENT(ei_tx_drop_nak_packet); 610 DEFINE_SSAM_PACKET_EVENT(ei_tx_drop_dsq_packet); 611 DEFINE_SSAM_PACKET_STATUS_EVENT(ei_tx_fail_write); 612 DEFINE_SSAM_PACKET_EVENT(ei_tx_corrupt_data); 613 DEFINE_SSAM_DATA_EVENT(ei_rx_corrupt_syn); 614 DEFINE_SSAM_FRAME_EVENT(ei_rx_corrupt_data); 615 DEFINE_SSAM_REQUEST_EVENT(ei_rx_drop_response); 616 617 DEFINE_SSAM_ALLOC_EVENT(ctrl_packet_alloc); 618 DEFINE_SSAM_FREE_EVENT(ctrl_packet_free); 619 620 DEFINE_SSAM_ALLOC_EVENT(event_item_alloc); 621 DEFINE_SSAM_FREE_EVENT(event_item_free); 622 623 #endif /* _SURFACE_AGGREGATOR_TRACE_H */ 624 625 /* This part must be outside protection */ 626 #undef TRACE_INCLUDE_PATH 627 #undef TRACE_INCLUDE_FILE 628 629 #define TRACE_INCLUDE_PATH . 630 #define TRACE_INCLUDE_FILE trace 631 632 #include <trace/define_trace.h> 633