Ejemplo n.º 1
0
static off_t procDumpVersion(char *buf, size_t size, off_t off)
{
	struct SYS_DATA *psSysData;

	if (off == 0)
		return printAppend(buf, size, 0, "Version %s (%s) %s\n",
				   PVRVERSION_STRING, PVR_BUILD_TYPE,
				   PVR_BUILD_DIR);

	if (SysAcquireData(&psSysData) != PVRSRV_OK)
		return PVRSRV_ERROR_GENERIC;

	if (off == 1) {
		char *pszSystemVersionString = "None";

		if (psSysData->pszVersionString)
			pszSystemVersionString = psSysData->pszVersionString;

		if (strlen(pszSystemVersionString) +
		    strlen("System Version String: \n") + 1 > size)
			return 0;
		return printAppend(buf, size, 0, "System Version String: %s\n",
				   pszSystemVersionString);
	}

	return END_OF_FILE;
}
Ejemplo n.º 2
0
static int RA_DumpSegs(char *page, char **start, off_t off, int count, int *eof,
		       void *data)
{
	struct BT *pBT = NULL;
	int len = 0;
	struct RA_ARENA *pArena = (struct RA_ARENA *)data;

	if (count < 80) {
		*start = (char *)0;
		return 0;
	}
	*eof = 0;
	*start = (char *)1;
	if (off == 0)
		return printAppend(page, count, 0,
			"Arena \"%s\"\nBase         Size Type Ref\n",
			pArena->name);
	for (pBT = pArena->pHeadSegment; --off && pBT;
	     pBT = pBT->pNextSegment)
		;
	if (pBT)
		len = printAppend(page, count, 0, "%08x %8x %4s %08x\n",
				  (unsigned)pBT->base, (unsigned)pBT->uSize,
				  _BTType(pBT->type), (unsigned)pBT->psMapping);
	else
		*eof = 1;
	return len;
}
Ejemplo n.º 3
0
static off_t
printLinuxBridgeStats(IMG_CHAR * buffer, size_t count, off_t off)
{
	PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY *psEntry;
	off_t Ret;

	LinuxLockMutex(&gPVRSRVLock);

	if(!off)
	{
		if(count < 500)
		{
			Ret = 0;
			goto unlock_and_return;
		}
		Ret = printAppend(buffer, count, 0,
						  "Total ioctl call count = %lu\n"
						  "Total number of bytes copied via copy_from_user = %lu\n"
						  "Total number of bytes copied via copy_to_user = %lu\n"
						  "Total number of bytes copied via copy_*_user = %lu\n\n"
						  "%-45s | %-40s | %10s | %20s | %10s\n",
						  g_BridgeGlobalStats.ui32IOCTLCount,
						  g_BridgeGlobalStats.ui32TotalCopyFromUserBytes,
						  g_BridgeGlobalStats.ui32TotalCopyToUserBytes,
						  g_BridgeGlobalStats.ui32TotalCopyFromUserBytes+g_BridgeGlobalStats.ui32TotalCopyToUserBytes,
						  "Bridge Name",
						  "Wrapper Function",
						  "Call Count",
						  "copy_from_user Bytes",
						  "copy_to_user Bytes"
						 );
		goto unlock_and_return;
	}

	if(off > BRIDGE_DISPATCH_TABLE_ENTRY_COUNT)
	{
		Ret = END_OF_FILE;
		goto unlock_and_return;
	}

	if(count < 300)
	{
		Ret = 0;
		goto unlock_and_return;
	}

	psEntry = &g_BridgeDispatchTable[off-1];
	Ret =  printAppend(buffer, count, 0,
					   "%-45s   %-40s   %-10lu   %-20lu   %-10lu\n",
					   psEntry->pszIOCName,
					   psEntry->pszFunctionName,
					   psEntry->ui32CallCount,
					   psEntry->ui32CopyFromUserTotalBytes,
					   psEntry->ui32CopyToUserTotalBytes);

unlock_and_return:
	LinuxUnLockMutex(&gPVRSRVLock);
	return Ret;
}
Ejemplo n.º 4
0
IMG_INT PVRDebugProcGetLevel(IMG_CHAR *page, IMG_CHAR **start, off_t off, IMG_INT count, IMG_INT *eof, IMG_VOID *data)
{
	if (off == 0) {
		*start = (IMG_CHAR *)1;
		return printAppend(page, count, 0, "%lu\n", gPVRDebugLevel);
	}
	*eof = 1;
	return 0;
}
Ejemplo n.º 5
0
int PVRDebugProcGetLevel(char *page, char **start, off_t off, int count,
			 int *eof, void *data)
{
	if (off == 0) {
		*start = (char *)1;
		return printAppend(page, count, 0, "%lu\n", gPVRDebugLevel);
	}
	*eof = 1;
	return 0;
}
Ejemplo n.º 6
0
static off_t procDumpSysNodes(char *buf, size_t size, off_t off)
{
	struct SYS_DATA *psSysData;
	struct PVRSRV_DEVICE_NODE *psDevNode;
	off_t len;

	if (size < 80)
		return 0;

	if (off == 0)
		return printAppend(buf, size, 0,
				   "Registered nodes\n"
		"Addr     Type     Class    Index Ref pvDev     Size Res\n");

	if (SysAcquireData(&psSysData) != PVRSRV_OK)
		return PVRSRV_ERROR_GENERIC;

	for (psDevNode = psSysData->psDeviceNodeList;
	     --off && psDevNode; psDevNode = psDevNode->psNext)
		;

	if (!psDevNode)
		return END_OF_FILE;

	len = printAppend(buf, size, 0,
			  "%p %-8s %-8s %4d  %2u  %p  %3u  %p\n",
			  psDevNode,
			  deviceTypeToString(psDevNode->sDevId.eDeviceType),
			  deviceClassToString(psDevNode->sDevId.eDeviceClass),
			  psDevNode->sDevId.eDeviceClass,
			  psDevNode->ui32RefCount,
			  psDevNode->pvDevice,
			  psDevNode->ui32pvDeviceSize,
			  psDevNode->hResManContext);
	return len;
}
Ejemplo n.º 7
0
static off_t printMemoryRecords(char *buffer, size_t count, off_t off)
{
	struct DEBUG_MEM_ALLOC_REC *psRecord;
	off_t Ret;

	mutex_lock(&g_sDebugMutex);

	if (!off) {
		if (count < 1000) {
			Ret = 0;
			goto unlock_and_return;
		}

		Ret = printAppend(buffer, count, 0, "%-60s: %d bytes\n",
			  "Current Water Mark of bytes allocated via kmalloc",
				 g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_KMALLOC]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Highest Water Mark of bytes allocated via kmalloc",
				g_HighWaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_KMALLOC]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Current Water Mark of bytes allocated via vmalloc",
			g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_VMALLOC]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Highest Water Mark of bytes allocated via vmalloc",
				g_HighWaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_VMALLOC]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Current Water Mark of bytes allocated via alloc_pages",
				g_WaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Highest Water Mark of bytes allocated via alloc_pages",
				g_HighWaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_ALLOC_PAGES]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Current Water Mark of bytes allocated via ioremap",
		g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_IOREMAP]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Highest Water Mark of bytes allocated via ioremap",
				g_HighWaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_IOREMAP]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Current Water Mark of bytes reserved for "
			"\"IO\" memory areas",
		g_WaterMarkData[DEBUG_MEM_ALLOC_TYPE_IO]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Highest Water Mark of bytes allocated for "
			"\"IO\" memory areas",
		g_HighWaterMarkData[DEBUG_MEM_ALLOC_TYPE_IO]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Current Water Mark of bytes allocated via "
			"kmem_cache_alloc",
				g_WaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE]);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
			"Highest Water Mark of bytes allocated via "
			"kmem_cache_alloc",
				g_HighWaterMarkData
				[DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE]);
		Ret = printAppend(buffer, count, Ret, "\n");

		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
		  "The Current Water Mark for memory allocated from system RAM",
		  g_SysRAMWaterMark);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
		  "The Highest Water Mark for memory allocated from system RAM",
		  g_SysRAMHighWaterMark);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
		  "The Current Water Mark for memory allocated from IO memory",
		  g_IOMemWaterMark);
		Ret = printAppend(buffer, count, Ret, "%-60s: %d bytes\n",
		  "The Highest Water Mark for memory allocated from IO memory",
		  g_IOMemHighWaterMark);

		Ret = printAppend(buffer, count, Ret, "\n");

		Ret = printAppend(buffer, count, Ret,
				"Details for all known allocations:\n"
				"%-16s %-8s %-8s %-10s %-5s %-10s %s\n", "Type",
				"CpuVAddr", "CpuPAddr", "Bytes", "PID",
				"PrivateData", "Filename:Line");


		goto unlock_and_return;
	}

	if (count < 1000) {
		Ret = 0;
		goto unlock_and_return;
	}

	for (psRecord = g_MemoryRecords; --off && psRecord;
	     psRecord = psRecord->psNext)
		;
	if (!psRecord) {
		Ret = END_OF_FILE;
		goto unlock_and_return;
	}

	if (psRecord->eAllocType != DEBUG_MEM_ALLOC_TYPE_KMEM_CACHE)
		Ret = printAppend(buffer, count, 0,
			 "%-16s %-8p %08x %-10d %-5d %-10s %s:%d\n",
			 DebugMemAllocRecordTypeToString(psRecord->eAllocType),
			 psRecord->pvCpuVAddr, psRecord->ulCpuPAddr,
			 psRecord->ui32Bytes, psRecord->pid, "NULL",
			 psRecord->pszFileName, psRecord->ui32Line);
	else
		Ret = printAppend(buffer, count, 0,
			  "%-16s %-8p %08x %-10d %-5d %-10s %s:%d\n",
			  DebugMemAllocRecordTypeToString(psRecord->eAllocType),
			  psRecord->pvCpuVAddr, psRecord->ulCpuPAddr,
			  psRecord->ui32Bytes, psRecord->pid,
			  KMemCacheNameWrapper(psRecord->pvPrivateData),
			  psRecord->pszFileName, psRecord->ui32Line);

