|
@@ -732,7 +732,7 @@ static rproc_handle_resource_t rproc_loading_handlers[RSC_LAST] = {
|
|
};
|
|
};
|
|
|
|
|
|
/* handle firmware resource entries before booting the remote processor */
|
|
/* handle firmware resource entries before booting the remote processor */
|
|
-static int rproc_handle_resources(struct rproc *rproc, int len,
|
|
|
|
|
|
+static int rproc_handle_resources(struct rproc *rproc,
|
|
rproc_handle_resource_t handlers[RSC_LAST])
|
|
rproc_handle_resource_t handlers[RSC_LAST])
|
|
{
|
|
{
|
|
struct device *dev = &rproc->dev;
|
|
struct device *dev = &rproc->dev;
|
|
@@ -742,7 +742,7 @@ static int rproc_handle_resources(struct rproc *rproc, int len,
|
|
for (i = 0; i < rproc->table_ptr->num; i++) {
|
|
for (i = 0; i < rproc->table_ptr->num; i++) {
|
|
int offset = rproc->table_ptr->offset[i];
|
|
int offset = rproc->table_ptr->offset[i];
|
|
struct fw_rsc_hdr *hdr = (void *)rproc->table_ptr + offset;
|
|
struct fw_rsc_hdr *hdr = (void *)rproc->table_ptr + offset;
|
|
- int avail = len - offset - sizeof(*hdr);
|
|
|
|
|
|
+ int avail = rproc->table_sz - offset - sizeof(*hdr);
|
|
void *rsc = (void *)hdr + sizeof(*hdr);
|
|
void *rsc = (void *)hdr + sizeof(*hdr);
|
|
|
|
|
|
/* make sure table isn't truncated */
|
|
/* make sure table isn't truncated */
|
|
@@ -849,16 +849,9 @@ static void rproc_resource_cleanup(struct rproc *rproc)
|
|
|
|
|
|
static int rproc_start(struct rproc *rproc, const struct firmware *fw)
|
|
static int rproc_start(struct rproc *rproc, const struct firmware *fw)
|
|
{
|
|
{
|
|
- struct resource_table *table, *loaded_table;
|
|
|
|
|
|
+ struct resource_table *loaded_table;
|
|
struct device *dev = &rproc->dev;
|
|
struct device *dev = &rproc->dev;
|
|
- int ret, tablesz;
|
|
|
|
-
|
|
|
|
- /* look for the resource table */
|
|
|
|
- table = rproc_find_rsc_table(rproc, fw, &tablesz);
|
|
|
|
- if (!table) {
|
|
|
|
- dev_err(dev, "Resource table look up failed\n");
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
|
|
+ int ret;
|
|
|
|
|
|
/* load the ELF segments to memory */
|
|
/* load the ELF segments to memory */
|
|
ret = rproc_load_segments(rproc, fw);
|
|
ret = rproc_load_segments(rproc, fw);
|
|
@@ -877,7 +870,7 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)
|
|
*/
|
|
*/
|
|
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
|
|
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
|
|
if (loaded_table) {
|
|
if (loaded_table) {
|
|
- memcpy(loaded_table, rproc->cached_table, tablesz);
|
|
|
|
|
|
+ memcpy(loaded_table, rproc->cached_table, rproc->table_sz);
|
|
rproc->table_ptr = loaded_table;
|
|
rproc->table_ptr = loaded_table;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -951,12 +944,13 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
|
|
goto clean_up;
|
|
goto clean_up;
|
|
|
|
|
|
rproc->table_ptr = rproc->cached_table;
|
|
rproc->table_ptr = rproc->cached_table;
|
|
|
|
+ rproc->table_sz = tablesz;
|
|
|
|
|
|
/* reset max_notifyid */
|
|
/* reset max_notifyid */
|
|
rproc->max_notifyid = -1;
|
|
rproc->max_notifyid = -1;
|
|
|
|
|
|
/* handle fw resources which are required to boot rproc */
|
|
/* handle fw resources which are required to boot rproc */
|
|
- ret = rproc_handle_resources(rproc, tablesz, rproc_loading_handlers);
|
|
|
|
|
|
+ ret = rproc_handle_resources(rproc, rproc_loading_handlers);
|
|
if (ret) {
|
|
if (ret) {
|
|
dev_err(dev, "Failed to process resources: %d\n", ret);
|
|
dev_err(dev, "Failed to process resources: %d\n", ret);
|
|
goto clean_up_resources;
|
|
goto clean_up_resources;
|