Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b7db009 in mainline


Ignore:
Timestamp:
2017-10-15T21:35:13Z (3 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
master
Children:
3afcf68
Parents:
9b2f69e
Message:

xhci: fix crashing QEMU

Location:
uspace/drv/bus/usb/xhci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/endpoint.c

    r9b2f69e rb7db009  
    3434 */
    3535
     36#include <usb/host/utils/malloc32.h>
    3637#include <usb/host/endpoint.h>
    3738#include <usb/descriptor.h>
     
    8485        /* 0 is slot ctx, 1 is EP0, then it's EP1 out, in, EP2 out, in, etc. */
    8586
    86         uint8_t off = 2 + 2 * (ep->base.target.endpoint - 1);
    87         if (ep->base.direction == USB_DIRECTION_IN)
     87        uint8_t off = 2 * (ep->base.target.endpoint);
     88        if (ep->base.direction == USB_DIRECTION_IN || ep->base.target.endpoint == 0)
    8889                ++off;
    8990
     
    197198
    198199                // Prepare input context.
    199                 ictx = malloc(sizeof(xhci_input_ctx_t));
     200                ictx = malloc32(sizeof(xhci_input_ctx_t));
    200201                if (!ictx) {
    201202                        return ENOMEM;
     
    226227                switch (ep->base.transfer_type) {
    227228                case USB_TRANSFER_CONTROL:
    228                         setup_control_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset], ep_ring);
     229                        setup_control_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset - 1], ep_ring);
    229230                        break;
    230231
    231232                case USB_TRANSFER_BULK:
    232                         setup_bulk_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset], ep_ring, &ss_desc);
     233                        setup_bulk_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset - 1], ep_ring, &ss_desc);
    233234                        break;
    234235
    235236                case USB_TRANSFER_ISOCHRONOUS:
    236                         setup_isoch_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset], ep_ring, &ss_desc);
     237                        setup_isoch_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset - 1], ep_ring, &ss_desc);
    237238                        break;
    238239
    239240                case USB_TRANSFER_INTERRUPT:
    240                         setup_interrupt_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset], ep_ring, &ss_desc);
     241                        setup_interrupt_ep_ctx(ep, &ictx->endpoint_ctx[ep_offset - 1], ep_ring, &ss_desc);
    241242                        break;
    242243
  • uspace/drv/bus/usb/xhci/transfers.c

    r9b2f69e rb7db009  
    306306int xhci_schedule_interrupt_transfer(xhci_hc_t* hc, usb_transfer_batch_t* batch)
    307307{
    308         /* FIXME: Removing the next 2 rows causes QEMU to crash lol */
    309         usb_log_warning("Interrupt transfers not yet implemented!");
    310         return ENOTSUP;
    311 
    312308        if (batch->setup_size) {
    313309                usb_log_warning("Setup packet present for a interrupt transfer.");
Note: See TracChangeset for help on using the changeset viewer.