Changeset a8ac368 in mainline for uspace/drv/uhci-hcd/transfer_list.c


Ignore:
Timestamp:
2011-03-29T20:08:53Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fc883bb
Parents:
0d92638 (diff), 51e5608 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

development changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/transfer_list.c

    r0d92638 ra8ac368  
    5858        }
    5959        instance->queue_head_pa = addr_to_phys(instance->queue_head);
     60        usb_log_debug2("Transfer list %s setup with QH: %p(%p).\n",
     61            name, instance->queue_head, instance->queue_head_pa);
    6062
    6163        qh_init(instance->queue_head);
     
    9193 * The batch is added to the end of the list and queue.
    9294 */
    93 void transfer_list_add_batch(transfer_list_t *instance, usb_transfer_batch_t *batch)
     95void transfer_list_add_batch(
     96    transfer_list_t *instance, usb_transfer_batch_t *batch)
    9497{
    9598        assert(instance);
     
    117120        qh_set_next_qh(last_qh, pa);
    118121
     122        asm volatile ("": : :"memory");
     123
    119124        /* Add to the driver list */
    120125        list_append(&batch->link, &instance->batch_list);
     
    136141 * this transfer list leading to the deadlock if its done inline.
    137142 */
    138 void transfer_list_remove_finished(transfer_list_t *instance)
    139 {
    140         assert(instance);
    141 
    142         LIST_INITIALIZE(done);
     143void transfer_list_remove_finished(transfer_list_t *instance, link_t *done)
     144{
     145        assert(instance);
     146        assert(done);
    143147
    144148        fibril_mutex_lock(&instance->guard);
     
    146150        while (current != &instance->batch_list) {
    147151                link_t *next = current->next;
    148                 usb_transfer_batch_t *batch = list_get_instance(current, usb_transfer_batch_t, link);
     152                usb_transfer_batch_t *batch =
     153                    list_get_instance(current, usb_transfer_batch_t, link);
    149154
    150155                if (batch_is_complete(batch)) {
    151156                        /* Save for post-processing */
    152157                        transfer_list_remove_batch(instance, batch);
    153                         list_append(current, &done);
     158                        list_append(current, done);
    154159                }
    155160                current = next;
     
    157162        fibril_mutex_unlock(&instance->guard);
    158163
    159         while (!list_empty(&done)) {
    160                 link_t *item = done.next;
    161                 list_remove(item);
    162                 usb_transfer_batch_t *batch = list_get_instance(item, usb_transfer_batch_t, link);
    163                 batch->next_step(batch);
    164         }
    165164}
    166165/*----------------------------------------------------------------------------*/
     
    174173        while (!list_empty(&instance->batch_list)) {
    175174                link_t *current = instance->batch_list.next;
    176                 usb_transfer_batch_t *batch = list_get_instance(current, usb_transfer_batch_t, link);
     175                usb_transfer_batch_t *batch =
     176                    list_get_instance(current, usb_transfer_batch_t, link);
    177177                transfer_list_remove_batch(instance, batch);
    178178                usb_transfer_batch_finish(batch, EIO);
     
    189189 * Does not lock the transfer list, caller is responsible for that.
    190190 */
    191 void transfer_list_remove_batch(transfer_list_t *instance, usb_transfer_batch_t *batch)
     191void transfer_list_remove_batch(
     192    transfer_list_t *instance, usb_transfer_batch_t *batch)
    192193{
    193194        assert(instance);
     
    210211        } else {
    211212                usb_transfer_batch_t *prev =
    212                     list_get_instance(batch->link.prev, usb_transfer_batch_t, link);
     213                    list_get_instance(
     214                        batch->link.prev, usb_transfer_batch_t, link);
    213215                assert((batch_qh(prev)->next & LINK_POINTER_ADDRESS_MASK)
    214216                    == addr_to_phys(batch_qh(batch)));
     
    216218                qpos = "NOT FIRST";
    217219        }
     220        asm volatile ("": : :"memory");
    218221        /* Remove from the batch list */
    219222        list_remove(&batch->link);
Note: See TracChangeset for help on using the changeset viewer.