drivers: pcie: late initialization of pcie when PCIe controller is used

For architectures that rely on a PCIe controller (for example, ARM64),
scanning the PCI space will only succeed after the controller has
initialized. Therefore, in the presence of PCIe controller, the PCIe
initialization is bumped to the next system init level.

In the past, drivers like ivshmem would do a late scan of the PCI space
in case the early scan failed; however, the cited commit removed this
feature and ivshmem fails for ARM64. This commit fix this by making the
early scan succeed.

Fixes: a96016d747 ("drivers: ivshmem: Remove unnecessary BDF lookup ...")
Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
This commit is contained in:
Rodrigo Cataldo 2022-12-01 17:28:17 +01:00 committed by Carles Cufí
commit bcb3961567

View file

@ -529,4 +529,15 @@ static int pcie_init(const struct device *dev)
return 0;
}
SYS_INIT(pcie_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
/*
* If a pcie controller is employed, pcie_scan() depends on it for working.
* Thus, pcie must be bumped to the next level
*/
#ifdef CONFIG_PCIE_CONTROLLER
#define PCIE_SYS_INIT_LEVEL PRE_KERNEL_2
#else
#define PCIE_SYS_INIT_LEVEL PRE_KERNEL_1
#endif
SYS_INIT(pcie_init, PCIE_SYS_INIT_LEVEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);