Changeset a0be5d0 in mainline


Ignore:
Timestamp:
2017-10-09T14:11:22Z (7 years ago)
Author:
Michal Staruch <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
42bc933
Parents:
ae03552e
Message:

Moved ring_doorbell, added address check

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

Legend:

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

    rae03552e ra0be5d0  
    145145}
    146146
    147 static inline int ring_doorbell(xhci_hc_t *hc, unsigned doorbell, unsigned target)
    148 {
    149         assert(hc);
    150         uint32_t v = host2xhci(32, target & BIT_RRANGE(uint32_t, 7));
    151         pio_write_32(&hc->db_arry[doorbell], v);
    152         return EOK;
    153 }
    154 
    155147static inline int enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd, unsigned doorbell, unsigned target)
    156148{
     
    161153
    162154        xhci_trb_ring_enqueue(&hc->command_ring, &cmd->trb, &cmd->trb_phys);
    163         ring_doorbell(hc, doorbell, target);
     155        hc_ring_doorbell(hc, doorbell, target);
    164156
    165157        usb_log_debug2("HC(%p): Sent command:", hc);
     
    196188
    197189        XHCI_REG_WR(hc->op_regs, XHCI_OP_CRR, 1);
    198         ring_doorbell(hc, 0, 0);
     190        hc_ring_doorbell(hc, 0, 0);
    199191}
    200192
  • uspace/drv/bus/usb/xhci/hc.c

    rae03552e ra0be5d0  
    457457                batch->buffer_size);
    458458
     459        if (!batch->ep->address) {
     460                usb_log_error("Attempted to schedule transfer to address 0.");
     461                return EINVAL;
     462        }
     463
    459464        switch (batch->ep->transfer_type) {
    460465        case USB_TRANSFER_CONTROL:
     
    616621}
    617622
    618 
     623int hc_ring_doorbell(xhci_hc_t *hc, unsigned doorbell, unsigned target)
     624{
     625        assert(hc);
     626        uint32_t v = host2xhci(32, target & BIT_RRANGE(uint32_t, 7));
     627        pio_write_32(&hc->db_arry[doorbell], v);
     628        return EOK;
     629}
    619630
    620631/**
  • uspace/drv/bus/usb/xhci/hc.h

    rae03552e ra0be5d0  
    9090void hc_interrupt(xhci_hc_t *, uint32_t);
    9191void hc_fini(xhci_hc_t *);
     92int hc_ring_doorbell(xhci_hc_t *, unsigned, unsigned);
    9293
    9394#endif
  • uspace/drv/bus/usb/xhci/transfers.c

    rae03552e ra0be5d0  
    4141#include "trb_ring.h"
    4242
    43 static inline int ring_doorbell(xhci_hc_t *hc, unsigned doorbell, unsigned target)
    44 {
    45         assert(hc);
    46         uint32_t v = host2xhci(32, target & BIT_RRANGE(uint32_t, 7));
    47         pio_write_32(&hc->db_arry[doorbell], v);
    48         return EOK;
    49 }
    50 
    5143static inline uint8_t get_transfer_type(xhci_trb_t* trb, uint8_t bmRequestType, uint16_t wLength)
    5244{
     
    143135{
    144136        if (!batch->setup_size) {
     137                usb_log_error("Missing setup packet for the control transfer.");
    145138                return EINVAL;
    146139        }
    147140        if (batch->ep->endpoint != 0 || batch->ep->transfer_type != USB_TRANSFER_CONTROL) {
    148141                /* This method only works for control transfers. */
     142                usb_log_error("Attempted to schedule control transfer to non 0 endpoint.");
    149143                return EINVAL;
    150144        }
     
    223217
    224218        /* For control transfers, the target is always 1. */
    225         ring_doorbell(hc, slot_id, 1);
     219        hc_ring_doorbell(hc, slot_id, 1);
    226220        return EOK;
    227221}
Note: See TracChangeset for help on using the changeset viewer.