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

[xhci] Use meaningful device names in debug messages

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

+ 122
- 119
src/drivers/usb/xhci.c Целия файл

@@ -279,23 +279,24 @@ static void xhci_init ( struct xhci_device *xhci, void *regs ) {
279 279
 	xhci->op = ( xhci->cap + caplength );
280 280
 	xhci->run = ( xhci->cap + rtsoff );
281 281
 	xhci->db = ( xhci->cap + dboff );
282
-	DBGC2 ( xhci, "XHCI %p cap %08lx op %08lx run %08lx db %08lx\n",
283
-		xhci, virt_to_phys ( xhci->cap ), virt_to_phys ( xhci->op ),
284
-		virt_to_phys ( xhci->run ), virt_to_phys ( xhci->db ) );
282
+	DBGC2 ( xhci, "XHCI %s cap %08lx op %08lx run %08lx db %08lx\n",
283
+		xhci->name, virt_to_phys ( xhci->cap ),
284
+		virt_to_phys ( xhci->op ), virt_to_phys ( xhci->run ),
285
+		virt_to_phys ( xhci->db ) );
285 286
 
286 287
 	/* Read structural parameters 1 */
287 288
 	hcsparams1 = readl ( xhci->cap + XHCI_CAP_HCSPARAMS1 );
288 289
 	xhci->slots = XHCI_HCSPARAMS1_SLOTS ( hcsparams1 );
289 290
 	xhci->intrs = XHCI_HCSPARAMS1_INTRS ( hcsparams1 );
290 291
 	xhci->ports = XHCI_HCSPARAMS1_PORTS ( hcsparams1 );
291
-	DBGC ( xhci, "XHCI %p has %d slots %d intrs %d ports\n",
292
-	       xhci, xhci->slots, xhci->intrs, xhci->ports );
292
+	DBGC ( xhci, "XHCI %s has %d slots %d intrs %d ports\n",
293
+	       xhci->name, xhci->slots, xhci->intrs, xhci->ports );
293 294
 
294 295
 	/* Read structural parameters 2 */
295 296
 	hcsparams2 = readl ( xhci->cap + XHCI_CAP_HCSPARAMS2 );
296 297
 	xhci->scratchpads = XHCI_HCSPARAMS2_SCRATCHPADS ( hcsparams2 );
297
-	DBGC2 ( xhci, "XHCI %p needs %d scratchpads\n",
298
-		xhci, xhci->scratchpads );
298
+	DBGC2 ( xhci, "XHCI %s needs %d scratchpads\n",
299
+		xhci->name, xhci->scratchpads );
299 300
 
300 301
 	/* Read capability parameters 1 */
301 302
 	hccparams1 = readl ( xhci->cap + XHCI_CAP_HCCPARAMS1 );
@@ -308,8 +309,8 @@ static void xhci_init ( struct xhci_device *xhci, void *regs ) {
308 309
 	xhci->pagesize = XHCI_PAGESIZE ( pagesize );
309 310
 	assert ( xhci->pagesize != 0 );
310 311
 	assert ( ( ( xhci->pagesize ) & ( xhci->pagesize - 1 ) ) == 0 );
311
-	DBGC2 ( xhci, "XHCI %p page size %zd bytes\n",
312
-		xhci, xhci->pagesize );
312
+	DBGC2 ( xhci, "XHCI %s page size %zd bytes\n",
313
+		xhci->name, xhci->pagesize );
313 314
 }
314 315
 
315 316
 /**
@@ -371,8 +372,8 @@ xhci_writeq ( struct xhci_device *xhci, physaddr_t value, void *reg ) {
371 372
 	 * address is outside the 32-bit address space, then fail.
372 373
 	 */
373 374
 	if ( ( value & ~0xffffffffULL ) && ! xhci->addr64 ) {
374
-		DBGC ( xhci, "XHCI %p cannot access address %lx\n",
375
-		       xhci, value );
375
+		DBGC ( xhci, "XHCI %s cannot access address %lx\n",
376
+		       xhci->name, value );
376 377
 		return -ENOTSUP;
377 378
 	}
378 379
 
@@ -452,26 +453,26 @@ static inline void xhci_dump ( struct xhci_device *xhci ) {
452 453
 
453 454
 	/* Dump USBCMD */
454 455
 	usbcmd = readl ( xhci->op + XHCI_OP_USBCMD );
455
-	DBGC ( xhci, "XHCI %p USBCMD %08x%s%s\n", xhci, usbcmd,
456
+	DBGC ( xhci, "XHCI %s USBCMD %08x%s%s\n", xhci->name, usbcmd,
456 457
 	       ( ( usbcmd & XHCI_USBCMD_RUN ) ? " run" : "" ),
457 458
 	       ( ( usbcmd & XHCI_USBCMD_HCRST ) ? " hcrst" : "" ) );
458 459
 
459 460
 	/* Dump USBSTS */
460 461
 	usbsts = readl ( xhci->op + XHCI_OP_USBSTS );
461
-	DBGC ( xhci, "XHCI %p USBSTS %08x%s\n", xhci, usbsts,
462
+	DBGC ( xhci, "XHCI %s USBSTS %08x%s\n", xhci->name, usbsts,
462 463
 	       ( ( usbsts & XHCI_USBSTS_HCH ) ? " hch" : "" ) );
463 464
 
464 465
 	/* Dump PAGESIZE */
465 466
 	pagesize = readl ( xhci->op + XHCI_OP_PAGESIZE );
466
-	DBGC ( xhci, "XHCI %p PAGESIZE %08x\n", xhci, pagesize );
467
+	DBGC ( xhci, "XHCI %s PAGESIZE %08x\n", xhci->name, pagesize );
467 468
 
468 469
 	/* Dump DNCTRL */
469 470
 	dnctrl = readl ( xhci->op + XHCI_OP_DNCTRL );
470
-	DBGC ( xhci, "XHCI %p DNCTRL %08x\n", xhci, dnctrl );
471
+	DBGC ( xhci, "XHCI %s DNCTRL %08x\n", xhci->name, dnctrl );
471 472
 
472 473
 	/* Dump CONFIG */
473 474
 	config = readl ( xhci->op + XHCI_OP_CONFIG );
474
-	DBGC ( xhci, "XHCI %p CONFIG %08x\n", xhci, config );
475
+	DBGC ( xhci, "XHCI %s CONFIG %08x\n", xhci->name, config );
475 476
 }
476 477
 
477 478
 /**
@@ -493,8 +494,8 @@ static inline void xhci_dump_port ( struct xhci_device *xhci,
493 494
 
494 495
 	/* Dump PORTSC */
495 496
 	portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) );
496
-	DBGC ( xhci, "XHCI %p port %d PORTSC %08x%s%s%s%s psiv=%d\n",
497
-	       xhci, port, portsc,
497
+	DBGC ( xhci, "XHCI %s-%d PORTSC %08x%s%s%s%s psiv=%d\n",
498
+	       xhci->name, port, portsc,
498 499
 	       ( ( portsc & XHCI_PORTSC_CCS ) ? " ccs" : "" ),
499 500
 	       ( ( portsc & XHCI_PORTSC_PED ) ? " ped" : "" ),
500 501
 	       ( ( portsc & XHCI_PORTSC_PR ) ? " pr" : "" ),
@@ -503,16 +504,16 @@ static inline void xhci_dump_port ( struct xhci_device *xhci,
503 504
 
504 505
 	/* Dump PORTPMSC */
505 506
 	portpmsc = readl ( xhci->op + XHCI_OP_PORTPMSC ( port ) );
506
-	DBGC ( xhci, "XHCI %p port %d PORTPMSC %08x\n", xhci, port, portpmsc );
507
+	DBGC ( xhci, "XHCI %s-%d PORTPMSC %08x\n", xhci->name, port, portpmsc );
507 508
 
508 509
 	/* Dump PORTLI */
509 510
 	portli = readl ( xhci->op + XHCI_OP_PORTLI ( port ) );
510
-	DBGC ( xhci, "XHCI %p port %d PORTLI %08x\n", xhci, port, portli );
511
+	DBGC ( xhci, "XHCI %s-%d PORTLI %08x\n", xhci->name, port, portli );
511 512
 
512 513
 	/* Dump PORTHLPMC */
513 514
 	porthlpmc = readl ( xhci->op + XHCI_OP_PORTHLPMC ( port ) );
514
-	DBGC ( xhci, "XHCI %p port %d PORTHLPMC %08x\n",
515
-	       xhci, port, porthlpmc );
515
+	DBGC ( xhci, "XHCI %s-%d PORTHLPMC %08x\n",
516
+	       xhci->name, port, porthlpmc );
516 517
 }
517 518
 
518 519
 /******************************************************************************
@@ -538,8 +539,8 @@ static void xhci_legacy_init ( struct xhci_device *xhci ) {
538 539
 	legacy = xhci_extended_capability ( xhci, XHCI_XECP_ID_LEGACY, 0 );
539 540
 	if ( ! legacy ) {
540 541
 		/* Not an error; capability may not be present */
541
-		DBGC ( xhci, "XHCI %p has no USB legacy support capability\n",
542
-		       xhci );
542
+		DBGC ( xhci, "XHCI %s has no USB legacy support capability\n",
543
+		       xhci->name );
543 544
 		return;
544 545
 	}
545 546
 
@@ -547,8 +548,8 @@ static void xhci_legacy_init ( struct xhci_device *xhci ) {
547 548
 	bios = readb ( xhci->cap + legacy + XHCI_USBLEGSUP_BIOS );
548 549
 	if ( ! ( bios & XHCI_USBLEGSUP_BIOS_OWNED ) ) {
549 550
 		/* Not an error; already owned by OS */
550
-		DBGC ( xhci, "XHCI %p USB legacy support already disabled\n",
551
-		       xhci );
551
+		DBGC ( xhci, "XHCI %s USB legacy support already disabled\n",
552
+		       xhci->name );
552 553
 		return;
553 554
 	}
554 555
 
@@ -580,13 +581,13 @@ static void xhci_legacy_claim ( struct xhci_device *xhci ) {
580 581
 		/* Check if BIOS has released ownership */
581 582
 		bios = readb ( xhci->cap + xhci->legacy + XHCI_USBLEGSUP_BIOS );
582 583
 		if ( ! ( bios & XHCI_USBLEGSUP_BIOS_OWNED ) ) {
583
-			DBGC ( xhci, "XHCI %p claimed ownership from BIOS\n",
584
-			       xhci );
584
+			DBGC ( xhci, "XHCI %s claimed ownership from BIOS\n",
585
+			       xhci->name );
585 586
 			ctlsts = readl ( xhci->cap + xhci->legacy +
586 587
 					 XHCI_USBLEGSUP_CTLSTS );
587 588
 			if ( ctlsts ) {
588
-				DBGC ( xhci, "XHCI %p warning: BIOS retained "
589
-				       "SMIs: %08x\n", xhci, ctlsts );
589
+				DBGC ( xhci, "XHCI %s warning: BIOS retained "
590
+				       "SMIs: %08x\n", xhci->name, ctlsts );
590 591
 			}
591 592
 			return;
592 593
 		}
@@ -598,8 +599,8 @@ static void xhci_legacy_claim ( struct xhci_device *xhci ) {
598 599
 	/* BIOS did not release ownership.  Claim it forcibly by
599 600
 	 * disabling all SMIs.
600 601
 	 */
601
-	DBGC ( xhci, "XHCI %p could not claim ownership from BIOS: forcibly "
602
-	       "disabling SMIs\n", xhci );
602
+	DBGC ( xhci, "XHCI %s could not claim ownership from BIOS: forcibly "
603
+	       "disabling SMIs\n", xhci->name );
603 604
 	writel ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_CTLSTS );
604 605
 }
605 606
 
@@ -616,13 +617,14 @@ static void xhci_legacy_release ( struct xhci_device *xhci ) {
616 617
 
617 618
 	/* Do nothing if releasing ownership is prevented */
618 619
 	if ( xhci_legacy_prevent_release ) {
619
-		DBGC ( xhci, "XHCI %p not releasing ownership to BIOS\n", xhci);
620
+		DBGC ( xhci, "XHCI %s not releasing ownership to BIOS\n",
621
+		       xhci->name );
620 622
 		return;
621 623
 	}
622 624
 
623 625
 	/* Release ownership */
624 626
 	writeb ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS );
625
-	DBGC ( xhci, "XHCI %p released ownership to BIOS\n", xhci );
627
+	DBGC ( xhci, "XHCI %s released ownership to BIOS\n", xhci->name );
626 628
 }
627 629
 
628 630
 /******************************************************************************
@@ -683,8 +685,8 @@ static unsigned int xhci_supported_protocol ( struct xhci_device *xhci,
683 685
 			return supported;
684 686
 	}
685 687
 
686
-	DBGC ( xhci, "XHCI %p port %d has no supported protocol\n",
687
-	       xhci, port );
688
+	DBGC ( xhci, "XHCI %s-%d has no supported protocol\n",
689
+	       xhci->name, port );
688 690
 	return 0;
689 691
 }
690 692
 
@@ -727,8 +729,8 @@ static unsigned int xhci_port_protocol ( struct xhci_device *xhci,
727 729
 		name.text[4] = '\0';
728 730
 		slot = readl ( xhci->cap + supported + XHCI_SUPPORTED_SLOT );
729 731
 		type = XHCI_SUPPORTED_SLOT_TYPE ( slot );
730
-		DBGC2 ( xhci, "XHCI %p port %d %sv%04x type %d",
731
-			xhci, port, name.text, protocol, type );
732
+		DBGC2 ( xhci, "XHCI %s-%d %sv%04x type %d",
733
+			xhci->name, port, name.text, protocol, type );
732 734
 		ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS );
733 735
 		psic = XHCI_SUPPORTED_PORTS_PSIC ( ports );
734 736
 		if ( psic ) {
@@ -805,8 +807,8 @@ static int xhci_port_speed ( struct xhci_device *xhci, unsigned int port,
805 807
 		case XHCI_SPEED_HIGH :	return USB_SPEED_HIGH;
806 808
 		case XHCI_SPEED_SUPER :	return USB_SPEED_SUPER;
807 809
 		default:
808
-			DBGC ( xhci, "XHCI %p port %d non-standard PSI value "
809
-			       "%d\n", xhci, port, psiv );
810
+			DBGC ( xhci, "XHCI %s-%d non-standard PSI value %d\n",
811
+			       xhci->name, port, psiv );
810 812
 			return -ENOTSUP;
811 813
 		}
812 814
 	}
@@ -822,8 +824,8 @@ static int xhci_port_speed ( struct xhci_device *xhci, unsigned int port,
822 824
 		}
823 825
 	}
824 826
 
825
-	DBGC ( xhci, "XHCI %p port %d spurious PSI value %d\n",
826
-	       xhci, port, psiv );
827
+	DBGC ( xhci, "XHCI %s-%d spurious PSI value %d\n",
828
+	       xhci->name, port, psiv );
827 829
 	return -ENOENT;
828 830
 }
829 831
 
@@ -862,8 +864,8 @@ static int xhci_port_psiv ( struct xhci_device *xhci, unsigned int port,
862 864
 		case USB_SPEED_HIGH :	return XHCI_SPEED_HIGH;
863 865
 		case USB_SPEED_SUPER :	return XHCI_SPEED_SUPER;
864 866
 		default:
865
-			DBGC ( xhci, "XHCI %p port %d non-standad speed %d\n",
866
-			       xhci, port, speed );
867
+			DBGC ( xhci, "XHCI %s-%d non-standad speed %d\n",
868
+			       xhci->name, port, speed );
867 869
 			return -ENOTSUP;
868 870
 		}
869 871
 	}
@@ -879,8 +881,8 @@ static int xhci_port_psiv ( struct xhci_device *xhci, unsigned int port,
879 881
 		}
880 882
 	}
881 883
 
882
-	DBGC ( xhci, "XHCI %p port %d unrepresentable speed %#x\n",
883
-	       xhci, port, speed );
884
+	DBGC ( xhci, "XHCI %s-%d unrepresentable speed %#x\n",
885
+	       xhci->name, port, speed );
884 886
 	return -ENOENT;
885 887
 }
886 888
 
@@ -910,7 +912,7 @@ static int xhci_dcbaa_alloc ( struct xhci_device *xhci ) {
910 912
 	len = ( ( xhci->slots + 1 ) * sizeof ( xhci->dcbaa[0] ) );
911 913
 	xhci->dcbaa = malloc_dma ( len, xhci_align ( len ) );
912 914
 	if ( ! xhci->dcbaa ) {
913
-		DBGC ( xhci, "XHCI %p could not allocate DCBAA\n", xhci );
915
+		DBGC ( xhci, "XHCI %s could not allocate DCBAA\n", xhci->name );
914 916
 		rc = -ENOMEM;
915 917
 		goto err_alloc;
916 918
 	}
@@ -922,8 +924,8 @@ static int xhci_dcbaa_alloc ( struct xhci_device *xhci ) {
922 924
 				  xhci->op + XHCI_OP_DCBAAP ) ) != 0 )
923 925
 		goto err_writeq;
924 926
 
925
-	DBGC2 ( xhci, "XHCI %p DCBAA at [%08lx,%08lx)\n",
926
-		xhci, dcbaap, ( dcbaap + len ) );
927
+	DBGC2 ( xhci, "XHCI %s DCBAA at [%08lx,%08lx)\n",
928
+		xhci->name, dcbaap, ( dcbaap + len ) );
927 929
 	return 0;
928 930
 
929 931
  err_writeq:
@@ -981,8 +983,8 @@ static int xhci_scratchpad_alloc ( struct xhci_device *xhci ) {
981 983
 	len = ( xhci->scratchpads * xhci->pagesize );
982 984
 	xhci->scratchpad = umalloc ( len );
983 985
 	if ( ! xhci->scratchpad ) {
984
-		DBGC ( xhci, "XHCI %p could not allocate scratchpad buffers\n",
985
-		       xhci );
986
+		DBGC ( xhci, "XHCI %s could not allocate scratchpad buffers\n",
987
+		       xhci->name );
986 988
 		rc = -ENOMEM;
987 989
 		goto err_alloc;
988 990
 	}
@@ -993,8 +995,8 @@ static int xhci_scratchpad_alloc ( struct xhci_device *xhci ) {
993 995
 	xhci->scratchpad_array =
994 996
 		malloc_dma ( array_len, xhci_align ( array_len ) );
995 997
 	if ( ! xhci->scratchpad_array ) {
996
-		DBGC ( xhci, "XHCI %p could not allocate scratchpad buffer "
997
-		       "array\n", xhci );
998
+		DBGC ( xhci, "XHCI %s could not allocate scratchpad buffer "
999
+		       "array\n", xhci->name );
998 1000
 		rc = -ENOMEM;
999 1001
 		goto err_alloc_array;
1000 1002
 	}
@@ -1009,8 +1011,8 @@ static int xhci_scratchpad_alloc ( struct xhci_device *xhci ) {
1009 1011
 	assert ( xhci->dcbaa != NULL );
1010 1012
 	xhci->dcbaa[0] = cpu_to_le64 ( virt_to_phys ( xhci->scratchpad_array ));
1011 1013
 
1012
-	DBGC2 ( xhci, "XHCI %p scratchpad [%08lx,%08lx) array [%08lx,%08lx)\n",
1013
-		xhci, user_to_phys ( xhci->scratchpad, 0 ),
1014
+	DBGC2 ( xhci, "XHCI %s scratchpad [%08lx,%08lx) array [%08lx,%08lx)\n",
1015
+		xhci->name, user_to_phys ( xhci->scratchpad, 0 ),
1014 1016
 		user_to_phys ( xhci->scratchpad, len ),
1015 1017
 		virt_to_phys ( xhci->scratchpad_array ),
1016 1018
 		( virt_to_phys ( xhci->scratchpad_array ) + array_len ) );
@@ -1103,7 +1105,7 @@ static int xhci_stop ( struct xhci_device *xhci ) {
1103 1105
 		mdelay ( 1 );
1104 1106
 	}
1105 1107
 
1106
-	DBGC ( xhci, "XHCI %p timed out waiting for stop\n", xhci );
1108
+	DBGC ( xhci, "XHCI %s timed out waiting for stop\n", xhci->name );
1107 1109
 	return -ETIMEDOUT;
1108 1110
 }
1109 1111
 
@@ -1141,7 +1143,7 @@ static int xhci_reset ( struct xhci_device *xhci ) {
1141 1143
 		mdelay ( 1 );
1142 1144
 	}
1143 1145
 
1144
-	DBGC ( xhci, "XHCI %p timed out waiting for reset\n", xhci );
1146
+	DBGC ( xhci, "XHCI %s timed out waiting for reset\n", xhci->name );
1145 1147
 	return -ETIMEDOUT;
1146 1148
 }
1147 1149
 
@@ -1416,8 +1418,8 @@ static int xhci_command_alloc ( struct xhci_device *xhci ) {
1416 1418
 				  xhci->op + XHCI_OP_CRCR ) ) != 0 )
1417 1419
 		goto err_writeq;
1418 1420
 
1419
-	DBGC2 ( xhci, "XHCI %p CRCR at [%08lx,%08lx)\n",
1420
-		xhci, crp, ( crp + xhci->command.len ) );
1421
+	DBGC2 ( xhci, "XHCI %s CRCR at [%08lx,%08lx)\n",
1422
+		xhci->name, crp, ( crp + xhci->command.len ) );
1421 1423
 	return 0;
1422 1424
 
1423 1425
  err_writeq:
@@ -1485,8 +1487,8 @@ static int xhci_event_alloc ( struct xhci_device *xhci ) {
1485 1487
 				  xhci->run + XHCI_RUN_ERSTBA ( 0 ) ) ) != 0 )
1486 1488
 		goto err_writeq_erstba;
1487 1489
 
1488
-	DBGC2 ( xhci, "XHCI %p event ring [%08lx,%08lx) table [%08lx,%08lx)\n",
1489
-		xhci, virt_to_phys ( event->trb ),
1490
+	DBGC2 ( xhci, "XHCI %s event ring [%08lx,%08lx) table [%08lx,%08lx)\n",
1491
+		xhci->name, virt_to_phys ( event->trb ),
1490 1492
 		( virt_to_phys ( event->trb ) + len ),
1491 1493
 		virt_to_phys ( event->segment ),
1492 1494
 		( virt_to_phys ( event->segment ) +
@@ -1547,8 +1549,8 @@ static void xhci_transfer ( struct xhci_device *xhci,
1547 1549
 	/* Identify slot */
1548 1550
 	if ( ( trb->slot > xhci->slots ) ||
1549 1551
 	     ( ( slot = xhci->slot[trb->slot] ) == NULL ) ) {
1550
-		DBGC ( xhci, "XHCI %p transfer event invalid slot %d:\n",
1551
-		       xhci, trb->slot );
1552
+		DBGC ( xhci, "XHCI %s transfer event invalid slot %d:\n",
1553
+		       xhci->name, trb->slot );
1552 1554
 		DBGC_HDA ( xhci, 0, trb, sizeof ( *trb ) );
1553 1555
 		return;
1554 1556
 	}
@@ -1556,8 +1558,8 @@ static void xhci_transfer ( struct xhci_device *xhci,
1556 1558
 	/* Identify endpoint */
1557 1559
 	if ( ( trb->endpoint > XHCI_CTX_END ) ||
1558 1560
 	     ( ( endpoint = slot->endpoint[trb->endpoint] ) == NULL ) ) {
1559
-		DBGC ( xhci, "XHCI %p slot %d transfer event invalid epid "
1560
-		       "%d:\n", xhci, slot->id, trb->endpoint );
1561
+		DBGC ( xhci, "XHCI %s slot %d transfer event invalid epid "
1562
+		       "%d:\n", xhci->name, slot->id, trb->endpoint );
1561 1563
 		DBGC_HDA ( xhci, 0, trb, sizeof ( *trb ) );
1562 1564
 		return;
1563 1565
 	}
@@ -1572,8 +1574,8 @@ static void xhci_transfer ( struct xhci_device *xhci,
1572 1574
 
1573 1575
 		/* Construct error */
1574 1576
 		rc = -ECODE ( trb->code );
1575
-		DBGC ( xhci, "XHCI %p slot %d ctx %d failed (code %d): %s\n",
1576
-		       xhci, slot->id, endpoint->ctx, trb->code,
1577
+		DBGC ( xhci, "XHCI %s slot %d ctx %d failed (code %d): %s\n",
1578
+		       xhci->name, slot->id, endpoint->ctx, trb->code,
1577 1579
 		       strerror ( rc ) );
1578 1580
 		DBGC_HDA ( xhci, 0, trb, sizeof ( *trb ) );
1579 1581
 
@@ -1610,15 +1612,15 @@ static void xhci_complete ( struct xhci_device *xhci,
1610 1612
 
1611 1613
 	/* Ignore "command ring stopped" notifications */
1612 1614
 	if ( trb->code == XHCI_CMPLT_CMD_STOPPED ) {
1613
-		DBGC2 ( xhci, "XHCI %p command ring stopped\n", xhci );
1615
+		DBGC2 ( xhci, "XHCI %s command ring stopped\n", xhci->name );
1614 1616
 		return;
1615 1617
 	}
1616 1618
 
1617 1619
 	/* Ignore unexpected completions */
1618 1620
 	if ( ! xhci->pending ) {
1619 1621
 		rc = -ECODE ( trb->code );
1620
-		DBGC ( xhci, "XHCI %p unexpected completion (code %d): %s\n",
1621
-		       xhci, trb->code, strerror ( rc ) );
1622
+		DBGC ( xhci, "XHCI %s unexpected completion (code %d): %s\n",
1623
+		       xhci->name, trb->code, strerror ( rc ) );
1622 1624
 		DBGC_HDA ( xhci, 0, trb, sizeof ( *trb ) );
1623 1625
 		return;
1624 1626
 	}
@@ -1671,8 +1673,8 @@ static void xhci_host_controller ( struct xhci_device *xhci,
1671 1673
 
1672 1674
 	/* Construct error */
1673 1675
 	rc = -ECODE ( trb->code );
1674
-	DBGC ( xhci, "XHCI %p host controller event (code %d): %s\n",
1675
-	       xhci, trb->code, strerror ( rc ) );
1676
+	DBGC ( xhci, "XHCI %s host controller event (code %d): %s\n",
1677
+	       xhci->name, trb->code, strerror ( rc ) );
1676 1678
 }
1677 1679
 
1678 1680
 /**
@@ -1721,8 +1723,8 @@ static void xhci_event_poll ( struct xhci_device *xhci ) {
1721 1723
 			break;
1722 1724
 
1723 1725
 		default:
1724
-			DBGC ( xhci, "XHCI %p unrecognised event %#x\n:",
1725
-			       xhci, event->cons );
1726
+			DBGC ( xhci, "XHCI %s unrecognised event %#x\n:",
1727
+			       xhci->name, event->cons );
1726 1728
 			DBGC_HDA ( xhci, virt_to_phys ( trb ),
1727 1729
 				   trb, sizeof ( *trb ) );
1728 1730
 			break;
@@ -1749,7 +1751,7 @@ static void xhci_abort ( struct xhci_device *xhci ) {
1749 1751
 	physaddr_t crp;
1750 1752
 
1751 1753
 	/* Abort the command */
1752
-	DBGC2 ( xhci, "XHCI %p aborting command\n", xhci );
1754
+	DBGC2 ( xhci, "XHCI %s aborting command\n", xhci->name );
1753 1755
 	xhci_writeq ( xhci, XHCI_CRCR_CA, xhci->op + XHCI_OP_CRCR );
1754 1756
 
1755 1757
 	/* Allow time for command to abort */
@@ -1802,8 +1804,8 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
1802 1804
 		if ( ! xhci->pending ) {
1803 1805
 			if ( complete->code != XHCI_CMPLT_SUCCESS ) {
1804 1806
 				rc = -ECODE ( complete->code );
1805
-				DBGC ( xhci, "XHCI %p command failed (code "
1806
-				       "%d): %s\n", xhci, complete->code,
1807
+				DBGC ( xhci, "XHCI %s command failed (code "
1808
+				       "%d): %s\n", xhci->name, complete->code,
1807 1809
 				       strerror ( rc ) );
1808 1810
 				DBGC_HDA ( xhci, 0, trb, sizeof ( *trb ) );
1809 1811
 				return rc;
@@ -1816,7 +1818,7 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
1816 1818
 	}
1817 1819
 
1818 1820
 	/* Timeout */
1819
-	DBGC ( xhci, "XHCI %p timed out waiting for completion\n", xhci );
1821
+	DBGC ( xhci, "XHCI %s timed out waiting for completion\n", xhci->name );
1820 1822
 	rc = -ETIMEDOUT;
1821 1823
 
1822 1824
 	/* Abort command */
@@ -1872,15 +1874,15 @@ static inline int xhci_enable_slot ( struct xhci_device *xhci,
1872 1874
 
1873 1875
 	/* Issue command and wait for completion */
1874 1876
 	if ( ( rc = xhci_command ( xhci, &trb ) ) != 0 ) {
1875
-		DBGC ( xhci, "XHCI %p could not enable new slot: %s\n",
1876
-		       xhci, strerror ( rc ) );
1877
+		DBGC ( xhci, "XHCI %s could not enable new slot: %s\n",
1878
+		       xhci->name, strerror ( rc ) );
1877 1879
 		return rc;
1878 1880
 	}
1879 1881
 
1880 1882
 	/* Extract slot number */
1881 1883
 	slot = enabled->slot;
1882 1884
 
1883
-	DBGC2 ( xhci, "XHCI %p slot %d enabled\n", xhci, slot );
1885
+	DBGC2 ( xhci, "XHCI %s slot %d enabled\n", xhci->name, slot );
1884 1886
 	return slot;
1885 1887
 }
1886 1888
 
@@ -1904,12 +1906,12 @@ static inline int xhci_disable_slot ( struct xhci_device *xhci,
1904 1906
 
1905 1907
 	/* Issue command and wait for completion */
1906 1908
 	if ( ( rc = xhci_command ( xhci, &trb ) ) != 0 ) {
1907
-		DBGC ( xhci, "XHCI %p could not disable slot %d: %s\n",
1908
-		       xhci, slot, strerror ( rc ) );
1909
+		DBGC ( xhci, "XHCI %s could not disable slot %d: %s\n",
1910
+		       xhci->name, slot, strerror ( rc ) );
1909 1911
 		return rc;
1910 1912
 	}
1911 1913
 
1912
-	DBGC2 ( xhci, "XHCI %p slot %d disabled\n", xhci, slot );
1914
+	DBGC2 ( xhci, "XHCI %s slot %d disabled\n", xhci->name, slot );
1913 1915
 	return 0;
1914 1916
 }
1915 1917
 
@@ -2028,8 +2030,8 @@ static inline int xhci_address_device ( struct xhci_device *xhci,
2028 2030
 	slot_ctx = ( slot->context +
2029 2031
 		     xhci_device_context_offset ( xhci, XHCI_CTX_SLOT ) );
2030 2032
 	usb->address = slot_ctx->address;
2031
-	DBGC2 ( xhci, "XHCI %p assigned address %d to %s\n",
2032
-		xhci, usb->address, usb->name );
2033
+	DBGC2 ( xhci, "XHCI %s assigned address %d to %s\n",
2034
+		xhci->name, usb->address, usb->name );
2033 2035
 
2034 2036
 	return 0;
2035 2037
 }
@@ -2092,8 +2094,8 @@ static inline int xhci_configure_endpoint ( struct xhci_device *xhci,
2092 2094
 				   xhci_configure_endpoint_input ) ) != 0 )
2093 2095
 		return rc;
2094 2096
 
2095
-	DBGC2 ( xhci, "XHCI %p slot %d ctx %d configured\n",
2096
-		xhci, slot->id, endpoint->ctx );
2097
+	DBGC2 ( xhci, "XHCI %s slot %d ctx %d configured\n",
2098
+		xhci->name, slot->id, endpoint->ctx );
2097 2099
 	return 0;
2098 2100
 }
2099 2101
 
@@ -2143,8 +2145,8 @@ static inline int xhci_deconfigure_endpoint ( struct xhci_device *xhci,
2143 2145
 				   xhci_deconfigure_endpoint_input ) ) != 0 )
2144 2146
 		return rc;
2145 2147
 
2146
-	DBGC2 ( xhci, "XHCI %p slot %d ctx %d deconfigured\n",
2147
-		xhci, slot->id, endpoint->ctx );
2148
+	DBGC2 ( xhci, "XHCI %s slot %d ctx %d deconfigured\n",
2149
+		xhci->name, slot->id, endpoint->ctx );
2148 2150
 	return 0;
2149 2151
 }
2150 2152
 
@@ -2198,8 +2200,8 @@ static inline int xhci_evaluate_context ( struct xhci_device *xhci,
2198 2200
 				   xhci_evaluate_context_input ) ) != 0 )
