Changeset 7e1b130 in mainline for uspace/drv/bus/usb/uhcirh/main.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/uhcirh/main.c

    r2f0dd2a r7e1b130  
    3636#include <ddf/driver.h>
    3737#include <devman.h>
    38 #include <device/hw_res.h>
     38#include <device/hw_res_parsed.h>
    3939#include <errno.h>
    4040#include <str_error.h>
     
    136136{
    137137        assert(dev);
    138        
     138
    139139        async_sess_t *parent_sess =
    140140            devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle,
     
    142142        if (!parent_sess)
    143143                return ENOMEM;
    144        
    145         hw_resource_list_t hw_resources;
    146         const int ret = hw_res_get_resource_list(parent_sess, &hw_resources);
     144
     145        hw_res_list_parsed_t hw_res;
     146        hw_res_list_parsed_init(&hw_res);
     147        const int ret =  hw_res_get_list_parsed(parent_sess, &hw_res, 0);
     148        async_hangup(parent_sess);
    147149        if (ret != EOK) {
    148                 async_hangup(parent_sess);
    149150                return ret;
    150151        }
    151        
    152         uintptr_t io_address = 0;
    153         size_t io_size = 0;
    154         bool io_found = false;
    155        
    156         size_t i = 0;
    157         for (; i < hw_resources.count; i++) {
    158                 hw_resource_t *res = &hw_resources.resources[i];
    159                 if (res->type == IO_RANGE) {
    160                         io_address = res->res.io_range.address;
    161                         io_size = res->res.io_range.size;
    162                         io_found = true;
    163                 }
    164        
     152
     153        if (hw_res.io_ranges.count != 1) {
     154                hw_res_list_parsed_clean(&hw_res);
     155                return EINVAL;
    165156        }
    166         async_hangup(parent_sess);
    167        
    168         if (!io_found)
    169                 return ENOENT;
    170        
     157
    171158        if (io_reg_address != NULL)
    172                 *io_reg_address = io_address;
    173        
     159                *io_reg_address = hw_res.io_ranges.ranges[0].address;
     160
    174161        if (io_reg_size != NULL)
    175                 *io_reg_size = io_size;
    176        
     162                *io_reg_size = hw_res.io_ranges.ranges[0].size;
     163
     164        hw_res_list_parsed_clean(&hw_res);
    177165        return EOK;
    178166}
Note: See TracChangeset for help on using the changeset viewer.