diff --git a/arch/Kconfig b/arch/Kconfig index 1ad53bf349..43475fea6a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -138,6 +138,7 @@ config ARCH_X86_64 select ARCH_HAVE_TESTSET select ARCH_HAVE_INTERRUPTSTACK select ARCH_HAVE_CUSTOMOPT + select PCI_LATE_DRIVERS_REGISTER if PCI select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF select ARCH_TOOLCHAIN_GNU ---help--- diff --git a/arch/x86_64/src/common/x86_64_initialize.c b/arch/x86_64/src/common/x86_64_initialize.c index ca289b46ac..412c8c7a16 100644 --- a/arch/x86_64/src/common/x86_64_initialize.c +++ b/arch/x86_64/src/common/x86_64_initialize.c @@ -145,6 +145,12 @@ void up_initialize(void) x86_64_netinitialize(); #endif + /* Initialize the PCI bus */ + +#ifdef CONFIG_PCI + x86_64_pci_init(); +#endif + /* Initialize USB -- device and/or host */ x86_64_usbinitialize(); diff --git a/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c b/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c index 8a39c3c2ab..4c8b60da5a 100644 --- a/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c +++ b/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c @@ -36,7 +36,10 @@ # include #endif -#include "x86_64_internal.h" +#ifdef CONFIG_PCI +# include +#endif + #include "qemu_intel64.h" /**************************************************************************** @@ -68,10 +71,10 @@ int qemu_bringup(void) int ret = OK; - /* Initialize the PCI bus */ - #ifdef CONFIG_PCI - x86_64_pci_init(); + /* Register the PCI bus drivers */ + + pci_register_drivers(); #endif #ifdef CONFIG_FS_PROCFS diff --git a/drivers/drivers_initialize.c b/drivers/drivers_initialize.c index 702fdd0069..b38a5ecf39 100644 --- a/drivers/drivers_initialize.c +++ b/drivers/drivers_initialize.c @@ -254,7 +254,7 @@ void drivers_initialize(void) mtd_loop_register(); #endif -#ifdef CONFIG_PCI +#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_LATE_DRIVERS_REGISTER) pci_register_drivers(); #endif diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 8722e164ca..f85217c7a5 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -12,6 +12,14 @@ menuconfig PCI if PCI +config PCI_LATE_DRIVERS_REGISTER + bool + default n + ---help--- + This option disables PCI driver registration in drivers_initialize(). + Care must be taken to call pci_register_drivers() in later code, most likely + as board specific code. + config PCI_MSIX bool "PCI MSI-X support" default n