Changeset 7e1b130 in mainline for uspace/drv/bus/usb/usbhub/usbhub.c


Ignore:
Timestamp:
2011-12-23T18:13:33Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3819ce5, b39eb79, f0b74b2
Parents:
2f0dd2a (diff), 153cc76a (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:

USB branch changes.

+ USB device drivers use single async session to host controller, this session (represented by usb_hc_connection_t) is used for both HC requests and to back usb device connection.
+ Pipe locking was removed. Reference counting was moved to usb_hc_connection_t. Every read/write operation uses separate parallel exchange thus any contention is resolved on hc side.

  • async_sess_t setup using EXCHANGE_PARALLEL uses one extra phone (session phone, each exch creates its own), thus the number of phones used by usb dvice driver might increase. Possible solutions are: make read/write calls atomic (all other calls are atomic) and use EXCHANGE_ATOMIC, any other solution provided by changes to async_sess_t.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r2f0dd2a r7e1b130  
    9999        fibril_condvar_initialize(&hub_dev->pending_ops_cv);
    100100
    101         /* Create hc connection */
    102         usb_log_debug("Initializing USB wire abstraction.\n");
    103         int opResult = usb_hc_connection_initialize_from_device(
    104             &hub_dev->connection, hub_dev->usb_device->ddf_dev);
    105         if (opResult != EOK) {
    106                 usb_log_error("Could not initialize connection to device: %s\n",
     101
     102        int opResult = usb_pipe_start_long_transfer(&usb_dev->ctrl_pipe);
     103        if (opResult != EOK) {
     104                usb_log_error("Failed to start long ctrl pipe transfer: %s\n",
    107105                    str_error(opResult));
    108106                return opResult;
     
    112110        opResult = usb_set_first_configuration(usb_dev);
    113111        if (opResult != EOK) {
     112                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    114113                usb_log_error("Could not set hub configuration: %s\n",
    115114                    str_error(opResult));
     
    120119        opResult = usb_hub_process_hub_specific_info(hub_dev);
    121120        if (opResult != EOK) {
     121                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    122122                usb_log_error("Could process hub specific info, %s\n",
    123123                    str_error(opResult));
     
    130130            fun_exposed, HUB_FNC_NAME);
    131131        if (hub_dev->hub_fun == NULL) {
     132                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    132133                usb_log_error("Failed to create hub function.\n");
    133134                return ENOMEM;
     
    137138        opResult = ddf_fun_bind(hub_dev->hub_fun);
    138139        if (opResult != EOK) {
     140                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    139141                usb_log_error("Failed to bind hub function: %s.\n",
    140142                   str_error(opResult));
     
    148150            usb_hub_polling_terminated_callback, hub_dev);
    149151        if (opResult != EOK) {
     152                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    150153                /* Function is already bound */
    151154                ddf_fun_unbind(hub_dev->hub_fun);
     
    159162            hub_dev->usb_device->ddf_dev->name, hub_dev->port_count);
    160163
     164        usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    161165        return EOK;
    162166}
Note: See TracChangeset for help on using the changeset viewer.