Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933318Ab2BAWqw (ORCPT ); Wed, 1 Feb 2012 17:46:52 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:48650 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757714Ab2BAWom (ORCPT ); Wed, 1 Feb 2012 17:44:42 -0500 From: Yinghai Lu To: Jesse Barnes , Benjamin Herrenschmidt , Tony Luck Cc: Bjorn Helgaas , Dominik Brodowski , Andrew Morton , Linus Torvalds , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Yinghai Lu Subject: [PATCH 11/15] PCI: Strict checking of valid range for bridge Date: Wed, 1 Feb 2012 14:43:58 -0800 Message-Id: <1328136242-17725-12-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1328136242-17725-1-git-send-email-yinghai@kernel.org> References: <1328136242-17725-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090202.4F29C04F.002A,ss=1,re=0.000,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1550 Lines: 53 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 --- 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 10aa6d1..b9459c5 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -784,6 +784,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), + (pci_domain_nr(bus)<<8) | secondary, + (pci_domain_nr(bus)<<8) | 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/