[U-Boot] PCI: Cannot read bus configuration

Fabio Estevam festevam at gmail.com
Thu Oct 8 01:37:29 CEST 2015


On Wed, Oct 7, 2015 at 8:24 PM, Fabio Estevam <festevam at gmail.com> wrote:
> On Wed, Oct 7, 2015 at 8:07 PM, Fabio Estevam <festevam at gmail.com> wrote:
>> Hi Simon,
>>
>> On Wed, Oct 7, 2015 at 7:30 PM, Simon Glass <sjg at 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.


More information about the U-Boot mailing list