aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/iov.c11
-rw-r--r--drivers/pci/pci.c3
-rw-r--r--drivers/pci/pci.h6
3 files changed, 7 insertions, 13 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 4d109c07294a..4b3a4eaad996 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -479,20 +479,16 @@ void pci_iov_release(struct pci_dev *dev)
479 * pci_iov_resource_bar - get position of the SR-IOV BAR 479 * pci_iov_resource_bar - get position of the SR-IOV BAR
480 * @dev: the PCI device 480 * @dev: the PCI device
481 * @resno: the resource number 481 * @resno: the resource number
482 * @type: the BAR type to be filled in
483 * 482 *
484 * Returns position of the BAR encapsulated in the SR-IOV capability. 483 * Returns position of the BAR encapsulated in the SR-IOV capability.
485 */ 484 */
486int pci_iov_resource_bar(struct pci_dev *dev, int resno, 485int pci_iov_resource_bar(struct pci_dev *dev, int resno)
487 enum pci_bar_type *type)
488{ 486{
489 if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCE_END) 487 if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCE_END)
490 return 0; 488 return 0;
491 489
492 BUG_ON(!dev->is_physfn); 490 BUG_ON(!dev->is_physfn);
493 491
494 *type = pci_bar_unknown;
495
496 return dev->sriov->pos + PCI_SRIOV_BAR + 492 return dev->sriov->pos + PCI_SRIOV_BAR +
497 4 * (resno - PCI_IOV_RESOURCES); 493 4 * (resno - PCI_IOV_RESOURCES);
498} 494}
@@ -510,13 +506,12 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno,
510resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno) 506resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno)
511{ 507{
512 struct resource tmp; 508 struct resource tmp;
513 enum pci_bar_type type; 509 int reg = pci_iov_resource_bar(dev, resno);
514 int reg = pci_iov_resource_bar(dev, resno, &type);
515 510
516 if (!reg) 511 if (!reg)
517 return 0; 512 return 0;
518 513
519 __pci_read_base(dev, type, &tmp, reg); 514 __pci_read_base(dev, pci_bar_unknown, &tmp, reg);
520 return resource_alignment(&tmp); 515 return resource_alignment(&tmp);
521} 516}
522 517
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 625a4ace10b4..7bf246595c63 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4180,7 +4180,8 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type)
4180 return dev->rom_base_reg; 4180 return dev->rom_base_reg;
4181 } else if (resno < PCI_BRIDGE_RESOURCES) { 4181 } else if (resno < PCI_BRIDGE_RESOURCES) {
4182 /* device specific resource */ 4182 /* device specific resource */
4183 reg = pci_iov_resource_bar(dev, resno, type); 4183 *type = pci_bar_unknown;
4184 reg = pci_iov_resource_bar(dev, resno);
4184 if (reg) 4185 if (reg)
4185 return reg; 4186 return reg;
4186 } 4187 }
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 0601890db22d..a0905a0985ce 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -251,8 +251,7 @@ static inline void pci_restore_ats_state(struct pci_dev *dev)
251#ifdef CONFIG_PCI_IOV 251#ifdef CONFIG_PCI_IOV
252int pci_iov_init(struct pci_dev *dev); 252int pci_iov_init(struct pci_dev *dev);
253void pci_iov_release(struct pci_dev *dev); 253void pci_iov_release(struct pci_dev *dev);
254int pci_iov_resource_bar(struct pci_dev *dev, int resno, 254int pci_iov_resource_bar(struct pci_dev *dev, int resno);
255 enum pci_bar_type *type);
256resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno); 255resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno);
257void pci_restore_iov_state(struct pci_dev *dev); 256void pci_restore_iov_state(struct pci_dev *dev);
258int pci_iov_bus_range(struct pci_bus *bus); 257int pci_iov_bus_range(struct pci_bus *bus);
@@ -266,8 +265,7 @@ static inline void pci_iov_release(struct pci_dev *dev)
266 265
267{ 266{
268} 267}
269static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno, 268static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno)
270 enum pci_bar_type *type)
271{ 269{
272 return 0; 270 return 0;
273} 271}