Changeset ad6857c in mainline for uspace/drv/pciintel/pci.c


Ignore:
Timestamp:
2011-02-27T02:43:29Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e1eb4d0
Parents:
1ae51ae
Message:

Fixed: pciintel reports correct io sizes

BIG FAT WARNING!!!:
I don't know whether the new version is correct, but it gets correct
values for my nb with intel chipset (as far as I can tell).
Someone with actual knowledge about PCI bus should definitely look at this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/pciintel/pci.c

    r1ae51ae rad6857c  
    320320        /* Get the value of the BAR. */
    321321        val = pci_conf_read_32(fun, addr);
     322
     323#define IO_MASK  (~0x3)
     324#define MEM_MASK (~0xf)
    322325       
    323326        io = (bool) (val & 1);
    324327        if (io) {
    325328                addrw64 = false;
     329                mask = IO_MASK;
    326330        } else {
     331                mask = MEM_MASK;
    327332                switch ((val >> 1) & 3) {
    328333                case 0:
     
    340345        /* Get the address mask. */
    341346        pci_conf_write_32(fun, addr, 0xffffffff);
    342         mask = pci_conf_read_32(fun, addr);
     347        mask &= pci_conf_read_32(fun, addr);
    343348       
    344349        /* Restore the original value. */
     
    659664size_t pci_bar_mask_to_size(uint32_t mask)
    660665{
    661         return ((mask & 0xfffffff0) ^ 0xffffffff) + 1;
     666        size_t size = mask & ~(mask - 1);
     667        return size;
    662668}
    663669
Note: See TracChangeset for help on using the changeset viewer.