gpu: pvr: get rid of unnecessary hash lookups for the proc object
[sgx.git] / pvr / mmap.h
1 /**********************************************************************
2  *
3  * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful but, except
10  * as otherwise stated in writing, without any warranty; without even the
11  * implied warranty of merchantability or fitness for a particular purpose.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * The full GNU General Public License is included in this distribution in
19  * the file called "COPYING".
20  *
21  * Contact Information:
22  * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23  * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24  *
25  ******************************************************************************/
26
27 #if !defined(__MMAP_H__)
28 #define __MMAP_H__
29
30 #include <linux/mm.h>
31 #include <linux/list.h>
32
33 #include "perproc.h"
34 #include "mm.h"
35
36 struct KV_OFFSET_STRUCT {
37         u32 ui32Mapped;
38         u32 ui32MMapOffset;
39         u32 ui32RealByteSize;
40         struct LinuxMemArea *psLinuxMemArea;
41         u32 ui32TID;
42         u32 ui32PID;
43         IMG_BOOL bOnMMapList;
44         u32 ui32RefCount;
45         u32 ui32UserVAddr;
46 #if defined(DEBUG_LINUX_MMAP_AREAS)
47         const char *pszName;
48 #endif
49         struct list_head sMMapItem;
50         struct list_head sAreaItem;
51 };
52
53 void PVRMMapInit(void);
54 void PVRMMapCleanup(void);
55
56 enum PVRSRV_ERROR PVRMMapRegisterArea(struct LinuxMemArea *psLinuxMemArea);
57
58 enum PVRSRV_ERROR PVRMMapRemoveRegisteredArea(
59                         struct LinuxMemArea *psLinuxMemArea);
60
61 enum PVRSRV_ERROR PVRMMapOSMemHandleToMMapData(
62                         struct PVRSRV_PER_PROCESS_DATA *psPerProc,
63                         void *hMHandle, u32 *pui32MMapOffset,
64                         u32 *pui32ByteOffset, u32 *pui32RealByteSize,
65                         u32 *pui32UserVAddr);
66
67 enum PVRSRV_ERROR PVRMMapReleaseMMapData(
68                         struct PVRSRV_PER_PROCESS_DATA *psPerProc,
69                         void *hMHandle, IMG_BOOL *pbMUnmap,
70                         u32 *pui32RealByteSize, u32 *pui32UserVAddr);
71
72 int PVRMMap(struct file *pFile, struct vm_area_struct *ps_vma);
73
74 #endif