@@ -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.
@@ -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;
/**
@@ -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);
This patch introduces a new API to allow platform driver to register platform specific carveout regions. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> --- drivers/remoteproc/remoteproc_core.c | 22 ++++++++++++++++++++++ drivers/remoteproc/remoteproc_internal.h | 7 +++++++ include/linux/remoteproc.h | 2 ++ 3 files changed, 31 insertions(+) -- 1.9.1