Revision 079d0b7f hw/usb-xhci.c

b/hw/usb-xhci.c
1336 1336
}
1337 1337
#endif
1338 1338

  
1339
static int xhci_setup_packet(XHCITransfer *xfer, XHCIPort *port, int ep)
1339
static int xhci_setup_packet(XHCITransfer *xfer, XHCIPort *port, USBDevice *dev)
1340 1340
{
1341
    usb_packet_setup(&xfer->packet,
1342
                     xfer->in_xfer ? USB_TOKEN_IN : USB_TOKEN_OUT,
1343
                     xfer->xhci->slots[xfer->slotid-1].devaddr,
1344
                     ep & 0x7f);
1341
    USBEndpoint *ep;
1342
    int dir;
1343

  
1344
    dir = xfer->in_xfer ? USB_TOKEN_IN : USB_TOKEN_OUT;
1345
    ep = usb_ep_get(dev, dir, xfer->epid >> 1);
1346
    usb_packet_setup(&xfer->packet, dir, ep);
1345 1347
    usb_packet_addbuf(&xfer->packet, xfer->data, xfer->data_length);
1346 1348
    DPRINTF("xhci: setup packet pid 0x%x addr %d ep %d\n",
1347
            xfer->packet.pid, xfer->packet.devaddr, xfer->packet.devep);
1349
            xfer->packet.pid, dev->addr, ep->nr);
1348 1350
    return 0;
1349 1351
}
1350 1352

  
......
1462 1464
    xfer->in_xfer = bmRequestType & USB_DIR_IN;
1463 1465
    xfer->iso_xfer = false;
1464 1466

  
1465
    xhci_setup_packet(xfer, port, 0);
1467
    xhci_setup_packet(xfer, port, dev);
1466 1468
    if (!xfer->in_xfer) {
1467 1469
        xhci_xfer_data(xfer, xfer->data, wLength, 0, 1, 0);
1468 1470
    }
......
1484 1486
    int ret;
1485 1487

  
1486 1488
    DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid);
1487
    uint8_t ep = xfer->epid>>1;
1488 1489

  
1489 1490
    xfer->in_xfer = epctx->type>>2;
1490
    if (xfer->in_xfer) {
1491
        ep |= 0x80;
1492
    }
1493 1491

  
1494 1492
    if (xfer->data && xfer->data_alloced < xfer->data_length) {
1495 1493
        xfer->data_alloced = 0;
......
1517 1515
        return -1;
1518 1516
    }
1519 1517

  
1520
    xhci_setup_packet(xfer, port, ep);
1518
    xhci_setup_packet(xfer, port, dev);
1521 1519

  
1522 1520
    switch(epctx->type) {
1523 1521
    case ET_INTR_OUT:
......
1530 1528
        FIXME();
1531 1529
        break;
1532 1530
    default:
1533
        fprintf(stderr, "xhci: unknown or unhandled EP type %d (ep %02x)\n",
1534
                epctx->type, ep);
1531
        fprintf(stderr, "xhci: unknown or unhandled EP "
1532
                "(type %d, in %d, ep %02x)\n",
1533
                epctx->type, xfer->in_xfer, xfer->epid);
1535 1534
        return -1;
1536 1535
    }
1537 1536

  

Also available in: Unified diff