Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966075Ab2B2XVG (ORCPT ); Wed, 29 Feb 2012 18:21:06 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:26156 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770Ab2B2XI4 (ORCPT ); Wed, 29 Feb 2012 18:08:56 -0500 From: Yinghai Lu To: Jesse Barnes , Benjamin Herrenschmidt , Tony Luck , David Miller , x86 Cc: Bjorn Helgaas , Dominik Brodowski , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Yinghai Lu Subject: [PATCH 30/39] PCI: Add pci_bus_extend/shrink_top() Date: Wed, 29 Feb 2012 15:07:29 -0800 Message-Id: <1330556858-11768-31-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1330556858-11768-1-git-send-email-yinghai@kernel.org> References: <1330556858-11768-1-git-send-email-yinghai@kernel.org> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-CT-RefId: str=0001.0A090208.4F4EAFF8.0005,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: 1833 Lines: 64 extend or shrink bus and parent buses top (subordinate) extended range is verified safe range, and stop at recorded parent_res. Signed-off-by: Yinghai Lu --- drivers/pci/probe.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 1c07aba..96259f8 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -655,6 +655,42 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) } } +static void __devinit pci_bus_update_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; + res->end += size; + parent->subordinate += size; + pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, + parent->subordinate); + 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_extend_top(struct pci_bus *parent, + long size, struct resource *parent_res) +{ + pci_bus_update_top(parent, size, parent_res); +} + +static void __devinit pci_bus_shrink_top(struct pci_bus *parent, + long size, struct resource *parent_res) +{ + pci_bus_update_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 -- 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/