[U-Boot] [PATCH 2/3] pcie_imx: Adjust the return value when imx_pcie_addr_valid() fails

Fabio Estevam festevam at gmail.com
Wed Jan 6 21:53:17 CET 2016


From: Fabio Estevam <fabio.estevam at nxp.com>

Since commit ff3e077bd2 ("dm: pci: Add a uclass for PCI") the following
error message is seen:

=> pci 0
Scanning PCI devices on bus 0
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
_____________________________________________________________
00.01.00   0x16c3     0xabcd     Bridge device           0x04
Cannot read bus configuration: -1

We can avoid this error by using the same approach as done in the
linux kernel PCI designware driver: (drivers/pci/host/pcie-designware.c)

static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
			int size, u32 *val)
{
	struct pcie_port *pp = bus->sysdata;
	int ret;

	if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0) {
		*val = 0xffffffff;
		return PCIBIOS_DEVICE_NOT_FOUND;
	}

,where PCIBIOS_DEVICE_NOT_FOUND is returned when an invalid address
is given.

Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
---
 drivers/pci/pcie_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index f1e189e..02867e2 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -381,7 +381,7 @@ static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
 	ret = imx_pcie_addr_valid(d);
 	if (ret) {
 		*val = 0xffffffff;
-		return ret;
+		return PCIBIOS_DEVICE_NOT_FOUND;
 	}
 
 	va_address = get_bus_address(d, where);
-- 
1.9.1



More information about the U-Boot mailing list