From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932861AbcH3Rah (ORCPT ); Tue, 30 Aug 2016 13:30:37 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:37923 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932636AbcH3Raf (ORCPT ); Tue, 30 Aug 2016 13:30:35 -0400 From: Paul Burton To: , Ralf Baechle CC: Paul Burton , Lorenzo Pieralisi , Bjorn Helgaas , , Sergey Ryazanov , Yinghai Lu , Will Deacon Subject: [PATCH v2 01/26] MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC Date: Tue, 30 Aug 2016 18:29:04 +0100 Message-ID: <20160830172929.16948-2-paul.burton@imgtec.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160830172929.16948-1-paul.burton@imgtec.com> References: <20160830172929.16948-1-paul.burton@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.100.200.118] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce support for CONFIG_PCI_DOMAINS_GENERIC, allowing for platforms to make use of generic PCI domains instead of the MIPS-specific implementation. The set_pci_need_domain_info function is introduced to abstract away the removed need_domain_info field in struct pci_controller, and pcibios_scanbus is adjusted to use the pci_domain_nr accessor instead of directly accessing the index field. Signed-off-by: Paul Burton --- Changes in v2: None arch/mips/Kconfig | 3 +++ arch/mips/include/asm/pci.h | 21 ++++++++++++++++++++- arch/mips/pci/pci.c | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 45bbddf..88c0c0d 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2980,6 +2980,9 @@ config HT_PCI config PCI_DOMAINS bool +config PCI_DOMAINS_GENERIC + bool + source "drivers/pci/Kconfig" # diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h index 547e113..0564692 100644 --- a/arch/mips/include/asm/pci.h +++ b/arch/mips/include/asm/pci.h @@ -39,10 +39,12 @@ struct pci_controller { struct resource *busn_resource; unsigned long busn_offset; +#ifndef CONFIG_PCI_DOMAINS_GENERIC unsigned int index; /* For compatibility with current (as of July 2003) pciutils and XFree86. Eventually will be removed. */ unsigned int need_domain_info; +#endif /* Optional access methods for reading/writing the bus number of the PCI controller */ @@ -101,7 +103,18 @@ struct pci_dev; */ #define PCI_DMA_BUS_IS_PHYS (1) -#ifdef CONFIG_PCI_DOMAINS +#ifdef CONFIG_PCI_DOMAINS_GENERIC +static inline int pci_proc_domain(struct pci_bus *bus) +{ + return pci_domain_nr(bus); +} + +static inline void set_pci_need_domain_info(struct pci_controller *hose, + int need_domain_info) +{ + /* nothing to do */ +} +#elif defined(CONFIG_PCI_DOMAINS) #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index static inline int pci_proc_domain(struct pci_bus *bus) @@ -109,6 +122,12 @@ static inline int pci_proc_domain(struct pci_bus *bus) struct pci_controller *hose = bus->sysdata; return hose->need_domain_info; } + +static inline void set_pci_need_domain_info(struct pci_controller *hose, + int need_domain_info) +{ + hose->need_domain_info = need_domain_info; +} #endif /* CONFIG_PCI_DOMAINS */ #endif /* __KERNEL__ */ diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index 644ae96..5207c04 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c @@ -95,8 +95,8 @@ static void pcibios_scanbus(struct pci_controller *hose) &resources); hose->bus = bus; - need_domain_info = need_domain_info || hose->index; - hose->need_domain_info = need_domain_info; + need_domain_info = need_domain_info || pci_domain_nr(bus); + set_pci_need_domain_info(hose, need_domain_info); if (!bus) { pci_free_resource_list(&resources); -- 2.9.3