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

Changeset a2b0ba3 in mainline


Ignore:
Timestamp:
2017-10-03T11:31:18Z (4 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master
Children:
a1eb7c67
Parents:
1f76b7d
Message:

Added synchronization to trb rin enqueue.

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

Legend:

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

    r1f76b7d ra2b0ba3  
    114114        ring->pcs = 1;
    115115
     116        fibril_mutex_initialize(&ring->guard);
     117
    116118        usb_log_debug("Initialized new TRB ring.");
    117119
     
    170172int xhci_trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td, uintptr_t *phys)
    171173{
     174        fibril_mutex_lock(&ring->guard);
     175
    172176        xhci_trb_t * const saved_enqueue_trb = ring->enqueue_trb;
    173177        trb_segment_t * const saved_enqueue_segment = ring->enqueue_segment;
     
    204208
    205209                usb_log_debug2("TRB ring(%p): Enqueued TRB %p", ring, trb);
     210                usb_log_error("RING->PCS: %u", ring->pcs);
    206211                ring->enqueue_trb++;
    207212
     
    219224        } while (xhci_trb_is_chained(trb++));
    220225
     226        fibril_mutex_unlock(&ring->guard);
    221227        return EOK;
    222228
     
    224230        ring->enqueue_segment = saved_enqueue_segment;
    225231        ring->enqueue_trb = saved_enqueue_trb;
     232        fibril_mutex_unlock(&ring->guard);
    226233        return EAGAIN;
    227234}
  • uspace/drv/bus/usb/xhci/trb_ring.h

    r1f76b7d ra2b0ba3  
    4444
    4545#include <adt/list.h>
     46#include <fibril_synch.h>
    4647#include <libarch/config.h>
    4748
     
    6869        uintptr_t dequeue;              /* Last reported position of the dequeue pointer */
    6970        bool pcs;                       /* Producer Cycle State: section 4.9.2 */
     71
     72        fibril_mutex_t guard;
    7073} xhci_trb_ring_t;
    7174
Note: See TracChangeset for help on using the changeset viewer.