[ARM] tegra: nvrm_transport: send address message after AVP init
authorGary King <gking@nvidia.com>
Wed, 1 Sep 2010 20:13:45 +0000 (13:13 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:50:40 +0000 (16:50 -0700)
rather than storing the address message in the mailbox when the shared
message memory is allocated during kernel init, send the message after
the AVP is initialized.

this prevents the message from being "lost" if the system enters LP0
before initializing the AVP.

Change-Id: I14634e2a53abacf840ed906451f1a07016a99015
Signed-off-by: Gary King <gking@nvidia.com>
arch/arm/mach-tegra/nv/nvrm/core/common/nvrm_moduleloader.c
arch/arm/mach-tegra/nv/nvrm/core/common/nvrm_transport.c

index f15c90e79a8ba7663d24abf1eac732eca74e34e1..22241b72a70e94c84bd7b28cfa53b19273c33376 100644 (file)
@@ -282,14 +282,12 @@ static NvError PrivateOsFopen(
     if (hFile == NULL)
         return NvError_InsufficientMemory;
 
-    NvOsDebugPrintf("%s <kernel impl>: file=%s\n", __func__, filename);
-    NvOsDebugPrintf("%s <kernel impl>: calling request_firmware()\n", __func__);
+    pr_debug("%s <kernel impl>: file=%s\n", __func__, filename);
     if (request_firmware(&s_FwEntry, filename, nvfw_dev.this_device) != 0)
     {
         pr_err("%s: Cannot read firmware '%s'\n", __func__, filename);
         return NvError_FileReadFailed;
     }
-    NvOsDebugPrintf("%s <kernel impl>: back from request_firmware()\n", __func__);
     hFile->pstart = s_FwEntry->data;
     hFile->pread = s_FwEntry->data;
     hFile->pend = s_FwEntry->data + s_FwEntry->size;
@@ -316,7 +314,6 @@ NvError NvRmLoadLibrary(
     NvError Error = NvSuccess;
     NV_ASSERT(sizeOfArgs <= MAX_ARGS_SIZE);
 
-    NvOsDebugPrintf("%s <kernel impl>: file=%s\n", __func__, pLibName);
     Error = NvRmLoadLibraryEx(hDevice, pLibName, pArgs, sizeOfArgs, NV_FALSE,
                               hLibHandle);
     return Error;
@@ -341,8 +338,6 @@ NvError NvRmLoadLibraryEx(
 
     NV_ASSERT(sizeOfArgs <= MAX_ARGS_SIZE);
 
-    NvOsDebugPrintf("%s <kernel impl>: file=%s\n", __func__, pLibName);
-
     NV_CHECK_ERROR_CLEANUP(NvRmPrivInitAvp(hDevice));
 
     e = NvRmPrivRPCConnect(s_RPCHandle);
@@ -535,6 +530,8 @@ static void NvRmPrivResetAvp(NvRmDeviceHandle hRm, unsigned long reset_va)
     writel(tmp, _TEGRA_AVP_RESET_VECTOR_ADDR);
 }
 
+void NvRmPrivXpcSendMsgAddress(void);
+
 static NvError NvRmPrivInitAvp(NvRmDeviceHandle hRm)
 {
     u32 *stub_phys = &_tegra_avp_launcher_stub_data[AVP_LAUNCHER_MMU_PHYSICAL];
@@ -573,6 +570,9 @@ static NvError NvRmPrivInitAvp(NvRmDeviceHandle hRm)
     NvRmPrivResetAvp(hRm, 0x00100000ul);
 
     NV_CHECK_ERROR_CLEANUP(NvRmPrivInitService(hRm));
+
+    NvRmPrivXpcSendMsgAddress();
+
     e = NvRmPrivInitModuleLoaderRPC(hRm);
     if (e != NvSuccess)
     {
index 8227b9f2ca45a9914c34667988ed3c18030e8dc1..97a6698790461cb1af1169076e4addf66626f614 100644 (file)
@@ -611,6 +611,13 @@ RegisterTransportInterrupt(NvRmDeviceHandle hDevice)
     return NvSuccess;
 }
 
+void NvRmPrivXpcSendMsgAddress(void)
+{
+    BUG_ON(!s_TransportInfo.MessageMemPhysAddr);
+    NvRmPrivXpcSendMessage(s_TransportInfo.hXpc,
+                           s_TransportInfo.MessageMemPhysAddr);
+}
+
 // allocate buffers to be used for sending/receiving messages.
 static void
 NvRmPrivTransportAllocBuffers(NvRmDeviceHandle hRmDevice)
@@ -657,7 +664,6 @@ NvRmPrivTransportAllocBuffers(NvRmDeviceHandle hRmDevice)
     NvRmMemWr32(hNewMemHandle, 0, 0xdeadf00d); // set this non-zero to throttle messages to the avp till avp is ready.
     NvRmMemWr32(hNewMemHandle,  MAX_MESSAGE_LENGTH + MAX_COMMAND_SIZE, 0);
 
-    NvRmPrivXpcSendMessage(s_TransportInfo.hXpc, s_TransportInfo.MessageMemPhysAddr);
     return;