Browse Source

[usb] Report xHCI host controller events

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
66048e3214
2 changed files with 41 additions and 0 deletions
  1. 20
    0
      src/drivers/usb/xhci.c
  2. 21
    0
      src/drivers/usb/xhci.h

+ 20
- 0
src/drivers/usb/xhci.c View File

1615
 	usb_port_changed ( usb_port ( xhci->bus->hub, port->port ) );
1615
 	usb_port_changed ( usb_port ( xhci->bus->hub, port->port ) );
1616
 }
1616
 }
1617
 
1617
 
1618
+/**
1619
+ * Handle host controller event
1620
+ *
1621
+ * @v xhci		xHCI device
1622
+ * @v host		Host controller event
1623
+ */
1624
+static void xhci_host_controller ( struct xhci_device *xhci,
1625
+				   struct xhci_trb_host_controller *host ) {
1626
+	int rc;
1627
+
1628
+	/* Construct error */
1629
+	rc = -ECODE ( host->code );
1630
+	DBGC ( xhci, "XHCI %p host controller event (code %d): %s\n",
1631
+	       xhci, host->code, strerror ( rc ) );
1632
+}
1633
+
1618
 /**
1634
 /**
1619
  * Poll event ring
1635
  * Poll event ring
1620
  *
1636
  *
1656
 			xhci_port_status ( xhci, &trb->port );
1672
 			xhci_port_status ( xhci, &trb->port );
1657
 			break;
1673
 			break;
1658
 
1674
 
1675
+		case XHCI_TRB_HOST_CONTROLLER:
1676
+			xhci_host_controller ( xhci, &trb->host );
1677
+			break;
1678
+
1659
 		default:
1679
 		default:
1660
 			DBGC ( xhci, "XHCI %p unrecognised event %#x\n:",
1680
 			DBGC ( xhci, "XHCI %p unrecognised event %#x\n:",
1661
 			       xhci, event->cons );
1681
 			       xhci, event->cons );

+ 21
- 0
src/drivers/usb/xhci.h View File

649
 /** A port status change transfer request block */
649
 /** A port status change transfer request block */
650
 #define XHCI_TRB_PORT_STATUS XHCI_TRB_TYPE ( 34 )
650
 #define XHCI_TRB_PORT_STATUS XHCI_TRB_TYPE ( 34 )
651
 
651
 
652
+/** A port status change transfer request block */
653
+struct xhci_trb_host_controller {
654
+	/** Reserved */
655
+	uint64_t reserved_a;
656
+	/** Reserved */
657
+	uint8_t reserved_b[3];
658
+	/** Completion code */
659
+	uint8_t code;
660
+	/** Flags */
661
+	uint8_t flags;
662
+	/** Type */
663
+	uint8_t type;
664
+	/** Reserved */
665
+	uint16_t reserved_c;
666
+} __attribute__ (( packed ));
667
+
668
+/** A port status change transfer request block */
669
+#define XHCI_TRB_HOST_CONTROLLER XHCI_TRB_TYPE ( 37 )
670
+
652
 /** A transfer request block */
671
 /** A transfer request block */
653
 union xhci_trb {
672
 union xhci_trb {
654
 	/** Template */
673
 	/** Template */
683
 	struct xhci_trb_complete complete;
702
 	struct xhci_trb_complete complete;
684
 	/** Port status changed event */
703
 	/** Port status changed event */
685
 	struct xhci_trb_port_status port;
704
 	struct xhci_trb_port_status port;
705
+	/** Host controller event */
706
+	struct xhci_trb_host_controller host;
686
 } __attribute__ (( packed ));
707
 } __attribute__ (( packed ));
687
 
708
 
688
 /** An input control context */
709
 /** An input control context */

Loading…
Cancel
Save