summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/pdump.c')
-rw-r--r--jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/pdump.c59
1 files changed, 55 insertions, 4 deletions
diff --git a/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/pdump.c b/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/pdump.c
index 0124737..548e8dc 100644
--- a/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/pdump.c
+++ b/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/pdump.c
@@ -62,6 +62,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62 62
63#include <linux/kernel.h> // sprintf 63#include <linux/kernel.h> // sprintf
64#include <linux/string.h> // strncpy, strlen 64#include <linux/string.h> // strncpy, strlen
65#include <linux/mutex.h>
65 66
66static IMG_BOOL PDumpWriteString2 (IMG_CHAR * pszString, IMG_UINT32 ui32Flags); 67static IMG_BOOL PDumpWriteString2 (IMG_CHAR * pszString, IMG_UINT32 ui32Flags);
67static IMG_BOOL PDumpWriteILock (PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32Count, IMG_UINT32 ui32Flags); 68static IMG_BOOL PDumpWriteILock (PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_UINT32 ui32Count, IMG_UINT32 ui32Flags);
@@ -80,7 +81,8 @@ static atomic_t gsPDumpSuspended = ATOMIC_INIT(0);
80 81
81static PDBGKM_SERVICE_TABLE gpfnDbgDrv = IMG_NULL; 82static PDBGKM_SERVICE_TABLE gpfnDbgDrv = IMG_NULL;
82 83
83 84DEFINE_MUTEX(sPDumpLock);
85DEFINE_MUTEX(sPDumpMsgLock);
84 86
85IMG_CHAR *pszStreamName[PDUMP_NUM_STREAMS] = { "ParamStream2", 87IMG_CHAR *pszStreamName[PDUMP_NUM_STREAMS] = { "ParamStream2",
86 "ScriptStream2", 88 "ScriptStream2",
@@ -391,7 +393,7 @@ IMG_VOID PDumpOSCPUVAddrToDevPAddr(PVRSRV_DEVICE_TYPE eDeviceType,
391IMG_VOID PDumpOSCPUVAddrToPhysPages(IMG_HANDLE hOSMemHandle, 393IMG_VOID PDumpOSCPUVAddrToPhysPages(IMG_HANDLE hOSMemHandle,
392 IMG_UINT32 ui32Offset, 394 IMG_UINT32 ui32Offset,
393 IMG_PUINT8 pui8LinAddr, 395 IMG_PUINT8 pui8LinAddr,
394 IMG_UINT32 ui32DataPageMask, 396 IMG_UINTPTR_T ui32DataPageMask,
395 IMG_UINT32 *pui32PageOffset) 397 IMG_UINT32 *pui32PageOffset)
396{ 398{
397 if(hOSMemHandle) 399 if(hOSMemHandle)
@@ -411,7 +413,7 @@ IMG_VOID PDumpOSCPUVAddrToPhysPages(IMG_HANDLE hOSMemHandle,
411 PVR_UNREFERENCED_PARAMETER(hOSMemHandle); 413 PVR_UNREFERENCED_PARAMETER(hOSMemHandle);
412 PVR_UNREFERENCED_PARAMETER(ui32Offset); 414 PVR_UNREFERENCED_PARAMETER(ui32Offset);
413 415
414 *pui32PageOffset = ((IMG_UINT32)pui8LinAddr & ui32DataPageMask); 416 *pui32PageOffset = ((IMG_UINTPTR_T)pui8LinAddr & ui32DataPageMask);
415 } 417 }
416} 418}
417 419
@@ -724,7 +726,7 @@ static IMG_BOOL PDumpWriteILock(PDBG_STREAM psStream, IMG_UINT8 *pui8Data, IMG_U
724 IMG_UINT32 ui32Written = 0; 726 IMG_UINT32 ui32Written = 0;
725 if ((psStream == IMG_NULL) || PDumpSuspended() || ((ui32Flags & PDUMP_FLAGS_NEVER) != 0)) 727 if ((psStream == IMG_NULL) || PDumpSuspended() || ((ui32Flags & PDUMP_FLAGS_NEVER) != 0))
726 { 728 {
727 PVR_DPF((PVR_DBG_MESSAGE, "PDumpWriteILock: Failed to write 0x%x bytes to stream 0x%x", ui32Count, (IMG_UINT32)psStream)); 729 PVR_DPF((PVR_DBG_MESSAGE, "PDumpWriteILock: Failed to write 0x%x bytes to stream 0x%p", ui32Count, psStream));
728 return IMG_TRUE; 730 return IMG_TRUE;
729 } 731 }
730 732
@@ -797,6 +799,55 @@ IMG_VOID PDumpResumeKM(IMG_VOID)
797 atomic_dec(&gsPDumpSuspended); 799 atomic_dec(&gsPDumpSuspended);
798} 800}
799 801
802/* Set to 1 if you want to debug PDump locking issues */
803#define DEBUG_PDUMP_LOCKS 0
804
805#if DEBUG_PDUMP_LOCKS
806static IMG_UINT32 ui32Count=0;
807static IMG_UINT32 aui32LockLine[2] = {0};
808static IMG_UINT32 aui32UnlockLine[2] = {0};
809static IMG_UINT32 ui32LockLineCount = 0;
810static IMG_UINT32 ui32UnlockLineCount = 0;
811#endif
812
813IMG_VOID PDumpOSLock(IMG_UINT32 ui32Line)
814{
815#if DEBUG_PDUMP_LOCKS
816 aui32LockLine[ui32LockLineCount++ % 2] = ui32Line;
817 ui32Count++;
818 if (ui32Count == 2)
819 {
820 IMG_UINT32 i;
821 printk(KERN_ERR "Double lock\n");
822 dump_stack();
823 for (i=0;i<2;i++)
824 {
825 printk(KERN_ERR "Lock[%d] = %d, Unlock[%d] = %d\n", i, aui32LockLine[i],i, aui32UnlockLine[i]);
826 }
827 }
828#endif
829 mutex_lock(&sPDumpLock);
830}
831
832IMG_VOID PDumpOSUnlock(IMG_UINT32 ui32Line)
833{
834 mutex_unlock(&sPDumpLock);
835#if DEBUG_PDUMP_LOCKS
836 aui32UnlockLine[ui32UnlockLineCount++ % 2] = ui32Line;
837 ui32Count--;
838#endif
839}
840
841IMG_VOID PDumpOSLockMessageBuffer(IMG_VOID)
842{
843 mutex_lock(&sPDumpMsgLock);
844}
845
846IMG_VOID PDumpOSUnlockMessageBuffer(IMG_VOID)
847{
848 mutex_unlock(&sPDumpMsgLock);
849}
850
800#endif /* #if defined (PDUMP) */ 851#endif /* #if defined (PDUMP) */
801#endif /* #if defined (SUPPORT_SGX) */ 852#endif /* #if defined (SUPPORT_SGX) */
802/***************************************************************************** 853/*****************************************************************************