Browse Source

[ehci] Use meaningful device names in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
5832e9ea93
2 changed files with 52 additions and 43 deletions
  1. 50
    43
      src/drivers/usb/ehci.c
  2. 2
    0
      src/drivers/usb/ehci.h

+ 50
- 43
src/drivers/usb/ehci.c View File

75
 	ehci->cap = regs;
75
 	ehci->cap = regs;
76
 	caplength = readb ( ehci->cap + EHCI_CAP_CAPLENGTH );
76
 	caplength = readb ( ehci->cap + EHCI_CAP_CAPLENGTH );
77
 	ehci->op = ( ehci->cap + caplength );
77
 	ehci->op = ( ehci->cap + caplength );
78
-	DBGC2 ( ehci, "EHCI %p cap %08lx op %08lx\n", ehci,
78
+	DBGC2 ( ehci, "EHCI %s cap %08lx op %08lx\n", ehci->name,
79
 		virt_to_phys ( ehci->cap ), virt_to_phys ( ehci->op ) );
79
 		virt_to_phys ( ehci->cap ), virt_to_phys ( ehci->op ) );
80
 
80
 
81
 	/* Read structural parameters */
81
 	/* Read structural parameters */
82
 	hcsparams = readl ( ehci->cap + EHCI_CAP_HCSPARAMS );
82
 	hcsparams = readl ( ehci->cap + EHCI_CAP_HCSPARAMS );
83
 	ehci->ports = EHCI_HCSPARAMS_PORTS ( hcsparams );
83
 	ehci->ports = EHCI_HCSPARAMS_PORTS ( hcsparams );
84
-	DBGC ( ehci, "EHCI %p has %d ports\n", ehci, ehci->ports );
84
+	DBGC ( ehci, "EHCI %s has %d ports\n", ehci->name, ehci->ports );
85
 
85
 
86
 	/* Read capability parameters 1 */
86
 	/* Read capability parameters 1 */
87
 	hccparams = readl ( ehci->cap + EHCI_CAP_HCCPARAMS );
87
 	hccparams = readl ( ehci->cap + EHCI_CAP_HCCPARAMS );
89
 	ehci->flsize = ( EHCI_HCCPARAMS_FLSIZE ( hccparams ) ?
89
 	ehci->flsize = ( EHCI_HCCPARAMS_FLSIZE ( hccparams ) ?
90
 			 EHCI_FLSIZE_SMALL : EHCI_FLSIZE_DEFAULT );
90
 			 EHCI_FLSIZE_SMALL : EHCI_FLSIZE_DEFAULT );
91
 	ehci->eecp = EHCI_HCCPARAMS_EECP ( hccparams );
91
 	ehci->eecp = EHCI_HCCPARAMS_EECP ( hccparams );
92
-	DBGC2 ( ehci, "EHCI %p %d-bit flsize %d\n", ehci,
92
+	DBGC2 ( ehci, "EHCI %s %d-bit flsize %d\n", ehci->name,
93
 		( ehci->addr64 ? 64 : 32 ), ehci->flsize );
93
 		( ehci->addr64 ? 64 : 32 ), ehci->flsize );
94
 }
94
 }
95
 
95
 
198
 	legacy = ehci_extended_capability ( ehci, pci, EHCI_EECP_ID_LEGACY, 0 );
198
 	legacy = ehci_extended_capability ( ehci, pci, EHCI_EECP_ID_LEGACY, 0 );
199
 	if ( ! legacy ) {
199
 	if ( ! legacy ) {
200
 		/* Not an error; capability may not be present */
200
 		/* Not an error; capability may not be present */
201
-		DBGC ( ehci, "EHCI %p has no USB legacy support capability\n",
202
-		       ehci );
201
+		DBGC ( ehci, "EHCI %s has no USB legacy support capability\n",
202
+		       ehci->name );
203
 		return;
203
 		return;
204
 	}
204
 	}
205
 
205
 
