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

    r695b6ff rddd0499d  
    11571157        ahci->memregs = NULL;
    11581158       
    1159         physmem_map((uintptr_t) (hw_res_parsed.mem_ranges.ranges[0].address),
     1159        physmem_map(RNGABS(hw_res_parsed.mem_ranges.ranges[0]),
    11601160            AHCI_MEMREGS_PAGES_COUNT, AS_AREA_READ | AS_AREA_WRITE,
    11611161            (void **) &ahci->memregs);
     
    11641164       
    11651165        /* Register interrupt handler */
    1166         ahci_ranges[0].base = (size_t) hw_res_parsed.mem_ranges.ranges[0].address;
     1166        ahci_ranges[0].base = RNGABS(hw_res_parsed.mem_ranges.ranges[0]);
    11671167        ahci_ranges[0].size = sizeof(ahci_memregs_t);
    11681168       
     
    11711171               
    11721172                ahci_cmds[base].addr =
    1173                     ((uint32_t *) (size_t) hw_res_parsed.mem_ranges.ranges[0].address) +
     1173                    ((uint32_t *) RNGABSPTR(hw_res_parsed.mem_ranges.ranges[0])) +
    11741174                    AHCI_PORTS_REGISTERS_OFFSET + port * AHCI_PORT_REGISTERS_SIZE +
    11751175                    AHCI_PORT_IS_REGISTER_OFFSET;
     
    11771177               
    11781178                ahci_cmds[base + 3].addr =
    1179                     ((uint32_t *) (size_t) hw_res_parsed.mem_ranges.ranges[0].address) +
     1179                    ((uint32_t *) RNGABSPTR(hw_res_parsed.mem_ranges.ranges[0])) +
    11801180                    AHCI_GHC_IS_REGISTER_OFFSET;
    11811181                ahci_cmds[base + 4].addr = ahci_cmds[base + 3].addr;
Note: See TracChangeset for help on using the changeset viewer.