common/cnxk: check BPHY IRQ availability
authorTomasz Duszynski <tduszynski@marvell.com>
Mon, 21 Jun 2021 15:04:34 +0000 (17:04 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 5 Jul 2021 21:07:52 +0000 (23:07 +0200)
Add support for checking whether given IRQ is available.

Signed-off-by: Jakub Palider <jpalider@marvell.com>
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_bphy_irq.c
drivers/common/cnxk/roc_bphy_irq.h
drivers/common/cnxk/version.map

index c575065..bea2b7f 100644 (file)
@@ -94,3 +94,12 @@ roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip)
        plt_free(irq_chip->irq_vecs);
        plt_free(irq_chip);
 }
+
+bool
+roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip, int irq_num)
+{
+       if (irq_num < 0 || (uint64_t)irq_num >= irq_chip->max_irq)
+               return false;
+
+       return irq_chip->avail_irq_bmask & BIT(irq_num);
+}
index b520078..f481f44 100644 (file)
@@ -23,5 +23,7 @@ struct roc_bphy_irq_chip {
 
 __roc_api struct roc_bphy_irq_chip *roc_bphy_intr_init(void);
 __roc_api void roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip);
+__roc_api bool roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip,
+                                      int irq_num);
 
 #endif /* _ROC_BPHY_IRQ_ */
index 483e520..427321c 100644 (file)
@@ -22,6 +22,7 @@ INTERNAL {
        roc_bphy_cgx_stop_rxtx;
        roc_bphy_dev_fini;
        roc_bphy_dev_init;
+       roc_bphy_intr_available;
        roc_bphy_intr_fini;
        roc_bphy_intr_init;
        roc_clk_freq_get;