mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			
		
			
				
	
	
		
			316 lines
		
	
	
		
			8.8 KiB
		
	
	
	
		
			Diff
		
	
	
			
		
		
	
	
			316 lines
		
	
	
		
			8.8 KiB
		
	
	
	
		
			Diff
		
	
	
| --- linux-4.9.37/drivers/usb/dwc3/trace.h	2017-07-12 16:42:41.000000000 +0300
 | |
| +++ linux-4.9.y/drivers/usb/dwc3/trace.h	2021-06-07 13:01:34.000000000 +0300
 | |
| @@ -27,57 +27,53 @@
 | |
|  #include "core.h"
 | |
|  #include "debug.h"
 | |
|  
 | |
| -DECLARE_EVENT_CLASS(dwc3_log_msg,
 | |
| -	TP_PROTO(struct va_format *vaf),
 | |
| -	TP_ARGS(vaf),
 | |
| -	TP_STRUCT__entry(__dynamic_array(char, msg, DWC3_MSG_MAX)),
 | |
| +DECLARE_EVENT_CLASS(dwc3_log_io,
 | |
| +	TP_PROTO(void *base, u32 offset, u32 value),
 | |
| +	TP_ARGS(base, offset, value),
 | |
| +	TP_STRUCT__entry(
 | |
| +		__field(void *, base)
 | |
| +		__field(u32, offset)
 | |
| +		__field(u32, value)
 | |
| +	),
 | |
|  	TP_fast_assign(
 | |
| -		vsnprintf(__get_str(msg), DWC3_MSG_MAX, vaf->fmt, *vaf->va);
 | |
| +		__entry->base = base;
 | |
| +		__entry->offset = offset;
 | |
| +		__entry->value = value;
 | |
|  	),
 | |
| -	TP_printk("%s", __get_str(msg))
 | |
| -);
 | |
| -
 | |
| -DEFINE_EVENT(dwc3_log_msg, dwc3_readl,
 | |
| -	TP_PROTO(struct va_format *vaf),
 | |
| -	TP_ARGS(vaf)
 | |
| -);
 | |
| -
 | |
| -DEFINE_EVENT(dwc3_log_msg, dwc3_writel,
 | |
| -	TP_PROTO(struct va_format *vaf),
 | |
| -	TP_ARGS(vaf)
 | |
| -);
 | |
| -
 | |
| -DEFINE_EVENT(dwc3_log_msg, dwc3_gadget,
 | |
| -	TP_PROTO(struct va_format *vaf),
 | |
| -	TP_ARGS(vaf)
 | |
| +	TP_printk("addr %p value %08x", __entry->base + __entry->offset,
 | |
| +			__entry->value)
 | |
|  );
 | |
|  
 | |
| -DEFINE_EVENT(dwc3_log_msg, dwc3_core,
 | |
| -	TP_PROTO(struct va_format *vaf),
 | |
| -	TP_ARGS(vaf)
 | |
| +DEFINE_EVENT(dwc3_log_io, dwc3_readl,
 | |
| +	TP_PROTO(void *base, u32 offset, u32 value),
 | |
| +	TP_ARGS(base, offset, value)
 | |
|  );
 | |
|  
 | |
| -DEFINE_EVENT(dwc3_log_msg, dwc3_ep0,
 | |
| -	TP_PROTO(struct va_format *vaf),
 | |
| -	TP_ARGS(vaf)
 | |
| +DEFINE_EVENT(dwc3_log_io, dwc3_writel,
 | |
| +	TP_PROTO(void *base, u32 offset, u32 value),
 | |
| +	TP_ARGS(base, offset, value)
 | |
|  );
 | |
|  
 | |
|  DECLARE_EVENT_CLASS(dwc3_log_event,
 | |
| -	TP_PROTO(u32 event),
 | |
| -	TP_ARGS(event),
 | |
| +	TP_PROTO(u32 event, struct dwc3 *dwc),
 | |
| +	TP_ARGS(event, dwc),
 | |
|  	TP_STRUCT__entry(
 | |
|  		__field(u32, event)
 | |
| +		__field(u32, ep0state)
 | |
| +		__dynamic_array(char, str, DWC3_MSG_MAX)
 | |
|  	),
 | |
|  	TP_fast_assign(
 | |
|  		__entry->event = event;
 | |
| +		__entry->ep0state = dwc->ep0state;
 | |
|  	),
 | |
|  	TP_printk("event (%08x): %s", __entry->event,
 | |
| -			dwc3_decode_event(__entry->event))
 | |
| +			dwc3_decode_event(__get_str(str), DWC3_MSG_MAX,
 | |
| +					__entry->event, __entry->ep0state))
 | |
|  );
 | |
|  
 | |
|  DEFINE_EVENT(dwc3_log_event, dwc3_event,
 | |
| -	TP_PROTO(u32 event),
 | |
| -	TP_ARGS(event)
 | |
| +	TP_PROTO(u32 event, struct dwc3 *dwc),
 | |
| +	TP_ARGS(event, dwc)
 | |
|  );
 | |
|  
 | |
|  DECLARE_EVENT_CLASS(dwc3_log_ctrl,
 | |
| @@ -89,6 +85,7 @@
 | |
|  		__field(__u16, wValue)
 | |
|  		__field(__u16, wIndex)
 | |
|  		__field(__u16, wLength)
 | |
| +		__dynamic_array(char, str, DWC3_MSG_MAX)
 | |
|  	),
 | |
|  	TP_fast_assign(
 | |
|  		__entry->bRequestType = ctrl->bRequestType;
 | |
| @@ -97,10 +94,10 @@
 | |
|  		__entry->wIndex = le16_to_cpu(ctrl->wIndex);
 | |
|  		__entry->wLength = le16_to_cpu(ctrl->wLength);
 | |
|  	),
 | |
| -	TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
 | |
| -		__entry->bRequestType, __entry->bRequest,
 | |
| -		__entry->wValue, __entry->wIndex,
 | |
| -		__entry->wLength
 | |
| +	TP_printk("%s", dwc3_decode_ctrl(__get_str(str), DWC3_MSG_MAX,
 | |
| +					__entry->bRequestType,
 | |
| +					__entry->bRequest, __entry->wValue,
 | |
| +					__entry->wIndex, __entry->wLength)
 | |
|  	)
 | |
|  );
 | |
|  
 | |
| @@ -113,7 +110,7 @@
 | |
|  	TP_PROTO(struct dwc3_request *req),
 | |
|  	TP_ARGS(req),
 | |
|  	TP_STRUCT__entry(
 | |
| -		__dynamic_array(char, name, DWC3_MSG_MAX)
 | |
| +		__string(name, req->dep->name)
 | |
|  		__field(struct dwc3_request *, req)
 | |
|  		__field(unsigned, actual)
 | |
|  		__field(unsigned, length)
 | |
| @@ -123,7 +120,7 @@
 | |
|  		__field(int, no_interrupt)
 | |
|  	),
 | |
|  	TP_fast_assign(
 | |
| -		snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name);
 | |
| +		__assign_str(name, req->dep->name);
 | |
|  		__entry->req = req;
 | |
|  		__entry->actual = req->request.actual;
 | |
|  		__entry->length = req->request.length;
 | |
| @@ -179,7 +176,7 @@
 | |
|  		__entry->param = param;
 | |
|  		__entry->status = status;
 | |
|  	),
 | |
