summaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-08-28 20:55:41 -0600
committerBjorn Helgaas <bhelgaas@google.com>2013-08-28 20:55:41 -0600
commit2e8b5f621dbe29425906852c6079afb6b28720cb (patch)
tree178a58a6dee0599d8b119d6c72969f9b6f4e37ac /drivers/pci/probe.c
parent07f2daad094bc9e9770143cd2d619de24d84bb3e (diff)
parentfed2451512495f0f0820ac9e53936bd208569bc8 (diff)
downloadop-kernel-dev-2e8b5f621dbe29425906852c6079afb6b28720cb.zip
op-kernel-dev-2e8b5f621dbe29425906852c6079afb6b28720cb.tar.gz
Merge branch 'pci/misc' into next
* pci/misc: PCI: Remove pcie_cap_has_devctl() PCI: Support PCIe Capability Slot registers only for ports with slots PCI: Remove PCIe Capability version checks PCI: Allow PCIe Capability link-related register access for switches PCI: Add offsets of PCIe capability registers PCI: Tidy bitmasks and spacing of PCIe capability definitions PCI: Remove obsolete comment reference to pci_pcie_cap2() PCI: Clarify PCI_EXP_TYPE_PCI_BRIDGE comment PCI: Rename PCIe capability definitions to follow convention PCI: Disable decoding for BAR sizing only when it was actually enabled PCI: Add comment about needing pci_msi_off() even when CONFIG_PCI_MSI=n PCI: Add pcibios_pm_ops for optional arch-specific hibernate functionality
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a57762f..eeb50bd 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)
OpenPOWER on IntegriCloud