Changeset d083126 in mainline for uspace/drv/bus/usb/ohci/ohci_batch.c


Ignore:
Timestamp:
2011-10-13T13:20:26Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3a5506a
Parents:
cff3fb6 (diff), 22a2b763 (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:

Merge initial USB unplug support.

Support device_remove and device_gone in libusbdev.
usbhub and uhcirh try to unbind and destroy functions of attached devices.
add unplug support for usbhub driver (only works on empty hubs as there is no support in other drivers).

Drivers to go:

usbmid
usbflbk
usbhid
usbmast
usbmouse

Tested on:

qemu UHCI and emulated hub,
ICH8 hw and Alcor Micro Corp. USB Hub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci_batch.c

    rcff3fb6 rd083126  
    5252        if (!ohci_batch)
    5353                return;
    54         unsigned i = 0;
    5554        if (ohci_batch->tds) {
    56                 for (; i< ohci_batch->td_count; ++i) {
     55                for (unsigned i = 0; i < ohci_batch->td_count; ++i) {
    5756                        if (i != ohci_batch->leave_td)
    5857                                free32(ohci_batch->tds[i]);
     
    107106        ohci_batch->tds[0] = ohci_endpoint_get(usb_batch->ep)->td;
    108107        ohci_batch->leave_td = 0;
    109         unsigned i = 1;
    110         for (; i <= ohci_batch->td_count; ++i) {
     108
     109        for (unsigned i = 1; i <= ohci_batch->td_count; ++i) {
    111110                ohci_batch->tds[i] = malloc32(sizeof(td_t));
    112111                CHECK_NULL_DISPOSE_RET(ohci_batch->tds[i],
     
    160159        usb_log_debug("Batch %p checking %zu td(s) for completion.\n",
    161160            ohci_batch->usb_batch, ohci_batch->td_count);
    162         usb_log_debug2("ED: %x:%x:%x:%x.\n",
     161        usb_log_debug2("ED: %08x:%08x:%08x:%08x.\n",
    163162            ohci_batch->ed->status, ohci_batch->ed->td_head,
    164163            ohci_batch->ed->td_tail, ohci_batch->ed->next);
     
    167166        for (; i < ohci_batch->td_count; ++i) {
    168167                assert(ohci_batch->tds[i] != NULL);
    169                 usb_log_debug("TD %zu: %x:%x:%x:%x.\n", i,
     168                usb_log_debug("TD %zu: %08x:%08x:%08x:%08x.\n", i,
    170169                    ohci_batch->tds[i]->status, ohci_batch->tds[i]->cbp,
    171170                    ohci_batch->tds[i]->next, ohci_batch->tds[i]->be);
     
    175174                ohci_batch->usb_batch->error = td_error(ohci_batch->tds[i]);
    176175                if (ohci_batch->usb_batch->error != EOK) {
    177                         usb_log_debug("Batch %p found error TD(%zu):%x.\n",
     176                        usb_log_debug("Batch %p found error TD(%zu):%08x.\n",
    178177                            ohci_batch->usb_batch, i,
    179178                            ohci_batch->tds[i]->status);
     
    196195        ohci_batch->usb_batch->transfered_size =
    197196            ohci_batch->usb_batch->buffer_size;
    198         for (--i;i < ohci_batch->td_count; ++i)
     197        for (--i;i < ohci_batch->td_count; ++i) {
    199198                ohci_batch->usb_batch->transfered_size
    200199                    -= td_remain_size(ohci_batch->tds[i]);
     200        }
    201201
    202202        /* Clear possible ED HALT */
     
    234234        assert(ohci_batch->usb_batch);
    235235        assert(dir == USB_DIRECTION_IN || dir == USB_DIRECTION_OUT);
    236         usb_log_debug("Using ED(%p): %x:%x:%x:%x.\n", ohci_batch->ed,
     236        usb_log_debug("Using ED(%p): %08x:%08x:%08x:%08x.\n", ohci_batch->ed,
    237237            ohci_batch->ed->status, ohci_batch->ed->td_tail,
    238238            ohci_batch->ed->td_head, ohci_batch->ed->next);
     
    251251                ohci_batch->usb_batch->setup_size, toggle);
    252252        td_set_next(ohci_batch->tds[0], ohci_batch->tds[1]);
    253         usb_log_debug("Created CONTROL SETUP TD: %x:%x:%x:%x.\n",
     253        usb_log_debug("Created CONTROL SETUP TD: %08x:%08x:%08x:%08x.\n",
    254254            ohci_batch->tds[0]->status, ohci_batch->tds[0]->cbp,
    255255            ohci_batch->tds[0]->next, ohci_batch->tds[0]->be);
     
    269269                td_set_next(ohci_batch->tds[td_current],
    270270                    ohci_batch->tds[td_current + 1]);
    271                 usb_log_debug("Created CONTROL DATA TD: %x:%x:%x:%x.\n",
     271                usb_log_debug("Created CONTROL DATA TD: %08x:%08x:%08x:%08x.\n",
    272272                    ohci_batch->tds[td_current]->status,
    273273                    ohci_batch->tds[td_current]->cbp,
     
    286286        td_set_next(ohci_batch->tds[td_current],
    287287            ohci_batch->tds[td_current + 1]);
    288         usb_log_debug("Created CONTROL STATUS TD: %x:%x:%x:%x.\n",
     288        usb_log_debug("Created CONTROL STATUS TD: %08x:%08x:%08x:%08x.\n",
    289289            ohci_batch->tds[td_current]->status,
    290290            ohci_batch->tds[td_current]->cbp,
     
    312312        assert(ohci_batch->usb_batch);
    313313        assert(dir == USB_DIRECTION_IN || dir == USB_DIRECTION_OUT);
    314         usb_log_debug("Using ED(%p): %x:%x:%x:%x.\n", ohci_batch->ed,
     314        usb_log_debug("Using ED(%p): %08x:%08x:%08x:%08x.\n", ohci_batch->ed,
    315315            ohci_batch->ed->status, ohci_batch->ed->td_tail,
    316316            ohci_batch->ed->td_head, ohci_batch->ed->next);
     
    328328                    ohci_batch->tds[td_current + 1]);
    329329
    330                 usb_log_debug("Created DATA TD: %x:%x:%x:%x.\n",
     330                usb_log_debug("Created DATA TD: %08x:%08x:%08x:%08x.\n",
    331331                    ohci_batch->tds[td_current]->status,
    332332                    ohci_batch->tds[td_current]->cbp,
Note: See TracChangeset for help on using the changeset viewer.