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

    r695b6ff rddd0499d  
    6565#include <ddf/log.h>
    6666#include <ops/hw_res.h>
     67#include <ops/pio_window.h>
    6768
    6869#include <device/hw_res.h>
     
    104105}
    105106
    106 static hw_resource_list_t *isa_get_fun_resources(ddf_fun_t *fnode)
    107 {
    108         isa_fun_t *isa = isa_fun(fnode);
    109         assert(isa);
    110 
    111         return &isa->hw_resources;
     107static hw_resource_list_t *isa_fun_get_resources(ddf_fun_t *fnode)
     108{
     109        isa_fun_t *fun = isa_fun(fnode);
     110        assert(fun);
     111
     112        return &fun->hw_resources;
    112113}
    113114
     
    116117        /* This is an old ugly way, copied from pci driver */
    117118        assert(fnode);
    118         isa_fun_t *isa = isa_fun(fnode);
    119         assert(isa);
     119        isa_fun_t *fun = isa_fun(fnode);
     120        assert(fun);
    120121
    121122        sysarg_t apic;
     
    133134                return false;
    134135
    135         const hw_resource_list_t *res = &isa->hw_resources;
     136        const hw_resource_list_t *res = &fun->hw_resources;
    136137        assert(res);
    137138        for (size_t i = 0; i < res->count; ++i) {
     
    159160{
    160161        assert(fnode);
    161         isa_fun_t *isa = isa_fun(fnode);
    162         assert(isa);
    163         const hw_resource_list_t *res = &isa->hw_resources;
     162        isa_fun_t *fun = isa_fun(fnode);
     163        assert(fun);
     164        const hw_resource_list_t *res = &fun->hw_resources;
    164165        assert(res);
    165166
     
    182183        assert(size);
    183184        assert(fnode);
    184         isa_fun_t *isa = isa_fun(fnode);
    185         assert(isa);
    186         const hw_resource_list_t *res = &isa->hw_resources;
     185        isa_fun_t *fun = isa_fun(fnode);
     186        assert(fun);
     187        const hw_resource_list_t *res = &fun->hw_resources;
    187188        assert(res);
    188189
     
    201202
    202203static hw_res_ops_t isa_fun_hw_res_ops = {
    203         .get_resource_list = isa_get_fun_resources,
     204        .get_resource_list = isa_fun_get_resources,
    204205        .enable_interrupt = isa_fun_enable_interrupt,
    205206        .dma_channel_setup = isa_fun_setup_dma,
     
    207208};
    208209
     210static pio_window_t *isa_fun_get_pio_window(ddf_fun_t *fnode)
     211{
     212        ddf_dev_t *dev = ddf_fun_get_dev(fnode);
     213        isa_bus_t *isa = isa_bus(dev);
     214        assert(isa);
     215
     216        return &isa->pio_win;
     217}
     218
     219static pio_window_ops_t isa_fun_pio_window_ops = {
     220        .get_pio_window = isa_fun_get_pio_window
     221};
     222
    209223static ddf_dev_ops_t isa_fun_ops= {
    210224        .interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops,
     225        .interfaces[PIO_WINDOW_DEV_IFACE] = &isa_fun_pio_window_ops,
    211226};
    212227
     
    414429                resources[count].res.io_range.address += isa->pio_win.io.base;
    415430                resources[count].res.io_range.size = len;
     431                resources[count].res.io_range.relative = false;
    416432                resources[count].res.io_range.endianness = LITTLE_ENDIAN;
    417433
Note: See TracChangeset for help on using the changeset viewer.