diff options
author | Loic Pallardy <loic.pallardy@st.com> | 2018-07-27 15:14:44 +0200 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2018-10-09 22:39:14 -0700 |
commit | 1429cca1175f4cb64dd5d61ffd6037895a41d672 (patch) | |
tree | 3d62e3b206f6da65bf01f9d160698b6dcb927f68 /drivers | |
parent | d7c51706d0956472b7c0530b1bf8fba32d82ee6b (diff) | |
download | linux-stable-1429cca1175f4cb64dd5d61ffd6037895a41d672.tar.gz linux-stable-1429cca1175f4cb64dd5d61ffd6037895a41d672.tar.bz2 linux-stable-1429cca1175f4cb64dd5d61ffd6037895a41d672.zip |
remoteproc: add helper function to allocate rproc_mem_entry from reserved memory
This patch introduces rproc_res_mem_entry_init() helper function to
allocate a rproc_mem_entry structure from a reserved memory region.
In that case, rproc_mem_entry structure has no alloc and release ops.
It will be used to assigned the specified reserved memory to any
rproc sub device.
Relation between rproc_mem_entry and rproc sub device will be done
by name.
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 9d17b3079506..d7a623b8801c 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -857,6 +857,7 @@ rproc_mem_entry_init(struct device *dev, mem->alloc = alloc; mem->release = release; mem->rsc_offset = FW_RSC_ADDR_ANY; + mem->of_resm_idx = -1; va_start(args, name); vsnprintf(mem->name, sizeof(mem->name), name, args); @@ -867,6 +868,42 @@ rproc_mem_entry_init(struct device *dev, EXPORT_SYMBOL(rproc_mem_entry_init); /** + * rproc_of_resm_mem_entry_init() - allocate and initialize rproc_mem_entry struct + * from a reserved memory phandle + * @dev: pointer on device struct + * @of_resm_idx: reserved memory phandle index in "memory-region" + * @len: memory carveout length + * @da: device address + * @name: carveout name + * + * This function allocates a rproc_mem_entry struct and fill it with parameters + * provided by client. + */ +struct rproc_mem_entry * +rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, + u32 da, const char *name, ...) +{ + struct rproc_mem_entry *mem; + va_list args; + + mem = kzalloc(sizeof(*mem), GFP_KERNEL); + if (!mem) + return mem; + + mem->da = da; + mem->len = len; + mem->rsc_offset = FW_RSC_ADDR_ANY; + mem->of_resm_idx = of_resm_idx; + + va_start(args, name); + vsnprintf(mem->name, sizeof(mem->name), name, args); + va_end(args); + + return mem; +} +EXPORT_SYMBOL(rproc_of_resm_mem_entry_init); + +/** * A lookup table for resource handlers. The indices are defined in * enum fw_resource_type. */ |