Changeset b80c1ab in mainline for uspace/drv/bus/usb/xhci/endpoint.c


Ignore:
Timestamp:
2017-11-14T23:17:54Z (6 years ago)
Author:
Aearsis <Hlavaty.Ondrej@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e76c0ea
Parents:
cfe4852
git-author:
Aearsis <Hlavaty.Ondrej@…> (2017-11-14 23:15:24)
git-committer:
Aearsis <Hlavaty.Ondrej@…> (2017-11-14 23:17:54)
Message:

xhci: use dma_buffers instead of malloc32 util

A bit of refactoring was needed to adapt scratchpad buffers.

File:
1 edited

Legend:

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

    rcfe4852 rb80c1ab  
    3434 */
    3535
    36 #include <usb/host/utils/malloc32.h>
    3736#include <usb/host/endpoint.h>
    3837#include <usb/descriptor.h>
     
    135134
    136135        XHCI_EP_MAX_P_STREAMS_SET(*ctx, pstreams);
    137         XHCI_EP_TR_DPTR_SET(*ctx, addr_to_phys(xhci_ep->primary_stream_ctx_array));
     136        XHCI_EP_TR_DPTR_SET(*ctx, xhci_ep->primary_stream_ctx_dma.phys);
    138137        // TODO: set HID?
    139138        XHCI_EP_LSA_SET(*ctx, 1);
     
    167166                usb_log_debug2("Allocating primary stream context array of size %u for endpoint " XHCI_EP_FMT,
    168167                        count, XHCI_EP_ARGS(*xhci_ep));
    169                 xhci_ep->primary_stream_ctx_array = malloc32(count * sizeof(xhci_stream_ctx_t));
    170                 if (!xhci_ep->primary_stream_ctx_array) {
     168                if ((dma_buffer_alloc(&xhci_ep->primary_stream_ctx_dma, count * sizeof(xhci_stream_ctx_t))))
    171169                        return ENOMEM;
    172                 }
     170                xhci_ep->primary_stream_ctx_array = xhci_ep->primary_stream_ctx_dma.virt;
    173171
    174172                xhci_ep->primary_stream_rings = calloc(count, sizeof(xhci_trb_ring_t));
    175173                if (!xhci_ep->primary_stream_rings) {
    176                         free32(xhci_ep->primary_stream_ctx_array);
     174                        dma_buffer_free(&xhci_ep->primary_stream_ctx_dma);
    177175                        return ENOMEM;
    178176                }
     
    227225                        // FIXME: Get the trb ring associated with stream [index] and fini it
    228226                }
    229                 free32(xhci_ep->primary_stream_ctx_array);
     227                dma_buffer_free(&xhci_ep->primary_stream_ctx_dma);
    230228        } else {
    231229                usb_log_debug2("Freeing main transfer ring of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
Note: See TracChangeset for help on using the changeset viewer.