sgxinit.o sgxreset.o sgxutils.o sgxkick.o \
sgxtransfer.o mmu.o pb.o perproc.o sysconfig.o \
sysutils.o osperproc.o bridged_support.o \
- bridged_sgx_bridge.o sgxpower.o pdump_common.o \
- pvr_events.o
+ bridged_sgx_bridge.o sgxpower.o pvr_events.o
pvrsrvkm-objs-$(CONFIG_PVR_DEBUG) += pvr_debug.o
pvrsrvkm-objs-$(CONFIG_DEBUG_FS) += pvr_debugfs.o
if (psRetOUT->eError != PVRSRV_OK)
return 0;
- psRetOUT->eError = PDumpMemUM(psPerProc, psPDumpMemDumpIN->pvAltLinAddr,
+ psRetOUT->eError = PDumpMemUM(psPDumpMemDumpIN->pvAltLinAddr,
psPDumpMemDumpIN->pvLinAddr,
pvMemInfo, psPDumpMemDumpIN->ui32Offset,
psPDumpMemDumpIN->ui32Bytes,
return 0;
psRetOUT->eError =
- PDumpMemUM(psPerProc, psPDumpSyncDumpIN->pvAltLinAddr, NULL,
+ PDumpMemUM(psPDumpSyncDumpIN->pvAltLinAddr, NULL,
((struct PVRSRV_KERNEL_SYNC_INFO *)pvSyncInfo)->
psSyncDataMemInfoKM,
psPDumpSyncDumpIN->ui32Offset, ui32Bytes, 0,
}
PDUMPCOMMENTWITHFLAGS(0, "%s\r\n", pszName);
- PDUMPMEMUM(psPerProc,
- NULL, psBuffer->pvLinAddr,
+ PDUMPMEMUM(NULL, psBuffer->pvLinAddr,
(struct PVRSRV_KERNEL_MEM_INFO *)psBuffer->
hKernelMemInfo,
psBuffer->ui32Start,
MAKEUNIQUETAG(psCtrlMemInfoKM));
}
PDUMPCOMMENTWITHFLAGS(0, "%s (part 1)\r\n", pszName);
- PDUMPMEMUM(psPerProc,
- NULL, psBuffer->pvLinAddr,
+ PDUMPMEMUM(NULL, psBuffer->pvLinAddr,
(struct PVRSRV_KERNEL_MEM_INFO *)psBuffer->
hKernelMemInfo,
psBuffer->ui32Start,
MAKEUNIQUETAG(psCtrlMemInfoKM));
}
PDUMPCOMMENTWITHFLAGS(0, "%s (part 2)\r\n", pszName);
- PDUMPMEMUM(psPerProc, NULL, psBuffer->pvLinAddr,
+ PDUMPMEMUM(NULL, psBuffer->pvLinAddr,
(struct PVRSRV_KERNEL_MEM_INFO *)psBuffer->
hKernelMemInfo,
0, psBuffer->ui32End, 0, hUniqueTag);
}
static enum PVRSRV_ERROR
-dbgdrv_write_data(void *buffer, int size)
+dbgdrv_write_data(void *buffer, int size, bool from_user)
{
return PVRSRV_OK;
}
}
static enum PVRSRV_ERROR
-pdump_dump(u32 flags, void *buffer, u32 size)
+pdump_dump(u32 flags, void *buffer, u32 size, bool from_user)
{
if (PDumpSuspended())
return PVRSRV_OK;
if (!dbgdrv_flags_check(flags))
return PVRSRV_OK;
- return dbgdrv_write_data(buffer, size);
+ return dbgdrv_write_data(buffer, size, from_user);
}
void PDumpCommentKM(char *pszComment, u32 ui32Flags)
MEMPOLL_COUNT, MEMPOLL_DELAY);
}
-enum PVRSRV_ERROR
-PDumpMemKM(void *pvAltLinAddr, struct PVRSRV_KERNEL_MEM_INFO *psMemInfo,
- u32 ui32Offset, u32 ui32Bytes, u32 ui32Flags, void *hUniqueTag)
+static void
+pdump_mem_print(u32 ui32Flags, struct PVRSRV_KERNEL_MEM_INFO *psMemInfo,
+ u32 ui32Offset, u32 ui32Bytes, void *hUniqueTag)
{
struct IMG_DEV_VIRTADDR sDevVPageAddr;
struct IMG_DEV_PHYADDR sDevPAddr;
u32 ui32PageOffset;
- enum PVRSRV_ERROR eError;
-
- PVR_ASSERT((ui32Offset + ui32Bytes) <= psMemInfo->ui32AllocSize);
-
- if (ui32Bytes == 0)
- return PVRSRV_ERROR_GENERIC;
-
- if (pvAltLinAddr)
- eError = pdump_dump(ui32Flags, pvAltLinAddr, ui32Bytes);
- else if (psMemInfo->pvLinAddrKM)
- eError = pdump_dump(ui32Flags,
- psMemInfo->pvLinAddrKM + ui32Offset,
- ui32Bytes);
- else
- return PVRSRV_ERROR_GENERIC;
-
- if (eError != PVRSRV_OK)
- return eError;
PDumpCommentWithFlags(ui32Flags, "LDB :SGXMEM:VA_%8.8X:0x%8.8X "
"0x%8.8X\r\n",
ui32Bytes -= ui32BlockBytes;
ui32Offset += ui32BlockBytes;
}
+}
+
+enum PVRSRV_ERROR
+PDumpMemKM(void *pvAltLinAddr, struct PVRSRV_KERNEL_MEM_INFO *psMemInfo,
+ u32 ui32Offset, u32 ui32Bytes, u32 ui32Flags, void *hUniqueTag)
+{
+ enum PVRSRV_ERROR eError;
+
+ PVR_ASSERT((ui32Offset + ui32Bytes) <= psMemInfo->ui32AllocSize);
+
+ if (!ui32Bytes)
+ return PVRSRV_ERROR_GENERIC;
+
+ if (pvAltLinAddr)
+ eError = pdump_dump(ui32Flags, pvAltLinAddr, ui32Bytes, false);
+ else if (psMemInfo->pvLinAddrKM)
+ eError = pdump_dump(ui32Flags,
+ psMemInfo->pvLinAddrKM + ui32Offset,
+ ui32Bytes, false);
+ else
+ return PVRSRV_ERROR_GENERIC;
+
+ if (eError != PVRSRV_OK)
+ return eError;
+
+ pdump_mem_print(ui32Flags, psMemInfo, ui32Offset, ui32Bytes,
+ hUniqueTag);
+
+ return PVRSRV_OK;
+}
+
+enum PVRSRV_ERROR
+PDumpMemUM(void *pvAltLinAddrUM, void *pvLinAddrUM,
+ struct PVRSRV_KERNEL_MEM_INFO *psMemInfo,
+ u32 ui32Offset, u32 ui32Bytes, u32 ui32Flags, void *hUniqueTag)
+{
+ enum PVRSRV_ERROR eError;
+
+ PVR_ASSERT((ui32Offset + ui32Bytes) <= psMemInfo->ui32AllocSize);
+
+ if (!ui32Bytes)
+ return PVRSRV_ERROR_GENERIC;
+
+ if (pvAltLinAddrUM)
+ eError = pdump_dump(ui32Flags, pvAltLinAddrUM, ui32Bytes, true);
+ else if (psMemInfo->pvLinAddrKM)
+ eError = pdump_dump(ui32Flags,
+ psMemInfo->pvLinAddrKM + ui32Offset,
+ ui32Bytes, false);
+ else if (pvLinAddrUM)
+ eError = pdump_dump(ui32Flags, pvLinAddrUM + ui32Offset,
+ ui32Bytes, true);
+ else
+ return PVRSRV_ERROR_GENERIC;
+
+ if (eError != PVRSRV_OK)
+ return eError;
+
+ pdump_mem_print(ui32Flags, psMemInfo, ui32Offset, ui32Bytes,
+ hUniqueTag);
return PVRSRV_OK;
}
if (bInitialisePages) {
eError = pdump_dump(PDUMP_FLAGS_CONTINUOUS, pvLinAddr,
- ui32Bytes);
+ ui32Bytes, false);
if (eError != PVRSRV_OK)
return eError;
}
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#if defined(PDUMP)
-#include "services_headers.h"
-#include "pdump_km.h"
-
-#if !defined(PDUMP_TEMP_BUFFER_SIZE)
-#define PDUMP_TEMP_BUFFER_SIZE (64 * 1024L)
-#endif
-
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#define PTR_PLUS(t, p, x) ((t *)(((char *)(p)) + (x)))
-#define VPTR_PLUS(p, x) PTR_PLUS(void, p, x)
-#define VPTR_INC(p, x) (p = VPTR_PLUS(p, x))
-
-static void *gpvTempBuffer;
-static void *ghTempBufferBlockAlloc;
-
-static void *GetTempBuffer(void)
-{
- if (gpvTempBuffer == NULL) {
- enum PVRSRV_ERROR eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
- PDUMP_TEMP_BUFFER_SIZE,
- &gpvTempBuffer,
- &ghTempBufferBlockAlloc);
- if (eError != PVRSRV_OK)
- PVR_DPF(PVR_DBG_ERROR,
- "GetTempBuffer: OSAllocMem failed: %d",
- eError);
- }
-
- return gpvTempBuffer;
-}
-
-static void FreeTempBuffer(void)
-{
- if (gpvTempBuffer != NULL) {
- OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, PDUMP_TEMP_BUFFER_SIZE,
- gpvTempBuffer, ghTempBufferBlockAlloc);
- gpvTempBuffer = NULL;
- }
-}
-
-void PDumpInitCommon(void)
-{
- (void)GetTempBuffer();
- PDumpInit();
-}
-
-void PDumpDeInitCommon(void)
-{
- FreeTempBuffer();
- PDumpDeInit();
-}
-
-enum PVRSRV_ERROR
-PDumpMemUM(struct PVRSRV_PER_PROCESS_DATA *psPerProc,
- void *pvAltLinAddrUM, void *pvLinAddrUM,
- struct PVRSRV_KERNEL_MEM_INFO *psMemInfo,
- u32 ui32Offset, u32 ui32Bytes, u32 ui32Flags,
- void *hUniqueTag)
-{
- void *pvAddrUM;
- void *pvAddrKM;
- u32 ui32BytesDumped;
- u32 ui32CurrentOffset;
-
- if (psMemInfo->pvLinAddrKM != NULL && pvAltLinAddrUM == NULL) {
- return PDumpMemKM(NULL, psMemInfo, ui32Offset, ui32Bytes,
- ui32Flags, hUniqueTag);
- }
-
- pvAddrUM = (pvAltLinAddrUM != NULL) ? pvAltLinAddrUM :
- ((pvLinAddrUM != NULL) ? VPTR_PLUS(pvLinAddrUM,
- ui32Offset) : NULL);
-
- pvAddrKM = GetTempBuffer();
-
- PVR_ASSERT(pvAddrUM != NULL && pvAddrKM != NULL);
- if (pvAddrUM == NULL || pvAddrKM == NULL) {
- PVR_DPF(PVR_DBG_ERROR, "PDumpMemUM: Nothing to dump");
- return PVRSRV_ERROR_GENERIC;
- }
-
- if (ui32Bytes > PDUMP_TEMP_BUFFER_SIZE)
- PDumpCommentWithFlags(ui32Flags,
- "Dumping 0x%8.8lx bytes of memory, in blocks of 0x%8.8lx bytes",
- ui32Bytes, (u32) PDUMP_TEMP_BUFFER_SIZE);
-
- ui32CurrentOffset = ui32Offset;
- for (ui32BytesDumped = 0; ui32BytesDumped < ui32Bytes;) {
- enum PVRSRV_ERROR eError;
- u32 ui32BytesToDump =
- MIN(PDUMP_TEMP_BUFFER_SIZE, ui32Bytes - ui32BytesDumped);
-
- eError = OSCopyFromUser(psPerProc,
- pvAddrKM, pvAddrUM, ui32BytesToDump);
- if (eError != PVRSRV_OK) {
- PVR_DPF(PVR_DBG_ERROR,
- "PDumpMemUM: OSCopyFromUser failed (%d)", eError);
- return eError;
- }
-
- eError = PDumpMemKM(pvAddrKM, psMemInfo, ui32CurrentOffset,
- ui32BytesToDump, ui32Flags, hUniqueTag);
- if (eError != PVRSRV_OK)
- return eError;
-
- VPTR_INC(pvAddrUM, ui32BytesToDump);
- ui32CurrentOffset += ui32BytesToDump;
- ui32BytesDumped += ui32BytesToDump;
- }
-
- return PVRSRV_OK;
-}
-
-#endif
enum PDUMP_POLL_OPERATOR eOperator,
void *hUniqueTag);
-enum PVRSRV_ERROR PDumpMemUM(struct PVRSRV_PER_PROCESS_DATA *psProcData,
- void *pvAltLinAddr, void *pvLinAddr,
+enum PVRSRV_ERROR PDumpMemUM(void *pvAltLinAddr, void *pvLinAddr,
struct PVRSRV_KERNEL_MEM_INFO *psMemInfo,
u32 ui32Offset, u32 ui32Bytes, u32 ui32Flags,
void *hUniqueTag);
u32 ui32Flags,
IMG_BOOL bInitialisePages,
void *hUniqueTag1, void *hUniqueTag2);
-void PDumpInitCommon(void);
-void PDumpDeInitCommon(void);
void PDumpInit(void);
void PDumpDeInit(void);
void PDumpSetFrameKM(u32 ui32Frame);
#define PDUMPMEM PDumpMemKM
#define PDUMPMEM2 PDumpMem2KM
#define PDUMPMEMUM PDumpMemUM
-#define PDUMPINIT PDumpInitCommon
-#define PDUMPDEINIT PDumpDeInitCommon
+#define PDUMPINIT PDumpInit
+#define PDUMPDEINIT PDumpDeInit
#define PDUMPREGWITHFLAGS PDumpRegWithFlagsKM
#define PDUMPREG PDumpReg
#define PDUMPCOMMENT PDumpComment