Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhcirh/main.c

    r89e061d r0c0f823b  
    3636#include <ddf/driver.h>
    3737#include <devman.h>
    38 #include <device/hw_res_parsed.h>
     38#include <device/hw_res.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_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);
     144       
     145        hw_resource_list_t hw_resources;
     146        const int ret = hw_res_get_resource_list(parent_sess, &hw_resources);
    149147        if (ret != EOK) {
     148                async_hangup(parent_sess);
    150149                return ret;
    151150        }
    152 
    153         if (hw_res.io_ranges.count != 1) {
    154                 hw_res_list_parsed_clean(&hw_res);
    155                 return EINVAL;
     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       
    156165        }
    157 
     166        async_hangup(parent_sess);
     167       
     168        if (!io_found)
     169                return ENOENT;
     170       
    158171        if (io_reg_address != NULL)
    159                 *io_reg_address = hw_res.io_ranges.ranges[0].address;
    160 
     172                *io_reg_address = io_address;
     173       
    161174        if (io_reg_size != NULL)
    162                 *io_reg_size = hw_res.io_ranges.ranges[0].size;
    163 
    164         hw_res_list_parsed_clean(&hw_res);
     175                *io_reg_size = io_size;
     176       
    165177        return EOK;
    166178}
Note: See TracChangeset for help on using the changeset viewer.