Pavankumar Kondeti | 38e508c | 2014-02-24 14:53:31 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #undef TRACE_SYSTEM |
| 15 | #define TRACE_SYSTEM ice40 |
| 16 | |
| 17 | #if !defined(_TRACE_ICE40_H) || defined(TRACE_HEADER_MULTI_READ) |
| 18 | #define _TRACE_ICE40_H |
| 19 | |
| 20 | #include <linux/tracepoint.h> |
| 21 | #include <linux/usb.h> |
| 22 | |
| 23 | TRACE_EVENT(ice40_reg_write, |
| 24 | |
| 25 | TP_PROTO(u8 addr, u8 val, u8 cmd0, u8 cmd1, int ret), |
| 26 | |
| 27 | TP_ARGS(addr, val, cmd0, cmd1, ret), |
| 28 | |
| 29 | TP_STRUCT__entry( |
| 30 | __field(u8, addr) |
| 31 | __field(u8, val) |
| 32 | __field(u8, cmd0) |
| 33 | __field(u8, cmd1) |
| 34 | __field(int, ret) |
| 35 | ), |
| 36 | |
| 37 | TP_fast_assign( |
| 38 | __entry->addr = addr; |
| 39 | __entry->val = val; |
| 40 | __entry->cmd0 = cmd0; |
| 41 | __entry->cmd1 = cmd1; |
| 42 | __entry->ret = ret; |
| 43 | ), |
| 44 | |
| 45 | TP_printk("addr = %x val = %x cmd0 = %x cmd1 = %x ret = %d", |
| 46 | __entry->addr, __entry->val, __entry->cmd0, |
| 47 | __entry->cmd1, __entry->ret) |
| 48 | ); |
| 49 | |
| 50 | TRACE_EVENT(ice40_reg_read, |
| 51 | |
| 52 | TP_PROTO(u8 addr, u8 cmd0, int ret), |
| 53 | |
| 54 | TP_ARGS(addr, cmd0, ret), |
| 55 | |
| 56 | TP_STRUCT__entry( |
| 57 | __field(u8, addr) |
| 58 | __field(u8, cmd0) |
| 59 | __field(int, ret) |
| 60 | ), |
| 61 | |
| 62 | TP_fast_assign( |
| 63 | __entry->addr = addr; |
| 64 | __entry->cmd0 = cmd0; |
| 65 | __entry->ret = ret; |
| 66 | ), |
| 67 | |
| 68 | TP_printk("addr = %x cmd0 = %x ret = %x", __entry->addr, |
| 69 | __entry->cmd0, __entry->ret) |
| 70 | ); |
| 71 | |
| 72 | TRACE_EVENT(ice40_hub_control, |
| 73 | |
| 74 | TP_PROTO(u16 req, u16 val, u16 index, u16 len, int ret), |
| 75 | |
| 76 | TP_ARGS(req, val, index, len, ret), |
| 77 | |
| 78 | TP_STRUCT__entry( |
| 79 | __field(u16, req) |
| 80 | __field(u16, val) |
| 81 | __field(u16, index) |
| 82 | __field(u16, len) |
| 83 | __field(int, ret) |
| 84 | ), |
| 85 | |
| 86 | TP_fast_assign( |
| 87 | __entry->req = req; |
| 88 | __entry->val = val; |
| 89 | __entry->index = index; |
| 90 | __entry->len = len; |
| 91 | __entry->ret = ret; |
| 92 | ), |
| 93 | |
| 94 | TP_printk("req = %x val = %x index = %x len = %x ret = %d", |
| 95 | __entry->req, __entry->val, __entry->index, |
| 96 | __entry->len, __entry->ret) |
| 97 | ); |
| 98 | |
| 99 | TRACE_EVENT(ice40_ep0, |
| 100 | |
| 101 | TP_PROTO(const char *state), |
| 102 | |
| 103 | TP_ARGS(state), |
| 104 | |
| 105 | TP_STRUCT__entry( |
| 106 | __string(state, state) |
| 107 | ), |
| 108 | |
| 109 | TP_fast_assign( |
| 110 | __assign_str(state, state); |
| 111 | ), |
| 112 | |
| 113 | TP_printk("ep0 state: %s", __get_str(state)) |
| 114 | ); |
| 115 | |
| 116 | TRACE_EVENT(ice40_urb_enqueue, |
| 117 | |
| 118 | TP_PROTO(struct urb *urb), |
| 119 | |
| 120 | TP_ARGS(urb), |
| 121 | |
| 122 | TP_STRUCT__entry( |
| 123 | __field(u16, epnum) |
| 124 | __field(u8, dir) |
| 125 | __field(u8, type) |
| 126 | __field(u32, len) |
| 127 | ), |
| 128 | |
| 129 | TP_fast_assign( |
| 130 | __entry->epnum = usb_pipeendpoint(urb->pipe); |
| 131 | __entry->dir = usb_urb_dir_in(urb); |
| 132 | __entry->type = usb_pipebulk(urb->pipe); |
| 133 | __entry->len = urb->transfer_buffer_length; |
| 134 | ), |
| 135 | |
| 136 | TP_printk("URB_LOG: E: ep %d %s %s len %d", __entry->epnum, |
| 137 | __entry->dir ? "In" : "Out", |
| 138 | __entry->type ? "Bulk" : "ctrl", |
| 139 | __entry->len) |
| 140 | ); |
| 141 | |
| 142 | TRACE_EVENT(ice40_urb_dequeue, |
| 143 | |
| 144 | TP_PROTO(struct urb *urb), |
| 145 | |
| 146 | TP_ARGS(urb), |
| 147 | |
| 148 | TP_STRUCT__entry( |
| 149 | __field(u16, epnum) |
| 150 | __field(u8, dir) |
| 151 | __field(u8, type) |
| 152 | __field(u32, len) |
| 153 | __field(int, reason) |
| 154 | ), |
| 155 | |
| 156 | TP_fast_assign( |
| 157 | __entry->epnum = usb_pipeendpoint(urb->pipe); |
| 158 | __entry->dir = usb_urb_dir_in(urb); |
| 159 | __entry->type = usb_pipebulk(urb->pipe); |
| 160 | __entry->len = urb->transfer_buffer_length; |
| 161 | __entry->reason = urb->unlinked; |
| 162 | ), |
| 163 | |
| 164 | TP_printk("URB_LOG: D: ep %d %s %s len %d reason %d", |
| 165 | __entry->epnum, |
| 166 | __entry->dir ? "In" : "Out", |
| 167 | __entry->type ? "Bulk" : "ctrl", |
| 168 | __entry->len, __entry->reason) |
| 169 | ); |
| 170 | |
| 171 | TRACE_EVENT(ice40_urb_done, |
| 172 | |
| 173 | TP_PROTO(struct urb *urb, int result), |
| 174 | |
| 175 | TP_ARGS(urb, result), |
| 176 | |
| 177 | TP_STRUCT__entry( |
| 178 | __field(int, result) |
| 179 | __field(u16, epnum) |
| 180 | __field(u8, dir) |
| 181 | __field(u8, type) |
| 182 | __field(u32, len) |
| 183 | __field(u32, actual) |
| 184 | ), |
| 185 | |
| 186 | TP_fast_assign( |
| 187 | __entry->result = result; |
| 188 | __entry->epnum = usb_pipeendpoint(urb->pipe); |
| 189 | __entry->dir = usb_urb_dir_in(urb); |
| 190 | __entry->type = usb_pipebulk(urb->pipe); |
| 191 | __entry->len = urb->transfer_buffer_length; |
| 192 | __entry->actual = urb->actual_length; |
| 193 | ), |
| 194 | |
| 195 | TP_printk("URB_LOG: C: ep %d %s %s len %d actual %d result %d", |
| 196 | __entry->epnum, __entry->dir ? "In" : "Out", |
| 197 | __entry->type ? "Bulk" : "ctrl", __entry->len, |
| 198 | __entry->actual, __entry->result) |
| 199 | ); |
| 200 | |
| 201 | TRACE_EVENT(ice40_bus_suspend, |
| 202 | |
| 203 | TP_PROTO(u8 status), |
| 204 | |
| 205 | TP_ARGS(status), |
| 206 | |
| 207 | TP_STRUCT__entry( |
| 208 | __field(u8, status) |
| 209 | ), |
| 210 | |
| 211 | TP_fast_assign( |
| 212 | __entry->status = status; |
| 213 | ), |
| 214 | |
| 215 | TP_printk("bus_suspend status %d", __entry->status) |
| 216 | ); |
| 217 | |
| 218 | TRACE_EVENT(ice40_bus_resume, |
| 219 | |
| 220 | TP_PROTO(u8 status), |
| 221 | |
| 222 | TP_ARGS(status), |
| 223 | |
| 224 | TP_STRUCT__entry( |
| 225 | __field(u8, status) |
| 226 | ), |
| 227 | |
| 228 | TP_fast_assign( |
| 229 | __entry->status = status; |
| 230 | ), |
| 231 | |
| 232 | TP_printk("bus_resume status %d", __entry->status) |
| 233 | ); |
| 234 | |
| 235 | TRACE_EVENT(ice40_setup, |
| 236 | |
| 237 | TP_PROTO(const char *token, int ret), |
| 238 | |
| 239 | TP_ARGS(token, ret), |
| 240 | |
| 241 | TP_STRUCT__entry( |
| 242 | __string(token, token) |
| 243 | __field(int, ret) |
| 244 | ), |
| 245 | |
| 246 | TP_fast_assign( |
| 247 | __assign_str(token, token); |
| 248 | __entry->ret = ret; |
| 249 | ), |
| 250 | |
| 251 | TP_printk("Trace: SETUP %s ret %d", |
| 252 | __get_str(token), __entry->ret) |
| 253 | ); |
| 254 | |
| 255 | TRACE_EVENT(ice40_in, |
| 256 | |
| 257 | TP_PROTO(u16 ep, const char *token, u8 len, u8 expected, int ret), |
| 258 | |
| 259 | TP_ARGS(ep, token, len, expected, ret), |
| 260 | |
| 261 | TP_STRUCT__entry( |
| 262 | __field(u16, ep) |
| 263 | __string(token, token) |
| 264 | __field(u8, len) |
| 265 | __field(u8, expected) |
| 266 | __field(int, ret) |
| 267 | ), |
| 268 | |
| 269 | TP_fast_assign( |
| 270 | __entry->ep = ep; |
| 271 | __assign_str(token, token); |
| 272 | __entry->len = len; |
| 273 | __entry->expected = expected; |
| 274 | __entry->ret = ret; |
| 275 | ), |
| 276 | |
| 277 | TP_printk("Trace: %d IN %s len %d expected %d ret %d", |
| 278 | __entry->ep, __get_str(token), |
| 279 | __entry->len, __entry->expected, |
| 280 | __entry->ret) |
| 281 | ); |
| 282 | |
| 283 | TRACE_EVENT(ice40_out, |
| 284 | |
| 285 | TP_PROTO(u16 ep, const char *token, u8 len, int ret), |
| 286 | |
| 287 | TP_ARGS(ep, token, len, ret), |
| 288 | |
| 289 | TP_STRUCT__entry( |
| 290 | __field(u16, ep) |
| 291 | __string(token, token) |
| 292 | __field(u8, len) |
| 293 | __field(int, ret) |
| 294 | ), |
| 295 | |
| 296 | TP_fast_assign( |
| 297 | __entry->ep = ep; |
| 298 | __assign_str(token, token); |
| 299 | __entry->len = len; |
| 300 | __entry->ret = ret; |
| 301 | ), |
| 302 | |
| 303 | TP_printk("Trace: %d OUT %s len %d ret %d", |
| 304 | __entry->ep, __get_str(token), |
| 305 | __entry->len, __entry->ret) |
| 306 | ); |
| 307 | #endif /* if !defined(_TRACE_ICE40_H) || defined(TRACE_HEADER_MULTI_READ) */ |
| 308 | |
| 309 | /* This part must be outside protection */ |
| 310 | #include <trace/define_trace.h> |