[PATCH 1/1] spl: initialize PCI before booting from SATA

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Mon Jul 24 10:50:05 CEST 2023



On 7/24/23 00:58, Simon Glass wrote:
> Hi Heinrich,
> 
> On Sat, 22 Jul 2023 at 15:56, Heinrich Schuchardt
> <heinrich.schuchardt at canonical.com> wrote:
>>
>> Many SATA controllers are PCI bus devices. Before calling scsi_scan() we
>> must bind the PCI devices.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> ---
>>   common/spl/spl_sata.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
>> index 32746ce9f3..060da49006 100644
>> --- a/common/spl/spl_sata.c
>> +++ b/common/spl/spl_sata.c
>> @@ -61,6 +61,8 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
>>          struct blk_desc *stor_dev;
>>
>>          /* try to recognize storage devices immediately */
>> +       if (IS_ENABLED(CONFIG_SPL_PCI))
>> +               pci_init();
> 
> error checking?

We should not fail here as there may be a SATA controller that does not 
depend on PCI though SPL_PCI is enabled.

Debug output for failing pci_init() (if deemed necessary) should be done 
within pci_init() and not be repeated for every invocation.

The boot method will write an error if it did not succeed. So don't add 
any debug output here.

Best regards

Heinrich

> 
>>          scsi_scan(false);
>>          stor_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0);
>>          if (!stor_dev)
>> --
>> 2.40.1
>>
> 
> Regards,
> Simon


More information about the U-Boot mailing list