From patchwork Wed Nov 25 02:05:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 62660 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 nAP2Gpt4014069 for ; Wed, 25 Nov 2009 02:16:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758246AbZKYCQo (ORCPT ); Tue, 24 Nov 2009 21:16:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758232AbZKYCQo (ORCPT ); Tue, 24 Nov 2009 21:16:44 -0500 Received: from hera.kernel.org ([140.211.167.34]:36953 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758186AbZKYCQn (ORCPT ); Tue, 24 Nov 2009 21:16:43 -0500 Received: from [10.6.76.26] (sca-ea-fw-1.Sun.COM [192.18.43.225]) (authenticated bits=0) by hera.kernel.org (8.14.3/8.14.3) with ESMTP id nAP2636L027328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 25 Nov 2009 02:06:03 GMT Message-ID: <4B0C90D8.2000407@kernel.org> Date: Tue, 24 Nov 2009 18:05:12 -0800 From: Yinghai Lu User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Jesse Barnes , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" CC: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Matthew Wilcox Subject: [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource -v2 References: <4AFFB1E6.9040300@kernel.org> <20091124131912.2aabb852@jbarnes-piketon> <4B0C4E69.4090402@kernel.org> <20091124134008.0050a339@jbarnes-piketon> In-Reply-To: <20091124134008.0050a339@jbarnes-piketon> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Index: linux-2.6/arch/x86/pci/i386.c =================================================================== --- linux-2.6.orig/arch/x86/pci/i386.c +++ linux-2.6/arch/x86/pci/i386.c @@ -146,16 +146,29 @@ static void __init pcibios_allocate_bus_ } } +struct pci_check_idx_range { + int start; + int end; +}; + static void __init pcibios_allocate_resources(int pass) { struct pci_dev *dev = NULL; - int idx, disabled; + int idx, disabled, i; u16 command; struct resource *r; + struct pci_check_idx_range idx_range[] = { + { PCI_STD_RESOURCES, PCI_STD_RESOURCE_END }, +#ifdef CONFIG_PCI_IOV + { PCI_IOV_RESOURCES, PCI_IOV_RESOURCE_END }, +#endif + }; + for_each_pci_dev(dev) { pci_read_config_word(dev, PCI_COMMAND, &command); - for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) { + for (i = 0; i < ARRAY_SIZE(idx_range); i++) + for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) { r = &dev->resource[idx]; if (r->parent) /* Already allocated */ continue;