Replanting xhci_complete

This commit is contained in:
xj 2024-08-05 01:38:11 -07:00
parent acf338844a
commit 48ff62be23
1 changed files with 15 additions and 6 deletions

View File

@ -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 ) {