CONFIG_SYS_EARLY_PCI_INIT for PCI-attached eMMC

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Thu Aug 14 16:10:13 CEST 2025


On 14.08.25 15:27, Fabio Estevam wrote:
> On Thu, Aug 14, 2025 at 9:52 AM Mark Kettenis <mark.kettenis at xs4all.nl> wrote:
> 
>> Not without removing the 2nd pci_init_r() that is conditionalized on
>> !CONFIG_IS_ENABLED(SYS_EARLY_PCI_INIT).
>>
>> That would require some thorough testing though; I certainly wouldn't
>> be sure calling pci_init_r() is safe at that point on the boards I
>> maintain.
> 
> You're right.
> 
> Maybe we could solve it with two patches:
> 
> 1. Convert EARLY_PCI_INIT to a Kconfig symbol:
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index a2f653f7e722..9119a1c0869f 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -824,6 +824,13 @@ config SYS_I2C_EEPROM_NXID
> 
>   endchoice
> 
> +config EARLY_PCI_INIT

Please, do not rename the symbol.

%s/EARLY_PCI_INIT/SYS_EARLY_PCI_INIT/

All configuration symbols starting on CONFIG_ should be defined in 
Kconfig. Only CFG_* are not Kconfig. Something must have gone wrong in 
the conversion work some years ago.

> +       bool "Enumerate PCI buses early during init"
> +       depends on PCI
> +       help
> +         Do early PCI configuration _before_ the flash gets initialised,

Highlighting is not supported in Kconfig.

%s/_before_/before/

> +         because PCU resources are crucial for flash access on some boards.

%s/PCU/PCI/

We were talking about eMMC, not SPI flash.

> +
>   config PCI_INIT_R
>          bool "Enumerate PCI buses during init"
>          depends on PCI
> 
> 2. Select CONFIG_EARLY_PCI_INIT in the defconfig
> 
> diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig
> index d5890bf87fb3..a0d03dc19d0b 100644
> --- a/configs/qemu_arm_defconfig
> +++ b/configs/qemu_arm_defconfig
> @@ -28,6 +28,7 @@ CONFIG_USE_PREBOOT=y
>   # CONFIG_DISPLAY_CPUINFO is not set
>   # CONFIG_DISPLAY_BOARDINFO is not set
>   # CONFIG_BOARD_INIT is not set
> +CONFIG_EARLY_PCI_INIT=y

%s/EARLY_PCI_INIT/SYS_EARLY_PCI_INIT/

Otherwise looks good to me.

Best regards

Heinrich

>   CONFIG_PCI_INIT_R=y
>   CONFIG_CMD_BOOTEFI_SELFTEST=y
>   CONFIG_CMD_NVEDIT_EFI=y



More information about the U-Boot mailing list