Replanting xhci_transfer

This commit is contained in:
xj 2024-08-05 01:16:19 -07:00
parent bf9c5056ac
commit acf338844a
1 changed files with 18 additions and 5 deletions

View File

@ -2669,12 +2669,25 @@ static void xhci_transfer ( struct xhci_host *xhci,
struct xhci_trb_transfer *trb ) { struct xhci_trb_transfer *trb ) {
struct xhci_slot *slot; struct xhci_slot *slot;
struct xhci_endpoint *endpoint; struct xhci_endpoint *endpoint;
union xhci_trb *trans_trb = (void *)(uintptr_t)(trb->transfer); uintptr_t vir_addr;
struct xhci_ring *trans_ring = XHCI_RING(trans_trb); /* to align addr is ring base */ union xhci_trb *trans_trb;
union xhci_trb *pending = &trans_ring->evt; /* preserve event trb pending to handle */ struct xhci_ring *trans_ring;
uint32_t eidx = trans_trb - trans_ring->ring + 1; /* calculate current evt trb index */ union xhci_trb *pending;
uint32_t eidx;
int rc; int rc;
vir_addr = usb_mem_page_phy2vir(trb->transfer);
#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 */
pending = &trans_ring->evt; /* preserve event trb pending to handle */
eidx = trans_trb - trans_ring->ring + 1; /* calculate current evt trb index */
/* Identify slot */ /* Identify slot */
if ( ( trb->slot > xhci->slots ) || if ( ( trb->slot > xhci->slots ) ||
( ( slot = xhci->slot[trb->slot] ) == NULL ) ) { ( ( slot = xhci->slot[trb->slot] ) == NULL ) ) {