diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-05 13:50:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-05 13:50:46 -0700 |
commit | 9b6a3df372f0318bb0ffe37ac5f4610fb9bdb44d (patch) | |
tree | 88b76c84a21927acffd02f556764c4be33258bce /drivers/pci/iov.c | |
parent | d3acd16cda3a1cbaff7c579c0e054f0ece613d14 (diff) | |
parent | 6faf17f6f1ffc586d16efc2f9fa2083a7785ee74 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI SR-IOV: correct broken resource alignment calculations
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r-- | drivers/pci/iov.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index e3a87210e94..e03fe98f061 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -598,6 +598,29 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno, } /** + * pci_sriov_resource_alignment - get resource alignment for VF BAR + * @dev: the PCI device + * @resno: the resource number + * + * Returns the alignment of the VF BAR found in the SR-IOV capability. + * This is not the same as the resource size which is defined as + * the VF BAR size multiplied by the number of VFs. The alignment + * is just the VF BAR size. + */ +int pci_sriov_resource_alignment(struct pci_dev *dev, int resno) +{ + struct resource tmp; + enum pci_bar_type type; + int reg = pci_iov_resource_bar(dev, resno, &type); + + if (!reg) + return 0; + + __pci_read_base(dev, type, &tmp, reg); + return resource_alignment(&tmp); +} + +/** * pci_restore_iov_state - restore the state of the IOV capability * @dev: the PCI device */ |