From 0b02ace561f4910559cd932e2b95c971241bb58f Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 4 Apr 2024 19:42:38 -0400 Subject: kernel: xhci: Improve documentation Signed-off-by: Ian Moffett --- sys/dev/usb/xhci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 2550768..26e155c 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -121,7 +121,15 @@ xhci_submit_cmd(struct xhci_hc *hc, struct xhci_trb trb) *cmd_db = 0; if (hc->cmd_count >= XHCI_CMDRING_LEN - 1) { - /* Create raw link TRB and ring the doorbell */ + /* + * Create raw link TRB and ring the doorbell. We want the + * xHC to flip its cycle bit so it doesn't confuse existing + * entries (that we'll overwrite) in the ring with current + * entries, so we set the Toggle Cycle bit. + * + * See the xHCI spec, section 6.4.4.1 for information regarding + * the format of link TRBs. + */ hc->cmd_ring[hc->cmd_ptr++] = VIRT_TO_PHYS(hc->cmd_ring) & 0xFFFFFFFF; hc->cmd_ring[hc->cmd_ptr++] = VIRT_TO_PHYS(hc->cmd_ring) >> 32; hc->cmd_ring[hc->cmd_ptr++] = 0; -- cgit v1.2.3