|
@@ -56,22 +56,6 @@ static struct list_head usb_halted = LIST_HEAD_INIT ( usb_halted );
|
56
|
56
|
******************************************************************************
|
57
|
57
|
*/
|
58
|
58
|
|
59
|
|
-/**
|
60
|
|
- * Get USB endpoint name (for debugging)
|
61
|
|
- *
|
62
|
|
- * @v address Endpoint address
|
63
|
|
- * @ret name Endpoint name
|
64
|
|
- */
|
65
|
|
-static inline const char * usb_endpoint_name ( unsigned int address ) {
|
66
|
|
- static char buf[ 9 /* "EPxx OUT" + NUL */ ];
|
67
|
|
-
|
68
|
|
- snprintf ( buf, sizeof ( buf ), "EP%d%s",
|
69
|
|
- ( address & USB_ENDPOINT_MAX ),
|
70
|
|
- ( address ?
|
71
|
|
- ( ( address & USB_ENDPOINT_IN ) ? " IN" : " OUT" ) : "" ));
|
72
|
|
- return buf;
|
73
|
|
-}
|
74
|
|
-
|
75
|
59
|
/**
|
76
|
60
|
* Get USB speed name (for debugging)
|
77
|
61
|
*
|
|
@@ -227,6 +211,23 @@ usb_endpoint_companion_descriptor ( struct usb_configuration_descriptor *config,
|
227
|
211
|
******************************************************************************
|
228
|
212
|
*/
|
229
|
213
|
|
|
214
|
+/**
|
|
215
|
+ * Get USB endpoint name (for debugging)
|
|
216
|
+ *
|
|
217
|
+ * @v ep USB endpoint
|
|
218
|
+ * @ret name Endpoint name
|
|
219
|
+ */
|
|
220
|
+const char * usb_endpoint_name ( struct usb_endpoint *ep ) {
|
|
221
|
+ static char buf[ 9 /* "EPxx OUT" + NUL */ ];
|
|
222
|
+ unsigned int address = ep->address;
|
|
223
|
+
|
|
224
|
+ snprintf ( buf, sizeof ( buf ), "EP%d%s",
|
|
225
|
+ ( address & USB_ENDPOINT_MAX ),
|
|
226
|
+ ( address ?
|
|
227
|
+ ( ( address & USB_ENDPOINT_IN ) ? " IN" : " OUT" ) : "" ));
|
|
228
|
+ return buf;
|
|
229
|
+}
|
|
230
|
+
|
230
|
231
|
/**
|
231
|
232
|
* Describe USB endpoint from device configuration
|
232
|
233
|
*
|
|
@@ -300,7 +301,7 @@ int usb_endpoint_open ( struct usb_endpoint *ep ) {
|
300
|
301
|
/* Add to endpoint list */
|
301
|
302
|
if ( usb->ep[idx] != NULL ) {
|
302
|
303
|
DBGC ( usb, "USB %s %s is already open\n",
|
303
|
|
- usb->name, usb_endpoint_name ( ep->address ) );
|
|
304
|
+ usb->name, usb_endpoint_name ( ep ) );
|
304
|
305
|
rc = -EALREADY;
|
305
|
306
|
goto err_already;
|
306
|
307
|
}
|
|
@@ -310,14 +311,14 @@ int usb_endpoint_open ( struct usb_endpoint *ep ) {
|
310
|
311
|
/* Open endpoint */
|
311
|
312
|
if ( ( rc = ep->host->open ( ep ) ) != 0 ) {
|
312
|
313
|
DBGC ( usb, "USB %s %s could not open: %s\n", usb->name,
|
313
|
|
- usb_endpoint_name ( ep->address ), strerror ( rc ) );
|
|
314
|
+ usb_endpoint_name ( ep ), strerror ( rc ) );
|
314
|
315
|
goto err_open;
|
315
|
316
|
}
|
316
|
317
|
ep->open = 1;
|
317
|
318
|
|
318
|
319
|
DBGC2 ( usb, "USB %s %s opened with MTU %zd, burst %d, interval %d\n",
|
319
|
|
- usb->name, usb_endpoint_name ( ep->address ), ep->mtu,
|
320
|
|
- ep->burst, ep->interval );
|
|
320
|
+ usb->name, usb_endpoint_name ( ep ), ep->mtu, ep->burst,
|
|
321
|
+ ep->interval );
|
321
|
322
|
return 0;
|
322
|
323
|
|
323
|
324
|
ep->open = 0;
|
|
@@ -353,7 +354,7 @@ static int usb_endpoint_clear_tt ( struct usb_endpoint *ep ) {
|
353
|
354
|
/* Clear transaction translator buffer */
|
354
|
355
|
if ( ( rc = tt->hub->driver->clear_tt ( tt->hub, tt, ep ) ) != 0 ) {
|
355
|
356
|
DBGC ( usb, "USB %s %s could not clear transaction translator: "
|
356
|
|
- "%s\n", usb->name, usb_endpoint_name ( ep->address ),
|
|
357
|
+ "%s\n", usb->name, usb_endpoint_name ( ep ),
|
357
|
358
|
strerror ( rc ) );
|
358
|
359
|
return rc;
|
359
|
360
|
}
|
|
@@ -407,8 +408,7 @@ static int usb_endpoint_reset ( struct usb_endpoint *ep ) {
|
407
|
408
|
/* Reset endpoint */
|
408
|
409
|
if ( ( rc = ep->host->reset ( ep ) ) != 0 ) {
|
409
|
410
|
DBGC ( usb, "USB %s %s could not reset: %s\n",
|
410
|
|
- usb->name, usb_endpoint_name ( ep->address ),
|
411
|
|
- strerror ( rc ) );
|
|
411
|
+ usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
|
412
|
412
|
return rc;
|
413
|
413
|
}
|
414
|
414
|
|
|
@@ -423,8 +423,7 @@ static int usb_endpoint_reset ( struct usb_endpoint *ep ) {
|
423
|
423
|
USB_ENDPOINT_HALT,
|
424
|
424
|
ep->address ) ) != 0 ) ) {
|
425
|
425
|
DBGC ( usb, "USB %s %s could not clear endpoint halt: %s\n",
|
426
|
|
- usb->name, usb_endpoint_name ( ep->address ),
|
427
|
|
- strerror ( rc ) );
|
|
426
|
+ usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
|
428
|
427
|
return rc;
|
429
|
428
|
}
|
430
|
429
|
|
|
@@ -433,7 +432,7 @@ static int usb_endpoint_reset ( struct usb_endpoint *ep ) {
|
433
|
432
|
INIT_LIST_HEAD ( &ep->halted );
|
434
|
433
|
|
435
|
434
|
DBGC ( usb, "USB %s %s reset\n",
|
436
|
|
- usb->name, usb_endpoint_name ( ep->address ) );
|
|
435
|
+ usb->name, usb_endpoint_name ( ep ) );
|
437
|
436
|
return 0;
|
438
|
437
|
}
|
439
|
438
|
|
|
@@ -452,8 +451,7 @@ static int usb_endpoint_mtu ( struct usb_endpoint *ep, size_t mtu ) {
|
452
|
451
|
ep->mtu = mtu;
|
453
|
452
|
if ( ( rc = ep->host->mtu ( ep ) ) != 0 ) {
|
454
|
453
|
DBGC ( usb, "USB %s %s could not update MTU: %s\n",
|
455
|
|
- usb->name, usb_endpoint_name ( ep->address ),
|
456
|
|
- strerror ( rc ) );
|
|
454
|
+ usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
|
457
|
455
|
return rc;
|
458
|
456
|
}
|
459
|
457
|
|
|
@@ -508,7 +506,7 @@ int usb_message ( struct usb_endpoint *ep, unsigned int request,
|
508
|
506
|
/* Enqueue message transfer */
|
509
|
507
|
if ( ( rc = ep->host->message ( ep, iobuf ) ) != 0 ) {
|
510
|
508
|
DBGC ( usb, "USB %s %s could not enqueue message transfer: "
|
511
|
|
- "%s\n", usb->name, usb_endpoint_name ( ep->address ),
|
|
509
|
+ "%s\n", usb->name, usb_endpoint_name ( ep ),
|
512
|
510
|
strerror ( rc ) );
|
513
|
511
|
return rc;
|
514
|
512
|
}
|
|
@@ -545,8 +543,7 @@ int usb_stream ( struct usb_endpoint *ep, struct io_buffer *iobuf,
|
545
|
543
|
/* Enqueue stream transfer */
|
546
|
544
|
if ( ( rc = ep->host->stream ( ep, iobuf, terminate ) ) != 0 ) {
|
547
|
545
|
DBGC ( usb, "USB %s %s could not enqueue stream transfer: %s\n",
|
548
|
|
- usb->name, usb_endpoint_name ( ep->address ),
|
549
|
|
- strerror ( rc ) );
|
|
546
|
+ usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
|
550
|
547
|
return rc;
|
551
|
548
|
}
|
552
|
549
|
|
|
@@ -574,8 +571,7 @@ void usb_complete_err ( struct usb_endpoint *ep, struct io_buffer *iobuf,
|
574
|
571
|
/* Schedule reset, if applicable */
|
575
|
572
|
if ( ( rc != 0 ) && ep->open ) {
|
576
|
573
|
DBGC ( usb, "USB %s %s completion failed: %s\n",
|
577
|
|
- usb->name, usb_endpoint_name ( ep->address ),
|
578
|
|
- strerror ( rc ) );
|
|
574
|
+ usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
|
579
|
575
|
list_del ( &ep->halted );
|
580
|
576
|
list_add_tail ( &ep->halted, &usb_halted );
|
581
|
577
|
}
|