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

Changeset a501aaba in mainline


Ignore:
Timestamp:
2017-10-26T22:21:30Z (3 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
master
Children:
5bc8250
Parents:
928afc8d
Message:

xhci trb_ring: fix ring wrapping

The Toggle Cycle of the Link TRB must be set, not the Cycle flag.

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

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/hw_struct/trb.h

    r928afc8d ra501aaba  
    105105#define TRB_COMPLETION_CODE(trb)        XHCI_DWORD_EXTRACT((trb).status, 31, 24)
    106106
     107#define TRB_LINK_SET_TC(trb, val) \
     108        xhci_dword_set_bits(&(trb).control, val, 1, 1)
     109#define TRB_SET_CYCLE(trb, val) \
     110        xhci_dword_set_bits(&(trb).control, val, 0, 0)
     111
    107112#define TRB_CTRL_SET_SETUP_WLENGTH(trb, val) \
    108113        xhci_qword_set_bits(&(trb).parameter, val, 63, 48)
     
    153158            || type == XHCI_TRB_TYPE_STATUS_STAGE
    154159            || type == XHCI_TRB_TYPE_ISOCH);
    155 }
    156 
    157 static inline void xhci_trb_set_cycle(xhci_trb_t *trb, bool cycle)
    158 {
    159         xhci_dword_set_bits(&trb->control, cycle, 0, 0);
    160160}
    161161
  • uspace/drv/bus/usb/xhci/trb_ring.c

    r928afc8d ra501aaba  
    107107        xhci_trb_t *last = segment_end(segment) - 1;
    108108        xhci_trb_link_fill(last, segment->phys);
    109         xhci_trb_set_cycle(last, true);
     109        TRB_LINK_SET_TC(*last, true);
    110110
    111111        ring->enqueue_segment = segment;
     
    219219        trb = first_trb;
    220220        for (size_t i = 0; i < trbs; ++i, ++trb) {
    221                 xhci_trb_set_cycle(trb, ring->pcs);
     221                TRB_SET_CYCLE(*trb, ring->pcs);
    222222                xhci_trb_copy(ring->enqueue_trb, trb);
    223223
     
    226226
    227227                if (TRB_TYPE(*ring->enqueue_trb) == XHCI_TRB_TYPE_LINK) {
    228                         // XXX: Check, whether the order here is correct (ambiguous instructions in 4.11.5.1)
    229                         xhci_trb_set_cycle(ring->enqueue_trb, ring->pcs);
     228                        TRB_SET_CYCLE(*ring->enqueue_trb, ring->pcs);
    230229
    231230                        if (TRB_LINK_TC(*ring->enqueue_trb)) {
Note: See TracChangeset for help on using the changeset viewer.