Changeset f82c4822 in mainline


Ignore:
Timestamp:
2018-01-10T23:02:27Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a6c4597
Parents:
1b78beae
Message:

ehci: add bus support for offline/online (WIP)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci_bus.c

    r1b78beae rf82c4822  
    137137{
    138138        ehci_transfer_batch_destroy(ehci_transfer_batch_get(batch));
     139}
     140
     141static int ehci_device_online(device_t *device)
     142{
     143        int err;
     144
     145        /* Allow creation of new endpoints and transfers. */
     146        usb_log_info("Device(%d): Going online.", device->address);
     147        fibril_mutex_lock(&device->guard);
     148        device->online = true;
     149        fibril_mutex_unlock(&device->guard);
     150
     151        if ((err = ddf_fun_online(device->fun))) {
     152                return err;
     153        }
     154
     155        return EOK;
     156}
     157
     158static int ehci_device_offline(device_t *device)
     159{
     160        int err;
     161
     162        /* Tear down all drivers working with the device. */
     163        if ((err = ddf_fun_offline(device->fun))) {
     164                return err;
     165        }
     166
     167        /* At this point, all drivers are assumed to have already terminated
     168         * in a consistent way. The following code just cleans up hanging
     169         * transfers if there are any. */
     170
     171        /* Block creation of new endpoints and transfers. */
     172        usb_log_info("Device(%d): Going offline.", device->address);
     173        fibril_mutex_lock(&device->guard);
     174        device->online = false;
     175        fibril_mutex_unlock(&device->guard);
     176
     177        /* FIXME: Abort all transfers to all endpoints. */
     178
     179        return EOK;
    139180}
    140181
     
    153194        .batch_destroy = ehci_destroy_batch,
    154195        .batch_schedule = ehci_hc_schedule,
     196        .device_online = ehci_device_online,
     197        .device_offline = ehci_device_offline,
    155198};
    156199
Note: See TracChangeset for help on using the changeset viewer.