Преглед на файлове

[uhci] Use meaningful device names in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown преди 9 години
родител
ревизия
bb6d7bebe9
променени са 2 файла, в които са добавени 21 реда и са изтрити 15 реда
  1. 19
    15
      src/drivers/usb/uhci.c
  2. 2
    0
      src/drivers/usb/uhci.h

+ 19
- 15
src/drivers/usb/uhci.c Целия файл

@@ -117,7 +117,7 @@ static int uhci_stop ( struct uhci_device *uhci ) {
117 117
 		mdelay ( 1 );
118 118
 	}
119 119
 
120
-	DBGC ( uhci, "UHCI %p timed out waiting for stop\n", uhci );
120
+	DBGC ( uhci, "UHCI %s timed out waiting for stop\n", uhci->name );
121 121
 	return -ETIMEDOUT;
122 122
 }
123 123
 
@@ -155,7 +155,7 @@ static int uhci_reset ( struct uhci_device *uhci ) {
155 155
 		mdelay ( 1 );
156 156
 	}
157 157
 
158
-	DBGC ( uhci, "UHCI %p timed out waiting for reset\n", uhci );
158
+	DBGC ( uhci, "UHCI %s timed out waiting for reset\n", uhci->name );
159 159
 	return -ETIMEDOUT;
160 160
 }
161 161
 
