From 6b3f51986d6578f6345bce522bb295de6baa8ce2 Mon Sep 17 00:00:00 2001 From: yezhonghui Date: Tue, 20 Aug 2024 17:20:07 +0800 Subject: [PATCH] pci ep support msi/msi-x test Signed-off-by: yezhonghui --- drivers/pci/pci_ep_test.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci_ep_test.c b/drivers/pci/pci_ep_test.c index 7c0d64a8a4..b57d651565 100644 --- a/drivers/pci/pci_ep_test.c +++ b/drivers/pci/pci_ep_test.c @@ -610,6 +610,15 @@ static int pci_ep_test_alloc_irq(FAR struct pci_ep_test_s *test, } test->irq_type = irq_type; + if (irq_type >= PCI_EP_TEST_IRQ_TYPE_MSI) + { + ret = pci_connect_irq(pdev, &test->irq, 1); + if (ret < 0) + { + pcierr("Failed to connect MSI %d\n", ret); + return ret; + } + } ret = irq_attach(test->irq, pci_ep_test_handler, test); if (ret >= 0) @@ -728,7 +737,6 @@ static int pci_ep_test_ioctl(FAR struct file *filep, break; default: - pcierr("Unspported cmd!!! \n"); break; } @@ -766,6 +774,7 @@ static int pci_ep_test_probe(FAR struct pci_device_s *dev) } test->pdev = dev; + test->alignment = sizeof(uint32_t); nxsem_init(&test->irq_raise, 0, 0); nxmutex_init(&test->mutex);