pci: add pci endpoint test driver

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
This commit is contained in:
yezhonghui
2024-07-18 09:50:28 +08:00
committed by Xiang Xiao
parent 9a84484df5
commit f6db814804
8 changed files with 903 additions and 0 deletions
+4
View File
@@ -54,6 +54,10 @@ if(CONFIG_PCI_ENDPOINT)
list(APPEND SRCS pci_epf_test.c)
endif() # CONFIG_PCI_EPF_TEST
if(CONFIG_PCI_EP_TEST)
list(APPEND SRCS pci_ep_test.c)
endif() # CONFIG_PCI_ENDPOINT_TEST
target_sources(drivers PRIVATE ${SRCS})
endif() # CONFIG_PCI_ENDPOINT
+5
View File
@@ -95,5 +95,10 @@ config PCI_EPF_TEST
---help---
pci epf test driver
config PCI_EP_TEST
bool "PCI endpoint test"
---help---
pci endpoint test driver
endif # PCI_ENDPOINT
+4
View File
@@ -49,6 +49,10 @@ ifeq ($(CONFIG_PCI_EPF_TEST),y)
CSRCS += pci_epf_test.c
endif
ifeq ($(CONFIG_PCI_EP_TEST),y)
CSRCS += pci_ep_test.c
endif
# Include PCI device driver build support
DEPPATH += --dep-path pci
+8
View File
@@ -132,6 +132,14 @@ int pci_register_drivers(void)
}
#endif
#ifdef CONFIG_PCI_EP_TEST
ret = pci_register_ep_test_driver();
if (ret < 0)
{
pcierr("pci_register_ep_test_driver failed, ret=%d\n", ret);
}
#endif
/* Initialization e1000 driver */
#ifdef CONFIG_NET_E1000
+12
View File
@@ -79,4 +79,16 @@ int pci_register_qemu_epc_driver(void);
int pci_register_epf_test_driver(void);
#endif
/****************************************************************************
* Name: pci_register_ep_test_driver
*
* Description:
* Register endpoint test device pci driver
*
****************************************************************************/
#ifdef CONFIG_PCI_EP_TEST
int pci_register_ep_test_driver(void);
#endif
#endif /* __DRIVERS_PCI_PCI_DRIVERS_H */
File diff suppressed because it is too large Load Diff
+3
View File
@@ -209,6 +209,9 @@
#define pci_map_region(dev, start, size) pci_bus_map_region((dev)->bus, start, size)
#define pci_is_bridge(dev) ((dev)->hdr_type == PCI_HEADER_TYPE_BRIDGE || \
(dev)->hdr_type == PCI_HEADER_TYPE_CARDBUS)
/****************************************************************************
* Public Types
****************************************************************************/
+27
View File
@@ -25,6 +25,8 @@
* Included Files
****************************************************************************/
#include <nuttx/fs/ioctl.h>
/****************************************************************************
* Public Types
****************************************************************************/
@@ -42,4 +44,29 @@
int pci_register_epf_test_device(FAR const char *epc_name);
#endif
#define PCITEST_BAR _PCIIOC(0x1)
#define PCITEST_LEGACY_IRQ _PCIIOC(0x2)
#define PCITEST_MSI _PCIIOC(0x3)
#define PCITEST_WRITE _PCIIOC(0x4)
#define PCITEST_READ _PCIIOC(0x5)
#define PCITEST_COPY _PCIIOC(0x6)
#define PCITEST_MSIX _PCIIOC(0x7)
#define PCITEST_SET_IRQTYPE _PCIIOC(0x8)
#define PCITEST_GET_IRQTYPE _PCIIOC(0x9)
#define PCITEST_CLEAR_IRQ _PCIIOC(0x10)
#define PCITEST_FLAGS_USE_DMA 0x00000001
/* struct pci_ep_test_param_s - Params config by user
*
* size: xfer data length
* flag: xfer mode flag
*/
struct pci_ep_test_param_s
{
unsigned int size;
unsigned int flags;
};
#endif /* __INCLUDE_NUTTX_PCI_EP_TEST_H */