207
 	pci_read_config_byte ( pci, ( legacy + EHCI_USBLEGSUP_BIOS ), &bios );
207
 	pci_read_config_byte ( pci, ( legacy + EHCI_USBLEGSUP_BIOS ), &bios );
208
 	if ( ! ( bios & EHCI_USBLEGSUP_BIOS_OWNED ) ) {
208
 	if ( ! ( bios & EHCI_USBLEGSUP_BIOS_OWNED ) ) {
209
 		/* Not an error; already owned by OS */
209
 		/* Not an error; already owned by OS */
210
-		DBGC ( ehci, "EHCI %p USB legacy support already disabled\n",
211
-		       ehci );
210
+		DBGC ( ehci, "EHCI %s USB legacy support already disabled\n",
211
+		       ehci->name );
212
 		return;
212
 		return;
213
 	}
213
 	}
214
 
214
 
244
 		pci_read_config_byte ( pci, ( legacy + EHCI_USBLEGSUP_BIOS ),
244
 		pci_read_config_byte ( pci, ( legacy + EHCI_USBLEGSUP_BIOS ),
245
 				       &bios );
245
 				       &bios );
246
 		if ( ! ( bios & EHCI_USBLEGSUP_BIOS_OWNED ) ) {
246
 		if ( ! ( bios & EHCI_USBLEGSUP_BIOS_OWNED ) ) {
247
-			DBGC ( ehci, "EHCI %p claimed ownership from BIOS\n",
248
-			       ehci );
247
+			DBGC ( ehci, "EHCI %s claimed ownership from BIOS\n",
248
+			       ehci->name );
249
 			pci_read_config_dword ( pci, ( legacy +
249
 			pci_read_config_dword ( pci, ( legacy +
250
 						       EHCI_USBLEGSUP_CTLSTS ),
250
 						       EHCI_USBLEGSUP_CTLSTS ),
251
 						&ctlsts );
251
 						&ctlsts );
252
 			if ( ctlsts ) {
252
 			if ( ctlsts ) {
253
-				DBGC ( ehci, "EHCI %p warning: BIOS retained "
254
-				       "SMIs: %08x\n", ehci, ctlsts );
253
+				DBGC ( ehci, "EHCI %s warning: BIOS retained "
254
+				       "SMIs: %08x\n", ehci->name, ctlsts );
255
 			}
255
 			}
256
 			return;
256
 			return;
257
 		}
257
 		}
263
 	/* BIOS did not release ownership.  Claim it forcibly by
263
 	/* BIOS did not release ownership.  Claim it forcibly by
264
 	 * disabling all SMIs.
264
 	 * disabling all SMIs.
265
 	 */
265
 	 */
266
-	DBGC ( ehci, "EHCI %p could not claim ownership from BIOS: forcibly "
267
-	       "disabling SMIs\n", ehci );
266
+	DBGC ( ehci, "EHCI %s could not claim ownership from BIOS: forcibly "
267
+	       "disabling SMIs\n", ehci->name );
268
 	pci_write_config_dword ( pci, ( legacy + EHCI_USBLEGSUP_CTLSTS ), 0 );
268
 	pci_write_config_dword ( pci, ( legacy + EHCI_USBLEGSUP_CTLSTS ), 0 );
269
 }
269
 }
270
 
270
 
283
 
283
 
284
 	/* Do nothing if releasing ownership is prevented */
284
 	/* Do nothing if releasing ownership is prevented */
285
 	if ( ehci_legacy_prevent_release ) {
285
 	if ( ehci_legacy_prevent_release ) {
286
-		DBGC ( ehci, "EHCI %p not releasing ownership to BIOS\n", ehci);
286
+		DBGC ( ehci, "EHCI %s not releasing ownership to BIOS\n",
287
+		       ehci->name );
287
 		return;
288
 		return;
288
 	}
289
 	}
289
 
290
 
290
 	/* Release ownership */
291
 	/* Release ownership */
