Skip to content

Commit

Permalink
ARM64: PCI: Add acpi_pci_bus_find_domain_nr()
Browse files Browse the repository at this point in the history
Extend pci_bus_find_domain_nr() so it can find the domain from either:

  - ACPI, via the new acpi_pci_bus_find_domain_nr() interface, or
  - DT, via of_pci_bus_find_domain_nr()

Note that this is only used for CONFIG_PCI_DOMAINS_GENERIC=y, so it does
not affect x86 or ia64.

[bhelgaas: changelog]
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Tomasz Nowicki authored and Bjorn Helgaas committed Jun 10, 2016
1 parent 1a4f93f commit 2ab51dd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions arch/arm64/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/mm.h>
#include <linux/of_pci.h>
#include <linux/of_platform.h>
#include <linux/pci.h>
#include <linux/slab.h>

/*
Expand Down Expand Up @@ -85,6 +86,12 @@ EXPORT_SYMBOL(pcibus_to_node);
#endif

#ifdef CONFIG_ACPI

int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
{
return 0;
}

/* Root bridge scanning */
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
{
Expand Down
4 changes: 3 additions & 1 deletion drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright 1997 -- 2000 Martin Mares <mj@ucw.cz>
*/

#include <linux/acpi.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
Expand Down Expand Up @@ -4990,7 +4991,8 @@ static int of_pci_bus_find_domain_nr(struct device *parent)

int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent)
{
return of_pci_bus_find_domain_nr(parent);
return acpi_disabled ? of_pci_bus_find_domain_nr(parent) :
acpi_pci_bus_find_domain_nr(bus);
}
#endif
#endif
Expand Down
6 changes: 6 additions & 0 deletions include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,12 @@ static inline int pci_domain_nr(struct pci_bus *bus)
{
return bus->domain_nr;
}
#ifdef CONFIG_ACPI
int acpi_pci_bus_find_domain_nr(struct pci_bus *bus);
#else
static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
{ return 0; }
#endif
int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
#endif

Expand Down

0 comments on commit 2ab51dd

Please sign in to comment.