| -	TP_printk("cmd '%s' [%d] param %08x --> status: %s",
 | |
| +	TP_printk("cmd '%s' [%x] param %08x --> status: %s",
 | |
|  		dwc3_gadget_generic_cmd_string(__entry->cmd),
 | |
|  		__entry->cmd, __entry->param,
 | |
|  		dwc3_gadget_generic_cmd_status_string(__entry->status)
 | |
| @@ -196,7 +193,7 @@
 | |
|  		struct dwc3_gadget_ep_cmd_params *params, int cmd_status),
 | |
|  	TP_ARGS(dep, cmd, params, cmd_status),
 | |
|  	TP_STRUCT__entry(
 | |
| -		__dynamic_array(char, name, DWC3_MSG_MAX)
 | |
| +		__string(name, dep->name)
 | |
|  		__field(unsigned int, cmd)
 | |
|  		__field(u32, param0)
 | |
|  		__field(u32, param1)
 | |
| @@ -204,14 +201,14 @@
 | |
|  		__field(int, cmd_status)
 | |
|  	),
 | |
|  	TP_fast_assign(
 | |
| -		snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
 | |
| +		__assign_str(name, dep->name);
 | |
|  		__entry->cmd = cmd;
 | |
|  		__entry->param0 = params->param0;
 | |
|  		__entry->param1 = params->param1;
 | |
|  		__entry->param2 = params->param2;
 | |
|  		__entry->cmd_status = cmd_status;
 | |
|  	),
 | |
| -	TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
 | |
| +	TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
 | |
|  		__get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
 | |
|  		__entry->cmd, __entry->param0,
 | |
|  		__entry->param1, __entry->param2,
 | |
| @@ -229,7 +226,7 @@
 | |
|  	TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
 | |
|  	TP_ARGS(dep, trb),
 | |
|  	TP_STRUCT__entry(
 | |
| -		__dynamic_array(char, name, DWC3_MSG_MAX)
 | |
| +		__string(name, dep->name)
 | |
|  		__field(struct dwc3_trb *, trb)
 | |
|  		__field(u32, allocated)
 | |
|  		__field(u32, queued)
 | |
| @@ -237,9 +234,10 @@
 | |
|  		__field(u32, bph)
 | |
|  		__field(u32, size)
 | |
|  		__field(u32, ctrl)
 | |
| +		__field(u32, type)
 | |
|  	),
 | |
|  	TP_fast_assign(
 | |
| -		snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
 | |
| +		__assign_str(name, dep->name);
 | |
|  		__entry->trb = trb;
 | |
|  		__entry->allocated = dep->allocated_requests;
 | |
|  		__entry->queued = dep->queued_requests;
 | |
| @@ -247,47 +245,40 @@
 | |
|  		__entry->bph = trb->bph;
 | |
|  		__entry->size = trb->size;
 | |
|  		__entry->ctrl = trb->ctrl;
 | |
| +		__entry->type = usb_endpoint_type(dep->endpoint.desc);
 | |
|  	),
 | |
| -	TP_printk("%s: %d/%d trb %p buf %08x%08x size %d ctrl %08x (%c%c%c%c:%c%c:%s)",
 | |
| +	TP_printk("%s: %d/%d trb %p buf %08x%08x size %s%d ctrl %08x (%c%c%c%c:%c%c:%s)",
 | |
|  		__get_str(name), __entry->queued, __entry->allocated,
 | |
|  		__entry->trb, __entry->bph, __entry->bpl,
 | |
| -		__entry->size, __entry->ctrl,
 | |
| +		({char *s;
 | |
| +		int pcm = ((__entry->size >> 24) & 3) + 1;
 | |
| +		switch (__entry->type) {
 | |
| +		case USB_ENDPOINT_XFER_INT:
 | |
| +		case USB_ENDPOINT_XFER_ISOC:
 | |
| +			switch (pcm) {
 | |
| +			case 1:
 | |
| +				s = "1x ";
 | |
| +				break;
 | |
| +			case 2:
 | |
| +				s = "2x ";
 | |
| +				break;
 | |
| +			case 3:
 | |
| +			default:
 | |
| +				s = "3x ";
 | |
| +				break;
 | |
| +			}
 | |
| +			break;
 | |
| +		default:
 | |
| +			s = "";
 | |
| +		} s; }),
 | |
| +		DWC3_TRB_SIZE_LENGTH(__entry->size), __entry->ctrl,
 | |
|  		__entry->ctrl & DWC3_TRB_CTRL_HWO ? 'H' : 'h',
 | |
|  		__entry->ctrl & DWC3_TRB_CTRL_LST ? 'L' : 'l',
 | |
|  		__entry->ctrl & DWC3_TRB_CTRL_CHN ? 'C' : 'c',
 | |
|  		__entry->ctrl & DWC3_TRB_CTRL_CSP ? 'S' : 's',
 | |
|  		__entry->ctrl & DWC3_TRB_CTRL_ISP_IMI ? 'S' : 's',
 | |
|  		__entry->ctrl & DWC3_TRB_CTRL_IOC ? 'C' : 'c',
 | |
| -		({char *s;
 | |
| -		switch (__entry->ctrl & 0x3f0) {
 | |
| -		case DWC3_TRBCTL_NORMAL:
 | |
| -			s = "normal";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_CONTROL_SETUP:
 | |
| -			s = "setup";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_CONTROL_STATUS2:
 | |
| -			s = "status2";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_CONTROL_STATUS3:
 | |
| -			s = "status3";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_CONTROL_DATA:
 | |
| -			s = "data";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_ISOCHRONOUS_FIRST:
 | |
| -			s = "isoc-first";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_ISOCHRONOUS:
 | |
| -			s = "isoc";
 | |
| -			break;
 | |
| -		case DWC3_TRBCTL_LINK_TRB:
 | |
| -			s = "link";
 | |
| -			break;
 | |
| -		default:
 | |
| -			s = "UNKNOWN";
 | |
| -			break;
 | |
| -		} s; })
 | |
| +		  dwc3_trb_type_string(DWC3_TRBCTL_TYPE(__entry->ctrl))
 | |
|  	)
 | |
|  );
 | |
|  
 | |
| @@ -301,6 +292,56 @@
 | |
|  	TP_ARGS(dep, trb)
 | |
|  );
 | |
