Changeset ddd0499d in mainline for uspace/drv/bus/usb/ehci/res.c


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

    r695b6ff rddd0499d  
    7171 *
    7272 * @param[in] dev Device asking for the addresses.
    73  * @param[out] mem_reg_address Base address of the memory range.
    74  * @param[out] mem_reg_size Size of the memory range.
     73 * @param[out] mem_regs_p Pointer to the register range.
    7574 * @param[out] irq_no IRQ assigned to the device.
    7675 * @return Error code.
    7776 */
    7877int get_my_registers(ddf_dev_t *dev,
    79     uintptr_t *mem_reg_address, size_t *mem_reg_size, int *irq_no)
     78    addr_range_t *mem_regs_p, int *irq_no)
    8079{
    8180        assert(dev);
     
    9998        }
    10099
    101         if (mem_reg_address)
    102                 *mem_reg_address = hw_res.mem_ranges.ranges[0].address;
    103         if (mem_reg_size)
    104                 *mem_reg_size = hw_res.mem_ranges.ranges[0].size;
     100        if (mem_regs_p)
     101                *mem_regs_p = hw_res.mem_ranges.ranges[0];
    105102        if (irq_no)
    106103                *irq_no = hw_res.irqs.irqs[0];
     
    267264}
    268265
    269 int disable_legacy(ddf_dev_t *device, uintptr_t reg_base, size_t reg_size)
     266int disable_legacy(ddf_dev_t *device, addr_range_t *reg_range)
    270267{
    271268        assert(device);
     
    274271        /* Map EHCI registers */
    275272        void *regs = NULL;
    276         int rc = pio_enable((void*)reg_base, reg_size, &regs);
     273        int rc = pio_enable_range(reg_range, &regs);
    277274        if (rc != EOK) {
    278275                usb_log_error("Failed to map registers %p: %s.\n",
    279                     (void *) reg_base, str_error(rc));
     276                    RNGABSPTR(*reg_range), str_error(rc));
    280277                return rc;
    281278        }
Note: See TracChangeset for help on using the changeset viewer.