291
 	pci_write_config_byte ( pci, ( ehci->legacy + EHCI_USBLEGSUP_OS ), 0 );
292
 	pci_write_config_byte ( pci, ( ehci->legacy + EHCI_USBLEGSUP_OS ), 0 );
292
-	DBGC ( ehci, "EHCI %p released ownership to BIOS\n", ehci );
293
+	DBGC ( ehci, "EHCI %s released ownership to BIOS\n", ehci->name );
293
 }
294
 }
294
 
295
 
295
 /******************************************************************************
296
 /******************************************************************************
333
 			continue;
334
 			continue;
334
 
335
 
335
 		/* Poll child companion controller bus */
336
 		/* Poll child companion controller bus */
337
+		DBGC2 ( ehci, "EHCI %s polling companion %s\n",
338
+			ehci->name, bus->name );
336
 		usb_poll ( bus );
339
 		usb_poll ( bus );
337
 	}
340
 	}
338
 }
341
 }
415
 		mdelay ( 1 );
418
 		mdelay ( 1 );
416
 	}
419
 	}
417
 
420
 
418
-	DBGC ( ehci, "EHCI %p timed out waiting for stop\n", ehci );
421
+	DBGC ( ehci, "EHCI %s timed out waiting for stop\n", ehci->name );
419
 	return -ETIMEDOUT;
422
 	return -ETIMEDOUT;
420
 }
423
 }
421
 
424
 
453
 		mdelay ( 1 );
456
 		mdelay ( 1 );
454
 	}
457
 	}
455
 
458
 
456
-	DBGC ( ehci, "EHCI %p timed out waiting for reset\n", ehci );
459
+	DBGC ( ehci, "EHCI %s timed out waiting for reset\n", ehci->name );
457
 	return -ETIMEDOUT;
460
 	return -ETIMEDOUT;
458
 }
461
 }
459
 
462
 
498
 		goto err_alloc_queue;
501
 		goto err_alloc_queue;
499
 	}
502
 	}
500
 	if ( ( rc = ehci_ctrl_reachable ( ehci, ring->head ) ) != 0 ) {
503
 	if ( ( rc = ehci_ctrl_reachable ( ehci, ring->head ) ) != 0 ) {
501
-		DBGC ( ehci, "EHCI %p queue head unreachable\n", ehci );
504
+		DBGC ( ehci, "EHCI %s queue head unreachable\n", ehci->name );
502
 		goto err_unreachable_queue;
505
 		goto err_unreachable_queue;
503
 	}
506
 	}
504
 	memset ( ring->head, 0, sizeof ( *ring->head ) );
507
 	memset ( ring->head, 0, sizeof ( *ring->head ) );
516
 	for ( i = 0 ; i < EHCI_RING_COUNT ; i++ ) {
519
 	for ( i = 0 ; i < EHCI_RING_COUNT ; i++ ) {
517
 		desc = &ring->desc[i];
520
 		desc = &ring->desc[i];
518
 		if ( ( rc = ehci_ctrl_reachable ( ehci, desc ) ) != 0 ) {
521
 		if ( ( rc = ehci_ctrl_reachable ( ehci, desc ) ) != 0 ) {
519
-			DBGC ( ehci, "EHCI %p descriptor unreachable\n", ehci );
522
+			DBGC ( ehci, "EHCI %s descriptor unreachable\n",
523
+			       ehci->name );
520
 			goto err_unreachable_desc;
524
 			goto err_unreachable_desc;
521
 		}
525
 		}
522
 		next = &ring->desc[ ( i + 1 ) % EHCI_RING_COUNT ];
526
 		next = &ring->desc[ ( i + 1 ) % EHCI_RING_COUNT ];
785
 	}
789
 	}
786
 
790
 
787
 	/* Bad things will probably happen now */
791
 	/* Bad things will probably happen now */
788
-	DBGC ( ehci, "EHCI %p timed out waiting for asynchronous schedule "
789
-	       "to advance\n", ehci );
792
+	DBGC ( ehci, "EHCI %s timed out waiting for asynchronous schedule "
793
+	       "to advance\n", ehci->name );
790
 	return -ETIMEDOUT;