|  
 | |
| +DECLARE_EVENT_CLASS(dwc3_log_ep,
 | |
| +	TP_PROTO(struct dwc3_ep *dep),
 | |
| +	TP_ARGS(dep),
 | |
| +	TP_STRUCT__entry(
 | |
| +		__string(name, dep->name)
 | |
| +		__field(unsigned, maxpacket)
 | |
| +		__field(unsigned, maxpacket_limit)
 | |
| +		__field(unsigned, max_streams)
 | |
| +		__field(unsigned, maxburst)
 | |
| +		__field(unsigned, flags)
 | |
| +		__field(unsigned, direction)
 | |
| +		__field(u8, trb_enqueue)
 | |
| +		__field(u8, trb_dequeue)
 | |
| +	),
 | |
| +	TP_fast_assign(
 | |
| +		__assign_str(name, dep->name);
 | |
| +		__entry->maxpacket = dep->endpoint.maxpacket;
 | |
| +		__entry->maxpacket_limit = dep->endpoint.maxpacket_limit;
 | |
| +		__entry->max_streams = dep->endpoint.max_streams;
 | |
| +		__entry->maxburst = dep->endpoint.maxburst;
 | |
| +		__entry->flags = dep->flags;
 | |
| +		__entry->direction = dep->direction;
 | |
| +		__entry->trb_enqueue = dep->trb_enqueue;
 | |
| +		__entry->trb_dequeue = dep->trb_dequeue;
 | |
| +	),
 | |
| +	TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c%c:%c",
 | |
| +		__get_str(name), __entry->maxpacket,
 | |
| +		__entry->maxpacket_limit, __entry->max_streams,
 | |
| +		__entry->maxburst, __entry->trb_enqueue,
 | |
| +		__entry->trb_dequeue,
 | |
| +		__entry->flags & DWC3_EP_ENABLED ? 'E' : 'e',
 | |
| +		__entry->flags & DWC3_EP_STALL ? 'S' : 's',
 | |
| +		__entry->flags & DWC3_EP_WEDGE ? 'W' : 'w',
 | |
| +		__entry->flags & DWC3_EP_BUSY ? 'B' : 'b',
 | |
| +		__entry->flags & DWC3_EP_PENDING_REQUEST ? 'P' : 'p',
 | |
| +		__entry->flags & DWC3_EP_MISSED_ISOC ? 'M' : 'm',
 | |
| +		__entry->direction ? '<' : '>'
 | |
| +	)
 | |
| +);
 | |
| +
 | |
| +DEFINE_EVENT(dwc3_log_ep, dwc3_gadget_ep_enable,
 | |
| +	TP_PROTO(struct dwc3_ep *dep),
 | |
| +	TP_ARGS(dep)
 | |
| +);
 | |
| +
 | |
| +DEFINE_EVENT(dwc3_log_ep, dwc3_gadget_ep_disable,
 | |
| +	TP_PROTO(struct dwc3_ep *dep),
 | |
| +	TP_ARGS(dep)
 | |
| +);
 | |
| +
 | |
|  #endif /* __DWC3_TRACE_H */
 | |
|  
 | |
|  /* this part has to be here */
 |