aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2011-10-28 18:25:50 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-01-06 15:10:52 -0500
commita2ebb827958a4ab3577443f89037f229683c644a (patch)
treec1e44c472315f75c8ba9d147e3712db1e9017a1e
parent166c6370754a0a92386e2ffb0eeb06e50ac8588d (diff)
PCI: add pci_scan_root_bus() that accepts resource list
"Early" and "header" quirks often use incorrect bus resources because they see the default resources assigned by pci_create_bus(), before the architecture fixes them up (typically in pcibios_fixup_bus()). Regions reserved by these quirks end up with the wrong parents. Here's the standard path for scanning a PCI root bus: pci_scan_bus or pci_scan_bus_parented pci_create_bus <-- A create with default resources pci_scan_child_bus pci_scan_slot pci_scan_single_device pci_scan_device pci_setup_device pci_fixup_device(early) <-- B pci_device_add pci_fixup_device(header) <-- C pcibios_fixup_bus <-- D fill in correct resources Early and header quirks at B and C use the default (incorrect) root bus resources rather than those filled in at D. This patch adds a new pci_scan_root_bus() function that sets the bus resources correctly from a supplied list of resources. I intend to remove pci_scan_bus() and pci_scan_bus_parented() after fixing all callers. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--drivers/pci/probe.c15
-rw-r--r--include/linux/pci.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 89ecded0581b..7fc7e14118cc 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1608,6 +1608,21 @@ err_out:
1608 return NULL; 1608 return NULL;
1609} 1609}
1610 1610
1611struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
1612 struct pci_ops *ops, void *sysdata, struct list_head *resources)
1613{
1614 struct pci_bus *b;
1615
1616 b = pci_create_root_bus(parent, bus, ops, sysdata, resources);
1617 if (!b)
1618 return NULL;
1619
1620 b->subordinate = pci_scan_child_bus(b);
1621 pci_bus_add_devices(b);
1622 return b;
1623}
1624EXPORT_SYMBOL(pci_scan_root_bus);
1625
1611struct pci_bus *pci_create_bus(struct device *parent, 1626struct pci_bus *pci_create_bus(struct device *parent,
1612 int bus, struct pci_ops *ops, void *sysdata) 1627 int bus, struct pci_ops *ops, void *sysdata)
1613{ 1628{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index eacb1e51e11b..5102d74f6bfc 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -673,6 +673,9 @@ static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *o
673struct pci_bus *pci_create_root_bus(struct device *parent, int bus, 673struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
674 struct pci_ops *ops, void *sysdata, 674 struct pci_ops *ops, void *sysdata,
675 struct list_head *resources); 675 struct list_head *resources);
676struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
677 struct pci_ops *ops, void *sysdata,
678 struct list_head *resources);
676struct pci_bus *pci_create_bus(struct device *parent, int bus, 679struct pci_bus *pci_create_bus(struct device *parent, int bus,
677 struct pci_ops *ops, void *sysdata); 680 struct pci_ops *ops, void *sysdata);
678struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 681struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,