0001
0002
0003
0004
0005
0006
0007
0008 #undef TRACE_SYSTEM
0009 #define TRACE_SYSTEM greybus
0010
0011 #if !defined(_TRACE_GREYBUS_H) || defined(TRACE_HEADER_MULTI_READ)
0012 #define _TRACE_GREYBUS_H
0013
0014 #include <linux/tracepoint.h>
0015
0016 struct gb_message;
0017 struct gb_operation;
0018 struct gb_connection;
0019 struct gb_bundle;
0020 struct gb_host_device;
0021
0022 DECLARE_EVENT_CLASS(gb_message,
0023
0024 TP_PROTO(struct gb_message *message),
0025
0026 TP_ARGS(message),
0027
0028 TP_STRUCT__entry(
0029 __field(u16, size)
0030 __field(u16, operation_id)
0031 __field(u8, type)
0032 __field(u8, result)
0033 ),
0034
0035 TP_fast_assign(
0036 __entry->size = le16_to_cpu(message->header->size);
0037 __entry->operation_id =
0038 le16_to_cpu(message->header->operation_id);
0039 __entry->type = message->header->type;
0040 __entry->result = message->header->result;
0041 ),
0042
0043 TP_printk("size=%u operation_id=0x%04x type=0x%02x result=0x%02x",
0044 __entry->size, __entry->operation_id,
0045 __entry->type, __entry->result)
0046 );
0047
0048 #define DEFINE_MESSAGE_EVENT(name) \
0049 DEFINE_EVENT(gb_message, name, \
0050 TP_PROTO(struct gb_message *message), \
0051 TP_ARGS(message))
0052
0053
0054
0055
0056
0057 DEFINE_MESSAGE_EVENT(gb_message_send);
0058
0059
0060
0061
0062 DEFINE_MESSAGE_EVENT(gb_message_recv_request);
0063
0064
0065
0066
0067
0068 DEFINE_MESSAGE_EVENT(gb_message_recv_response);
0069
0070
0071
0072
0073
0074 DEFINE_MESSAGE_EVENT(gb_message_cancel_outgoing);
0075
0076
0077
0078
0079
0080 DEFINE_MESSAGE_EVENT(gb_message_cancel_incoming);
0081
0082
0083
0084
0085
0086 DEFINE_MESSAGE_EVENT(gb_message_submit);
0087
0088 #undef DEFINE_MESSAGE_EVENT
0089
0090 DECLARE_EVENT_CLASS(gb_operation,
0091
0092 TP_PROTO(struct gb_operation *operation),
0093
0094 TP_ARGS(operation),
0095
0096 TP_STRUCT__entry(
0097 __field(u16, cport_id)
0098 __field(u16, id)
0099 __field(u8, type)
0100 __field(unsigned long, flags)
0101 __field(int, active)
0102 __field(int, waiters)
0103 __field(int, errno)
0104 ),
0105
0106 TP_fast_assign(
0107 __entry->cport_id = operation->connection->hd_cport_id;
0108 __entry->id = operation->id;
0109 __entry->type = operation->type;
0110 __entry->flags = operation->flags;
0111 __entry->active = operation->active;
0112 __entry->waiters = atomic_read(&operation->waiters);
0113 __entry->errno = operation->errno;
0114 ),
0115
0116 TP_printk("id=%04x type=0x%02x cport_id=%04x flags=0x%lx active=%d waiters=%d errno=%d",
0117 __entry->id, __entry->cport_id, __entry->type, __entry->flags,
0118 __entry->active, __entry->waiters, __entry->errno)
0119 );
0120
0121 #define DEFINE_OPERATION_EVENT(name) \
0122 DEFINE_EVENT(gb_operation, name, \
0123 TP_PROTO(struct gb_operation *operation), \
0124 TP_ARGS(operation))
0125
0126
0127
0128
0129
0130 DEFINE_OPERATION_EVENT(gb_operation_create);
0131
0132
0133
0134
0135 DEFINE_OPERATION_EVENT(gb_operation_create_core);
0136
0137
0138
0139
0140
0141 DEFINE_OPERATION_EVENT(gb_operation_create_incoming);
0142
0143
0144
0145
0146
0147 DEFINE_OPERATION_EVENT(gb_operation_destroy);
0148
0149
0150
0151
0152
0153 DEFINE_OPERATION_EVENT(gb_operation_get_active);
0154
0155
0156
0157
0158
0159 DEFINE_OPERATION_EVENT(gb_operation_put_active);
0160
0161 #undef DEFINE_OPERATION_EVENT
0162
0163 DECLARE_EVENT_CLASS(gb_connection,
0164
0165 TP_PROTO(struct gb_connection *connection),
0166
0167 TP_ARGS(connection),
0168
0169 TP_STRUCT__entry(
0170 __field(int, hd_bus_id)
0171 __field(u8, bundle_id)
0172
0173 __dynamic_array(char, name, sizeof(connection->name))
0174 __field(enum gb_connection_state, state)
0175 __field(unsigned long, flags)
0176 ),
0177
0178 TP_fast_assign(
0179 __entry->hd_bus_id = connection->hd->bus_id;
0180 __entry->bundle_id = connection->bundle ?
0181 connection->bundle->id : BUNDLE_ID_NONE;
0182 memcpy(__get_str(name), connection->name,
0183 sizeof(connection->name));
0184 __entry->state = connection->state;
0185 __entry->flags = connection->flags;
0186 ),
0187
0188 TP_printk("hd_bus_id=%d bundle_id=0x%02x name=\"%s\" state=%u flags=0x%lx",
0189 __entry->hd_bus_id, __entry->bundle_id, __get_str(name),
0190 (unsigned int)__entry->state, __entry->flags)
0191 );
0192
0193 #define DEFINE_CONNECTION_EVENT(name) \
0194 DEFINE_EVENT(gb_connection, name, \
0195 TP_PROTO(struct gb_connection *connection), \
0196 TP_ARGS(connection))
0197
0198
0199
0200
0201 DEFINE_CONNECTION_EVENT(gb_connection_create);
0202
0203
0204
0205
0206
0207 DEFINE_CONNECTION_EVENT(gb_connection_release);
0208
0209
0210
0211
0212
0213 DEFINE_CONNECTION_EVENT(gb_connection_get);
0214
0215
0216
0217
0218
0219
0220 DEFINE_CONNECTION_EVENT(gb_connection_put);
0221
0222
0223
0224
0225
0226 DEFINE_CONNECTION_EVENT(gb_connection_enable);
0227
0228
0229
0230
0231
0232
0233 DEFINE_CONNECTION_EVENT(gb_connection_disable);
0234
0235 #undef DEFINE_CONNECTION_EVENT
0236
0237 DECLARE_EVENT_CLASS(gb_bundle,
0238
0239 TP_PROTO(struct gb_bundle *bundle),
0240
0241 TP_ARGS(bundle),
0242
0243 TP_STRUCT__entry(
0244 __field(u8, intf_id)
0245 __field(u8, id)
0246 __field(u8, class)
0247 __field(size_t, num_cports)
0248 ),
0249
0250 TP_fast_assign(
0251 __entry->intf_id = bundle->intf->interface_id;
0252 __entry->id = bundle->id;
0253 __entry->class = bundle->class;
0254 __entry->num_cports = bundle->num_cports;
0255 ),
0256
0257 TP_printk("intf_id=0x%02x id=%02x class=0x%02x num_cports=%zu",
0258 __entry->intf_id, __entry->id, __entry->class,
0259 __entry->num_cports)
0260 );
0261
0262 #define DEFINE_BUNDLE_EVENT(name) \
0263 DEFINE_EVENT(gb_bundle, name, \
0264 TP_PROTO(struct gb_bundle *bundle), \
0265 TP_ARGS(bundle))
0266
0267
0268
0269
0270 DEFINE_BUNDLE_EVENT(gb_bundle_create);
0271
0272
0273
0274
0275
0276 DEFINE_BUNDLE_EVENT(gb_bundle_release);
0277
0278
0279
0280
0281
0282 DEFINE_BUNDLE_EVENT(gb_bundle_add);
0283
0284
0285
0286
0287
0288 DEFINE_BUNDLE_EVENT(gb_bundle_destroy);
0289
0290 #undef DEFINE_BUNDLE_EVENT
0291
0292 DECLARE_EVENT_CLASS(gb_interface,
0293
0294 TP_PROTO(struct gb_interface *intf),
0295
0296 TP_ARGS(intf),
0297
0298 TP_STRUCT__entry(
0299 __field(u8, module_id)
0300 __field(u8, id)
0301 __field(u8, device_id)
0302 __field(int, disconnected)
0303 __field(int, ejected)
0304 __field(int, active)
0305 __field(int, enabled)
0306 __field(int, mode_switch)
0307 ),
0308
0309 TP_fast_assign(
0310 __entry->module_id = intf->module->module_id;
0311 __entry->id = intf->interface_id;
0312 __entry->device_id = intf->device_id;
0313 __entry->disconnected = intf->disconnected;
0314 __entry->ejected = intf->ejected;
0315 __entry->active = intf->active;
0316 __entry->enabled = intf->enabled;
0317 __entry->mode_switch = intf->mode_switch;
0318 ),
0319
0320 TP_printk("intf_id=%u device_id=%u module_id=%u D=%d J=%d A=%d E=%d M=%d",
0321 __entry->id, __entry->device_id, __entry->module_id,
0322 __entry->disconnected, __entry->ejected, __entry->active,
0323 __entry->enabled, __entry->mode_switch)
0324 );
0325
0326 #define DEFINE_INTERFACE_EVENT(name) \
0327 DEFINE_EVENT(gb_interface, name, \
0328 TP_PROTO(struct gb_interface *intf), \
0329 TP_ARGS(intf))
0330
0331
0332
0333
0334 DEFINE_INTERFACE_EVENT(gb_interface_create);
0335
0336
0337
0338
0339 DEFINE_INTERFACE_EVENT(gb_interface_release);
0340
0341
0342
0343
0344 DEFINE_INTERFACE_EVENT(gb_interface_add);
0345
0346
0347
0348
0349 DEFINE_INTERFACE_EVENT(gb_interface_del);
0350
0351
0352
0353
0354
0355 DEFINE_INTERFACE_EVENT(gb_interface_activate);
0356
0357
0358
0359
0360 DEFINE_INTERFACE_EVENT(gb_interface_deactivate);
0361
0362
0363
0364
0365 DEFINE_INTERFACE_EVENT(gb_interface_enable);
0366
0367
0368
0369
0370 DEFINE_INTERFACE_EVENT(gb_interface_disable);
0371
0372 #undef DEFINE_INTERFACE_EVENT
0373
0374 DECLARE_EVENT_CLASS(gb_module,
0375
0376 TP_PROTO(struct gb_module *module),
0377
0378 TP_ARGS(module),
0379
0380 TP_STRUCT__entry(
0381 __field(int, hd_bus_id)
0382 __field(u8, module_id)
0383 __field(size_t, num_interfaces)
0384 __field(int, disconnected)
0385 ),
0386
0387 TP_fast_assign(
0388 __entry->hd_bus_id = module->hd->bus_id;
0389 __entry->module_id = module->module_id;
0390 __entry->num_interfaces = module->num_interfaces;
0391 __entry->disconnected = module->disconnected;
0392 ),
0393
0394 TP_printk("hd_bus_id=%d module_id=%u num_interfaces=%zu disconnected=%d",
0395 __entry->hd_bus_id, __entry->module_id,
0396 __entry->num_interfaces, __entry->disconnected)
0397 );
0398
0399 #define DEFINE_MODULE_EVENT(name) \
0400 DEFINE_EVENT(gb_module, name, \
0401 TP_PROTO(struct gb_module *module), \
0402 TP_ARGS(module))
0403
0404
0405
0406
0407
0408 DEFINE_MODULE_EVENT(gb_module_create);
0409
0410
0411
0412
0413 DEFINE_MODULE_EVENT(gb_module_release);
0414
0415
0416
0417
0418
0419 DEFINE_MODULE_EVENT(gb_module_add);
0420
0421
0422
0423
0424
0425 DEFINE_MODULE_EVENT(gb_module_del);
0426
0427 #undef DEFINE_MODULE_EVENT
0428
0429 DECLARE_EVENT_CLASS(gb_host_device,
0430
0431 TP_PROTO(struct gb_host_device *hd),
0432
0433 TP_ARGS(hd),
0434
0435 TP_STRUCT__entry(
0436 __field(int, bus_id)
0437 __field(size_t, num_cports)
0438 __field(size_t, buffer_size_max)
0439 ),
0440
0441 TP_fast_assign(
0442 __entry->bus_id = hd->bus_id;
0443 __entry->num_cports = hd->num_cports;
0444 __entry->buffer_size_max = hd->buffer_size_max;
0445 ),
0446
0447 TP_printk("bus_id=%d num_cports=%zu mtu=%zu",
0448 __entry->bus_id, __entry->num_cports,
0449 __entry->buffer_size_max)
0450 );
0451
0452 #define DEFINE_HD_EVENT(name) \
0453 DEFINE_EVENT(gb_host_device, name, \
0454 TP_PROTO(struct gb_host_device *hd), \
0455 TP_ARGS(hd))
0456
0457
0458
0459
0460
0461 DEFINE_HD_EVENT(gb_hd_create);
0462
0463
0464
0465
0466
0467 DEFINE_HD_EVENT(gb_hd_release);
0468
0469
0470
0471
0472
0473 DEFINE_HD_EVENT(gb_hd_add);
0474
0475
0476
0477
0478
0479 DEFINE_HD_EVENT(gb_hd_del);
0480
0481
0482
0483
0484
0485
0486 DEFINE_HD_EVENT(gb_hd_in);
0487
0488 #undef DEFINE_HD_EVENT
0489
0490 #endif
0491
0492
0493 #undef TRACE_INCLUDE_PATH
0494 #define TRACE_INCLUDE_PATH .
0495
0496
0497
0498
0499 #undef TRACE_INCLUDE_FILE
0500 #define TRACE_INCLUDE_FILE greybus_trace
0501 #include <trace/define_trace.h>
0502