diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c index d07154f82..889ddd83f 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c @@ -2757,12 +2757,21 @@ static void xhci_transfer ( struct xhci_host *xhci, */ static void xhci_complete ( struct xhci_host *xhci, struct xhci_trb_complete *trb ) { - int rc; - union xhci_trb *cmd_trb = (void *)(uintptr_t)(trb->command); - struct xhci_ring *cmd_ring = XHCI_RING(cmd_trb); /* to align addr is ring base */ - union xhci_trb *pending = &cmd_ring->evt; /* preserve event trb pending to handle */ - uint32_t eidx = cmd_trb - cmd_ring->ring + 1; /* calculate current evt trb index */ - struct xhci_endpoint *work_pipe = xhci->cur_cmd_pipe; + int rc; + union xhci_trb *cmd_trb; + struct xhci_ring *cmd_ring; + union xhci_trb *pending; + uint32_t eidx; + struct xhci_endpoint *work_pipe; + uintptr_t vir_addr; + + vir_addr = usb_mem_page_phy2vir(trb->command); + + cmd_trb = (void *)(uintptr_t)(vir_addr); + cmd_ring = XHCI_RING(cmd_trb); /* to align addr is ring base */ + pending = &cmd_ring->evt; /* preserve event trb pending to handle */ + eidx = cmd_trb - cmd_ring->ring + 1; /* calculate current evt trb index */ + work_pipe = xhci->cur_cmd_pipe; /* Ignore "command ring stopped" notifications */ if ( trb->code == XHCI_CMPLT_CMD_STOPPED ) {