[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1509108254-22296-4-git-send-email-loic.pallardy@st.com>
Date: Fri, 27 Oct 2017 14:44:10 +0200
From: Loic Pallardy <loic.pallardy@...com>
To: <bjorn.andersson@...aro.org>, <ohad@...ery.com>
CC: <linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<arnaud.pouliquen@...com>, <benjamin.gaignard@...aro.org>,
Loic Pallardy <loic.pallardy@...com>
Subject: [PATCH 3/7] remoteproc: introduce rproc_add_carveout function
This patch introduces a new API to allow platform driver to register
platform specific carveout regions.
Signed-off-by: Loic Pallardy <loic.pallardy@...com>
---
drivers/remoteproc/remoteproc_core.c | 22 ++++++++++++++++++++++
drivers/remoteproc/remoteproc_internal.h | 7 +++++++
include/linux/remoteproc.h | 2 ++
3 files changed, 31 insertions(+)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index f23daf9..279320a 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -737,6 +737,7 @@ static int rproc_handle_carveout(struct rproc *rproc,
carveout->dma = dma;
carveout->da = rsc->da;
carveout->release = rproc_release_carveout;
+ carveout->priv = (void *)CARVEOUT_RSC_ALLOCATED;
list_add_tail(&carveout->node, &rproc->carveouts);
@@ -751,6 +752,27 @@ static int rproc_handle_carveout(struct rproc *rproc,
return ret;
}
+/**
+ * rproc_add_carveout() - register an allocated carveout region
+ * @rproc: rproc handle
+ * @mem: memory entry to register
+ *
+ * This function registers specified memory entry in @rproc carveouts list.
+ * Specified carveout should have been allocated before registering.
+ */
+int rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem)
+{
+ if (!rproc || !mem)
+ return -EINVAL;
+
+ mem->priv = (void *)CARVEOUT_EXTERNAL;
+
+ list_add_tail(&mem->node, &rproc->carveouts);
+
+ return 0;
+}
+EXPORT_SYMBOL(rproc_add_carveout);
+
/*
* A lookup table for resource handlers. The indices are defined in
* enum fw_resource_type.
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
index c1077be..69b22ac 100644
--- a/drivers/remoteproc/remoteproc_internal.h
+++ b/drivers/remoteproc/remoteproc_internal.h
@@ -23,6 +23,13 @@
#include <linux/irqreturn.h>
#include <linux/firmware.h>
+/* Indicate carveout origin */
+enum carveout_src {
+ CARVEOUT_RSC = 0,
+ CARVEOUT_RSC_ALLOCATED = 1,
+ CARVEOUT_EXTERNAL = 2,
+};
+
struct rproc;
/**
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 8780f2e..5bd5175 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -522,6 +522,8 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
int rproc_del(struct rproc *rproc);
void rproc_free(struct rproc *rproc);
+int rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem);
+
int rproc_boot(struct rproc *rproc);
void rproc_shutdown(struct rproc *rproc);
void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);
--
1.9.1
Powered by blists - more mailing lists