#include <rte_rawdev_pmd.h>
#include <roc_api.h>
-#include <roc_bphy_irq.h>
#include "cnxk_bphy_irq.h"
bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id);
irq_chip = bphy_dev->irq_chip;
- return irq_chip->max_irq;
+ return roc_bphy_intr_max_get(irq_chip);
}
int
bphy_dev->irq_chip = NULL;
}
-struct bphy_mem *
+int
+cnxk_bphy_intr_register(uint16_t dev_id, int irq_num,
+ cnxk_bphy_intr_handler_t handler, void *data, int cpu)
+{
+ struct roc_bphy_intr intr = {
+ .irq_num = irq_num,
+ .intr_handler = handler,
+ .isr_data = data,
+ .cpu = cpu
+ };
+
+ struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id);
+ struct roc_bphy_irq_chip *irq_chip = bphy_dev->irq_chip;
+
+ if (!irq_chip)
+ return -ENODEV;
+ if (!handler || !data)
+ return -EINVAL;
+
+ return roc_bphy_intr_register(irq_chip, &intr);
+}
+
+void
+cnxk_bphy_intr_unregister(uint16_t dev_id, int irq_num)
+{
+ struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id);
+
+ if (bphy_dev->irq_chip)
+ roc_bphy_intr_clear(bphy_dev->irq_chip, irq_num);
+ else
+ plt_err("Missing irq chip");
+}
+
+struct cnxk_bphy_mem *
cnxk_bphy_mem_get(uint16_t dev_id)
{
struct bphy_device *bphy_dev = cnxk_bphy_get_bphy_dev_by_dev_id(dev_id);