From patchwork Fri Jan 15 00:39:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 73044 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0F0eZIL005462 for ; Fri, 15 Jan 2010 00:40:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751621Ab0AOAk3 (ORCPT ); Thu, 14 Jan 2010 19:40:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751156Ab0AOAk2 (ORCPT ); Thu, 14 Jan 2010 19:40:28 -0500 Received: from hera.kernel.org ([140.211.167.34]:56035 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049Ab0AOAk1 (ORCPT ); Thu, 14 Jan 2010 19:40:27 -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 o0F0eFDJ022749 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 15 Jan 2010 00:40:22 GMT X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.95.2 at hera.kernel.org Message-ID: <4B4FB931.7020301@kernel.org> Date: Thu, 14 Jan 2010 16:39:13 -0800 From: Yinghai Lu User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091130 SUSE/3.0.0-1.1.1 Thunderbird/3.0 MIME-Version: 1.0 To: Bjorn Helgaas CC: Jeff Garrett , linux-kernel@vger.kernel.org, Len Brown , linux-acpi@vger.kernel.org, Jesse Barnes , linux-pci@vger.kernel.org, David Airlie Subject: Re: [PATCH] x86/pci: intel ioh need to subtract mmconf range References: <20100113053736.GA6720@jgarrett.org> <201001141609.19290.bjorn.helgaas@hp.com> <4B4FAAE0.7080608@kernel.org> <201001141649.08554.bjorn.helgaas@hp.com> In-Reply-To: <201001141649.08554.bjorn.helgaas@hp.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Index: linux-2.6/arch/x86/pci/intel_bus.c =================================================================== --- linux-2.6.orig/arch/x86/pci/intel_bus.c +++ linux-2.6/arch/x86/pci/intel_bus.c @@ -46,6 +46,18 @@ static inline void print_ioh_resources(s #define RANGE_NUM 16 +static void __devinit subtract_mmconf(struct range *range, int nr) +{ + struct pci_mmcfg_region *cfg; + + if (list_empty(&pci_mmcfg_list)) + return; + + list_for_each_entry(cfg, &pci_mmcfg_list, list) + subtract_range(range, nr, cfg->res.start, + cfg->res.end + 1); +} + static void __devinit pci_root_bus_res(struct pci_dev *dev) { u16 word; @@ -58,6 +70,9 @@ static void __devinit pci_root_bus_res(s struct range range[RANGE_NUM]; int i; + if (list_empty(&pci_mmcfg_list)) + return; + /* some sys doesn't get mmconf enabled */ if (dev->cfg_size < 0x200) return; @@ -96,6 +111,7 @@ static void __devinit pci_root_bus_res(s subtract_range(range, RANGE_NUM, vt_base, vt_end + 1); } + subtract_mmconf(range, RANGE_NUM); for (i = 0; i < RANGE_NUM; i++) { if (!range[i].end) continue; @@ -112,8 +128,18 @@ static void __devinit pci_root_bus_res(s mmioh_base |= ((u64)(dword & 0x7ffff)) << 32; pci_read_config_dword(dev, IOH_LMMIOH_LIMITU, &dword); mmioh_end |= ((u64)(dword & 0x7ffff)) << 32; - update_res(info, cap_resource(mmioh_base), cap_resource(mmioh_end), - IORESOURCE_MEM, 0); + memset(range, 0, sizeof(range)); + add_range(range, RANGE_NUM, 0, mmioh_base, mmioh_end + 1); + /* mmconf could be above 4g */ + subtract_mmconf(range, RANGE_NUM); + for (i = 0; i < RANGE_NUM; i++) { + if (!range[i].end) + continue; + + update_res(info, cap_resource(range[i].start), + cap_resource(range[i].end - 1), + IORESOURCE_MEM, 0); + } print_ioh_resources(info); } Index: linux-2.6/arch/x86/pci/Makefile =================================================================== --- linux-2.6.orig/arch/x86/pci/Makefile +++ linux-2.6/arch/x86/pci/Makefile @@ -14,7 +14,8 @@ obj-$(CONFIG_X86_VISWS) += visws.o obj-$(CONFIG_X86_NUMAQ) += numaq_32.o obj-y += common.o early.o -obj-y += amd_bus.o bus_numa.o intel_bus.o +obj-y += amd_bus.o bus_numa.o +obj-$(CONFIG_PCI_MMCONFIG) += intel_bus.o ifeq ($(CONFIG_PCI_DEBUG),y) EXTRA_CFLAGS += -DDEBUG