|  | @@ -2457,27 +2457,37 @@ static int xhci_endpoint_message ( struct usb_endpoint *ep,
 | 
		
	
		
			
			| 2457 | 2457 |   *
 | 
		
	
		
			
			| 2458 | 2458 |   * @v ep		USB endpoint
 | 
		
	
		
			
			| 2459 | 2459 |   * @v iobuf		I/O buffer
 | 
		
	
		
			
			|  | 2460 | + * @v terminate		Terminate using a short packet
 | 
		
	
		
			
			| 2460 | 2461 |   * @ret rc		Return status code
 | 
		
	
		
			
			| 2461 | 2462 |   */
 | 
		
	
		
			
			| 2462 | 2463 |  static int xhci_endpoint_stream ( struct usb_endpoint *ep,
 | 
		
	
		
			
			| 2463 |  | -				  struct io_buffer *iobuf ) {
 | 
		
	
		
			
			|  | 2464 | +				  struct io_buffer *iobuf, int terminate ) {
 | 
		
	
		
			
			| 2464 | 2465 |  	struct xhci_endpoint *endpoint = usb_endpoint_get_hostdata ( ep );
 | 
		
	
		
			
			| 2465 |  | -	union xhci_trb trb;
 | 
		
	
		
			
			|  | 2466 | +	union xhci_trb trbs[ 1 /* Normal */ + 1 /* Possible zero-length */ ];
 | 
		
	
		
			
			|  | 2467 | +	union xhci_trb *trb = trbs;
 | 
		
	
		
			
			| 2466 | 2468 |  	struct xhci_trb_normal *normal;
 | 
		
	
		
			
			|  | 2469 | +	size_t len = iob_len ( iobuf );
 | 
		
	
		
			
			| 2467 | 2470 |  	int rc;
 | 
		
	
		
			
			| 2468 | 2471 |  
 | 
		
	
		
			
			| 2469 | 2472 |  	/* Profile stream transfers */
 | 
		
	
		
			
			| 2470 | 2473 |  	profile_start ( &xhci_stream_profiler );
 | 
		
	
		
			
			| 2471 | 2474 |  
 | 
		
	
		
			
			| 2472 | 2475 |  	/* Construct normal TRBs */
 | 
		
	
		
			
			| 2473 |  | -	normal = &trb.normal;
 | 
		
	
		
			
			|  | 2476 | +	memset ( &trbs, 0, sizeof ( trbs ) );
 | 
		
	
		
			
			|  | 2477 | +	normal = &(trb++)->normal;
 | 
		
	
		
			
			| 2474 | 2478 |  	normal->data = cpu_to_le64 ( virt_to_phys ( iobuf->data ) );
 | 
		
	
		
			
			| 2475 |  | -	normal->len = cpu_to_le32 ( iob_len ( iobuf ) );
 | 
		
	
		
			
			| 2476 |  | -	normal->flags = XHCI_TRB_IOC;
 | 
		
	
		
			
			|  | 2479 | +	normal->len = cpu_to_le32 ( len );
 | 
		
	
		
			
			| 2477 | 2480 |  	normal->type = XHCI_TRB_NORMAL;
 | 
		
	
		
			
			|  | 2481 | +	if ( terminate && ( ( len & ( ep->mtu - 1 ) ) == 0 ) ) {
 | 
		
	
		
			
			|  | 2482 | +		normal->flags = XHCI_TRB_CH;
 | 
		
	
		
			
			|  | 2483 | +		normal = &(trb++)->normal;
 | 
		
	
		
			
			|  | 2484 | +		normal->type = XHCI_TRB_NORMAL;
 | 
		
	
		
			
			|  | 2485 | +	}
 | 
		
	
		
			
			|  | 2486 | +	normal->flags = XHCI_TRB_IOC;
 | 
		
	
		
			
			| 2478 | 2487 |  
 | 
		
	
		
			
			| 2479 | 2488 |  	/* Enqueue TRBs */
 | 
		
	
		
			
			| 2480 |  | -	if ( ( rc = xhci_enqueue ( &endpoint->ring, iobuf, &trb ) ) != 0 )
 | 
		
	
		
			
			|  | 2489 | +	if ( ( rc = xhci_enqueue_multi ( &endpoint->ring, iobuf, trbs,
 | 
		
	
		
			
			|  | 2490 | +					 ( trb - trbs ) ) ) != 0 )
 | 
		
	
		
			
			| 2481 | 2491 |  		return rc;
 | 
		
	
		
			
			| 2482 | 2492 |  
 | 
		
	
		
			
			| 2483 | 2493 |  	/* Ring the doorbell */
 |