[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328425088-6562-14-git-send-email-yinghai@kernel.org>
Date: Sat, 4 Feb 2012 22:57:57 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Jesse Barnes <jbarnes@...tuousgeek.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Tony Luck <tony.luck@...el.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...e.de>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH 13/24] PCI: Strict checking of valid range for bridge
children bridges busn range should be able to be allocated from parent bus range.
to avoid overlapping between sibling bridges on same bus.
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
drivers/pci/probe.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7015dcd..a860acb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -770,6 +770,31 @@ reduce_needed_size:
return ret;
}
+static int __devinit pci_bridge_check_busn_broken(struct pci_bus *bus,
+ struct pci_dev *dev,
+ int secondary, int subordinate)
+{
+ int broken = 0;
+
+ struct resource busn_res;
+ int ret;
+
+ memset(&busn_res, 0, sizeof(struct resource));
+ dev_printk(KERN_DEBUG, &dev->dev,
+ "check if busn %02x-%02x is in busn_res: %pR\n",
+ secondary, subordinate, &bus->busn_res);
+ ret = allocate_resource(&bus->busn_res, &busn_res,
+ (subordinate - secondary + 1),
+ busn(pci_domain_nr(bus), secondary),
+ busn(pci_domain_nr(bus), subordinate),
+ 1, NULL, NULL);
+ if (ret)
+ broken = 1;
+ else
+ release_resource(&busn_res);
+
+ return broken;
+}
/*
* 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