diff options
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 e3a87210e947..e03fe98f0619 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, | |||
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | /** | 600 | /** |
| 601 | * pci_sriov_resource_alignment - get resource alignment for VF BAR | ||
| 602 | * @dev: the PCI device | ||
| 603 | * @resno: the resource number | ||
| 604 | * | ||
| 605 | * Returns the alignment of the VF BAR found in the SR-IOV capability. | ||
| 606 | * This is not the same as the resource size which is defined as | ||
| 607 | * the VF BAR size multiplied by the number of VFs. The alignment | ||
| 608 | * is just the VF BAR size. | ||
| 609 | */ | ||
| 610 | int pci_sriov_resource_alignment(struct pci_dev *dev, int resno) | ||
| 611 | { | ||
| 612 | struct resource tmp; | ||
| 613 | enum pci_bar_type type; | ||
| 614 | int reg = pci_iov_resource_bar(dev, resno, &type); | ||
| 615 | |||
| 616 | if (!reg) | ||
| 617 | return 0; | ||
| 618 | |||
| 619 | __pci_read_base(dev, type, &tmp, reg); | ||
| 620 | return resource_alignment(&tmp); | ||
| 621 | } | ||
| 622 | |||
| 623 | /** | ||
| 601 | * pci_restore_iov_state - restore the state of the IOV capability | 624 | * pci_restore_iov_state - restore the state of the IOV capability |
| 602 | * @dev: the PCI device | 625 | * @dev: the PCI device |
| 603 | */ | 626 | */ |
