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


Ignore:
Timestamp:
2017-11-14T23:17:54Z (7 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/transfers.c

    rcfe4852 rb80c1ab  
    3434 */
    3535
    36 #include <usb/host/utils/malloc32.h>
    3736#include <usb/debug.h>
    3837#include <usb/request.h>
     
    113112        assert(transfer);
    114113
    115         if (transfer->hc_buffer)
    116                 free32(transfer->hc_buffer);
     114        dma_buffer_free(&transfer->hc_buffer);
    117115}
    118116
     
    156154                xhci_trb_clean(trb_data);
    157155
    158                 trb_data->parameter = addr_to_phys(transfer->hc_buffer);
     156                trb_data->parameter = host2xhci(64, transfer->hc_buffer.phys);
    159157
    160158                // data size (sent for OUT, or buffer size)
     
    196194        xhci_trb_t trb;
    197195        xhci_trb_clean(&trb);
    198         trb.parameter = addr_to_phys(transfer->hc_buffer);
     196        trb.parameter = host2xhci(64, transfer->hc_buffer.phys);
    199197
    200198        // data size (sent for OUT, or buffer size)
     
    217215        xhci_trb_t trb;
    218216        xhci_trb_clean(&trb);
    219         trb.parameter = addr_to_phys(transfer->hc_buffer);
     217        trb.parameter = host2xhci(64, transfer->hc_buffer.phys);
    220218
    221219        // data size (sent for OUT, or buffer size)
     
    282280                assert(batch->buffer);
    283281                assert(batch->transfered_size <= batch->buffer_size);
    284                 memcpy(batch->buffer, transfer->hc_buffer, batch->transfered_size);
     282                memcpy(batch->buffer, transfer->hc_buffer.virt, batch->transfered_size);
    285283        }
    286284
     
    324322
    325323        if (batch->buffer_size > 0) {
    326                 transfer->hc_buffer = malloc32(batch->buffer_size);
    327                 if (!transfer->hc_buffer)
     324                if (dma_buffer_alloc(&transfer->hc_buffer, batch->buffer_size))
    328325                        return ENOMEM;
    329326        }
     
    331328        if (batch->dir != USB_DIRECTION_IN) {
    332329                // Sending stuff from host to device, we need to copy the actual data.
    333                 memcpy(transfer->hc_buffer, batch->buffer, batch->buffer_size);
     330                memcpy(transfer->hc_buffer.virt, batch->buffer, batch->buffer_size);
    334331        }
    335332
Note: See TracChangeset for help on using the changeset viewer.