2199 2201
 		return rc;
2200 2202
 
2201
-	DBGC2 ( xhci, "XHCI %p slot %d ctx %d (re-)evaluated\n",
2202
-		xhci, slot->id, endpoint->ctx );
2203
+	DBGC2 ( xhci, "XHCI %s slot %d ctx %d (re-)evaluated\n",
2204
+		xhci->name, slot->id, endpoint->ctx );
2203 2205
 	return 0;
2204 2206
 }
2205 2207
 
@@ -2226,8 +2228,8 @@ static inline int xhci_reset_endpoint ( struct xhci_device *xhci,
2226 2228
 
2227 2229
 	/* Issue command and wait for completion */
2228 2230
 	if ( ( rc = xhci_command ( xhci, &trb ) ) != 0 ) {
2229
-		DBGC ( xhci, "XHCI %p slot %d ctx %d could not reset endpoint "
2230
-		       "in state %d: %s\n", xhci, slot->id, endpoint->ctx,
2231
+		DBGC ( xhci, "XHCI %s slot %d ctx %d could not reset endpoint "
2232
+		       "in state %d: %s\n", xhci->name, slot->id, endpoint->ctx,
2231 2233
 		       endpoint->context->state, strerror ( rc ) );
2232 2234
 		return rc;
2233 2235
 	}
@@ -2258,8 +2260,8 @@ static inline int xhci_stop_endpoint ( struct xhci_device *xhci,
2258 2260
 
2259 2261
 	/* Issue command and wait for completion */
2260 2262
 	if ( ( rc = xhci_command ( xhci, &trb ) ) != 0 ) {
2261
-		DBGC ( xhci, "XHCI %p slot %d ctx %d could not stop endpoint "
2262
-		       "in state %d: %s\n", xhci, slot->id, endpoint->ctx,
2263
+		DBGC ( xhci, "XHCI %s slot %d ctx %d could not stop endpoint "
2264
+		       "in state %d: %s\n", xhci->name, slot->id, endpoint->ctx,
2263 2265
 		       endpoint->context->state, strerror ( rc ) );
2264 2266
 		return rc;
2265 2267
 	}
@@ -2302,8 +2304,8 @@ xhci_set_tr_dequeue_pointer ( struct xhci_device *xhci,
2302 2304
 
2303 2305
 	/* Issue command and wait for completion */
2304 2306
 	if ( ( rc = xhci_command ( xhci, &trb ) ) != 0 ) {
2305
-		DBGC ( xhci, "XHCI %p slot %d ctx %d could not set TR dequeue "
2306
-		       "pointer in state %d: %s\n", xhci, slot->id,
2307
+		DBGC ( xhci, "XHCI %s slot %d ctx %d could not set TR dequeue "
2308
+		       "pointer in state %d: %s\n", xhci->name, slot->id,
2307 2309
 		       endpoint->ctx, endpoint->context->state, strerror ( rc));
2308 2310
 		return rc;
2309 2311
 	}
@@ -2380,8 +2382,8 @@ static int xhci_endpoint_open ( struct usb_endpoint *ep ) {
2380 2382
 	     ( ( rc = xhci_configure_endpoint ( xhci, slot, endpoint ) ) != 0 ))
2381 2383
 		goto err_configure_endpoint;
2382 2384
 
2383
-	DBGC2 ( xhci, "XHCI %p slot %d ctx %d ring [%08lx,%08lx)\n",
2384
-		xhci, slot->id, ctx, virt_to_phys ( endpoint->ring.trb ),
2385
+	DBGC2 ( xhci, "XHCI %s slot %d ctx %d ring [%08lx,%08lx)\n",
2386
+		xhci->name, slot->id, ctx, virt_to_phys ( endpoint->ring.trb ),
2385 2387
 		( virt_to_phys ( endpoint->ring.trb ) + endpoint->ring.len ) );
2386 2388
 	return 0;
2387 2389
 
@@ -2446,8 +2448,8 @@ static int xhci_endpoint_reset ( struct usb_endpoint *ep ) {
2446 2448
 	/* Ring doorbell to resume processing */
2447 2449
 	xhci_doorbell ( &endpoint->ring );
2448 2450
 
2449
-	DBGC ( xhci, "XHCI %p slot %d ctx %d reset\n",
2450
-	       xhci, slot->id, endpoint->ctx );
2451
+	DBGC ( xhci, "XHCI %s slot %d ctx %d reset\n",
2452
+	       xhci->name, slot->id, endpoint->ctx );
2451 2453
 	return 0;
2452 2454
 }
2453 2455
 
@@ -2609,8 +2611,8 @@ static int xhci_device_open ( struct usb_device *usb ) {
2609 2611
 	type = xhci_port_slot_type ( xhci, usb->port->address );
2610 2612
 	if ( type < 0 ) {
2611 2613
 		rc = type;
2612
-		DBGC ( xhci, "XHCI %p port %d has no slot type\n",
2613
-		       xhci, usb->port->address );
2614
+		DBGC ( xhci, "XHCI %s-%d has no slot type\n",
2615
+		       xhci->name, usb->port->address );
2614 2616
 		goto err_type;
2615 2617
 	}
2616 2618
 
@@ -2652,8 +2654,8 @@ static int xhci_device_open ( struct usb_device *usb ) {
2652 2654
 	assert ( xhci->dcbaa[id] == 0 );
2653 2655
 	xhci->dcbaa[id] = cpu_to_le64 ( virt_to_phys ( slot->context ) );
2654 2656
 
2655
-	DBGC2 ( xhci, "XHCI %p slot %d device context [%08lx,%08lx) for %s\n",
2656
-		xhci, slot->id, virt_to_phys ( slot->context ),
2657
+	DBGC2 ( xhci, "XHCI %s slot %d device context [%08lx,%08lx) for %s\n",
2658
+		xhci->name, slot->id, virt_to_phys ( slot->context ),
2657 2659
 		( virt_to_phys ( slot->context ) + len ), usb->name );
2658 2660
 	return 0;
2659 2661
 
@@ -2691,8 +2693,8 @@ static void xhci_device_close ( struct usb_device *usb ) {
2691 2693
 		 * has been re-enabled, then some assertions will be
2692 2694
 		 * triggered.
2693 2695
 		 */
2694
-		DBGC ( xhci, "XHCI %p slot %d leaking context memory\n",
2695
-		      xhci, slot->id );
2696
+		DBGC ( xhci, "XHCI %s slot %d leaking context memory\n",
2697
+		       xhci->name, slot->id );
2696 2698
 		slot->context = NULL;
2697 2699
 	}
2698 2700
 
@@ -2978,8 +2980,8 @@ static int xhci_root_enable ( struct usb_hub *hub, struct usb_port *port ) {
2978 2980
 		mdelay ( 1 );
2979 2981
 	}
2980 2982
 
2981
-	DBGC ( xhci, "XHCI %p timed out waiting for port %d to enable\n",
2982
-	       xhci, port->address );
2983
+	DBGC ( xhci, "XHCI %s-%d timed out waiting for port to enable\n",
2984
+	       xhci->name, port->address );
2983 2985
 	return -ETIMEDOUT;
2984 2986
 }
2985 2987
 
@@ -3022,8 +3024,8 @@ static int xhci_root_speed ( struct usb_hub *hub, struct usb_port *port ) {
3022 3024
 
3023 3025
 	/* Read port status */
3024 3026
 	portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port->address ) );
3025
-	DBGC2 ( xhci, "XHCI %p port %d status is %08x\n",
3026
-		xhci, port->address, portsc );
3027
+	DBGC2 ( xhci, "XHCI %s-%d status is %08x\n",
3028
+		xhci->name, port->address, portsc );
3027 3029
 	ccs = ( portsc & XHCI_PORTSC_CCS );
3028 3030
 	ped = ( portsc & XHCI_PORTSC_PED );
3029 3031
 	csc = ( portsc & XHCI_PORTSC_CSC );
@@ -3069,11 +3071,11 @@ static int xhci_root_speed ( struct usb_hub *hub, struct usb_port *port ) {
3069 3071
  */
3070 3072
 static int xhci_root_clear_tt ( struct usb_hub *hub, struct usb_port *port,
3071 3073
 				struct usb_endpoint *ep ) {
3072
-	struct ehci_device *ehci = usb_hub_get_drvdata ( hub );
3074
+	struct xhci_device *xhci = usb_hub_get_drvdata ( hub );
3073 3075
 
3074 3076
 	/* Should never be called; this is a root hub */
3075
-	DBGC ( ehci, "XHCI %p port %d nonsensical CLEAR_TT for %s endpoint "
3076
-	       "%02x\n", ehci, port->address, ep->usb->name, ep->address );
3077
+	DBGC ( xhci, "XHCI %s-%d nonsensical CLEAR_TT for %s %s\n", xhci->name,
3078
+	       port->address, ep->usb->name, usb_endpoint_name ( ep ) );
3077 3079
 
3078 3080
 	return -ENOTSUP;
3079 3081
 }
@@ -3138,8 +3140,8 @@ static void xhci_pch_fix ( struct xhci_device *xhci, struct pci_device *pci ) {
3138 3140
 	pci_read_config_dword ( pci, XHCI_PCH_USB3PSSEN, &usb3pssen );
3139 3141
 	pci_read_config_dword ( pci, XHCI_PCH_USB3PRM, &usb3prm );
3140 3142
 	if ( usb3prm & ~usb3pssen ) {
3141
-		DBGC ( xhci, "XHCI %p enabling SuperSpeed on ports %08x\n",
3142
-		       xhci, ( usb3prm & ~usb3pssen ) );
3143
+		DBGC ( xhci, "XHCI %s enabling SuperSpeed on ports %08x\n",
3144
+		       xhci->name, ( usb3prm & ~usb3pssen ) );
3143 3145
 	}
3144 3146
 	pch->usb3pssen = usb3pssen;
3145 3147
 	usb3pssen |= usb3prm;
@@ -3149,8 +3151,8 @@ static void xhci_pch_fix ( struct xhci_device *xhci, struct pci_device *pci ) {
3149 3151
 	pci_read_config_dword ( pci, XHCI_PCH_XUSB2PR, &xusb2pr );
3150 3152
 	pci_read_config_dword ( pci, XHCI_PCH_XUSB2PRM, &xusb2prm );
3151 3153
 	if ( xusb2prm & ~xusb2pr ) {
3152
-		DBGC ( xhci, "XHCI %p routing ports %08x from EHCI to xHCI\n",
3153
-		       xhci, ( xusb2prm & ~xusb2pr ) );
3154
+		DBGC ( xhci, "XHCI %s routing ports %08x from EHCI to xHCI\n",
3155
+		       xhci->name, ( xusb2prm & ~xusb2pr ) );
3154 3156
 	}
3155 3157
 	pch->xusb2pr = xusb2pr;
3156 3158
 	xusb2pr |= xusb2prm;
@@ -3193,6 +3195,7 @@ static int xhci_probe ( struct pci_device *pci ) {
3193 3195
 		rc = -ENOMEM;
3194 3196
 		goto err_alloc;
3195 3197
 	}
3198
+	xhci->name = pci->dev.name;
3196 3199
 
3197 3200
 	/* Fix up PCI device */
3198 3201
 	adjust_pci_device ( pci );

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

@@ -1036,6 +1036,8 @@ struct xhci_pch {
1036 1036
 struct xhci_device {
1037 1037
 	/** Registers */
1038 1038
 	void *regs;
1039
+	/** Name */
1040
+	const char *name;
1039 1041
 
1040 1042
 	/** Capability registers */
1041 1043
 	void *cap;

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