diff options
author | Zoltan Kiss <zoltan.kiss@citrix.com> | 2013-08-22 22:19:18 (GMT) |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-08-23 15:21:19 (GMT) |
commit | 808e34e2cd6bc74a2311b6a00d12a52e37fb50c0 (patch) | |
tree | 140b13a3e3946b3695176ea9c989e658d8a1b09e /drivers/pci/probe.c | |
parent | da27f4b3ec77a04672345381cbfeeb841d427327 (diff) | |
download | linux-fsl-qoriq-808e34e2cd6bc74a2311b6a00d12a52e37fb50c0.tar.xz |
PCI: Disable decoding for BAR sizing only when it was actually enabled
We disable BARs while sizing them so we don't cause conflicts with other
devices (see 253d2e5498 and bbffe43524). But if device decoding is already
disabled before we size the BAR, we don't need to disable it again.
[bhelgaas: changelog, add PCI_COMMAND_DECODING_ENABLE for readability]
Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cf57fe7..b50386d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -156,6 +156,8 @@ static inline unsigned long decode_bar(struct pci_dev *dev, u32 bar) return flags; } +#define PCI_COMMAND_DECODE_ENABLE (PCI_COMMAND_MEMORY | PCI_COMMAND_IO) + /** * pci_read_base - read a PCI BAR * @dev: the PCI device @@ -178,8 +180,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, /* No printks while decoding is disabled! */ if (!dev->mmio_always_on) { pci_read_config_word(dev, PCI_COMMAND, &orig_cmd); - pci_write_config_word(dev, PCI_COMMAND, - orig_cmd & ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO)); + if (orig_cmd & PCI_COMMAND_DECODE_ENABLE) { + pci_write_config_word(dev, PCI_COMMAND, + orig_cmd & ~PCI_COMMAND_DECODE_ENABLE); + } } res->name = pci_name(dev); @@ -293,7 +297,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, fail: res->flags = 0; out: - if (!dev->mmio_always_on) + if (!dev->mmio_always_on && + (orig_cmd & PCI_COMMAND_DECODE_ENABLE)) pci_write_config_word(dev, PCI_COMMAND, orig_cmd); if (bar_too_big) |