This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8b82fc6dda951da737a1fe592d601da63f88b1ad Author: dongjiuzhu1 <[email protected]> AuthorDate: Tue Nov 18 11:54:47 2025 +0800 drivers/pci: keep the bus state per CPU in BMP mode In BMP mode every CPU runs its own instance of the kernel, but the PCI core kept one global lock and one list each of devices, drivers and controllers, and the ivshmem bus and the endpoint framework one list each too, so the CPUs registered into and walked each other's lists. Define them with DEFINE_PER_CPU_BMP / DEFINE_PER_CPU_BSS_BMP. A per-CPU copy cannot be given a self-referencing static initializer, so the lists become dq_queue_t, for which all zeroes is an empty queue; the list nodes in struct pci_device_s, pci_bus_s, pci_controller_s, pci_driver_s, pci_epc_ctrl_s, pci_epf_device_s, pci_epf_driver_s and ivshmem_driver_s become dq_entry_t. Without CONFIG_BMP the variables stay single instances. Signed-off-by: dongjiuzhu1 <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/pci/pci.c | 83 ++++++++++++++++------------------------- drivers/pci/pci_epc.c | 29 +++++++------- drivers/pci/pci_epf.c | 33 ++++++++-------- drivers/pci/pci_ivshmem.c | 48 +++++++++++------------- drivers/pci/pci_qemu_epc.c | 2 +- drivers/pci/pci_uio_ivshmem.c | 1 + include/nuttx/pci/pci.h | 16 ++++---- include/nuttx/pci/pci_epc.h | 8 ++-- include/nuttx/pci/pci_epf.h | 13 ++++--- include/nuttx/pci/pci_ivshmem.h | 4 +- 10 files changed, 110 insertions(+), 127 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d1d8c9a74e9..b8c38559cee 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -128,13 +128,17 @@ static int pci_ioctl(FAR struct file *filep, int cmd, unsigned long arg); * Private Data ****************************************************************************/ -static mutex_t g_pci_lock = NXMUTEX_INITIALIZER; -static struct list_node g_pci_device_list = - LIST_INITIAL_VALUE(g_pci_device_list); -static struct list_node g_pci_driver_list = - LIST_INITIAL_VALUE(g_pci_driver_list); -static struct list_node g_pci_ctrl_list = - LIST_INITIAL_VALUE(g_pci_ctrl_list); +static DEFINE_PER_CPU_BMP(mutex_t, g_pci_lock) = NXMUTEX_INITIALIZER; +#define g_pci_lock this_cpu_var_bmp(g_pci_lock) + +static DEFINE_PER_CPU_BSS_BMP(dq_queue_t, g_pci_device_queue); +#define g_pci_device_queue this_cpu_var_bmp(g_pci_device_queue) + +static DEFINE_PER_CPU_BSS_BMP(dq_queue_t, g_pci_driver_queue); +#define g_pci_driver_queue this_cpu_var_bmp(g_pci_driver_queue) + +static DEFINE_PER_CPU_BSS_BMP(dq_queue_t, g_pci_ctrl_queue); +#define g_pci_ctrl_queue this_cpu_var_bmp(g_pci_ctrl_queue) static const struct file_operations g_pci_fops = { @@ -158,7 +162,7 @@ pci_do_find_device_from_bus(FAR struct pci_bus_s *bus, uint8_t busno, FAR struct pci_bus_s *bus_tmp; FAR struct pci_device_s *dev; - list_for_every_entry(&bus->devices, dev, struct pci_device_s, bus_list) + dq_for_every_entry(&bus->devices, dev, struct pci_device_s, bus_node) { if (dev->bus->number == busno && devfn == dev->devfn) { @@ -166,8 +170,8 @@ pci_do_find_device_from_bus(FAR struct pci_bus_s *bus, uint8_t busno, } } - list_for_every_entry(&bus->children, bus_tmp, - struct pci_bus_s, node) + dq_for_every_entry(&bus->children, bus_tmp, + struct pci_bus_s, node) { dev = pci_find_device_from_bus(bus_tmp, busno, devfn); if (dev != NULL) @@ -263,7 +267,7 @@ static int pci_ioctl(FAR struct file *filep, int cmd, unsigned long arg) return ret; } - list_for_every_entry(&g_pci_ctrl_list, ctrl, struct pci_controller_s, node) + dq_for_every_entry(&g_pci_ctrl_queue, ctrl, struct pci_controller_s, node) { if (ctrl->domain == sel->pc_domain) { @@ -273,7 +277,7 @@ static int pci_ioctl(FAR struct file *filep, int cmd, unsigned long arg) nxmutex_unlock(&g_pci_lock); - if (&ctrl->node == &g_pci_ctrl_list) + if (ctrl == NULL) { return -ENODEV; } @@ -448,8 +452,8 @@ static int pci_enable_parent_bridges(FAR struct pci_device_s *dev) while (bus != NULL && bus->parent_bus != NULL) { bridge = NULL; - list_for_every_entry(&bus->parent_bus->devices, candidate, - struct pci_device_s, bus_list) + dq_for_every_entry(&bus->parent_bus->devices, candidate, + struct pci_device_s, bus_node) { if (candidate->subordinate == bus) { @@ -614,19 +618,7 @@ static uint8_t pci_find_next_cap(FAR struct pci_bus_s *bus, static FAR struct pci_bus_s *pci_alloc_bus(void) { - FAR struct pci_bus_s *bus; - - bus = kmm_zalloc(sizeof(*bus)); - if (bus == NULL) - { - return NULL; - } - - list_initialize(&bus->node); - list_initialize(&bus->children); - list_initialize(&bus->devices); - - return bus; + return kmm_zalloc(sizeof(struct pci_bus_s)); } /**************************************************************************** @@ -642,18 +634,7 @@ static FAR struct pci_bus_s *pci_alloc_bus(void) static FAR struct pci_device_s *pci_alloc_device(void) { - FAR struct pci_device_s *dev; - - dev = kmm_zalloc(sizeof(*dev)); - if (dev == NULL) - { - return NULL; - } - - list_initialize(&dev->node); - list_initialize(&dev->bus_list); - - return dev; + return kmm_zalloc(sizeof(struct pci_device_s)); } /**************************************************************************** @@ -674,14 +655,14 @@ static void pci_register_bus_devices(FAR struct pci_bus_s *bus) /* Activate all devices on this bus */ - list_for_every_entry(&bus->devices, dev, struct pci_device_s, bus_list) + dq_for_every_entry(&bus->devices, dev, struct pci_device_s, bus_node) { pci_register_device(dev); } /* Walk down the hierarchy */ - list_for_every_entry(&bus->children, child_bus, struct pci_bus_s, node) + dq_for_every_entry(&bus->children, child_bus, struct pci_bus_s, node) { pci_register_bus_devices(child_bus); } @@ -918,7 +899,7 @@ static void pci_setup_device(FAR struct pci_device_s *dev, int max_bar, pci_write_config_byte(dev, PCI_COMMAND, cmd); #endif - list_add_tail(&dev->bus->devices, &dev->bus_list); + dq_addlast(&dev->bus_node, &dev->bus->devices); } /**************************************************************************** @@ -1170,7 +1151,7 @@ static void pci_scan_bus(FAR struct pci_bus_s *bus) child_bus->number = bus->ctrl->busno++; #endif - list_add_tail(&bus->children, &child_bus->node); + dq_addlast(&child_bus->node, &bus->children); dev->subordinate = child_bus; /* Scan pci hierarchy behind bridge */ @@ -2177,9 +2158,9 @@ int pci_register_driver(FAR struct pci_driver_s *drv) /* Add the driver to the pci driver list */ - list_add_tail(&g_pci_driver_list, &drv->node); + dq_addlast(&drv->node, &g_pci_driver_queue); - list_for_every_entry(&g_pci_device_list, dev, struct pci_device_s, node) + dq_for_every_entry(&g_pci_device_queue, dev, struct pci_device_s, node) { if (dev->drv != NULL) { @@ -2230,7 +2211,7 @@ int pci_unregister_driver(FAR struct pci_driver_s *drv) return ret; } - list_for_every_entry(&g_pci_device_list, dev, struct pci_device_s, node) + dq_for_every_entry(&g_pci_device_queue, dev, struct pci_device_s, node) { if (dev->drv == drv) { @@ -2239,7 +2220,7 @@ int pci_unregister_driver(FAR struct pci_driver_s *drv) } } - list_delete(&drv->node); + dq_rem(&drv->node, &g_pci_driver_queue); nxmutex_unlock(&g_pci_lock); return ret; @@ -2271,9 +2252,9 @@ int pci_register_device(FAR struct pci_device_s *dev) return ret; } - list_add_tail(&g_pci_device_list, &dev->node); + dq_addlast(&dev->node, &g_pci_device_queue); - list_for_every_entry(&g_pci_driver_list, drv, struct pci_driver_s, node) + dq_for_every_entry(&g_pci_driver_queue, drv, struct pci_driver_s, node) { for (id = drv->id_table; id->vendor; id++) { @@ -2324,7 +2305,7 @@ int pci_unregister_device(FAR struct pci_device_s *dev) } dev->drv = NULL; - list_delete(&dev->node); + dq_rem(&dev->node, &g_pci_device_queue); nxmutex_unlock(&g_pci_lock); return ret; @@ -2365,7 +2346,7 @@ int pci_register_controller(FAR struct pci_controller_s *ctrl) pci_register_bus_devices(bus); nxmutex_lock(&g_pci_lock); - list_add_tail(&g_pci_ctrl_list, &ctrl->node); + dq_addlast(&ctrl->node, &g_pci_ctrl_queue); nxmutex_unlock(&g_pci_lock); return 0; diff --git a/drivers/pci/pci_epc.c b/drivers/pci/pci_epc.c index b86541d7243..6b0b3a54d33 100644 --- a/drivers/pci/pci_epc.c +++ b/drivers/pci/pci_epc.c @@ -43,9 +43,11 @@ * Private Data ****************************************************************************/ -static mutex_t g_pci_epc_lock = NXMUTEX_INITIALIZER; -static struct list_node g_pci_epc_device_list = - LIST_INITIAL_VALUE(g_pci_epc_device_list); +static DEFINE_PER_CPU_BMP(mutex_t, g_pci_epc_lock) = NXMUTEX_INITIALIZER; +#define g_pci_epc_lock this_cpu_var_bmp(g_pci_epc_lock) + +static DEFINE_PER_CPU_BMP(dq_queue_t, g_pci_epc_device_queue); +#define g_pci_epc_device_queue this_cpu_var_bmp(g_pci_epc_device_queue) /**************************************************************************** * Public Functions @@ -82,8 +84,8 @@ FAR struct pci_epc_ctrl_s *pci_get_epc(FAR const char *epc_name) return NULL; } - list_for_every_entry(&g_pci_epc_device_list, epc, struct pci_epc_ctrl_s, - node) + dq_for_every_entry(&g_pci_epc_device_queue, epc, struct pci_epc_ctrl_s, + node) { if (strcmp(epc_name, epc->name) == 0) { @@ -750,7 +752,7 @@ int pci_epc_add_epf(FAR struct pci_epc_ctrl_s *epc, epf->funcno = funcno; epf->epc = epc; - list_add_tail(&epc->epf, &epf->epc_node); + dq_addlast(&epf->epc_node, &epc->epf); out: nxmutex_unlock(&epc->lock); @@ -785,7 +787,7 @@ void pci_epc_remove_epf(FAR struct pci_epc_ctrl_s *epc, nxmutex_lock(&epc->lock); clear_bit(epf->funcno, &epc->funcno_map); - list_delete(&epf->epc_node); + dq_rem(&epf->epc_node, &epc->epf); epf->epc = NULL; nxmutex_unlock(&epc->lock); } @@ -818,7 +820,7 @@ void pci_epc_linkup(FAR struct pci_epc_ctrl_s *epc) } nxmutex_lock(&epc->lock); - list_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) + dq_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) { nxmutex_lock(&epf->lock); if (epf->event_ops && epf->event_ops->link_up) @@ -860,7 +862,7 @@ void pci_epc_linkdown(FAR struct pci_epc_ctrl_s *epc) } nxmutex_lock(&epc->lock); - list_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) + dq_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) { nxmutex_lock(&epf->lock); if (epf->event_ops && epf->event_ops->link_down) @@ -902,7 +904,7 @@ void pci_epc_init_notify(FAR struct pci_epc_ctrl_s *epc) } nxmutex_lock(&epc->lock); - list_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) + dq_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) { nxmutex_lock(&epf->lock); if (epf->event_ops && epf->event_ops->core_init) @@ -944,7 +946,7 @@ void pci_epc_bme_notify(FAR struct pci_epc_ctrl_s *epc) } nxmutex_lock(&epc->lock); - list_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) + dq_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) { nxmutex_lock(&epf->lock); if (epf->event_ops && epf->event_ops->bme) @@ -1010,11 +1012,10 @@ pci_epc_create(FAR const char *name, FAR void *priv, FAR void *dma_addr, epc->priv = priv; memcpy(epc->name, name, len); nxmutex_init(&epc->lock); - list_initialize(&epc->epf); epc->ops = ops; nxmutex_lock(&g_pci_epc_lock); - list_add_tail(&g_pci_epc_device_list, &epc->node); + dq_addlast(&epc->node, &g_pci_epc_device_queue); nxmutex_unlock(&g_pci_epc_lock); return epc; @@ -1048,7 +1049,7 @@ void pci_epc_destroy(FAR struct pci_epc_ctrl_s *epc) } nxmutex_lock(&g_pci_epc_lock); - list_delete(&epc->node); + dq_rem(&epc->node, &g_pci_epc_device_queue); nxmutex_unlock(&g_pci_epc_lock); nxmutex_destroy(&epc->lock); diff --git a/drivers/pci/pci_epf.c b/drivers/pci/pci_epf.c index a7c92867ebc..313014e94c3 100644 --- a/drivers/pci/pci_epf.c +++ b/drivers/pci/pci_epf.c @@ -39,11 +39,14 @@ * Private Data ****************************************************************************/ -static struct list_node g_pci_epf_device_list = - LIST_INITIAL_VALUE(g_pci_epf_device_list); -static struct list_node g_pci_epf_driver_list = - LIST_INITIAL_VALUE(g_pci_epf_driver_list); -static mutex_t g_pci_epf_lock = NXMUTEX_INITIALIZER; +static DEFINE_PER_CPU_BSS_BMP(dq_queue_t, g_pci_epf_device_queue); +#define g_pci_epf_device_queue this_cpu_var_bmp(g_pci_epf_device_queue) + +static DEFINE_PER_CPU_BSS_BMP(dq_queue_t, g_pci_epf_driver_queue); +#define g_pci_epf_driver_queue this_cpu_var_bmp(g_pci_epf_driver_queue) + +static DEFINE_PER_CPU_BMP(mutex_t, g_pci_epf_lock) = NXMUTEX_INITIALIZER; +#define g_pci_epf_lock this_cpu_var_bmp(g_pci_epf_lock) /**************************************************************************** * Private Functions @@ -306,10 +309,10 @@ int pci_epf_device_register(FAR struct pci_epf_device_s *epf) return ret; } - list_add_tail(&g_pci_epf_device_list, &epf->node); + dq_addlast(&epf->node, &g_pci_epf_device_queue); - list_for_every_entry(&g_pci_epf_driver_list, drv, - struct pci_epf_driver_s, node) + dq_for_every_entry(&g_pci_epf_driver_queue, drv, + struct pci_epf_driver_s, node) { epf->id = pci_epf_match_device(epf, drv); if (epf->id == NULL) @@ -388,7 +391,7 @@ int pci_epf_device_unregister(FAR struct pci_epf_device_s *epf) } epf->driver = NULL; - list_delete(&epf->node); + dq_rem(&epf->node, &g_pci_epf_device_queue); nxmutex_unlock(&g_pci_epf_lock); return ret; @@ -428,10 +431,10 @@ int pci_epf_register_driver(FAR struct pci_epf_driver_s *drv) /* Add the driver to the pci epf driver list */ - list_add_tail(&g_pci_epf_driver_list, &drv->node); + dq_addlast(&drv->node, &g_pci_epf_driver_queue); - list_for_every_entry(&g_pci_epf_device_list, epf, struct pci_epf_device_s, - node) + dq_for_every_entry(&g_pci_epf_device_queue, epf, struct pci_epf_device_s, + node) { if (epf->driver != NULL) { @@ -507,8 +510,8 @@ int pci_epf_unregister_driver(FAR struct pci_epf_driver_s *drv) return ret; } - list_for_every_entry(&g_pci_epf_device_list, epf, struct pci_epf_device_s, - node) + dq_for_every_entry(&g_pci_epf_device_queue, epf, struct pci_epf_device_s, + node) { if (epf->driver == drv) { @@ -518,7 +521,7 @@ int pci_epf_unregister_driver(FAR struct pci_epf_driver_s *drv) } } - list_delete(&drv->node); + dq_rem(&drv->node, &g_pci_epf_driver_queue); nxmutex_unlock(&g_pci_epf_lock); return ret; diff --git a/drivers/pci/pci_ivshmem.c b/drivers/pci/pci_ivshmem.c index ecfeafb6188..8004516017d 100644 --- a/drivers/pci/pci_ivshmem.c +++ b/drivers/pci/pci_ivshmem.c @@ -33,7 +33,6 @@ #include <nuttx/arch.h> #include <nuttx/kmalloc.h> -#include <nuttx/list.h> #include <nuttx/mutex.h> #include <nuttx/pci/pci.h> #include <nuttx/pci/pci_ivshmem.h> @@ -59,9 +58,9 @@ struct ivshmem_bus_s { - mutex_t lock; /* Lock for the list */ - struct list_node dev; /* Wait match ivshmem device list */ - struct list_node drv; /* Ivshmem driver list */ + mutex_t lock; /* Lock for the queue */ + dq_queue_t dev; /* Wait match ivshmem device queue */ + dq_queue_t drv; /* Ivshmem driver queue */ }; struct ivshmem_device_s @@ -69,7 +68,7 @@ struct ivshmem_device_s FAR struct pci_device_s *dev; FAR struct ivshmem_driver_s *drv; - struct list_node node; + dq_entry_t node; int id; @@ -95,14 +94,14 @@ static int ivshmem_unregister_device(FAR struct ivshmem_device_s *dev); * Private Data ****************************************************************************/ -static int g_ivshmem_next_id = 0; +static DEFINE_PER_CPU_BSS_BMP(int, g_ivshmem_next_id); +#define g_ivshmem_next_id this_cpu_var_bmp(g_ivshmem_next_id) -static struct ivshmem_bus_s g_ivshmem_bus = +static DEFINE_PER_CPU_BMP(struct ivshmem_bus_s, g_ivshmem_bus) = { NXMUTEX_INITIALIZER, - LIST_INITIAL_VALUE(g_ivshmem_bus.dev), - LIST_INITIAL_VALUE(g_ivshmem_bus.drv), }; +#define g_ivshmem_bus this_cpu_var_bmp(g_ivshmem_bus) static const struct pci_device_id_s g_ivshmem_id_table[] = { @@ -136,18 +135,17 @@ static int ivshmem_register_device(FAR struct ivshmem_device_s *dev) return ret; } - /* Add the device to the ivshmem_bus device list */ + /* Add the device to the ivshmem_bus device queue */ - list_add_tail(&g_ivshmem_bus.dev, &dev->node); + dq_addlast(&dev->node, &g_ivshmem_bus.dev); /* Match the driver has registered in the ivshmem_bus */ - list_for_every_entry(&g_ivshmem_bus.drv, drv, struct ivshmem_driver_s, - node) + dq_for_every_entry(&g_ivshmem_bus.drv, drv, struct ivshmem_driver_s, node) { if (drv->id == dev->id) { - /* If found the driver in the driver list, call driver probe, + /* If found the driver in the driver queue, call driver probe, * if probe success, assign item->driver to indicate the device * matched. */ @@ -180,9 +178,9 @@ static int ivshmem_unregister_device(FAR struct ivshmem_device_s *dev) return ret; } - /* Remove the device from the device list */ + /* Remove the device from the device queue */ - list_delete(&dev->node); + dq_rem(&dev->node, &g_ivshmem_bus.dev); nxmutex_unlock(&g_ivshmem_bus.lock); @@ -485,18 +483,17 @@ int ivshmem_register_driver(FAR struct ivshmem_driver_s *drv) return ret; } - /* Add the driver to the ivshmem_bus driver list */ + /* Add the driver to the ivshmem_bus driver queue */ - list_add_tail(&g_ivshmem_bus.drv, &drv->node); + dq_addlast(&drv->node, &g_ivshmem_bus.drv); /* Match all the devices has registered in the ivshmem_bus */ - list_for_every_entry(&g_ivshmem_bus.dev, dev, - struct ivshmem_device_s, node) + dq_for_every_entry(&g_ivshmem_bus.dev, dev, struct ivshmem_device_s, node) { if (drv->id == dev->id) { - /* If found the device in the device list, call driver probe, + /* If found the device in the device queue, call driver probe, * if probe success, assign item->driver to indicate the device * matched. */ @@ -530,10 +527,9 @@ int ivshmem_unregister_driver(FAR struct ivshmem_driver_s *drv) return ret; } - /* Find all the devices matched with driver in device list */ + /* Find all the devices matched with driver in device queue */ - list_for_every_entry(&g_ivshmem_bus.dev, dev, - struct ivshmem_device_s, node) + dq_for_every_entry(&g_ivshmem_bus.dev, dev, struct ivshmem_device_s, node) { if (dev->drv == drv) { @@ -546,9 +542,9 @@ int ivshmem_unregister_driver(FAR struct ivshmem_driver_s *drv) } } - /* Remove the driver from the driver list */ + /* Remove the driver from the driver queue */ - list_delete(&drv->node); + dq_rem(&drv->node, &g_ivshmem_bus.drv); nxmutex_unlock(&g_ivshmem_bus.lock); return ret; diff --git a/drivers/pci/pci_qemu_epc.c b/drivers/pci/pci_qemu_epc.c index f8adb912c66..5884184bb05 100644 --- a/drivers/pci/pci_qemu_epc.c +++ b/drivers/pci/pci_qemu_epc.c @@ -477,7 +477,7 @@ qemu_epc_get_bar_addr_from_funcno(FAR struct pci_epc_ctrl_s *epc, { FAR struct pci_epf_device_s *epf; - list_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) + dq_for_every_entry(&epc->epf, epf, struct pci_epf_device_s, epc_node) { if (epf->funcno == funcno) { diff --git a/drivers/pci/pci_uio_ivshmem.c b/drivers/pci/pci_uio_ivshmem.c index 6a662791781..06717722c42 100644 --- a/drivers/pci/pci_uio_ivshmem.c +++ b/drivers/pci/pci_uio_ivshmem.c @@ -35,6 +35,7 @@ #include <nuttx/fs/fs.h> #include <nuttx/kmalloc.h> +#include <nuttx/list.h> #include <nuttx/mm/map.h> #include <nuttx/pci/pci_ivshmem.h> #include <nuttx/semaphore.h> diff --git a/include/nuttx/pci/pci.h b/include/nuttx/pci/pci.h index 04d66faebde..82a4ff18377 100644 --- a/include/nuttx/pci/pci.h +++ b/include/nuttx/pci/pci.h @@ -30,7 +30,7 @@ #include <stdint.h> #include <stdbool.h> -#include <nuttx/list.h> +#include <nuttx/queue.h> #include <nuttx/pci/pci_ids.h> #include <nuttx/pci/pci_regs.h> @@ -285,8 +285,8 @@ struct pci_device_id_s struct pci_device_s { - struct list_node node; - struct list_node bus_list; /* Node in per-bus list */ + dq_entry_t node; + dq_entry_t bus_node; /* Node in per-bus queue */ FAR struct pci_bus_s *bus; /* Bus this device is on */ FAR struct pci_bus_s *subordinate; /* Bus this device bridges to */ @@ -313,9 +313,9 @@ struct pci_bus_s FAR struct pci_controller_s *ctrl; /* Associated host controller */ FAR struct pci_bus_s *parent_bus; /* Parent bus */ - struct list_node node; /* Node in list of buses */ - struct list_node children; /* List of child buses */ - struct list_node devices; /* List of devices on this bus */ + dq_entry_t node; /* Node in queue of buses */ + dq_queue_t children; /* queue of child buses */ + dq_queue_t devices; /* queue of devices on this bus */ uint8_t number; /* Bus number */ }; @@ -369,7 +369,7 @@ struct pci_controller_s FAR const struct pci_ops_s *ops; FAR struct pci_bus_s *bus; - struct list_node node; + dq_entry_t node; uint16_t domain; /* PCI domain/segment id */ uint8_t busno; }; @@ -386,7 +386,7 @@ struct pci_driver_s CODE void (*remove)(FAR struct pci_device_s *dev); - struct list_node node; + dq_entry_t node; }; /**************************************************************************** diff --git a/include/nuttx/pci/pci_epc.h b/include/nuttx/pci/pci_epc.h index 559f6370d75..d7930619c74 100644 --- a/include/nuttx/pci/pci_epc.h +++ b/include/nuttx/pci/pci_epc.h @@ -28,7 +28,7 @@ ****************************************************************************/ #include <stdbool.h> -#include <nuttx/list.h> +#include <nuttx/queue.h> #include <nuttx/mutex.h> #include <nuttx/pci/pci_epf.h> #include <nuttx/pci/pci_regs.h> @@ -181,7 +181,7 @@ struct pci_epc_mem_s * mem: Array of address space of the endpoint controlle * num_windows: Number of mem supported by device * max_functions: Max number of functions that can be configured in this EPC - * node: The node of epc list + * node: The node of epc queue * dmaheap: The dma heap * lock: Mutex to protect pci_epc ops * funcno_map: Bitmap to manage physical function number @@ -191,12 +191,12 @@ struct pci_epc_mem_s struct pci_epc_ctrl_s { - struct list_node epf; + dq_queue_t epf; FAR const struct pci_epc_ops_s *ops; FAR struct pci_epc_mem_s *mem; unsigned int num_windows; uint8_t max_functions; - struct list_node node; + dq_entry_t node; FAR struct mm_heap_s *dmaheap; /* Mutex to protect against concurrent access of EP controller */ diff --git a/include/nuttx/pci/pci_epf.h b/include/nuttx/pci/pci_epf.h index f2f29f687b1..b8b6dda6ec4 100644 --- a/include/nuttx/pci/pci_epf.h +++ b/include/nuttx/pci/pci_epf.h @@ -32,7 +32,7 @@ #include <stdint.h> #include <nuttx/compiler.h> -#include <nuttx/list.h> +#include <nuttx/queue.h> #include <nuttx/arch.h> #include <nuttx/mutex.h> #include <nuttx/pci/pci_regs.h> @@ -109,7 +109,8 @@ struct pci_epf_device_id_s * epc: The EPC device to which this EPF device is bound * driver: The EPF driver to which this EPF device is bound * id: Pointer to the EPF device ID - * node: To add pci_epf as a list of PCI endpoint functions to pci_epc_ctrl_s + * node: To add pci_epf as a queue of PCI endpoint functions to + * pci_epc_ctrl_s * lock: mutex to protect pci_epf_ops_s * is_bound: Indicates if bind notification to function driver has been * invoked @@ -130,8 +131,8 @@ struct pci_epf_device_s FAR struct pci_epc_ctrl_s *epc; FAR struct pci_epf_driver_s *driver; FAR const struct pci_epf_device_id_s *id; - struct list_node node; - struct list_node epc_node; + dq_entry_t node; + dq_entry_t epc_node; /* Mutex to protect against concurrent access of pci_epf_ops_s */ @@ -177,7 +178,7 @@ struct pci_epc_event_ops_s * driver * remove: Ops to perform when the binding between the EPF device and EPF * driver is broken - * node: EPF driver list node + * node: EPF driver queue node * ops: Set of function pointers for performing EPF operations * id_table: Identifies EPF devices for probing */ @@ -187,7 +188,7 @@ struct pci_epf_driver_s CODE int (*probe)(FAR struct pci_epf_device_s *epf); CODE void (*remove)(FAR struct pci_epf_device_s *epf); - struct list_node node; + dq_entry_t node; FAR const struct pci_epf_ops_s *ops; FAR const struct pci_epf_device_id_s *id_table; }; diff --git a/include/nuttx/pci/pci_ivshmem.h b/include/nuttx/pci/pci_ivshmem.h index 033e468f82e..3dc167b5730 100644 --- a/include/nuttx/pci/pci_ivshmem.h +++ b/include/nuttx/pci/pci_ivshmem.h @@ -33,7 +33,7 @@ #ifdef CONFIG_PCI_IVSHMEM #include <nuttx/irq.h> -#include <nuttx/list.h> +#include <nuttx/queue.h> /**************************************************************************** * Pre-processor Definitions @@ -49,7 +49,7 @@ struct ivshmem_driver_s int id; CODE int (*probe)(FAR struct ivshmem_device_s *dev); CODE void (*remove)(FAR struct ivshmem_device_s *dev); - struct list_node node; + dq_entry_t node; }; /****************************************************************************
