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

    r695b6ff rddd0499d  
    256256        fibril_mutex_lock(&bus->conf_mutex);
    257257
    258         pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr));
     258        pio_write_32(bus->conf_addr_reg, host2uint32_t_le(conf_addr));
    259259
    260260        /*
     
    263263         * support shorter PIO reads offset from this register.
    264264         */
    265         val = uint32_t_le2host(pio_read_32(bus->conf_data_port));
     265        val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
    266266
    267267        switch (len) {
     
    299299                 * missing bits first.
    300300                 */
    301                 pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr));
    302                 val = uint32_t_le2host(pio_read_32(bus->conf_data_port));
     301                pio_write_32(bus->conf_addr_reg, host2uint32_t_le(conf_addr));
     302                val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
    303303        }
    304304       
     
    317317        }
    318318
    319         pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr));
    320         pio_write_32(bus->conf_data_port, host2uint32_t_le(val));
     319        pio_write_32(bus->conf_addr_reg, host2uint32_t_le(conf_addr));
     320        pio_write_32(bus->conf_data_reg, host2uint32_t_le(val));
    321321       
    322322        fibril_mutex_unlock(&bus->conf_mutex);
     
    449449                hw_resources[count].res.io_range.address = range_addr;
    450450                hw_resources[count].res.io_range.size = range_size;
     451                hw_resources[count].res.io_range.relative = true;
    451452                hw_resources[count].res.io_range.endianness = LITTLE_ENDIAN;
    452453        } else {
     
    454455                hw_resources[count].res.mem_range.address = range_addr;
    455456                hw_resources[count].res.mem_range.size = range_size;
     457                hw_resources[count].res.mem_range.relative = false;
    456458                hw_resources[count].res.mem_range.endianness = LITTLE_ENDIAN;
    457459        }
     
    722724            hw_resources.resources[1].res.io_range.address);
    723725       
    724         bus->conf_io_addr =
    725             (uint32_t) hw_resources.resources[0].res.io_range.address;
    726         bus->conf_io_data =
    727             (uint32_t) hw_resources.resources[1].res.io_range.address;
    728        
    729         if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 4,
    730             &bus->conf_addr_port)) {
     726        if (pio_enable_resource(&bus->pio_win, &hw_resources.resources[0],
     727            (void **) &bus->conf_addr_reg)) {
    731728                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
    732729                rc = EADDRNOTAVAIL;
    733730                goto fail;
    734731        }
    735         if (pio_enable((void *)(uintptr_t)bus->conf_io_data, 4,
    736             &bus->conf_data_port)) {
     732        if (pio_enable_resource(&bus->pio_win, &hw_resources.resources[1],
     733            (void **) &bus->conf_data_reg)) {
    737734                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
    738735                rc = EADDRNOTAVAIL;
Note: See TracChangeset for help on using the changeset viewer.