aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-10-05 13:18:08 -0400
committerRalf Baechle <ralf@linux-mips.org>2016-10-06 11:57:23 -0400
commit88555b481958083b1b928a4ba5c6e3bc606ce34b (patch)
treec7e0e62e57e7d4e013f1f38cf408654c1ee6faa7 /arch/mips
parent23dac14d058fcd7cb2b4e6389139ca065855afe7 (diff)
MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC
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 <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14341/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/mips/include/asm/pci.h21
-rw-r--r--arch/mips/pci/pci.c4
3 files changed, 25 insertions, 3 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 400cd3695ecc..7a75215aabac 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2995,6 +2995,9 @@ config HT_PCI
2995config PCI_DOMAINS 2995config PCI_DOMAINS
2996 bool 2996 bool
2997 2997
2998config PCI_DOMAINS_GENERIC
2999 bool
3000
2998source "drivers/pci/Kconfig" 3001source "drivers/pci/Kconfig"
2999 3002
3000# 3003#
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 547e113ac0fe..0564692c7d3b 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -39,10 +39,12 @@ struct pci_controller {
39 struct resource *busn_resource; 39 struct resource *busn_resource;
40 unsigned long busn_offset; 40 unsigned long busn_offset;
41 41
42#ifndef CONFIG_PCI_DOMAINS_GENERIC
42 unsigned int index; 43 unsigned int index;
43 /* For compatibility with current (as of July 2003) pciutils 44 /* For compatibility with current (as of July 2003) pciutils
44 and XFree86. Eventually will be removed. */ 45 and XFree86. Eventually will be removed. */
45 unsigned int need_domain_info; 46 unsigned int need_domain_info;
47#endif
46 48
47 /* Optional access methods for reading/writing the bus number 49 /* Optional access methods for reading/writing the bus number
48 of the PCI controller */ 50 of the PCI controller */
@@ -101,7 +103,18 @@ struct pci_dev;
101 */ 103 */
102#define PCI_DMA_BUS_IS_PHYS (1) 104#define PCI_DMA_BUS_IS_PHYS (1)
103 105
104#ifdef CONFIG_PCI_DOMAINS 106#ifdef CONFIG_PCI_DOMAINS_GENERIC
107static inline int pci_proc_domain(struct pci_bus *bus)
108{
109 return pci_domain_nr(bus);
110}
111
112static inline void set_pci_need_domain_info(struct pci_controller *hose,
113 int need_domain_info)
114{
115 /* nothing to do */
116}
117#elif defined(CONFIG_PCI_DOMAINS)
105#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 118#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
106 119
107static inline int pci_proc_domain(struct pci_bus *bus) 120static inline int pci_proc_domain(struct pci_bus *bus)
@@ -109,6 +122,12 @@ static inline int pci_proc_domain(struct pci_bus *bus)
109 struct pci_controller *hose = bus->sysdata; 122 struct pci_controller *hose = bus->sysdata;
110 return hose->need_domain_info; 123 return hose->need_domain_info;
111} 124}
125
126static inline void set_pci_need_domain_info(struct pci_controller *hose,
127 int need_domain_info)
128{
129 hose->need_domain_info = need_domain_info;
130}
112#endif /* CONFIG_PCI_DOMAINS */ 131#endif /* CONFIG_PCI_DOMAINS */
113 132
114#endif /* __KERNEL__ */ 133#endif /* __KERNEL__ */
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 644ae9696edd..5207c043c69c 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)
95 &resources); 95 &resources);
96 hose->bus = bus; 96 hose->bus = bus;
97 97
98 need_domain_info = need_domain_info || hose->index; 98 need_domain_info = need_domain_info || pci_domain_nr(bus);
99 hose->need_domain_info = need_domain_info; 99 set_pci_need_domain_info(hose, need_domain_info);
100 100
101 if (!bus) { 101 if (!bus) {
102 pci_free_resource_list(&resources); 102 pci_free_resource_list(&resources);