unlock_and_return:
	mutex_unlock(&g_sDebugMutex);
	return Ret;
}
Ejemplo n.º 8
0
static off_t printLinuxMemAreaRecords(char *buffer, size_t count, off_t off)
{
	struct DEBUG_LINUX_MEM_AREA_REC *psRecord;
	off_t Ret;

	mutex_lock(&g_sDebugMutex);

	if (!off) {
		if (count < 500) {
			Ret = 0;
			goto unlock_and_return;
		}
		Ret = printAppend(buffer, count, 0,
				  "Number of Linux Memory Areas: %u\n"
			  "At the current water mark these areas "
				  "correspond to %u bytes "
				  "(excluding SUB areas)\n"
			  "At the highest water mark these areas "
				  "corresponded to %u bytes "
				  "(excluding SUB areas)\n"
			  "\nDetails for all Linux Memory Areas:\n"
			  "%s %-24s %s %s %-8s %-5s %s\n",
			  g_LinuxMemAreaCount,
			  g_LinuxMemAreaWaterMark,
			  g_LinuxMemAreaHighWaterMark,
			  "psLinuxMemArea",
			  "LinuxMemType",
			  "CpuVAddr",
			  "CpuPAddr", "Bytes", "Pid", "Flags");
		goto unlock_and_return;
	}

	for (psRecord = g_LinuxMemAreaRecords; --off && psRecord;
	     psRecord = psRecord->psNext)
		;
	if (!psRecord) {
		Ret = END_OF_FILE;
		goto unlock_and_return;
	}

	if (count < 500) {
		Ret = 0;
		goto unlock_and_return;
	}

	Ret = printAppend(buffer, count, 0,
			  "%8p       %-24s %8p %08x %-8d %-5u %08x=(%s)\n",
			  psRecord->psLinuxMemArea,
			  LinuxMemAreaTypeToString(psRecord->psLinuxMemArea->
						   eAreaType),
			  LinuxMemAreaToCpuVAddr(psRecord->psLinuxMemArea),
			  LinuxMemAreaToCpuPAddr(psRecord->psLinuxMemArea,
						 0).uiAddr,
			  psRecord->psLinuxMemArea->ui32ByteSize, psRecord->pid,
			  psRecord->ui32Flags,
			  HAPFlagsToString(psRecord->ui32Flags)
	    );

unlock_and_return:
	mutex_unlock(&g_sDebugMutex);
	return Ret;
}
Ejemplo n.º 9
0
static int RA_DumpInfo(char *page, char **start, off_t off, int count, int *eof,
	    void *data)
{
	int len = 0;
	struct RA_ARENA *pArena = (struct RA_ARENA *)data;

	if (count < 80) {
		*start = (char *)0;
		return 0;
	}
	*eof = 0;
	switch (off) {
	case 0:
		len = printAppend(page, count, 0, "quantum\t\t\t%u\n",
				  pArena->uQuantum);
		break;
	case 1:
		len = printAppend(page, count, 0, "import_handle\t\t%08X\n",
				(unsigned)pArena->pImportHandle);
		break;
#ifdef RA_STATS
	case 2:
		len = printAppend(page, count, 0, "span count\t\t%u\n",
				pArena->sStatistics.uSpanCount);
		break;
	case 3:
		len = printAppend(page, count, 0, "live segment count\t%u\n",
				pArena->sStatistics.uLiveSegmentCount);
		break;
	case 4:
		len = printAppend(page, count, 0, "free segment count\t%u\n",
				pArena->sStatistics.uFreeSegmentCount);
		break;
	case 5:
		len = printAppend(page, count, 0,
				"free resource count\t%u (0x%x)\n",
				pArena->sStatistics.uFreeResourceCount,
				(unsigned)pArena->sStatistics.
				uFreeResourceCount);
		break;
	case 6:
		len = printAppend(page, count, 0, "total allocs\t\t%u\n",
				pArena->sStatistics.uCumulativeAllocs);
		break;
	case 7:
		len = printAppend(page, count, 0, "total frees\t\t%u\n",
				pArena->sStatistics.uCumulativeFrees);
		break;
	case 8:
		len = printAppend(page, count, 0, "import count\t\t%u\n",
				pArena->sStatistics.uImportCount);
		break;
	case 9:
		len = printAppend(page, count, 0, "export count\t\t%u\n",
				pArena->sStatistics.uExportCount);
		break;
#endif

	default:
		*eof = 1;
	}
	*start = (char *)1;
	return len;
}