aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-09-17 22:24:28 -0700
committerYinghai Lu <yinghai@kernel.org>2012-09-17 22:24:28 -0700
commit41a1d23d5f8daf38dba2b76634036beb47743b23 (patch)
treec272bbd1f10b18c870cb3cc06498b7f99298b5bc
parent4f2300d956a338a95bdc9e15df94f886f607abda (diff)
downloadlinux-yinghai-41a1d23d5f8daf38dba2b76634036beb47743b23.tar.gz
PCI: Add pci_bus_extend/shrink_top()
Extend or shrink bus and parent buses top (subordinate) Extended range is verified safe range, and stop at recorded parent_res. -v2: Remove busn_res change, it is updated in other function. Signed-off-by: Yinghai Lu <yinghai@kernel.org>
-rw-r--r--drivers/pci/probe.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 54ff6fd6854ea..471f7a331c840 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -864,6 +864,34 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
}
}
+static void __devinit pci_bus_extend_top(struct pci_bus *parent,
+ long size, struct resource *parent_res)
+{
+ struct resource *res;
+
+ if (!size)
+ return;
+
+ while (parent) {
+ res = &parent->busn_res;
+ if (res == parent_res)
+ break;
+ pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS,
+ parent->busn_res.end);
+ dev_printk(KERN_DEBUG, &parent->dev,
+ "busn_res: %s %02lx to %pR\n",
+ (size > 0) ? "extended" : "shrunk",
+ abs(size), res);
+ parent = parent->parent;
+ }
+}
+
+static void __devinit pci_bus_shrink_top(struct pci_bus *parent,
+ long size, struct resource *parent_res)
+{
+ pci_bus_extend_top(parent, -size, parent_res);
+}
+
/*
* 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