summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl_qbman/qman_driver.c
diff options
context:
space:
mode:
authorRoy Pledge <Roy.Pledge@freescale.com>2013-08-13 15:25:33 (GMT)
committerRivera Jose-B46482 <Jose.G.Rivera@freescale.com>2013-08-15 14:46:50 (GMT)
commitc639ccce631a1ab6575d31207ac8b09a31bfde5e (patch)
tree6d070a7e69289f16aa64b09e97af2dd4d0a6cb4d /drivers/staging/fsl_qbman/qman_driver.c
parent18621b815334dbcda6369b70dce81c985a48fde3 (diff)
downloadlinux-fsl-qoriq-c639ccce631a1ab6575d31207ac8b09a31bfde5e.tar.xz
Add API to allocate specific portals based on index.
This allows an application to get back the exact portal it was previously using by specifing the portals index value. Signed-off-by: Roy Pledge <Roy.Pledge@freescale.com> Change-Id: I8233816f0519731eb65b3671d68a01266eee42dd Reviewed-on: http://git.am.freescale.net:8181/4002 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Ladouceur Jeffrey-R11498 <Jeffrey.Ladouceur@freescale.com> Reviewed-by: Wang Haiying-R54964 <Haiying.Wang@freescale.com> Reviewed-by: Rivera Jose-B46482 <Jose.G.Rivera@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_qbman/qman_driver.c')
-rw-r--r--drivers/staging/fsl_qbman/qman_driver.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/staging/fsl_qbman/qman_driver.c b/drivers/staging/fsl_qbman/qman_driver.c
index 6d879a4..b706b21 100644
--- a/drivers/staging/fsl_qbman/qman_driver.c
+++ b/drivers/staging/fsl_qbman/qman_driver.c
@@ -455,6 +455,21 @@ static struct qm_portal_config *get_pcfg(struct list_head *list)
return pcfg;
}
+static struct qm_portal_config *get_pcfg_idx(struct list_head *list, u32 idx)
+{
+ struct qm_portal_config *pcfg;
+ if (list_empty(list))
+ return NULL;
+ list_for_each_entry(pcfg, list, list) {
+ if (pcfg->public_cfg.index == idx) {
+ list_del(&pcfg->list);
+ return pcfg;
+ }
+ }
+ return NULL;
+}
+
+
static void portal_set_cpu(struct qm_portal_config *pcfg, int cpu)
{
int ret;
@@ -531,11 +546,14 @@ _iommu_domain_free:
iommu_domain_free(pcfg->iommu_domain);
}
-struct qm_portal_config *qm_get_unused_portal(void)
+struct qm_portal_config *qm_get_unused_portal_idx(u32 idx)
{
struct qm_portal_config *ret;
spin_lock(&unused_pcfgs_lock);
- ret = get_pcfg(&unused_pcfgs);
+ if (idx == QBMAN_ANY_PORTAL_IDX)
+ ret = get_pcfg(&unused_pcfgs);
+ else
+ ret = get_pcfg_idx(&unused_pcfgs, idx);
spin_unlock(&unused_pcfgs_lock);
/* Bind stashing LIODNs to the CPU we are currently executing on, and
* set the portal to use the stashing request queue corresonding to the
@@ -550,6 +568,11 @@ struct qm_portal_config *qm_get_unused_portal(void)
return ret;
}
+struct qm_portal_config *qm_get_unused_portal()
+{
+ return qm_get_unused_portal_idx(QBMAN_ANY_PORTAL_IDX);
+}
+
void qm_put_unused_portal(struct qm_portal_config *pcfg)
{
spin_lock(&unused_pcfgs_lock);