summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-uclass.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-07-19 00:20:06 +0800
committerSimon Glass <sjg@chromium.org>2015-07-28 10:36:24 -0600
commitd11d9ef1579ed7ee58b28828a67b7e174c571fb3 (patch)
tree5803f6bc7d5090b162f1577d86a5f3d18e160d9f /drivers/pci/pci-uclass.c
parent8326f136da6dc496648b8aa75d9717e2e31adad0 (diff)
downloadtalos-obmc-uboot-d11d9ef1579ed7ee58b28828a67b7e174c571fb3.tar.gz
talos-obmc-uboot-d11d9ef1579ed7ee58b28828a67b7e174c571fb3.zip
dm: pci: Support bridge device configuration correctly
Commit aec241d "dm: pci: Use the correct hose when configuring devices" was an attempt to fix pci bridge device configuration, but unfortunately that does not work 100%. In pciauto_config_devices(), the fix tried to call pciauto_config_device() with a ctlr_hose which is supposed to be the root controller hose, however when walking through a pci topology with 2 or more pci bridges this logic simply fails. The call chain is: pciauto_config_devices()->pciauto_config_device() ->dm_pci_hose_probe_bus(). Here the call to dm_pci_hose_probe_bus() does not make any sense as the given hose is not the bridge device's hose, instead it is either the root controller's hose (case#1: if it is the 2nd pci bridge), or the bridge's parent bridge's hose (case#2: if it is the 3rd pci bridge). In both cases the logic is wrong. For example, for failing case#1 if the bridge device to config has the same devfn as one of the devices under the root controller, the call to pci_bus_find_devfn() will return the udevice of that pci device under the root controller as the bus, but this is wrong as the udevice is not a bus which does not contain all the necessary bits associated with the udevice which causes further failures. To correctly support pci bridge device configuration, we should still call pciauto_config_device() with the pci bridge's hose directly. In order to access valid pci region information, we need to refer to the root controller simply by a call to pci_bus_to_hose(0) and get the region information there in the pciauto_prescan_setup_bridge(), pciauto_postscan_setup_bridge() and pciauto_config_device(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/pci/pci-uclass.c')
-rw-r--r--drivers/pci/pci-uclass.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index bc0be1e9e4..c7d93f92d6 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -301,14 +301,10 @@ int pci_auto_config_devices(struct udevice *bus)
for (ret = device_find_first_child(bus, &dev);
!ret && dev;
ret = device_find_next_child(&dev)) {
- struct pci_controller *ctlr_hose;
unsigned int max_bus;
debug("%s: device %s\n", __func__, dev->name);
-
- /* The root controller has the region information */
- ctlr_hose = hose->ctlr->uclass_priv;
- max_bus = pciauto_config_device(ctlr_hose, pci_get_bdf(dev));
+ max_bus = pciauto_config_device(hose, pci_get_bdf(dev));
sub_bus = max(sub_bus, max_bus);
}
debug("%s: done\n", __func__);
OpenPOWER on IntegriCloud