Changeset 86c2ccd in mainline


Ignore:
Timestamp:
2011-02-26T01:25:28Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eb292a0
Parents:
c3ae877
Message:

Fixes

Fixed: infinite loop in device_keeper
Fixed: assertion fail in device_keeper
Fixed: Callback on batches after releasing transfer_list mutex
Fixed: debug output in pci.c

Location:
uspace/drv/uhci-hcd
Files:
6 edited

Legend:

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

    rc3ae877 r86c2ccd  
    3333 */
    3434#include <errno.h>
     35#include <str_error.h>
    3536
    3637#include <usb/debug.h>
     
    194195
    195196        instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
     197        usb_log_debug("Control write last TD status: %x.\n",
     198                instance->tds[i].status);
    196199
    197200        instance->next_step = batch_call_out_and_dispose;
     
    228231
    229232        instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
     233        usb_log_debug("Control read last TD status: %x.\n",
     234                instance->tds[i].status);
    230235
    231236        instance->next_step = batch_call_in_and_dispose;
     
    293298
    294299        int err = instance->error;
    295         usb_log_info("Callback IN(%d): %d, %zu.\n", instance->transfer_type,
    296             err, instance->transfered_size);
     300        usb_log_info("Callback IN(%d): %s(%d), %zu.\n", instance->transfer_type,
     301            str_error(err), err, instance->transfered_size);
    297302
    298303        instance->callback_in(instance->fun,
  • uspace/drv/uhci-hcd/pci.c

    rc3ae877 r86c2ccd  
    9090                                io_address = res->res.io_range.address;
    9191                                io_size = res->res.io_range.size;
    92                                 usb_log_debug("Found io: %x %d.\n",
    93                                     res->res.io_range.address, res->res.io_range.size);
     92                                usb_log_debug("Found io: %llx %zu %zu.\n",
     93                                    res->res.io_range.address, res->res.io_range.size, io_size);
    9494                                io_found = true;
    9595                                break;
     
    125125            IPC_FLAG_BLOCKING);
    126126        bool enabled = hw_res_enable_interrupt(parent_phone);
     127        async_hangup(parent_phone);
    127128        return enabled ? EOK : EIO;
    128129}
  • uspace/drv/uhci-hcd/transfer_list.c

    rc3ae877 r86c2ccd  
    7070        assert(instance);
    7171        assert(batch);
     72        usb_log_debug("Adding batch(%p) to queue %s.\n", batch, instance->name);
    7273
    7374        uint32_t pa = (uintptr_t)addr_to_phys(batch->qh);
     
    123124}
    124125/*----------------------------------------------------------------------------*/
    125 void transfer_list_check(transfer_list_t *instance)
     126void transfer_list_remove_finished(transfer_list_t *instance)
    126127{
    127128        assert(instance);
     129
     130        LIST_INITIALIZE(done);
     131
    128132        fibril_mutex_lock(&instance->guard);
    129133        link_t *current = instance->batch_list.next;
     
    134138                if (batch_is_complete(batch)) {
    135139                        transfer_list_remove_batch(instance, batch);
    136                         batch->next_step(batch);
     140                        list_append(current, &done);
    137141                }
    138142                current = next;
    139143        }
    140144        fibril_mutex_unlock(&instance->guard);
     145
     146        while (!list_empty(&done)) {
     147                link_t *item = done.next;
     148                list_remove(item);
     149                batch_t *batch = list_get_instance(item, batch_t, link);
     150                batch->next_step(batch);
     151        }
    141152}
    142153/**
  • uspace/drv/uhci-hcd/transfer_list.h

    rc3ae877 r86c2ccd  
    6060        queue_head_dispose(instance->queue_head);
    6161}
    62 void transfer_list_check(transfer_list_t *instance);
     62void transfer_list_remove_finished(transfer_list_t *instance);
    6363
    6464void transfer_list_add_batch(transfer_list_t *instance, batch_t *batch);
  • uspace/drv/uhci-hcd/uhci.c

    rc3ae877 r86c2ccd  
    285285                return;
    286286        usb_log_debug("UHCI interrupt: %X.\n", status);
    287         transfer_list_check(&instance->transfers_interrupt);
    288         transfer_list_check(&instance->transfers_control_slow);
    289         transfer_list_check(&instance->transfers_control_full);
    290         transfer_list_check(&instance->transfers_bulk_full);
     287        transfer_list_remove_finished(&instance->transfers_interrupt);
     288        transfer_list_remove_finished(&instance->transfers_control_slow);
     289        transfer_list_remove_finished(&instance->transfers_control_full);
     290        transfer_list_remove_finished(&instance->transfers_bulk_full);
    291291}
    292292/*----------------------------------------------------------------------------*/
     
    297297        assert(instance);
    298298
    299         while(1) {
     299        while (1) {
    300300                uint16_t status = pio_read_16(&instance->registers->usbsts);
    301301                usb_log_debug("UHCI status: %x.\n", status);
     
    303303                uhci_interrupt(instance, status);
    304304                pio_write_16(&instance->registers->usbsts, 0x1f);
    305                 async_usleep(UHCI_CLEANER_TIMEOUT * 1000);
     305                async_usleep(UHCI_CLEANER_TIMEOUT * 5);
    306306        }
    307307        return EOK;
  • uspace/drv/uhci-hcd/utils/device_keeper.c

    rc3ae877 r86c2ccd  
    136136                        return address;
    137137                }
     138                ++address;
    138139        }
    139140        fibril_mutex_unlock(&instance->guard);
     
    147148        assert(address >= 0);
    148149        assert(address <= USB11_ADDRESS_MAX);
    149         assert(instance->devices[address].occupied);
    150150        return instance->devices[address].speed;
    151151}
Note: See TracChangeset for help on using the changeset viewer.