From patchwork Wed Jun 24 21:48:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 32271 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5OLmhrS001021 for ; Wed, 24 Jun 2009 21:48:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbZFXVsi (ORCPT ); Wed, 24 Jun 2009 17:48:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751776AbZFXVsi (ORCPT ); Wed, 24 Jun 2009 17:48:38 -0400 Received: from hera.kernel.org ([140.211.167.34]:37208 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbZFXVsh (ORCPT ); Wed, 24 Jun 2009 17:48:37 -0400 Received: from [192.168.86.129] (70.89.117.125-Busname-WA.hfc.comcastbusiness.net [70.89.117.125]) (authenticated bits=0) by hera.kernel.org (8.14.2/8.13.8) with ESMTP id n5OLmRaI002250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Jun 2009 21:48:27 GMT Message-ID: <4A429F29.4070007@kernel.org> Date: Wed, 24 Jun 2009 14:48:25 -0700 From: Yinghai Lu User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: Ingo Molnar , Jesse Barnes , Gary Hade , Matthew Wilcox , Larry Finger CC: Linus Torvalds , Andrew Morton , linux-pci@vger.kernel.org, "linux-kernel@vger.kernel.org" , Jaswinder Singh Rajput Subject: [PATCH] x86/pci: get root CRS before scan child -v2 References: <20090624122433.GA24781@elte.hu> <20090624145119.GA12664@elte.hu> <4A429EBB.5010209@kernel.org> In-Reply-To: <4A429EBB.5010209@kernel.org> X-Virus-Scanned: ClamAV 0.93.3/9504/Wed Jun 24 15:02:51 2009 on hera.kernel.org X-Virus-Status: Clean Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org so we could remove adjust_transparent_bridge_resources.. and give x86_pci_root_bus_res_quirks chance when _CRS is not used or not there. v2: add print out if pci conf reading for res is used for root Signed-off-by: Yinghai Lu --- arch/x86/pci/acpi.c | 32 +++++++++----------------------- arch/x86/pci/amd_bus.c | 8 ++++++-- 2 files changed, 15 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/arch/x86/pci/acpi.c =================================================================== --- linux-2.6.orig/arch/x86/pci/acpi.c +++ linux-2.6/arch/x86/pci/acpi.c @@ -118,23 +118,6 @@ setup_resource(struct acpi_resource *acp } static void -adjust_transparent_bridge_resources(struct pci_bus *bus) -{ - struct pci_dev *dev; - - list_for_each_entry(dev, &bus->devices, bus_list) { - int i; - u16 class = dev->class >> 8; - - if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent) { - for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) - dev->subordinate->resource[i] = - dev->bus->resource[i - 3]; - } - } -} - -static void get_current_resources(struct acpi_device *device, int busnum, int domain, struct pci_bus *bus) { @@ -161,8 +144,6 @@ get_current_resources(struct acpi_device info.res_num = 0; acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, &info); - if (info.res_num) - adjust_transparent_bridge_resources(bus); return; @@ -225,8 +206,15 @@ struct pci_bus * __devinit pci_acpi_scan */ memcpy(bus->sysdata, sd, sizeof(*sd)); kfree(sd); - } else - bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); + } else { + bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); + if (bus) { + if (!(pci_probe & PCI_NO_ROOT_CRS)) + get_current_resources(device, busnum, domain, + bus); + bus->subordinate = pci_scan_child_bus(bus); + } + } if (!bus) kfree(sd); @@ -241,8 +229,6 @@ struct pci_bus * __devinit pci_acpi_scan #endif } - if (bus && !(pci_probe & PCI_NO_ROOT_CRS)) - get_current_resources(device, busnum, domain, bus); return bus; } Index: linux-2.6/arch/x86/pci/amd_bus.c =================================================================== --- linux-2.6.orig/arch/x86/pci/amd_bus.c +++ linux-2.6/arch/x86/pci/amd_bus.c @@ -100,8 +100,9 @@ void x86_pci_root_bus_res_quirks(struct int j; struct pci_root_info *info; - /* don't go for it if _CRS is used */ - if (!(pci_probe & PCI_NO_ROOT_CRS)) + /* don't go for it if _CRS is used already */ + if (b->resource[0] != &ioport_resource || + b->resource[1] != &iomem_resource) return; /* if only one root bus, don't need to anything */ @@ -116,6 +117,9 @@ void x86_pci_root_bus_res_quirks(struct if (i == pci_root_num) return; + printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n", + b->number); + info = &pci_root_info[i]; for (j = 0; j < info->res_num; j++) { struct resource *res;