Changeset ddd0499d in mainline for uspace/drv/bus/usb/uhci/uhci.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/uhci/uhci.c

    r695b6ff rddd0499d  
    184184        ddf_fun_data_implant(instance->rh_fun, &instance->rh);
    185185
    186         uintptr_t reg_base = 0;
    187         size_t reg_size = 0;
     186        addr_range_t regs;
    188187        int irq = 0;
    189188
    190         rc = get_my_registers(device, &reg_base, &reg_size, &irq);
     189        rc = get_my_registers(device, &regs, &irq);
    191190        if (rc != EOK) {
    192191                usb_log_error("Failed to get I/O addresses for %" PRIun ": %s.\n",
     
    194193                goto error;
    195194        }
    196         usb_log_debug("I/O regs at 0x%p (size %zu), IRQ %d.\n",
    197             (void *) reg_base, reg_size, irq);
     195        usb_log_debug("I/O regs at %p (size %zu), IRQ %d.\n",
     196            RNGABSPTR(regs), RNGSZ(regs), irq);
    198197
    199198        rc = disable_legacy(device);
     
    204203        }
    205204
    206         rc = hc_register_irq_handler(device, reg_base, reg_size, irq, irq_handler);
     205        rc = hc_register_irq_handler(device, &regs, irq, irq_handler);
    207206        if (rc != EOK) {
    208207                usb_log_error("Failed to register interrupt handler: %s.\n",
     
    223222        }
    224223
    225         rc = hc_init(&instance->hc, (void*)reg_base, reg_size, interrupts);
     224        rc = hc_init(&instance->hc, &regs, interrupts);
    226225        if (rc != EOK) {
    227226                usb_log_error("Failed to init uhci_hcd: %s.\n", str_error(rc));
Note: See TracChangeset for help on using the changeset viewer.