Skip to content

Commit

Permalink
MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Burton authored and Ralf Baechle committed Oct 6, 2016
1 parent 23dac14 commit 88555b4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2995,6 +2995,9 @@ config HT_PCI
config PCI_DOMAINS
bool

config PCI_DOMAINS_GENERIC
bool

source "drivers/pci/Kconfig"

#
Expand Down
21 changes: 20 additions & 1 deletion arch/mips/include/asm/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -101,14 +103,31 @@ 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)
{
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__ */
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 88555b4

Please sign in to comment.