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/lib/c/include/device/hw_res_parsed.h

    r695b6ff rddd0499d  
    3737
    3838#include <device/hw_res.h>
     39#include <device/pio_window.h>
    3940#include <str.h>
    4041
     
    4546#define HW_RES_KEEP_DUPLICIT   0x2
    4647
     48
     49#define RNGABS(rng)     (rng).address.absolute
     50#define RNGREL(rng)     (rng).address.relative
     51#define RNGSZ(rng)      (rng).size
     52
     53#define RNGABSPTR(rng)  ((void *) ((uintptr_t) RNGABS((rng))))
     54
     55typedef struct address64 {
     56        /** Aboslute address. */
     57        uint64_t absolute;
     58        /** PIO window base relative address. */
     59        uint64_t relative;
     60} address64_t;
     61
    4762/** Address range structure */
    4863typedef struct addr_range {
    4964        /** Start address */
    50         uint64_t address;
    51        
    52         /** Endianness */
    53         endianness_t endianness;
     65        address64_t address;
    5466       
    5567        /** Area size */
    5668        size_t size;
     69
     70        /** Endianness */
     71        endianness_t endianness;
    5772} addr_range_t;
    5873
     
    139154}
    140155
    141 extern int hw_res_list_parse(const hw_resource_list_t *,
     156extern int hw_res_list_parse(const pio_window_t *, const hw_resource_list_t *,
    142157    hw_res_list_parsed_t *, int);
    143158extern int hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
Note: See TracChangeset for help on using the changeset viewer.