794
 	return -ETIMEDOUT;
791
 }
795
 }
792
 
796
 
808
 	 * safely run concurrently with hardware execution of the
812
 	 * safely run concurrently with hardware execution of the
809
 	 * schedule.
813
 	 * schedule.
810
 	 */
814
 	 */
811
-	DBGCP ( ehci, "EHCI %p periodic schedule: ", ehci );
815
+	DBGCP ( ehci, "EHCI %s periodic schedule: ", ehci->name );
812
 	link = EHCI_LINK_TERMINATE;
816
 	link = EHCI_LINK_TERMINATE;
813
 	list_for_each_entry_reverse ( endpoint, &ehci->periodic, schedule ) {
817
 	list_for_each_entry_reverse ( endpoint, &ehci->periodic, schedule ) {
814
 		queue = endpoint->ring.head;
818
 		queue = endpoint->ring.head;
822
 	DBGCP ( ehci, "\n" );
826
 	DBGCP ( ehci, "\n" );
823
 
827
 
824
 	/* Populate periodic frame list */
828
 	/* Populate periodic frame list */
825
-	DBGCP ( ehci, "EHCI %p periodic frame list:", ehci );
829
+	DBGCP ( ehci, "EHCI %s periodic frame list:", ehci->name );
826
 	frames = EHCI_PERIODIC_FRAMES ( ehci->flsize );
830
 	frames = EHCI_PERIODIC_FRAMES ( ehci->flsize );
827
 	for ( i = 0 ; i < frames ; i++ ) {
831
 	for ( i = 0 ; i < frames ; i++ ) {
828
 
832
 
1092
 		/* No way to prevent hardware from continuing to
1096
 		/* No way to prevent hardware from continuing to
1093
 		 * access the memory, so leak it.
1097
 		 * access the memory, so leak it.
1094
 		 */
1098
 		 */
1095
-		DBGC ( ehci, "EHCI %p %s endpoint %02x could not unschedule: "
1096
-		       "%s\n", ehci, usb->name, ep->address, strerror ( rc ) );
1099
+		DBGC ( ehci, "EHCI %s %s could not unschedule: %s\n",
1100
+		       usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
1097
 		return;
1101
 		return;
1098
 	}
1102
 	}
1099
 
1103
 
1291
 		 */
1295
 		 */
1292
 		if ( status & EHCI_STATUS_HALTED ) {
1296
 		if ( status & EHCI_STATUS_HALTED ) {
1293
 			rc = -EIO_STATUS ( status );
1297
 			rc = -EIO_STATUS ( status );
1294
-			DBGC ( ehci, "EHCI %p %s endpoint %02x completion %d "
1295
-			       "failed (status %02x): %s\n", ehci, usb->name,
1296
-			       ep->address, index, status, strerror ( rc ) );
1298
+			DBGC ( ehci, "EHCI %s %s completion %d failed (status "
1299
+			       "%02x): %s\n", usb->name,
1300
+			       usb_endpoint_name ( ep ), index, status,
1301
+			       strerror ( rc ) );
1297
 			while ( ! iobuf )
1302
 			while ( ! iobuf )
1298
 				iobuf = ehci_dequeue ( ring );
1303
 				iobuf = ehci_dequeue ( ring );
1299
 			usb_complete_err ( endpoint->ep, iobuf, rc );
1304
 			usb_complete_err ( endpoint->ep, iobuf, rc );
1373
 	address = usb_alloc_address ( bus );
1378
 	address = usb_alloc_address ( bus );
1374
 	if ( address < 0 ) {
1379
 	if ( address < 0 ) {
1375
 		rc = address;
1380
 		rc = address;
1376
-		DBGC ( ehci, "EHCI %p %s could not allocate address: %s\n",
1377
-		       ehci, usb->name, strerror ( rc ) );
1381
+		DBGC ( ehci, "EHCI %s could not allocate address: %s\n",
1382
+		       usb->name, strerror ( rc ) );
1378
 		goto err_alloc_address;
1383
 		goto err_alloc_address;
1379
 	}
1384
 	}
1380
 
1385
 
1496
 	portsc = readl ( ehci->op + EHCI_OP_PORTSC ( port->address ) );
1501
 	portsc = readl ( ehci->op + EHCI_OP_PORTSC ( port->address ) );
1497
 	line = EHCI_PORTSC_LINE_STATUS ( portsc );
1502
 	line = EHCI_PORTSC_LINE_STATUS ( portsc );
1498
 	if ( line == EHCI_PORTSC_LINE_STATUS_LOW ) {
1503
 	if ( line == EHCI_PORTSC_LINE_STATUS_LOW ) {
1499
-		DBGC ( ehci, "EHCI %p port %d detected low-speed device: "
1500
-		       "disowning\n", ehci, port->address );
1504
+		DBGC ( ehci, "EHCI %s-%d detected low-speed device: "
1505
+		       "disowning\n", ehci->name, port->address );
1501
 		goto disown;
1506
 		goto disown;
1502
 	}
1507
 	}
1503
 
1508
 
1517
 		if ( ! ( portsc & EHCI_PORTSC_PR ) ) {
1522
 		if ( ! ( portsc & EHCI_PORTSC_PR ) ) {
1518
 			if ( portsc & EHCI_PORTSC_PED )
1523
 			if ( portsc & EHCI_PORTSC_PED )
1519
 				return 0;
1524
 				return 0;
1520
-			DBGC ( ehci, "EHCI %p port %d not enabled after reset: "
1521
-			       "disowning\n", ehci, port->address );
1525
+			DBGC ( ehci, "EHCI %s-%d not enabled after reset: "
1526
+			       "disowning\n", ehci->name, port->address );
1522
 			goto disown;
1527
 			goto disown;
1523
 		}
1528
 		}
1524
 
1529
 
1526
 		mdelay ( 1 );
1531
 		mdelay ( 1 );
1527
 	}
1532
 	}
1528
 
1533
 
1529
-	DBGC ( ehci, "EHCI %p timed out waiting for port %d to reset\n",
1530
-	       ehci, port->address );
1534
+	DBGC ( ehci, "EHCI %s-%d timed out waiting for port to reset\n",
1535
+	       ehci->name, port->address );
1531
 	return -ETIMEDOUT;
1536
 	return -ETIMEDOUT;
1532
 
1537
 
1533
  disown:
1538
  disown:
1582
 
1587
 
1583
 	/* Read port status */
1588
 	/* Read port status */
1584
 	portsc = readl ( ehci->op + EHCI_OP_PORTSC ( port->address ) );
1589
 	portsc = readl ( ehci->op + EHCI_OP_PORTSC ( port->address ) );
1585
-	DBGC2 ( ehci, "EHCI %p port %d status is %08x\n",
1586
-		ehci, port->address, portsc );
1590
+	DBGC2 ( ehci, "EHCI %s-%d status is %08x\n",
1591
+		ehci->name, port->address, portsc );
1587
 	ccs = ( portsc & EHCI_PORTSC_CCS );
1592
 	ccs = ( portsc & EHCI_PORTSC_CCS );
1588
 	csc = ( portsc & EHCI_PORTSC_CSC );
1593
 	csc = ( portsc & EHCI_PORTSC_CSC );
1589
 	ped = ( portsc & EHCI_PORTSC_PED );
1594
 	ped = ( portsc & EHCI_PORTSC_PED );
1626
 	struct ehci_device *ehci = usb_hub_get_drvdata ( hub );
1631
 	struct ehci_device *ehci = usb_hub_get_drvdata ( hub );
1627
 
1632
 
1628
 	/* Should never be called; this is a root hub */
1633
 	/* Should never be called; this is a root hub */
1629
-	DBGC ( ehci, "EHCI %p port %d nonsensical CLEAR_TT for %s endpoint "
1630
-	       "%02x\n", ehci, port->address, ep->usb->name, ep->address );
1634
+	DBGC ( ehci, "EHCI %s-%d nonsensical CLEAR_TT for %s %s\n", ehci->name,
1635
+	       port->address, ep->usb->name, usb_endpoint_name ( ep ) );
1631
 
1636
 
1632
 	return -ENOTSUP;
1637
 	return -ENOTSUP;
1633
 }
1638
 }
1701
 	if ( ehci->addr64 ) {
1706
 	if ( ehci->addr64 ) {
1702
 		writel ( ehci->ctrldssegment, ehci->op + EHCI_OP_CTRLDSSEGMENT);
1707
 		writel ( ehci->ctrldssegment, ehci->op + EHCI_OP_CTRLDSSEGMENT);
1703
 	} else if ( ehci->ctrldssegment ) {
1708
 	} else if ( ehci->ctrldssegment ) {
1704
-		DBGC ( ehci, "EHCI %p CTRLDSSEGMENT not supported\n", ehci );
1709
+		DBGC ( ehci, "EHCI %s CTRLDSSEGMENT not supported\n",
1710
+		       ehci->name );
1705
 		rc = -ENOTSUP;
1711
 		rc = -ENOTSUP;
1706
 		goto err_ctrldssegment;
1712
 		goto err_ctrldssegment;
1707
 	}
1713
 	}
1715
 		goto err_alloc_frame;
1721
 		goto err_alloc_frame;
1716
 	}
