Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758803Ab2FZSy4 (ORCPT ); Tue, 26 Jun 2012 14:54:56 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:29933 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755324Ab2FZSyy (ORCPT ); Tue, 26 Jun 2012 14:54:54 -0400 From: Yinghai Lu To: Bjorn Helgaas , Benjamin Herrenschmidt , Tony Luck , David Miller , x86 Cc: Dominik Brodowski , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Yinghai Lu Subject: [PATCH -v12 04/15] PCI: Add pci_bus_extend/shrink_top() Date: Tue, 26 Jun 2012 11:53:58 -0700 Message-Id: <1340736849-14875-5-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1340736849-14875-1-git-send-email-yinghai@kernel.org> References: <1340736849-14875-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1670 Lines: 58 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 --- 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 cd06c84..44c42ae 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -689,6 +689,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 -- 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/