@@ -29,10 +29,11 @@ remoteproc_check_fw_format(const void *img_data, size_t img_len)
2929 return NULL ;
3030}
3131
32+ /* try the internal list added by remoteproc_add_mem first and then get_mem callback */
3233static struct remoteproc_mem *
3334remoteproc_get_mem (struct remoteproc * rproc , const char * name ,
3435 metal_phys_addr_t pa , metal_phys_addr_t da ,
35- void * va , size_t size )
36+ void * va , size_t size , struct remoteproc_mem * buf )
3637{
3738 struct metal_list * node ;
3839 struct remoteproc_mem * mem ;
@@ -72,7 +73,11 @@ remoteproc_get_mem(struct remoteproc *rproc, const char *name,
7273 return NULL ;
7374 }
7475 }
75- return NULL ;
76+
77+ if (!rproc -> ops -> get_mem )
78+ return NULL ;
79+
80+ return rproc -> ops -> get_mem (rproc , name , pa , da , va , size , buf );
7681}
7782
7883static metal_phys_addr_t
@@ -282,9 +287,10 @@ remoteproc_get_io_with_name(struct remoteproc *rproc,
282287 const char * name )
283288{
284289 struct remoteproc_mem * mem ;
290+ struct remoteproc_mem buf ;
285291
286292 mem = remoteproc_get_mem (rproc , name ,
287- METAL_BAD_PHYS , METAL_BAD_PHYS , NULL , 0 );
293+ METAL_BAD_PHYS , METAL_BAD_PHYS , NULL , 0 , & buf );
288294 if (mem )
289295 return mem -> io ;
290296 else
@@ -296,8 +302,9 @@ remoteproc_get_io_with_pa(struct remoteproc *rproc,
296302 metal_phys_addr_t pa )
297303{
298304 struct remoteproc_mem * mem ;
305+ struct remoteproc_mem buf ;
299306
300- mem = remoteproc_get_mem (rproc , NULL , pa , METAL_BAD_PHYS , NULL , 0 );
307+ mem = remoteproc_get_mem (rproc , NULL , pa , METAL_BAD_PHYS , NULL , 0 , & buf );
301308 if (mem )
302309 return mem -> io ;
303310 else
@@ -310,8 +317,9 @@ remoteproc_get_io_with_da(struct remoteproc *rproc,
310317 unsigned long * offset )
311318{
312319 struct remoteproc_mem * mem ;
320+ struct remoteproc_mem buf ;
313321
314- mem = remoteproc_get_mem (rproc , NULL , METAL_BAD_PHYS , da , NULL , 0 );
322+ mem = remoteproc_get_mem (rproc , NULL , METAL_BAD_PHYS , da , NULL , 0 , & buf );
315323 if (mem ) {
316324 struct metal_io_region * io ;
317325 metal_phys_addr_t pa ;
@@ -329,9 +337,10 @@ struct metal_io_region *
329337remoteproc_get_io_with_va (struct remoteproc * rproc , void * va )
330338{
331339 struct remoteproc_mem * mem ;
340+ struct remoteproc_mem buf ;
332341
333342 mem = remoteproc_get_mem (rproc , NULL , METAL_BAD_PHYS , METAL_BAD_PHYS ,
334- va , 0 );
343+ va , 0 , & buf );
335344 if (mem )
336345 return mem -> io ;
337346 else
@@ -346,6 +355,7 @@ void *remoteproc_mmap(struct remoteproc *rproc,
346355 void * va = NULL ;
347356 metal_phys_addr_t lpa , lda ;
348357 struct remoteproc_mem * mem ;
358+ struct remoteproc_mem buf ;
349359
350360 if (!rproc )
351361 return NULL ;
@@ -359,7 +369,7 @@ void *remoteproc_mmap(struct remoteproc *rproc,
359369 lda = * da ;
360370 else
361371 lda = METAL_BAD_PHYS ;
362- mem = remoteproc_get_mem (rproc , NULL , lpa , lda , NULL , size );
372+ mem = remoteproc_get_mem (rproc , NULL , lpa , lda , NULL , size , & buf );
363373 if (mem ) {
364374 if (lpa != METAL_BAD_PHYS )
365375 lda = remoteproc_patoda (mem , lpa );
0 commit comments