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 fae28bd33..5dec2e413 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 @@ -2712,24 +2712,25 @@ static void xhci_transfer ( struct xhci_host *xhci, struct xhci_trb_transfer *trb ) { struct xhci_slot *slot; struct xhci_endpoint *endpoint; - uintptr_t vir_addr; + uintptr_t vir_addr, phy_addr; union xhci_trb *trans_trb; struct xhci_ring *trans_ring; union xhci_trb *pending; uint32_t eidx; int rc; - vir_addr = usb_mem_data_page_phy2vir(trb->transfer); + phy_addr = (trb->transfer & ~(XHCI_RING_SIZE-1)); + vir_addr = usb_mem_data_page_phy2vir(phy_addr); #if 0 if(!vir_addr) return; #endif - trans_trb = (void *)(uintptr_t)(vir_addr); - trans_ring = XHCI_RING(trans_trb); /* to align addr is ring base */ +// trans_trb = trb->transfer; + trans_ring = (struct xhci_ring *)(vir_addr); /* to align addr is ring base */ pending = &trans_ring->evt; /* preserve event trb pending to handle */ - eidx = trans_trb - trans_ring->ring + 1; /* calculate current evt trb index */ + eidx = (trb->transfer - phy_addr)/sizeof(union xhci_trb) + 1; /* calculate current evt trb index */ /* Identify slot */ if ( ( trb->slot > xhci->slots ) ||