summaryrefslogtreecommitdiffstats
path: root/linux/drivers/soc/fsl/qbman
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/soc/fsl/qbman')
-rw-r--r--linux/drivers/soc/fsl/qbman/qman.c43
-rw-r--r--linux/drivers/soc/fsl/qbman/qman_portal.c28
-rw-r--r--linux/drivers/soc/fsl/qbman/qman_priv.h6
3 files changed, 77 insertions, 0 deletions
diff --git a/linux/drivers/soc/fsl/qbman/qman.c b/linux/drivers/soc/fsl/qbman/qman.c
index acb3a1d9..73e1f09d 100644
--- a/linux/drivers/soc/fsl/qbman/qman.c
+++ b/linux/drivers/soc/fsl/qbman/qman.c
@@ -1281,6 +1281,49 @@ fail_dqrr:
fail_eqcr:
return -EIO;
}
+#ifdef __rtems__
+int
+qman_portal_get_channel(const struct qman_portal *portal)
+{
+
+ if (portal == NULL) {
+ return (-1);
+ }
+
+ return (portal->config->channel);
+}
+
+int
+qman_portal_get_irq(const struct qman_portal *portal)
+{
+
+ if (portal == NULL) {
+ return (-1);
+ }
+
+ return (portal->config->irq);
+}
+
+struct qman_portal *
+qman_create_dedicated_portal(const struct qm_portal_config *c,
+ const struct qman_cgrs *cgrs)
+{
+ struct qman_portal *portal;
+ int err;
+
+ portal = kmalloc(sizeof(*portal), GFP_KERNEL);
+ if (portal == NULL)
+ return (NULL);
+
+ err = qman_create_portal(portal, c, cgrs);
+ if (err != 0) {
+ kfree(portal);
+ return (NULL);
+ }
+
+ return (portal);
+}
+#endif /* __rtems__ */
struct qman_portal *qman_create_affine_portal(const struct qm_portal_config *c,
const struct qman_cgrs *cgrs)
diff --git a/linux/drivers/soc/fsl/qbman/qman_portal.c b/linux/drivers/soc/fsl/qbman/qman_portal.c
index 45aba3a8..b4dd1cd0 100644
--- a/linux/drivers/soc/fsl/qbman/qman_portal.c
+++ b/linux/drivers/soc/fsl/qbman/qman_portal.c
@@ -385,6 +385,33 @@ module_driver(qman_portal_driver,
static struct qm_portal_config qman_configs[MAX_QMAN_PORTALS];
+static LIST_HEAD(qman_free_portals);
+
+struct qman_portal *
+qman_get_dedicated_portal(int cpu)
+{
+ struct qm_portal_config *pcfg;
+ struct qman_portal *p;
+ u32 irq_sources;
+
+ if (list_empty(&qman_free_portals))
+ return (NULL);
+
+ pcfg = list_first_entry(&qman_free_portals, struct qm_portal_config,
+ node);
+ pcfg->cpu = cpu;
+ p = qman_create_dedicated_portal(pcfg, NULL);
+ if (p == NULL)
+ return (NULL);
+
+ list_del(&pcfg->node);
+
+ irq_sources = QM_PIRQ_EQCI | QM_PIRQ_EQRI | QM_PIRQ_MRI | QM_PIRQ_CSCI
+ | QM_PIRQ_DQRI;
+ qman_p_irqsource_add(p, irq_sources);
+ return (p);
+}
+
static bool
is_dequeue_enabled(const struct device_node *dn)
{
@@ -475,6 +502,7 @@ qman_sysinit_portals(void)
qman_portal_update_sdest(pcfg, val);
} else {
pcfg->cpu = -1;
+ list_add_tail(&pcfg->node, &qman_free_portals);
}
node = fdt_next_subnode(fdt, node);
diff --git a/linux/drivers/soc/fsl/qbman/qman_priv.h b/linux/drivers/soc/fsl/qbman/qman_priv.h
index 369ba752..2db10889 100644
--- a/linux/drivers/soc/fsl/qbman/qman_priv.h
+++ b/linux/drivers/soc/fsl/qbman/qman_priv.h
@@ -165,6 +165,8 @@ struct qm_portal_config {
struct iommu_domain *iommu_domain;
/* Allow these to be joined in lists */
struct list_head list;
+#else /* __rtems__ */
+ struct list_head node;
#endif /* __rtems__ */
/* User-visible portal configuration settings */
/* portal is affined to this cpu */
@@ -201,6 +203,10 @@ int qman_wq_alloc(void);
void qman_liodn_fixup(u16 channel);
void qman_set_sdest(u16 channel, unsigned int cpu_idx);
+#ifdef __rtems__
+struct qman_portal *qman_create_dedicated_portal(
+ const struct qm_portal_config *c, const struct qman_cgrs *cgrs);
+#endif /* __rtems__ */
struct qman_portal *qman_create_affine_portal(
const struct qm_portal_config *config,
const struct qman_cgrs *cgrs);