Changeset 548c123 in mainline for uspace/drv/bus/usb/xhci/trb_ring.c


Ignore:
Timestamp:
2017-09-29T21:46:08Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc9ac7c
Parents:
ab5a0830
Message:

xhci commands: embed TRB into the command structure

Previously, a pointer into the TRB ring itself was contained. That could cause
problems, because the ring does not care and can move/deallocate segments, or
overwrite TRBs inside. To solve the original issue, xhci_trb_ring_enqueue can
now fill physical address of the TRB enqueued.

Also, this eliminates the need to track ownage of TRB.

File:
1 edited

Legend:

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

    rab5a0830 r548c123  
    164164 *
    165165 * @param td the first TRB of TD
     166 * @param phys returns address of the first TRB enqueued
    166167 * @return EOK on success,
    167168 *         EAGAIN when the ring is too full to fit all TRBs (temporary)
    168169 */
    169 int xhci_trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td)
     170int xhci_trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td, uintptr_t *phys)
    170171{
    171172        xhci_trb_t * const saved_enqueue_trb = ring->enqueue_trb;
    172173        trb_segment_t * const saved_enqueue_segment = ring->enqueue_segment;
     174        if (phys)
     175                *phys = NULL;
    173176
    174177        /*
     
    189192        ring->enqueue_segment = saved_enqueue_segment;
    190193        ring->enqueue_trb = saved_enqueue_trb;
     194        if (phys)
     195                *phys = trb_ring_enqueue_phys(ring);
    191196
    192197        /*
Note: See TracChangeset for help on using the changeset viewer.