@@ -541,7 +541,7 @@ static void uhci_periodic_schedule ( struct uhci_device *uhci ) {
541 541
 	 * safely run concurrently with hardware execution of the
542 542
 	 * schedule.
543 543
 	 */
544
-	DBGCP ( uhci, "UHCI %p periodic schedule: ", uhci );
544
+	DBGCP ( uhci, "UHCI %s periodic schedule: ", uhci->name );
545 545
 	link = end = uhci_link_qh ( uhci->head );
546 546
 	list_for_each_entry_reverse ( endpoint, &uhci->periodic, schedule ) {
547 547
 		queue = endpoint->ring.head;
@@ -554,7 +554,7 @@ static void uhci_periodic_schedule ( struct uhci_device *uhci ) {
554 554
 	DBGCP ( uhci, "\n" );
555 555
 
556 556
 	/* Populate periodic frame list */
557
-	DBGCP ( uhci, "UHCI %p periodic frame list:", uhci );
557
+	DBGCP ( uhci, "UHCI %s periodic frame list:", uhci->name );
558 558
 	for ( i = 0 ; i < UHCI_FRAMES ; i++ ) {
559 559
 
560 560
 		/* Calculate maximum interval (in microframes) which
@@ -930,9 +930,10 @@ static void uhci_endpoint_poll ( struct uhci_endpoint *endpoint ) {
930 930
 		 * and report the error to the USB core.
931 931
 		 */
932 932
 		if ( desc->status & UHCI_STATUS_STALLED ) {
933
-			DBGC ( uhci, "UHCI %p %s endpoint %02x completion "
934
-			       "%d.%d failed (status %02x)\n", uhci, usb->name,
935
-			       ep->address, index, xfer->cons, desc->status );
933
+			DBGC ( uhci, "UHCI %s %s completion %d.%d failed "
934
+			       "(status %02x)\n", usb->name,
935
+			       usb_endpoint_name ( ep ), index,
936
+			       xfer->cons, desc->status );
936 937
 			link = UHCI_LINK_TERMINATE;
937 938
 			ring->head->current = cpu_to_le32 ( link );
938 939
 			wmb();
@@ -1062,8 +1063,8 @@ static int uhci_device_address ( struct usb_device *usb ) {
1062 1063
 	address = usb_alloc_address ( bus );
1063 1064
 	if ( address < 0 ) {
1064 1065
 		rc = address;
1065
-		DBGC ( uhci, "UHCI %p %s could not allocate address: %s\n",
1066
-		       uhci, usb->name, strerror ( rc ) );
1066
+		DBGC ( uhci, "UHCI %s could not allocate address: %s\n",
1067
+		       usb->name, strerror ( rc ) );
1067 1068
 		goto err_alloc_address;
1068 1069
 	}
1069 1070
 
@@ -1184,8 +1185,8 @@ static int uhci_root_enable ( struct usb_hub *hub, struct usb_port *port ) {
1184 1185
 		mdelay ( 1 );
1185 1186
 	}
1186 1187
 
1187
-	DBGC ( uhci, "UHCI %p timed out waiting for port %d to enable "
1188
-	       "(status %04x)\n",  uhci, port->address, portsc );
1188
+	DBGC ( uhci, "UHCI %s-%d timed out waiting for port to enable "
1189
+	       "(status %04x)\n",  uhci->name, port->address, portsc );
1189 1190
 	return -ETIMEDOUT;
1190 1191
 }
1191 1192
 
@@ -1217,6 +1218,7 @@ static int uhci_root_disable ( struct usb_hub *hub, struct usb_port *port ) {
1217 1218
  */
1218 1219
 static int uhci_root_speed ( struct usb_hub *hub, struct usb_port *port ) {
1219 1220
 	struct uhci_device *uhci = usb_hub_get_drvdata ( hub );
1221
+	struct pci_device pci;
1220 1222
 	uint16_t portsc;
1221 1223
 	unsigned int speed;
1222 1224
 
@@ -1231,8 +1233,9 @@ static int uhci_root_speed ( struct usb_hub *hub, struct usb_port *port ) {
1231 1233
 		/* Defer connection detection until companion
1232 1234
 		 * controller has been enumerated.
1233 1235
 		 */
1234
-		DBGC ( uhci, "UHCI %p port %d deferring connection\n",
1235
-		       uhci, port->address );
1236
+		pci_init ( &pci, uhci->companion );
1237
+		DBGC ( uhci, "UHCI %s-%d deferring for companion " PCI_FMT "\n",
1238
+		       uhci->name, port->address, PCI_ARGS ( &pci ) );
1236 1239
 		speed = USB_SPEED_NONE;
1237 1240
 	} else if ( portsc & UHCI_PORTSC_LS ) {
1238 1241
 		/* Low-speed device */
@@ -1263,8 +1266,8 @@ static int uhci_root_clear_tt ( struct usb_hub *hub, struct usb_port *port,
1263 1266
 	struct uhci_device *uhci = usb_hub_get_drvdata ( hub );
1264 1267
 
1265 1268
 	/* Should never be called; this is a root hub */
1266
-	DBGC ( uhci, "UHCI %p port %d nonsensical CLEAR_TT for %s endpoint "
1267
-	       "%02x\n", uhci, port->address, ep->usb->name, ep->address );
1269
+	DBGC ( uhci, "UHCI %s-%d nonsensical CLEAR_TT for %s %s\n", uhci->name,
1270
+	       port->address, ep->usb->name, usb_endpoint_name ( ep ) );
1268 1271
 
1269 1272
 	return -ENOTSUP;
1270 1273
 }
@@ -1479,6 +1482,7 @@ static int uhci_probe ( struct pci_device *pci ) {
1479 1482
 		rc = -ENOMEM;
1480 1483
 		goto err_alloc;
1481 1484
 	}
1485
+	uhci->name = pci->dev.name;
1482 1486
 	INIT_LIST_HEAD ( &uhci->endpoints );
1483 1487
 	INIT_LIST_HEAD ( &uhci->async );
1484 1488
 	INIT_LIST_HEAD ( &uhci->periodic );

+ 2
- 0
src/drivers/usb/uhci.h Целия файл

@@ -307,6 +307,8 @@ uhci_ring_remaining ( struct uhci_ring *ring ) {
307 307
 struct uhci_device {
308 308
 	/** Registers */
309 309
 	unsigned long regs;
310
+	/** Name */
311
+	const char *name;
310 312
 
311 313
 	/** EHCI companion controller bus:dev.fn address (if any) */
312 314
 	unsigned int companion;

Loading…
Отказ
Запис