intel64: register PCI controller early but postpone PCI drivers init

Some of PCI drivers require OS interfaces that can't be executed in the INIT context.
In that case we have to postpone PCI drivers probing and call it for example
in board initialization logic.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2024-03-11 17:15:05 +01:00 committed by Xiang Xiao
parent 393ed71d81
commit a0e00b993a
5 changed files with 23 additions and 5 deletions

View File

@ -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---

View File

@ -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();

View File

@ -36,7 +36,10 @@
# include <nuttx/timers/oneshot.h>
#endif
#include "x86_64_internal.h"
#ifdef CONFIG_PCI
# include <nuttx/pci/pci.h>
#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

View File

@ -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

View File

@ -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