1722
 	}
1717
 	if ( ( rc = ehci_ctrl_reachable ( ehci, ehci->frame ) ) != 0 ) {
1723
 	if ( ( rc = ehci_ctrl_reachable ( ehci, ehci->frame ) ) != 0 ) {
1718
-		DBGC ( ehci, "EHCI %p frame list unreachable\n", ehci );
1724
+		DBGC ( ehci, "EHCI %s frame list unreachable\n", ehci->name );
1719
 		goto err_unreachable_frame;
1725
 		goto err_unreachable_frame;
1720
 	}
1726
 	}
1721
 	ehci_periodic_schedule ( ehci );
1727
 	ehci_periodic_schedule ( ehci );
1807
 
1813
 
1808
 	/* Report fatal errors */
1814
 	/* Report fatal errors */
1809
 	if ( change & EHCI_USBSTS_SYSERR )
1815
 	if ( change & EHCI_USBSTS_SYSERR )
1810
-		DBGC ( ehci, "EHCI %p host system error\n", ehci );
1816
+		DBGC ( ehci, "EHCI %s host system error\n", ehci->name );
1811
 }
1817
 }
1812
 
1818
 
1813
 /******************************************************************************
1819
 /******************************************************************************
1871
 		rc = -ENOMEM;
1877
 		rc = -ENOMEM;
1872
 		goto err_alloc;
1878
 		goto err_alloc;
1873
 	}
1879
 	}
1880
+	ehci->name = pci->dev.name;
1874
 	INIT_LIST_HEAD ( &ehci->endpoints );
1881
 	INIT_LIST_HEAD ( &ehci->endpoints );
1875
 	INIT_LIST_HEAD ( &ehci->async );
1882
 	INIT_LIST_HEAD ( &ehci->async );
1876
 	INIT_LIST_HEAD ( &ehci->periodic );
1883
 	INIT_LIST_HEAD ( &ehci->periodic );

+ 2
- 0
src/drivers/usb/ehci.h View File

483
 struct ehci_device {
483
 struct ehci_device {
484
 	/** Registers */
484
 	/** Registers */
485
 	void *regs;
485
 	void *regs;
486
+	/** Name */
487
+	const char *name;
486
 
488
 
487
 	/** Capability registers */
489
 	/** Capability registers */
488
 	void *cap;
490
 	void *cap;

Loading…
Cancel
Save