Replanting xhci_complete

This commit is contained in:
xj 2024-08-05 01:47:35 -07:00
parent 48ff62be23
commit ad027ba080
1 changed files with 10 additions and 5 deletions

View File

@ -2763,14 +2763,19 @@ static void xhci_complete ( struct xhci_host *xhci,
union xhci_trb *pending;
uint32_t eidx;
struct xhci_endpoint *work_pipe;
uintptr_t vir_addr;
uintptr_t addr_offset;
vir_addr = usb_mem_page_phy2vir(trb->command);
// vir_addr = usb_mem_page_phy2vir(trb->command);
cmd_ring = xhci->cmds;
addr_offset = trb->command - xhci->cmds_phy;
cmd_trb = (void *)(uintptr_t)(vir_addr);
cmd_ring = XHCI_RING(cmd_trb); /* to align addr is ring base */
// 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 */
// eidx = cmd_trb - cmd_ring->ring + 1; /* calculate current evt trb index */
eidx = addr_offset / sizeof(union xhci_trb); /* calculate current evt trb index */
work_pipe = xhci->cur_cmd_pipe;
/* Ignore "command ring stopped" notifications */