summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-11-29 13:17:49 -0700
committerSimon Glass <sjg@chromium.org>2016-01-12 10:19:09 -0700
commit5e23b8b4a4a63178015432a94617d937d8eb42cd (patch)
tree1285b0a143961b630bb27338bbe8f8f84a59a23c /drivers/pci/pci-uclass.c
parentf3f1faefcc25c7cce2babe944aa39178b498cd7f (diff)
downloadtalos-obmc-uboot-5e23b8b4a4a63178015432a94617d937d8eb42cd.tar.gz
talos-obmc-uboot-5e23b8b4a4a63178015432a94617d937d8eb42cd.zip
dm: pci: Use driver model PCI API in auto-config
At present we are using legacy functions even in the auto-configuration code used by driver model. Add a new pci_auto.c version which uses the correct API. Create a new pci_internal.h header to hold functions that are used within the PCI subsystem, but are not exported to other drivers. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/pci/pci-uclass.c')
-rw-r--r--drivers/pci/pci-uclass.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 28280553da..792d9cbeeb 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -17,6 +17,7 @@
#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
#include <asm/fsp/fsp_support.h>
#endif
+#include "pci_internal.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -404,7 +405,7 @@ int pci_auto_config_devices(struct udevice *bus)
int ret;
debug("%s: device %s\n", __func__, dev->name);
- ret = pciauto_config_device(hose, dm_pci_get_bdf(dev));
+ ret = dm_pciauto_config_device(dev);
if (ret < 0)
return ret;
max_bus = ret;
@@ -419,26 +420,16 @@ int pci_auto_config_devices(struct udevice *bus)
return sub_bus;
}
-int dm_pci_hose_probe_bus(struct pci_controller *hose, pci_dev_t bdf)
+int dm_pci_hose_probe_bus(struct udevice *bus)
{
- struct udevice *parent, *bus;
int sub_bus;
int ret;
debug("%s\n", __func__);
- parent = hose->bus;
-
- /* Find the bus within the parent */
- ret = pci_bus_find_devfn(parent, PCI_MASK_BUS(bdf), &bus);
- if (ret) {
- debug("%s: Cannot find device %x on bus %s: %d\n", __func__,
- bdf, parent->name, ret);
- return ret;
- }
sub_bus = pci_get_bus_max() + 1;
debug("%s: bus = %d/%s\n", __func__, sub_bus, bus->name);
- pciauto_prescan_setup_bridge(hose, bdf, sub_bus);
+ dm_pciauto_prescan_setup_bridge(bus, sub_bus);
ret = device_probe(bus);
if (ret) {
@@ -452,7 +443,7 @@ int dm_pci_hose_probe_bus(struct pci_controller *hose, pci_dev_t bdf)
return -EPIPE;
}
sub_bus = pci_get_bus_max();
- pciauto_postscan_setup_bridge(hose, bdf, sub_bus);
+ dm_pciauto_postscan_setup_bridge(bus, sub_bus);
return sub_bus;
}
OpenPOWER on IntegriCloud