Reverted GateSwi patch in MessageQCopy_send.
authorRamsey Harris <ramsey@ti.com>
Thu, 7 Mar 2013 20:08:15 +0000 (12:08 -0800)
committerRamsey Harris <ramsey@ti.com>
Thu, 7 Mar 2013 20:08:15 +0000 (12:08 -0800)
The GateSwi patch moved the GateSwi_leave() call too far down
the function. This placed Semaphore_pend() inside the GateSwi
which is illegal.

packages/ti/ipc/rpmsg/MessageQCopy.c

index a34f4f6cb76ea6fc58862b133ba62a3223b5021b..dbcedaa95daba6130f92438a5d94f8b3aaacd660 100644 (file)
@@ -573,6 +573,7 @@ Int MessageQCopy_send(UInt16 dstProc,
             Semaphore_reset(transport.semHandle_toHost, 0);
             token = VirtQueue_getAvailBuf(transport.virtQueue_toHost,
                     (Void **)&msg, &length);
+            GateSwi_leave(module.gateSwi, key);
         } while (token < 0 && Semaphore_pend(transport.semHandle_toHost,
                                              BIOS_WAIT_FOREVER));
         if (token >= 0) {
@@ -584,15 +585,16 @@ Int MessageQCopy_send(UInt16 dstProc,
             msg->flags = 0;
             msg->reserved = 0;
 
+            key = GateSwi_enter(module.gateSwi);  // Protect vring structs.
             VirtQueue_addUsedBuf(transport.virtQueue_toHost, token,
                                                             RPMSG_BUF_SIZE);
             VirtQueue_kick(transport.virtQueue_toHost);
+            GateSwi_leave(module.gateSwi, key);
         }
         else {
             status = MessageQCopy_E_FAIL;
             Log_print0(Diags_STATUS, FXNN": getAvailBuf failed!");
         }
-        GateSwi_leave(module.gateSwi, key);
     }
     else {
         /* Put on a Message queue on this processor: */