Skip to content

Commit 88555b4

Browse files
paulburtonralfbaechle
authored andcommitted
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 <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/14341/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent 23dac14 commit 88555b4

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

arch/mips/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,6 +2995,9 @@ config HT_PCI
29952995
config PCI_DOMAINS
29962996
bool
29972997

2998+
config PCI_DOMAINS_GENERIC
2999+
bool
3000+
29983001
source "drivers/pci/Kconfig"
29993002

30003003
#

arch/mips/include/asm/pci.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ struct pci_controller {
3939
struct resource *busn_resource;
4040
unsigned long busn_offset;
4141

42+
#ifndef CONFIG_PCI_DOMAINS_GENERIC
4243
unsigned int index;
4344
/* For compatibility with current (as of July 2003) pciutils
4445
and XFree86. Eventually will be removed. */
4546
unsigned int need_domain_info;
47+
#endif
4648

4749
/* Optional access methods for reading/writing the bus number
4850
of the PCI controller */
@@ -101,14 +103,31 @@ struct pci_dev;
101103
*/
102104
#define PCI_DMA_BUS_IS_PHYS (1)
103105

104-
#ifdef CONFIG_PCI_DOMAINS
106+
#ifdef CONFIG_PCI_DOMAINS_GENERIC
107+
static inline int pci_proc_domain(struct pci_bus *bus)
108+
{
109+
return pci_domain_nr(bus);
110+
}
111+
112+
static 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)
105118
#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
106119

107120
static inline int pci_proc_domain(struct pci_bus *bus)
108121
{
109122
struct pci_controller *hose = bus->sysdata;
110123
return hose->need_domain_info;
111124
}
125+
126+
static 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+
}
112131
#endif /* CONFIG_PCI_DOMAINS */
113132

114133
#endif /* __KERNEL__ */

arch/mips/pci/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ static void pcibios_scanbus(struct pci_controller *hose)
9595
&resources);
9696
hose->bus = bus;
9797

98-
need_domain_info = need_domain_info || hose->index;
99-
hose->need_domain_info = need_domain_info;
98+
need_domain_info = need_domain_info || pci_domain_nr(bus);
99+
set_pci_need_domain_info(hose, need_domain_info);
100100

101101
if (!bus) {
102102
pci_free_resource_list(&resources);

0 commit comments

Comments
 (0)