Changeset a1eb7c67 in mainline


Ignore:
Timestamp:
2017-10-03T11:36:40Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
adb4e683
Parents:
a2b0ba3
Message:

Added synchronization to event ring enqueue, removed a leftover debug message.

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

Legend:

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

    ra2b0ba3 ra1eb7c67  
    208208
    209209                usb_log_debug2("TRB ring(%p): Enqueued TRB %p", ring, trb);
    210                 usb_log_error("RING->PCS: %u", ring->pcs);
    211210                ring->enqueue_trb++;
    212211
     
    264263        ring->ccs = 1;
    265264
     265        fibril_mutex_initialize(&ring->guard);
     266
    266267        usb_log_debug("Initialized event ring.");
    267268
     
    295296int xhci_event_ring_dequeue(xhci_event_ring_t *ring, xhci_trb_t *event)
    296297{
     298        fibril_mutex_lock(&ring->guard);
     299
    297300        /**
    298301         * The ERDP reported to the HC is a half-phase off the one we need to
     
    301304        ring->dequeue_ptr = event_ring_dequeue_phys(ring);
    302305
    303         if (TRB_CYCLE(*ring->dequeue_trb) != ring->ccs)
     306        if (TRB_CYCLE(*ring->dequeue_trb) != ring->ccs) {
     307                fibril_mutex_unlock(&ring->guard);
    304308                return ENOENT; /* The ring is empty. */
     309        }
    305310
    306311        memcpy(event, ring->dequeue_trb, sizeof(xhci_trb_t));
     
    323328        }
    324329
    325         return EOK;
    326 }
     330        fibril_mutex_unlock(&ring->guard);
     331        return EOK;
     332}
  • uspace/drv/bus/usb/xhci/trb_ring.h

    ra2b0ba3 ra1eb7c67  
    106106
    107107        bool ccs;                       /* Consumer Cycle State: section 4.9.2 */
     108
     109        fibril_mutex_t guard;
    108110} xhci_event_ring_t;
    109111
Note: See TracChangeset for help on using the changeset viewer.