From b5ad9739df66cd0f137a5c33a3b66f405a46f091 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Tue, 16 Mar 2021 09:29:37 +0100 Subject: [PATCH] drivers/pcie: Add a marco for fixed or MSI IRQ This is meant to be called by drivers on PCIe BUS with a fixed (from DTS) IRQ or an MSI one. I.e.: all drivers without a runtime IRQ detection/allocation. The arch-specific macro is required to be implemented relevantly. Signed-off-by: Tomasz Bursztyka --- include/drivers/pcie/pcie.h | 19 +++++++++++++++++++ include/sys/arch_interface.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/include/drivers/pcie/pcie.h b/include/drivers/pcie/pcie.h index 76c1afc94ff..611158e4284 100644 --- a/include/drivers/pcie/pcie.h +++ b/include/drivers/pcie/pcie.h @@ -313,6 +313,25 @@ extern bool pcie_connect_dynamic_irq(pcie_bdf_t bdf, #define PCIE_MAX_DEV (0xFFFFFFFF & PCIE_BDF_DEV_MASK) #define PCIE_MAX_FUNC (0xFFFFFFFF & PCIE_BDF_FUNC_MASK) +/** + * @brief Initialize an interrupt handler for a PCIe endpoint IRQ + * + * This routine is only meant to be used by drivers using PCIe bus and having + * fixed or MSI based IRQ (so no runtime detection of the IRQ). In case + * of runtime detection see pcie_connect_dynamic_irq() + * + * @param bdf_p PCIe endpoint BDF + * @param irq_p IRQ line number. + * @param priority_p Interrupt priority. + * @param isr_p Address of interrupt service routine. + * @param isr_param_p Parameter passed to interrupt service routine. + * @param flags_p Architecture-specific IRQ configuration flags.. + */ +#define PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, \ + isr_p, isr_param_p, flags_p) \ + ARCH_PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, \ + isr_p, isr_param_p, flags_p) + #ifdef __cplusplus } #endif diff --git a/include/sys/arch_interface.h b/include/sys/arch_interface.h index 1d8a1f71c61..cc22f9d7eb3 100644 --- a/include/sys/arch_interface.h +++ b/include/sys/arch_interface.h @@ -313,6 +313,14 @@ int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority, * @see IRQ_CONNECT() */ +#ifdef CONFIG_PCIE +/** + * @def ARCH_PCIE_IRQ_CONNECT(bdf, irq, pri, isr, arg, flags) + * + * @see PCIE_IRQ_CONNECT() + */ +#endif /* CONFIG_PCIE */ + /** * @def ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) *