QNX IPC: RpmsgRpc - Fix Tiler Address Translations
authorAngela Stegmaier <angelabaker@ti.com>
Mon, 6 May 2013 20:38:01 +0000 (15:38 -0500)
committerChris Ring <cring@ti.com>
Thu, 9 May 2013 17:21:04 +0000 (10:21 -0700)
Tiler address translations should be done thorugh the
ProcMgr_translate function instead of just assuming
the remote core VA is the same as the PA.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Chris Ring <cring@ti.com>
qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c

index 71636ff16e60e7afd2f8d01d3e5d8fc7773ad533..63baca0425c130c35cf23eeeb9f8c18db516191d 100644 (file)
@@ -1660,17 +1660,14 @@ _rpmsg_rpc_pa2da(ProcMgr_Handle handle, uint32_t pa)
     Int status = 0;
     uint32_t da;
 
-    if (pa >= TILER_MEM_8BIT && pa < TILER_MEM_END) {
-        return pa;
+    status = ProcMgr_translateAddr(handle, (Ptr *)&da,
+                                   ProcMgr_AddrType_SlaveVirt,
+                                   (Ptr)pa, ProcMgr_AddrType_MasterPhys);
+    if (status >= 0) {
+        return da;
     }
     else {
-        status = ProcMgr_translateAddr(handle, (Ptr *)&da,
-                                       ProcMgr_AddrType_SlaveVirt,
-                                       (Ptr)pa, ProcMgr_AddrType_MasterPhys);
-        if (status >= 0)
-            return da;
-        else
-            return 0;
+        return 0;
     }
 }
 
@@ -1717,7 +1714,8 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, pid_t pid, bool reverse)
                 vptr[idx] = mmap64(NULL, function->params[idx].size,
                                    PROT_NOCACHE | PROT_READ | PROT_WRITE,
                                    MAP_PHYS, NOFD, paddr[idx]);
-                if (vptr == MAP_FAILED) {
+                if (vptr[idx] == MAP_FAILED) {
+                    vptr[idx] = 0;
                     status = -ENOMEM;
                     break;
                 }