[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1340736849-14875-6-git-send-email-yinghai@kernel.org>
Date: Tue, 26 Jun 2012 11:53:59 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Tony Luck <tony.luck@...el.com>,
David Miller <davem@...emloft.net>, x86 <x86@...nel.org>
Cc: Dominik Brodowski <linux@...inikbrodowski.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH -v12 05/15] PCI: Probe safe range that we can use for unassigned bridge.
Try to allocate from parent bus busn_res. If we can not find any big enough,
will try to extend parent bus top. even the extending is through allocating,
after allocating will pad the range to parent buses top.
When extending happens, We will record the parent_res, so could use it as
stopper for really extend/shrink top later.
-v4: Use generic probe_resource()
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
drivers/pci/probe.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 44c42ae..75bca6f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -717,6 +717,34 @@ static void __devinit pci_bus_shrink_top(struct pci_bus *parent,
pci_bus_extend_top(parent, -size, parent_res);
}
+static int __devinit pci_bridge_probe_busn_res(struct pci_bus *bus,
+ struct pci_dev *dev, struct resource *busn_res,
+ resource_size_t needed_size, struct resource **p)
+{
+ int ret;
+ int old_size = resource_size(&bus->busn_res);
+ int skip_nr = 1;
+ int domain_limit = 0xff;
+ int stop_flags = IORESOURCE_PCI_FIXED;
+
+ ret = probe_resource(&bus->busn_res, busn_res, needed_size,
+ p, skip_nr, domain_limit, stop_flags);
+
+ if (ret)
+ return ret;
+
+ busn_res->flags = IORESOURCE_BUS;
+
+ if (*p) {
+ /* extend parent bus top*/
+ int new_size = resource_size(&bus->busn_res);
+
+ pci_bus_extend_top(bus, new_size - old_size, *p);
+ }
+
+ return ret;
+}
+
/*
* 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
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists