The BPHY CGX/RPM implements following features in the rawdev API:
- Access to BPHY CGX/RPM via a set of predefined messages
+- Access to BPHY memory
Device Setup
------------
are also two convenience functions namely ``rte_pmd_bphy_intr_init()`` and
``rte_pmd_bphy_intr_fini()`` that take care of all details.
+
+Get device memory
+~~~~~~~~~~~~~~~~~
+
+Message is used to read device MMIO address.
+
+Message must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET``. There's a convenience function
+``rte_pmd_bphy_intr_mem_get()`` available that takes care of retrieving that address.
+
Self test
---------
case CNXK_BPHY_IRQ_MSG_TYPE_FINI:
cnxk_bphy_intr_fini(dev->dev_id);
break;
+ case CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET:
+ bphy_dev->queues[queue].rsp = &bphy_dev->mem;
+ break;
default:
ret = -EINVAL;
}
roc_bphy_intr_fini(irq_chip);
bphy_dev->irq_chip = NULL;
}
+
+struct 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);
+
+ return &bphy_dev->mem;
+}
int cnxk_bphy_intr_init(uint16_t dev_id);
void cnxk_bphy_intr_fini(uint16_t dev_id);
+struct bphy_mem *cnxk_bphy_mem_get(uint16_t dev_id);
uint64_t cnxk_bphy_irq_max_get(uint16_t dev_id);
#endif /* _CNXK_BPHY_IRQ_ */
void *data;
};
+#define cnxk_bphy_mem bphy_mem
#define CNXK_BPHY_DEF_QUEUE 0
enum cnxk_bphy_irq_msg_type {
struct cnxk_bphy_irq_msg {
enum cnxk_bphy_irq_msg_type type;
+ /*
+ * The data field, depending on message type, may point to
+ * - (deq) struct cnxk_bphy_mem for memory range request response
+ * - (xxx) NULL
+ */
void *data;
};
rte_rawdev_enqueue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE);
}
+static __rte_always_inline struct cnxk_bphy_mem *
+rte_pmd_bphy_intr_mem_get(uint16_t dev_id)
+{
+ struct cnxk_bphy_irq_msg msg = {
+ .type = CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET,
+ };
+ struct rte_rawdev_buf *bufs[1];
+ struct rte_rawdev_buf buf;
+ int ret;
+
+ buf.buf_addr = &msg;
+ bufs[0] = &buf;
+
+ ret = rte_rawdev_enqueue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE);
+ if (ret)
+ return NULL;
+
+ ret = rte_rawdev_dequeue_buffers(dev_id, bufs, 1, CNXK_BPHY_DEF_QUEUE);
+ if (ret)
+ return NULL;
+
+ return buf.buf_addr;
+}
+
#endif /* _CNXK_BPHY_H_ */