aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-09-17 22:24:30 -0700
committerYinghai Lu <yinghai@kernel.org>2012-09-17 22:24:30 -0700
commit7f028741fe173c2791ce24ed2fd95e38ed9c9e36 (patch)
tree81ca2972ec62544359fccf6f4761d212b1081487
parentf4f26d7257040ff14c9b27f2777b1e3096656637 (diff)
downloadlinux-yinghai-7f028741fe173c2791ce24ed2fd95e38ed9c9e36.tar.gz
PCI: Don't shrink too much for hotplug bridge
Otherwise may have problem later if we plug pcie cards with bridges. Signed-off-by: Yinghai Lu <yinghai@kernel.org>
-rw-r--r--drivers/pci/probe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7c8429ad46b6a..e0f43537e5959 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -991,6 +991,7 @@ static int __devinit pci_bridge_check_busn_broken(struct pci_bus *bus,
static unsigned int __devinit __pci_scan_child_bus(struct pci_bus *bus,
int pass);
+#define HOTPLUG_BRIDGE_RESERVE_BUSNR 8
/*
* If it's a bridge, configure it and scan the bus behind it.
* For CardBus bridges, we don't scan behind as the devices will
@@ -1157,6 +1158,11 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
/*
* Set the subordinate bus number to its real value.
*/
+ if (dev->is_hotplug_bridge && child->busn_res.end > max &&
+ (max - child->busn_res.start) < HOTPLUG_BRIDGE_RESERVE_BUSNR)
+ max = min_t(int, child->busn_res.start +
+ HOTPLUG_BRIDGE_RESERVE_BUSNR,
+ child->busn_res.end);
shrink_size = (int)child->busn_res.end - max;
pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
pci_bus_update_busn_res_end(child, max);