[U-Boot] PCI: Cannot read bus configuration

Hi Simon,
Since commit ff3e077bd2 ("dm: pci: Add a uclass for PCI") I see the following error message after running the 'pci' command:
=> 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 => pci 1 Scanning PCI devices on bus 1 BusDevFun VendorId DeviceId Device Class Sub-Class _____________________________________________________________ 01.00.00 0x8086 0x08b1 Network controller 0x80 Cannot read bus configuration: -1 =>
How can we silent this error?
Regards,
Fabio Estevam

Hi Fabio,
On 7 October 2015 at 19:34, Fabio Estevam festevam@gmail.com wrote:
Hi Simon,
Since commit ff3e077bd2 ("dm: pci: Add a uclass for PCI") I see the following error message after running the 'pci' command:
=> 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 => pci 1 Scanning PCI devices on bus 1 BusDevFun VendorId DeviceId Device Class Sub-Class _____________________________________________________________ 01.00.00 0x8086 0x08b1 Network controller 0x80 Cannot read bus configuration: -1 =>
How can we silent this error?
This added error checking to pci_read_config_word(). It might be worth looking at why the access is failing.
Regards, Simon

Hi Simon,
On Wed, Oct 7, 2015 at 7:30 PM, Simon Glass sjg@chromium.org wrote:
This added error checking to pci_read_config_word(). It might be worth looking at why the access is failing.
I noticed that when VendorID !=0xffff then pci_read_config_word() returns 0.
In the case when VendorID ==0xffff then it returns -1.
If I do like this:
--- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -77,7 +77,7 @@ void pciinfo(int BusNum, int ShortPCIListing)
ret = pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID); - if (ret) + if (ret && (VendorID != 0xFFFF)) goto error; if ((VendorID == 0xFFFF) || (VendorID == 0x0000)) continue;
Then the error message is not printed.
Not familiar with the PCI code, so any suggestions are welcome.
Thanks

On Wed, Oct 7, 2015 at 8:07 PM, Fabio Estevam festevam@gmail.com wrote:
Hi Simon,
On Wed, Oct 7, 2015 at 7:30 PM, Simon Glass sjg@chromium.org wrote:
This added error checking to pci_read_config_word(). It might be worth looking at why the access is failing.
I noticed that when VendorID !=0xffff then pci_read_config_word() returns 0.
In the case when VendorID ==0xffff then it returns -1.
If I do like this:
--- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -77,7 +77,7 @@ void pciinfo(int BusNum, int ShortPCIListing)
ret = pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID);
if (ret)
if (ret && (VendorID != 0xFFFF)) goto error; if ((VendorID == 0xFFFF) || (VendorID == 0x0000)) continue;
Then the error message is not printed.
Not familiar with the PCI code, so any suggestions are welcome.
If I read the code right it seems that in this loop all the PCI devices will be scanned.
When no more devices are found then pci_read_config_word() returns -1 and VendoID == 0xffff.
Maybe all we need to do is to filter the error message like this:
--- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -100,7 +100,8 @@ void pciinfo(int BusNum, int ShortPCIListing)
return; error: - printf("Cannot read bus configuration: %d\n", ret); + if (VendorID != 0xFFFF) + printf("Cannot read bus configuration: %d\n", ret); }
Makes sense?
Thanks

On Wed, Oct 7, 2015 at 8:24 PM, Fabio Estevam festevam@gmail.com wrote:
On Wed, Oct 7, 2015 at 8:07 PM, Fabio Estevam festevam@gmail.com wrote:
Hi Simon,
On Wed, Oct 7, 2015 at 7:30 PM, Simon Glass sjg@chromium.org wrote:
This added error checking to pci_read_config_word(). It might be worth looking at why the access is failing.
I noticed that when VendorID !=0xffff then pci_read_config_word() returns 0.
In the case when VendorID ==0xffff then it returns -1.
If I do like this:
--- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -77,7 +77,7 @@ void pciinfo(int BusNum, int ShortPCIListing)
ret = pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID);
if (ret)
if (ret && (VendorID != 0xFFFF)) goto error; if ((VendorID == 0xFFFF) || (VendorID == 0x0000)) continue;
Then the error message is not printed.
Not familiar with the PCI code, so any suggestions are welcome.
If I read the code right it seems that in this loop all the PCI devices will be scanned.
When no more devices are found then pci_read_config_word() returns -1 and VendoID == 0xffff.
Maybe all we need to do is to filter the error message like this:
--- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -100,7 +100,8 @@ void pciinfo(int BusNum, int ShortPCIListing)
return;
error:
printf("Cannot read bus configuration: %d\n", ret);
if (VendorID != 0xFFFF)
printf("Cannot read bus configuration: %d\n", ret);
}
Makes sense?
Ok, sent a patch that restored the original behaviour.
participants (2)
-
Fabio Estevam
-
Simon Glass