1 /*************************************************************************/ /*!
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
30 This License is also included in this distribution in the file called
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
43 #pragma warning(disable:4201)
44 #pragma warning(disable:4214)
45 #pragma warning(disable:4115)
46 #pragma warning(disable:4514)
54 #include <asm/uaccess.h>
55 #include "pvr_uaccess.h"
58 #include "img_types.h"
59 #include "dbgdrvif_srv5.h"
61 #include "dbgdriv_ioctl.h"
65 #pragma warning(default:4214)
66 #pragma warning(default:4115)
69 /*****************************************************************************
71 *****************************************************************************/
73 /*****************************************************************************
74 FUNCTION : DBGDIOCDrivGetServiceTable
81 *****************************************************************************/
82 static IMG_UINT32 DBGDIOCDrivGetServiceTable(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
86 PVR_UNREFERENCED_PARAMETER(pvInBuffer);
87 PVR_UNREFERENCED_PARAMETER(bCompat);
88 ppvOut = (void **) pvOutBuffer;
90 *ppvOut = DBGDrivGetServiceTable();
95 #if defined(__QNXNTO__)
96 /*****************************************************************************
97 FUNCTION : DBGIODrivCreateStream
104 *****************************************************************************/
105 static IMG_UINT32 DBGDIOCDrivCreateStream(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
107 PDBG_IN_CREATESTREAM psIn;
108 PDBG_OUT_CREATESTREAM psOut;
110 PVR_UNREFERENCED_PARAMETER(bCompat);
112 psIn = (PDBG_IN_CREATESTREAM) pvInBuffer;
113 psOut = (PDBG_OUT_CREATESTREAM) pvOutBuffer;
115 return (ExtDBGDrivCreateStream(psIn->u.pszName, DEBUG_FLAGS_NO_BUF_EXPANDSION, psIn->ui32Pages, &psOut->phInit, &psOut->phMain, &psOut->phDeinit));
119 /*****************************************************************************
120 FUNCTION : DBGDIOCDrivGetStream
127 *****************************************************************************/
128 static IMG_UINT32 DBGDIOCDrivGetStream(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
130 PDBG_IN_FINDSTREAM psParams;
133 psParams = (PDBG_IN_FINDSTREAM)pvInBuffer;
134 phStream = (IMG_SID *)pvOutBuffer;
136 /* Ensure that the name will be NULL terminated */
137 psParams->pszName[DEBUG_STREAM_NAME_MAX-1] = '\0';
139 *phStream = PStream2SID(ExtDBGDrivFindStream(psParams->pszName, psParams->bResetStream));
144 /*****************************************************************************
145 FUNCTION : DBGDIOCDrivRead
152 *****************************************************************************/
153 static IMG_UINT32 DBGDIOCDrivRead(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
155 IMG_UINT32 * pui32BytesCopied;
156 PDBG_IN_READ psInParams;
157 PDBG_STREAM psStream;
158 IMG_UINT8 *pui8ReadBuffer;
160 psInParams = (PDBG_IN_READ) pvInBuffer;
161 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
162 pui8ReadBuffer = WIDEPTR_GET_PTR(psInParams->pui8OutBuffer, bCompat);
164 psStream = SID2PStream(psInParams->hStream);
166 if (psStream != (PDBG_STREAM)NULL)
168 *pui32BytesCopied = ExtDBGDrivRead(psStream,
169 psInParams->ui32BufID,
170 psInParams->ui32OutBufferSize,
177 *pui32BytesCopied = 0;
182 /*****************************************************************************
183 FUNCTION : DBGDIOCDrivSetMarker
185 PURPOSE : Sets the marker in the stream to split output files
187 PARAMETERS : pvInBuffer, pvOutBuffer
190 *****************************************************************************/
191 static IMG_UINT32 DBGDIOCDrivSetMarker(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
193 PDBG_IN_SETMARKER psParams;
194 PDBG_STREAM psStream;
196 psParams = (PDBG_IN_SETMARKER) pvInBuffer;
197 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
198 PVR_UNREFERENCED_PARAMETER(bCompat);
200 psStream = SID2PStream(psParams->hStream);
201 if (psStream != (PDBG_STREAM)NULL)
203 ExtDBGDrivSetMarker(psStream, psParams->ui32Marker);
213 /*****************************************************************************
214 FUNCTION : DBGDIOCDrivGetMarker
216 PURPOSE : Gets the marker in the stream to split output files
218 PARAMETERS : pvInBuffer, pvOutBuffer
221 *****************************************************************************/
222 static IMG_UINT32 DBGDIOCDrivGetMarker(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
224 PDBG_STREAM psStream;
225 IMG_UINT32 *pui32Current;
227 PVR_UNREFERENCED_PARAMETER(bCompat);
229 pui32Current = (IMG_UINT32 *) pvOutBuffer;
231 psStream = SID2PStream(*(IMG_SID *)pvInBuffer);
232 if (psStream != (PDBG_STREAM)NULL)
234 *pui32Current = ExtDBGDrivGetMarker(psStream);
246 /*****************************************************************************
247 FUNCTION : DBGDIOCDrivWaitForEvent
254 *****************************************************************************/
255 static IMG_UINT32 DBGDIOCDrivWaitForEvent(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
257 DBG_EVENT eEvent = (DBG_EVENT)(*(IMG_UINT32 *)pvInBuffer);
259 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
260 PVR_UNREFERENCED_PARAMETER(bCompat);
262 ExtDBGDrivWaitForEvent(eEvent);
268 /*****************************************************************************
269 FUNCTION : DBGDIOCDrivGetFrame
271 PURPOSE : Gets the marker in the stream to split output files
273 PARAMETERS : pvInBuffer, pvOutBuffer
276 *****************************************************************************/
277 static IMG_UINT32 DBGDIOCDrivGetFrame(void * pvInBuffer, void * pvOutBuffer, IMG_BOOL bCompat)
279 IMG_UINT32 *pui32Current;
281 PVR_UNREFERENCED_PARAMETER(pvInBuffer);
282 PVR_UNREFERENCED_PARAMETER(bCompat);
284 pui32Current = (IMG_UINT32 *) pvOutBuffer;
286 *pui32Current = ExtDBGDrivGetFrame();
292 ioctl interface jump table.
293 Accessed from the UM debug driver client
295 IMG_UINT32 (*g_DBGDrivProc[DEBUG_SERVICE_MAX_API])(void *, void *, IMG_BOOL) =
297 DBGDIOCDrivGetServiceTable, /* WDDM only for KMD to retrieve address from DBGDRV, Not used by umdbgdrvlnx */
298 DBGDIOCDrivGetStream,
300 DBGDIOCDrivSetMarker,
301 DBGDIOCDrivGetMarker,
302 DBGDIOCDrivWaitForEvent,
304 #if defined(__QNXNTO__)
305 DBGDIOCDrivCreateStream
309 /*****************************************************************************
310 End of file (IOCTL.C)
311 *****************************************************************************/