Changeset b80c1ab in mainline for uspace/drv/bus/usb/xhci/commands.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/commands.c

    rcfe4852 rb80c1ab  
    3737#include <str_error.h>
    3838#include <usb/debug.h>
    39 #include <usb/host/utils/malloc32.h>
    4039#include "commands.h"
    4140#include "debug.h"
     
    5756 */
    5857#define TRB_SET_DEQUEUE_PTR(trb, dptr) (trb).parameter |= host2xhci(64, (dptr))
    59 #define TRB_SET_ICTX(trb, phys) (trb).parameter |= host2xhci(64, phys_addr & (~0xF))
     58#define TRB_SET_ICTX(trb, phys) (trb).parameter |= host2xhci(64, (phys) & (~0xF))
    6059
    6160#define TRB_GET_CODE(trb) XHCI_DWORD_EXTRACT((trb).status, 31, 24)
     
    9998        list_remove(&cmd->_header.link);
    10099
    101         if (cmd->input_ctx) {
    102                 free32(cmd->input_ctx);
    103         };
    104 
    105         if (cmd->bandwidth_ctx) {
    106                 free32(cmd->bandwidth_ctx);
    107         }
     100        dma_buffer_free(&cmd->input_ctx);
     101        dma_buffer_free(&cmd->bandwidth_ctx);
    108102
    109103        if (cmd->_header.async) {
     
    360354        assert(hc);
    361355        assert(cmd);
    362         assert(cmd->input_ctx);
     356        assert(dma_buffer_is_set(&cmd->input_ctx));
    363357
    364358        /**
     
    371365        xhci_trb_clean(&cmd->_header.trb);
    372366
    373         uint64_t phys_addr = (uint64_t) addr_to_phys(cmd->input_ctx);
    374         TRB_SET_ICTX(cmd->_header.trb, phys_addr);
     367        TRB_SET_ICTX(cmd->_header.trb, cmd->input_ctx.phys);
    375368
    376369        /**
     
    396389        if (!cmd->deconfigure) {
    397390                /* If the DC flag is on, input context is not evaluated. */
    398                 assert(cmd->input_ctx);
    399 
    400                 uint64_t phys_addr = (uint64_t) addr_to_phys(cmd->input_ctx);
    401                 TRB_SET_ICTX(cmd->_header.trb, phys_addr);
     391                assert(dma_buffer_is_set(&cmd->input_ctx));
     392
     393                TRB_SET_ICTX(cmd->_header.trb, cmd->input_ctx.phys);
    402394        }
    403395
     
    413405        assert(hc);
    414406        assert(cmd);
    415         assert(cmd->input_ctx);
     407        assert(dma_buffer_is_set(&cmd->input_ctx));
    416408
    417409        /**
     
    423415        xhci_trb_clean(&cmd->_header.trb);
    424416
    425         uint64_t phys_addr = (uint64_t) addr_to_phys(cmd->input_ctx);
    426         TRB_SET_ICTX(cmd->_header.trb, phys_addr);
     417        TRB_SET_ICTX(cmd->_header.trb, cmd->input_ctx.phys);
    427418
    428419        TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_EVALUATE_CONTEXT_CMD);
     
    506497        xhci_trb_clean(&cmd->_header.trb);
    507498
    508         uint64_t phys_addr = (uint64_t) addr_to_phys(cmd->bandwidth_ctx);
    509         TRB_SET_ICTX(cmd->_header.trb, phys_addr);
     499        TRB_SET_ICTX(cmd->_header.trb, cmd->bandwidth_ctx.phys);
    510500
    511501        TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_GET_PORT_BANDWIDTH_CMD);
Note: See TracChangeset for help on using the changeset viewer.