瀏覽代碼

[usb] Report xHCI host controller events

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 年之前
父節點
當前提交
66048e3214
共有 2 個文件被更改,包括 41 次插入0 次删除
  1. 20
    0
      src/drivers/usb/xhci.c
  2. 21
    0
      src/drivers/usb/xhci.h

+ 20
- 0
src/drivers/usb/xhci.c 查看文件

@@ -1615,6 +1615,22 @@ static void xhci_port_status ( struct xhci_device *xhci,
1615 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 1635
  * Poll event ring
1620 1636
  *
@@ -1656,6 +1672,10 @@ static void xhci_event_poll ( struct xhci_device *xhci ) {
1656 1672
 			xhci_port_status ( xhci, &trb->port );
1657 1673
 			break;
1658 1674
 
1675
+		case XHCI_TRB_HOST_CONTROLLER:
1676
+			xhci_host_controller ( xhci, &trb->host );
1677
+			break;
1678
+
1659 1679
 		default:
1660 1680
 			DBGC ( xhci, "XHCI %p unrecognised event %#x\n:",
1661 1681
 			       xhci, event->cons );

+ 21
- 0
src/drivers/usb/xhci.h 查看文件

@@ -649,6 +649,25 @@ struct xhci_trb_port_status {
649 649
 /** A port status change transfer request block */
650 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 671
 /** A transfer request block */
653 672
 union xhci_trb {
654 673
 	/** Template */
@@ -683,6 +702,8 @@ union xhci_trb {
683 702
 	struct xhci_trb_complete complete;
684 703
 	/** Port status changed event */
685 704
 	struct xhci_trb_port_status port;
705
+	/** Host controller event */
706
+	struct xhci_trb_host_controller host;
686 707
 } __attribute__ (( packed ));
687 708
 
688 709
 /** An input control context */

Loading…
取消
儲存