fixes for bc_cat
[sgx.git] / pvr / services.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 #ifndef __SERVICES_H__
28 #define __SERVICES_H__
29
30
31 #include "img_defs.h"
32 #include "servicesext.h"
33 #include "pdumpdefs.h"
34
35 struct SYS_DATA;
36
37 #define PVRSRV_4K_PAGE_SIZE                             4096UL
38
39 #define PVRSRV_MAX_CMD_SIZE                             1024
40
41 #define PVRSRV_MAX_DEVICES                              16
42
43 #define EVENTOBJNAME_MAXLENGTH                          50
44
45 #define PVRSRV_MEM_READ                                 (1UL<<0)
46 #define PVRSRV_MEM_WRITE                                (1UL<<1)
47 #define PVRSRV_MEM_CACHE_CONSISTENT                     (1UL<<2)
48 #define PVRSRV_MEM_NO_SYNCOBJ                           (1UL<<3)
49 #define PVRSRV_MEM_INTERLEAVED                          (1UL<<4)
50 #define PVRSRV_MEM_DUMMY                                (1UL<<5)
51 #define PVRSRV_MEM_EDM_PROTECT                          (1UL<<6)
52 #define PVRSRV_MEM_ZERO                                 (1UL<<7)
53 #define PVRSRV_MEM_USER_SUPPLIED_DEVVADDR               (1UL<<8)
54 #define PVRSRV_MEM_RAM_BACKED_ALLOCATION                (1UL<<9)
55 #define PVRSRV_MEM_NO_RESMAN                            (1UL<<10)
56 #define PVRSRV_MEM_EXPORTED                             (1UL<<11)
57
58 #define PVRSRV_HAP_CACHED                               (1UL<<12)
59 #define PVRSRV_HAP_UNCACHED                             (1UL<<13)
60 #define PVRSRV_HAP_WRITECOMBINE                         (1UL<<14)
61 #define PVRSRV_HAP_CACHETYPE_MASK       (PVRSRV_HAP_CACHED                | \
62                                          PVRSRV_HAP_UNCACHED              | \
63                                          PVRSRV_HAP_WRITECOMBINE)
64 #define PVRSRV_HAP_KERNEL_ONLY                          (1UL<<15)
65 #define PVRSRV_HAP_SINGLE_PROCESS                       (1UL<<16)
66 #define PVRSRV_HAP_MULTI_PROCESS                        (1UL<<17)
67 #define PVRSRV_HAP_FROM_EXISTING_PROCESS                (1UL<<18)
68 #define PVRSRV_HAP_NO_CPU_VIRTUAL                       (1UL<<19)
69 #define PVRSRV_HAP_MAPTYPE_MASK         (PVRSRV_HAP_KERNEL_ONLY           | \
70                                          PVRSRV_HAP_SINGLE_PROCESS        | \
71                                          PVRSRV_HAP_MULTI_PROCESS         | \
72                                          PVRSRV_HAP_FROM_EXISTING_PROCESS | \
73                                          PVRSRV_HAP_NO_CPU_VIRTUAL)
74 #define PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT             24
75
76 #define PVRSRV_MAP_NOUSERVIRTUAL                        (1UL << 27)
77
78 #define PVRSRV_NO_CONTEXT_LOSS                          0
79 #define PVRSRV_SEVERE_LOSS_OF_CONTEXT                   1
80 #define PVRSRV_PRE_STATE_CHANGE_MASK                    0x80
81
82 #define PVRSRV_DEFAULT_DEV_COOKIE                       1
83
84 #define PVRSRV_MISC_INFO_TIMER_PRESENT                  (1UL << 0)
85 #define PVRSRV_MISC_INFO_CLOCKGATE_PRESENT              (1UL << 1)
86 #define PVRSRV_MISC_INFO_MEMSTATS_PRESENT               (1UL << 2)
87 #define PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT      (1UL << 3)
88 #define PVRSRV_MISC_INFO_DDKVERSION_PRESENT             (1UL << 4)
89
90 #define PVRSRV_PDUMP_MAX_FILENAME_SIZE                  20
91 #define PVRSRV_PDUMP_MAX_COMMENT_SIZE                   200
92
93 #define PVRSRV_CHANGEDEVMEM_ATTRIBS_CACHECOHERENT       0x00000001
94
95 #define PVRSRV_MAPEXTMEMORY_FLAGS_ALTERNATEVA           0x00000001
96 #define PVRSRV_MAPEXTMEMORY_FLAGS_PHYSCONTIG            0x00000002
97
98 #define PVRSRV_MODIFYSYNCOPS_FLAGS_WOP_INC              0x00000001
99 #define PVRSRV_MODIFYSYNCOPS_FLAGS_ROP_INC              0x00000002
100 #define PVRSRV_MODIFYSYNCOPS_FLAGS_WOC_INC              0x00000004
101 #define PVRSRV_MODIFYSYNCOPS_FLAGS_ROC_INC              0x00000008
102
103 enum PVRSRV_DEVICE_TYPE {
104         PVRSRV_DEVICE_TYPE_UNKNOWN = 0,
105         PVRSRV_DEVICE_TYPE_MBX1 = 1,
106         PVRSRV_DEVICE_TYPE_MBX1_LITE = 2,
107
108         PVRSRV_DEVICE_TYPE_M24VA = 3,
109         PVRSRV_DEVICE_TYPE_MVDA2 = 4,
110         PVRSRV_DEVICE_TYPE_MVED1 = 5,
111         PVRSRV_DEVICE_TYPE_MSVDX = 6,
112
113         PVRSRV_DEVICE_TYPE_SGX = 7,
114
115         PVRSRV_DEVICE_TYPE_VGX = 8,
116
117         PVRSRV_DEVICE_TYPE_EXT = 9,
118
119         PVRSRV_DEVICE_TYPE_LAST = 9,
120
121         PVRSRV_DEVICE_TYPE_FORCE_I32 = 0x7fffffff
122 };
123
124 #define HEAP_ID(_dev_ , _dev_heap_idx_)                                 \
125         (((_dev_) << 24) | ((_dev_heap_idx_) & ((1 << 24) - 1)))
126
127 #define HEAP_IDX(_heap_id_)                                             \
128         ((_heap_id_) & ((1 << 24) - 1))
129
130 #define HEAP_DEV(_heap_id_)                                             \
131         ((_heap_id_) >> 24)
132
133 #define PVRSRV_UNDEFINED_HEAP_ID                        (~0LU)
134
135 enum IMG_MODULE_ID {
136         IMG_EGL =               0x00000001,
137         IMG_OPENGLES1 =         0x00000002,
138         IMG_OPENGLES2 =         0x00000003,
139         IMG_D3DM =              0x00000004,
140         IMG_SRV_UM =            0x00000005,
141         IMG_OPENVG =            0x00000006,
142         IMG_SRVCLIENT =         0x00000007,
143         IMG_VISTAKMD =          0x00000008,
144         IMG_VISTA3DNODE =       0x00000009,
145         IMG_VISTAMVIDEONODE =   0x0000000A,
146         IMG_VISTAVPBNODE =      0x0000000B,
147         IMG_OPENGL =            0x0000000C,
148         IMG_D3D =               0x0000000D
149 };
150
151 struct PVRSRV_CONNECTION {
152         void *hServices;
153         u32 ui32ProcessID;
154 };
155
156 struct PVRSRV_DEV_DATA {
157         struct PVRSRV_CONNECTION sConnection;
158         void *hDevCookie;
159 };
160
161 struct PVRSRV_HWREG {
162         u32 ui32RegAddr;
163         u32 ui32RegVal;
164 };
165
166 struct PVRSRV_MEMBLK {
167         struct IMG_DEV_VIRTADDR sDevVirtAddr;
168         void *hOSMemHandle;
169         void *hOSWrapMem;
170         void *hBuffer;
171         void *hResItem;
172         struct IMG_SYS_PHYADDR *psIntSysPAddr;
173 };
174
175 struct PVRSRV_KERNEL_MEM_INFO;
176
177 struct PVRSRV_CLIENT_MEM_INFO {
178         void *pvLinAddr;
179         void *pvLinAddrKM;
180         struct IMG_DEV_VIRTADDR sDevVAddr;
181         struct IMG_CPU_PHYADDR sCpuPAddr;
182         u32 ui32Flags;
183         u32 ui32ClientFlags;
184         u32 ui32AllocSize;
185         struct PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo;
186         void *hMappingInfo;
187         void *hKernelMemInfo;
188         void *hResItem;
189         struct PVRSRV_CLIENT_MEM_INFO *psNext;
190 };
191
192 #define PVRSRV_MAX_CLIENT_HEAPS (32)
193 struct PVRSRV_HEAP_INFO {
194         u32 ui32HeapID;
195         void *hDevMemHeap;
196         struct IMG_DEV_VIRTADDR sDevVAddrBase;
197         u32 ui32HeapByteSize;
198         u32 ui32Attribs;
199 };
200
201 struct PVRSRV_DEVICE_IDENTIFIER {
202         enum PVRSRV_DEVICE_TYPE eDeviceType;
203         enum PVRSRV_DEVICE_CLASS eDeviceClass;
204         u32 ui32DeviceIndex;
205
206 };
207
208 struct PVRSRV_EVENTOBJECT {
209         char szName[EVENTOBJNAME_MAXLENGTH];
210         void *hOSEventKM;
211 };
212
213 struct PVRSRV_MISC_INFO {
214         u32 ui32StateRequest;
215         u32 ui32StatePresent;
216
217         void *pvSOCTimerRegisterKM;
218         void *pvSOCTimerRegisterUM;
219         void *hSOCTimerRegisterOSMemHandle;
220         void *hSOCTimerRegisterMappingInfo;
221
222         void *pvSOCClockGateRegs;
223         u32 ui32SOCClockGateRegsSize;
224
225         char *pszMemoryStr;
226         u32 ui32MemoryStrLen;
227
228         struct PVRSRV_EVENTOBJECT sGlobalEventObject;
229         void *hOSGlobalEvent;
230
231         u32 aui32DDKVersion[4];
232 };
233
234 enum PVRSRV_ERROR AllocateDeviceID(struct SYS_DATA *psSysData, u32 *pui32DevID);
235 enum PVRSRV_ERROR FreeDeviceID(struct SYS_DATA *psSysData, u32 ui32DevID);
236
237 #endif