Changeset ddd0499d in mainline for uspace/drv/bus/usb/uhcirh/main.c


Ignore:
Timestamp:
2013-09-12T22:05:13Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4285851
Parents:
695b6ff (diff), 7de1988c (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:

Support for PIO window-relative and absolute HW resource ranges.

The goal of this merge is to allow bus drivers to pass resources with IO
and memory ranges to the child drivers either in the PIO window-relative
form or system bus absolute form. Using the PIO window and the
relative/absolute attribute of a range, each driver can now reconstruct
both forms. Helper functions are provided to automate these
transformations as much as possible.

Changes in this merge in a greater detail:

  • Support for PIO_WINDOW_DEV_IFACE in isa so that it can provide the PIO window to its children.
  • Add 'relative' member to both hw_resource_t.res.mem_range and hw_resource_t.res.io_range so that the drivers can actually tell whether a range is absolute (eg. it was absolutized by its parent).
  • Add pio_enable_resource() to allow drivers to enable PIO without the need to actually care about what kind of range the resource contains. This is used by pci now.
  • Automate things even more for drivers that use hw_res_get_list_parsed(). The parsed HW resources compute both forms (relative/absolute) and offer it to the driver which is using them. Such a driver then uses whatever form is more fit for it and its purposes.
  • Drivers using the parsed resources can use pio_enable_range() to enable PIO and RNGABS*()/RNGREL()/RNGSZ courtesy macros for easier access to the actual range address/size are provided.
  • Device drivers affected by these API changes were converted.
  • uhcirh now requires uhci to provide PIO_WINDOW_DEV_IFACE; however, the uhcirh driver is removed in the feature USB branch so there was no point in implementing this feature and UHCI USB is thus temporarily broken.
File:
1 edited

Legend:

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

    r695b6ff rddd0499d  
    4848#define NAME "uhcirh"
    4949
    50 static int hc_get_my_registers(ddf_dev_t *dev,
    51     uintptr_t *io_reg_address, size_t *io_reg_size);
     50static int hc_get_my_registers(ddf_dev_t *dev, addr_range_t *io_regs);
    5251
    5352static int uhci_rh_dev_add(ddf_dev_t *device);
     
    9089            ddf_dev_get_handle(device));
    9190
    92         uintptr_t io_regs = 0;
    93         size_t io_size = 0;
     91        addr_range_t regs;
    9492        uhci_root_hub_t *rh = NULL;
    9593        int rc;
    9694
    97         rc = hc_get_my_registers(device, &io_regs, &io_size);
     95        rc = hc_get_my_registers(device, &regs);
    9896        if (rc != EOK) {
    9997                usb_log_error( "Failed to get registers from HC: %s.\n",
     
    103101
    104102        usb_log_debug("I/O regs at %p (size %zuB).\n",
    105             (void *) io_regs, io_size);
     103            RNGABSPTR(regs), RNGSZ(regs));
    106104
    107105        rh = ddf_dev_data_alloc(device, sizeof(uhci_root_hub_t));
     
    111109        }
    112110
    113         rc = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
     111        rc = uhci_root_hub_init(rh, &regs, device);
    114112        if (rc != EOK) {
    115113                usb_log_error("Failed(%d) to initialize rh driver instance: "
     
    127125 *
    128126 * @param[in] dev Device asking for the addresses.
    129  * @param[out] io_reg_address Base address of the memory range.
    130  * @param[out] io_reg_size Size of the memory range.
     127 * @param[out] io_regs_p Pointer to the device's register range.
    131128 * @return Error code.
    132129 */
    133 int hc_get_my_registers(
    134     ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)
     130int hc_get_my_registers(ddf_dev_t *dev, addr_range_t *io_regs_p)
    135131{
    136132        async_sess_t *parent_sess =
     
    153149        }
    154150
    155         if (io_reg_address != NULL)
    156                 *io_reg_address = hw_res.io_ranges.ranges[0].address;
    157 
    158         if (io_reg_size != NULL)
    159                 *io_reg_size = hw_res.io_ranges.ranges[0].size;
     151        if (io_regs_p != NULL)
     152                *io_regs_p = hw_res.io_ranges.ranges[0];
    160153
    161154        hw_res_list_parsed_clean(&hw_res);
Note: See TracChangeset for help on using the changeset viewer.