1 #ifndef _G_RS_CLIENT_NVOC_H_
2 #define _G_RS_CLIENT_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 2015-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
11  * SPDX-License-Identifier: MIT
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  */
31 
32 #include "g_rs_client_nvoc.h"
33 
34 #ifndef _RS_CLIENT_H_
35 #define _RS_CLIENT_H_
36 
37 
38 #include "resserv/resserv.h"
39 #include "nvport/nvport.h"
40 #include "resserv/rs_resource.h"
41 #include "containers/list.h"
42 #include "utils/nvrange.h"
43 
44 #define RS_UNIQUE_HANDLE_BASE  (0xcaf00000)
45 #define RS_UNIQUE_HANDLE_RANGE (0x00080000)
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /**
52  * @defgroup RsClient
53  * @addtogroup RsClient
54  * @{*/
55 
56 typedef enum {
57     CLIENT_TYPE_USER,
58     CLIENT_TYPE_KERNEL
59 } CLIENT_TYPE;
60 
61 typedef struct AccessBackRef
62 {
63     NvHandle hClient;
64     NvHandle hResource;
65 } AccessBackRef;
66 
67 MAKE_LIST(AccessBackRefList, AccessBackRef);
68 
69 /**
70  * Information about a client
71  */
72 
73 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
74 // the matching C source file, but causes diagnostics to be issued if another
75 // source file references the field.
76 #ifdef NVOC_RS_CLIENT_H_PRIVATE_ACCESS_ALLOWED
77 #define PRIVATE_FIELD(x) x
78 #else
79 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
80 #endif
81 
82 struct RsClient {
83     const struct NVOC_RTTI *__nvoc_rtti;
84     struct Object __nvoc_base_Object;
85     struct Object *__nvoc_pbase_Object;
86     struct RsClient *__nvoc_pbase_RsClient;
87     NV_STATUS (*__clientValidate__)(struct RsClient *, const API_SECURITY_INFO *);
88     RS_PRIV_LEVEL (*__clientGetCachedPrivilege__)(struct RsClient *);
89     NvBool (*__clientIsAdmin__)(struct RsClient *, RS_PRIV_LEVEL);
90     NV_STATUS (*__clientFreeResource__)(struct RsClient *, RsServer *, struct RS_RES_FREE_PARAMS_INTERNAL *);
91     NV_STATUS (*__clientDestructResourceRef__)(struct RsClient *, RsServer *, struct RsResourceRef *);
92     NV_STATUS (*__clientUnmapMemory__)(struct RsClient *, struct RsResourceRef *, struct RS_LOCK_INFO *, struct RsCpuMapping **, API_SECURITY_INFO *);
93     NV_STATUS (*__clientInterMap__)(struct RsClient *, struct RsResourceRef *, struct RsResourceRef *, struct RS_INTER_MAP_PARAMS *);
94     NV_STATUS (*__clientInterUnmap__)(struct RsClient *, struct RsResourceRef *, struct RS_INTER_UNMAP_PARAMS *);
95     NV_STATUS (*__clientValidateNewResourceHandle__)(struct RsClient *, NvHandle, NvBool);
96     NV_STATUS (*__clientPostProcessPendingFreeList__)(struct RsClient *, struct RsResourceRef **);
97     NV_STATUS (*__clientShareResource__)(struct RsClient *, struct RsResourceRef *, RS_SHARE_POLICY *, struct CALL_CONTEXT *);
98     NvHandle hClient;
99     CLIENT_TYPE type;
100     NvBool bActive;
101     NvBool bResourceWarning;
102     NvBool bDisabled;
103     NvBool bHighPriorityFreeDone;
104     RsRefMap resourceMap;
105     AccessBackRefList accessBackRefList;
106     NvHandle handleRangeStart;
107     NvHandle handleRangeSize;
108     struct NV_RANGE handleRestrictRange;
109     NvHandle handleGenIdx;
110     RsRefFreeList pendingFreeList;
111     struct RS_FREE_STACK *pFreeStack;
112     struct ListNode disabledClientNode;
113 };
114 
115 #ifndef __NVOC_CLASS_RsClient_TYPEDEF__
116 #define __NVOC_CLASS_RsClient_TYPEDEF__
117 typedef struct RsClient RsClient;
118 #endif /* __NVOC_CLASS_RsClient_TYPEDEF__ */
119 
120 #ifndef __nvoc_class_id_RsClient
121 #define __nvoc_class_id_RsClient 0x8f87e5
122 #endif /* __nvoc_class_id_RsClient */
123 
124 extern const struct NVOC_CLASS_DEF __nvoc_class_def_RsClient;
125 
126 #define __staticCast_RsClient(pThis) \
127     ((pThis)->__nvoc_pbase_RsClient)
128 
129 #ifdef __nvoc_rs_client_h_disabled
130 #define __dynamicCast_RsClient(pThis) ((RsClient*)NULL)
131 #else //__nvoc_rs_client_h_disabled
132 #define __dynamicCast_RsClient(pThis) \
133     ((RsClient*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(RsClient)))
134 #endif //__nvoc_rs_client_h_disabled
135 
136 
137 NV_STATUS __nvoc_objCreateDynamic_RsClient(RsClient**, Dynamic*, NvU32, va_list);
138 
139 NV_STATUS __nvoc_objCreate_RsClient(RsClient**, Dynamic*, NvU32, struct PORT_MEM_ALLOCATOR * arg_pAllocator, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams);
140 #define __objCreate_RsClient(ppNewObj, pParent, createFlags, arg_pAllocator, arg_pParams) \
141     __nvoc_objCreate_RsClient((ppNewObj), staticCast((pParent), Dynamic), (createFlags), arg_pAllocator, arg_pParams)
142 
143 #define clientValidate(pClient, pSecInfo) clientValidate_DISPATCH(pClient, pSecInfo)
144 #define clientGetCachedPrivilege(pClient) clientGetCachedPrivilege_DISPATCH(pClient)
145 #define clientIsAdmin(pClient, privLevel) clientIsAdmin_DISPATCH(pClient, privLevel)
146 #define clientFreeResource(pClient, pServer, pParams) clientFreeResource_DISPATCH(pClient, pServer, pParams)
147 #define clientDestructResourceRef(pClient, pServer, pResourceRef) clientDestructResourceRef_DISPATCH(pClient, pServer, pResourceRef)
148 #define clientUnmapMemory(pClient, pResourceRef, pLockInfo, ppCpuMapping, pSecInfo) clientUnmapMemory_DISPATCH(pClient, pResourceRef, pLockInfo, ppCpuMapping, pSecInfo)
149 #define clientInterMap(pClient, pMapperRef, pMappableRef, pParams) clientInterMap_DISPATCH(pClient, pMapperRef, pMappableRef, pParams)
150 #define clientInterUnmap(pClient, pMapperRef, pParams) clientInterUnmap_DISPATCH(pClient, pMapperRef, pParams)
151 #define clientValidateNewResourceHandle(pClient, hResource, bRestrict) clientValidateNewResourceHandle_DISPATCH(pClient, hResource, bRestrict)
152 #define clientPostProcessPendingFreeList(pClient, ppFirstLowPriRef) clientPostProcessPendingFreeList_DISPATCH(pClient, ppFirstLowPriRef)
153 #define clientShareResource(pClient, pResourceRef, pSharePolicy, pCallContext) clientShareResource_DISPATCH(pClient, pResourceRef, pSharePolicy, pCallContext)
154 NV_STATUS clientValidate_IMPL(struct RsClient *pClient, const API_SECURITY_INFO *pSecInfo);
155 
clientValidate_DISPATCH(struct RsClient * pClient,const API_SECURITY_INFO * pSecInfo)156 static inline NV_STATUS clientValidate_DISPATCH(struct RsClient *pClient, const API_SECURITY_INFO *pSecInfo) {
157     return pClient->__clientValidate__(pClient, pSecInfo);
158 }
159 
160 RS_PRIV_LEVEL clientGetCachedPrivilege_IMPL(struct RsClient *pClient);
161 
clientGetCachedPrivilege_DISPATCH(struct RsClient * pClient)162 static inline RS_PRIV_LEVEL clientGetCachedPrivilege_DISPATCH(struct RsClient *pClient) {
163     return pClient->__clientGetCachedPrivilege__(pClient);
164 }
165 
166 NvBool clientIsAdmin_IMPL(struct RsClient *pClient, RS_PRIV_LEVEL privLevel);
167 
clientIsAdmin_DISPATCH(struct RsClient * pClient,RS_PRIV_LEVEL privLevel)168 static inline NvBool clientIsAdmin_DISPATCH(struct RsClient *pClient, RS_PRIV_LEVEL privLevel) {
169     return pClient->__clientIsAdmin__(pClient, privLevel);
170 }
171 
172 NV_STATUS clientFreeResource_IMPL(struct RsClient *pClient, RsServer *pServer, struct RS_RES_FREE_PARAMS_INTERNAL *pParams);
173 
clientFreeResource_DISPATCH(struct RsClient * pClient,RsServer * pServer,struct RS_RES_FREE_PARAMS_INTERNAL * pParams)174 static inline NV_STATUS clientFreeResource_DISPATCH(struct RsClient *pClient, RsServer *pServer, struct RS_RES_FREE_PARAMS_INTERNAL *pParams) {
175     return pClient->__clientFreeResource__(pClient, pServer, pParams);
176 }
177 
178 NV_STATUS clientDestructResourceRef_IMPL(struct RsClient *pClient, RsServer *pServer, struct RsResourceRef *pResourceRef);
179 
clientDestructResourceRef_DISPATCH(struct RsClient * pClient,RsServer * pServer,struct RsResourceRef * pResourceRef)180 static inline NV_STATUS clientDestructResourceRef_DISPATCH(struct RsClient *pClient, RsServer *pServer, struct RsResourceRef *pResourceRef) {
181     return pClient->__clientDestructResourceRef__(pClient, pServer, pResourceRef);
182 }
183 
184 NV_STATUS clientUnmapMemory_IMPL(struct RsClient *pClient, struct RsResourceRef *pResourceRef, struct RS_LOCK_INFO *pLockInfo, struct RsCpuMapping **ppCpuMapping, API_SECURITY_INFO *pSecInfo);
185 
clientUnmapMemory_DISPATCH(struct RsClient * pClient,struct RsResourceRef * pResourceRef,struct RS_LOCK_INFO * pLockInfo,struct RsCpuMapping ** ppCpuMapping,API_SECURITY_INFO * pSecInfo)186 static inline NV_STATUS clientUnmapMemory_DISPATCH(struct RsClient *pClient, struct RsResourceRef *pResourceRef, struct RS_LOCK_INFO *pLockInfo, struct RsCpuMapping **ppCpuMapping, API_SECURITY_INFO *pSecInfo) {
187     return pClient->__clientUnmapMemory__(pClient, pResourceRef, pLockInfo, ppCpuMapping, pSecInfo);
188 }
189 
190 NV_STATUS clientInterMap_IMPL(struct RsClient *pClient, struct RsResourceRef *pMapperRef, struct RsResourceRef *pMappableRef, struct RS_INTER_MAP_PARAMS *pParams);
191 
clientInterMap_DISPATCH(struct RsClient * pClient,struct RsResourceRef * pMapperRef,struct RsResourceRef * pMappableRef,struct RS_INTER_MAP_PARAMS * pParams)192 static inline NV_STATUS clientInterMap_DISPATCH(struct RsClient *pClient, struct RsResourceRef *pMapperRef, struct RsResourceRef *pMappableRef, struct RS_INTER_MAP_PARAMS *pParams) {
193     return pClient->__clientInterMap__(pClient, pMapperRef, pMappableRef, pParams);
194 }
195 
196 NV_STATUS clientInterUnmap_IMPL(struct RsClient *pClient, struct RsResourceRef *pMapperRef, struct RS_INTER_UNMAP_PARAMS *pParams);
197 
clientInterUnmap_DISPATCH(struct RsClient * pClient,struct RsResourceRef * pMapperRef,struct RS_INTER_UNMAP_PARAMS * pParams)198 static inline NV_STATUS clientInterUnmap_DISPATCH(struct RsClient *pClient, struct RsResourceRef *pMapperRef, struct RS_INTER_UNMAP_PARAMS *pParams) {
199     return pClient->__clientInterUnmap__(pClient, pMapperRef, pParams);
200 }
201 
202 NV_STATUS clientValidateNewResourceHandle_IMPL(struct RsClient *pClient, NvHandle hResource, NvBool bRestrict);
203 
clientValidateNewResourceHandle_DISPATCH(struct RsClient * pClient,NvHandle hResource,NvBool bRestrict)204 static inline NV_STATUS clientValidateNewResourceHandle_DISPATCH(struct RsClient *pClient, NvHandle hResource, NvBool bRestrict) {
205     return pClient->__clientValidateNewResourceHandle__(pClient, hResource, bRestrict);
206 }
207 
208 NV_STATUS clientPostProcessPendingFreeList_IMPL(struct RsClient *pClient, struct RsResourceRef **ppFirstLowPriRef);
209 
clientPostProcessPendingFreeList_DISPATCH(struct RsClient * pClient,struct RsResourceRef ** ppFirstLowPriRef)210 static inline NV_STATUS clientPostProcessPendingFreeList_DISPATCH(struct RsClient *pClient, struct RsResourceRef **ppFirstLowPriRef) {
211     return pClient->__clientPostProcessPendingFreeList__(pClient, ppFirstLowPriRef);
212 }
213 
214 NV_STATUS clientShareResource_IMPL(struct RsClient *pClient, struct RsResourceRef *pResourceRef, RS_SHARE_POLICY *pSharePolicy, struct CALL_CONTEXT *pCallContext);
215 
clientShareResource_DISPATCH(struct RsClient * pClient,struct RsResourceRef * pResourceRef,RS_SHARE_POLICY * pSharePolicy,struct CALL_CONTEXT * pCallContext)216 static inline NV_STATUS clientShareResource_DISPATCH(struct RsClient *pClient, struct RsResourceRef *pResourceRef, RS_SHARE_POLICY *pSharePolicy, struct CALL_CONTEXT *pCallContext) {
217     return pClient->__clientShareResource__(pClient, pResourceRef, pSharePolicy, pCallContext);
218 }
219 
220 NV_STATUS clientConstruct_IMPL(struct RsClient *arg_pClient, struct PORT_MEM_ALLOCATOR *arg_pAllocator, struct RS_RES_ALLOC_PARAMS_INTERNAL *arg_pParams);
221 
222 #define __nvoc_clientConstruct(arg_pClient, arg_pAllocator, arg_pParams) clientConstruct_IMPL(arg_pClient, arg_pAllocator, arg_pParams)
223 void clientDestruct_IMPL(struct RsClient *pClient);
224 
225 #define __nvoc_clientDestruct(pClient) clientDestruct_IMPL(pClient)
226 NV_STATUS clientGetResourceByRef_IMPL(struct RsClient *pClient, struct RsResourceRef *pResourceRef, struct RsResource **ppResource);
227 
228 #ifdef __nvoc_rs_client_h_disabled
clientGetResourceByRef(struct RsClient * pClient,struct RsResourceRef * pResourceRef,struct RsResource ** ppResource)229 static inline NV_STATUS clientGetResourceByRef(struct RsClient *pClient, struct RsResourceRef *pResourceRef, struct RsResource **ppResource) {
230     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
231     return NV_ERR_NOT_SUPPORTED;
232 }
233 #else //__nvoc_rs_client_h_disabled
234 #define clientGetResourceByRef(pClient, pResourceRef, ppResource) clientGetResourceByRef_IMPL(pClient, pResourceRef, ppResource)
235 #endif //__nvoc_rs_client_h_disabled
236 
237 NV_STATUS clientGetResource_IMPL(struct RsClient *pClient, NvHandle hResource, NvU32 internalClassId, struct RsResource **ppResource);
238 
239 #ifdef __nvoc_rs_client_h_disabled
clientGetResource(struct RsClient * pClient,NvHandle hResource,NvU32 internalClassId,struct RsResource ** ppResource)240 static inline NV_STATUS clientGetResource(struct RsClient *pClient, NvHandle hResource, NvU32 internalClassId, struct RsResource **ppResource) {
241     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
242     return NV_ERR_NOT_SUPPORTED;
243 }
244 #else //__nvoc_rs_client_h_disabled
245 #define clientGetResource(pClient, hResource, internalClassId, ppResource) clientGetResource_IMPL(pClient, hResource, internalClassId, ppResource)
246 #endif //__nvoc_rs_client_h_disabled
247 
248 NV_STATUS clientGetResourceRef_IMPL(struct RsClient *pClient, NvHandle hResource, struct RsResourceRef **ppResourceRef);
249 
250 #ifdef __nvoc_rs_client_h_disabled
clientGetResourceRef(struct RsClient * pClient,NvHandle hResource,struct RsResourceRef ** ppResourceRef)251 static inline NV_STATUS clientGetResourceRef(struct RsClient *pClient, NvHandle hResource, struct RsResourceRef **ppResourceRef) {
252     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
253     return NV_ERR_NOT_SUPPORTED;
254 }
255 #else //__nvoc_rs_client_h_disabled
256 #define clientGetResourceRef(pClient, hResource, ppResourceRef) clientGetResourceRef_IMPL(pClient, hResource, ppResourceRef)
257 #endif //__nvoc_rs_client_h_disabled
258 
259 NV_STATUS clientGetResourceRefWithAccess_IMPL(struct RsClient *pClient, NvHandle hResource, const RS_ACCESS_MASK *pRightsRequired, struct RsResourceRef **ppResourceRef);
260 
261 #ifdef __nvoc_rs_client_h_disabled
clientGetResourceRefWithAccess(struct RsClient * pClient,NvHandle hResource,const RS_ACCESS_MASK * pRightsRequired,struct RsResourceRef ** ppResourceRef)262 static inline NV_STATUS clientGetResourceRefWithAccess(struct RsClient *pClient, NvHandle hResource, const RS_ACCESS_MASK *pRightsRequired, struct RsResourceRef **ppResourceRef) {
263     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
264     return NV_ERR_NOT_SUPPORTED;
265 }
266 #else //__nvoc_rs_client_h_disabled
267 #define clientGetResourceRefWithAccess(pClient, hResource, pRightsRequired, ppResourceRef) clientGetResourceRefWithAccess_IMPL(pClient, hResource, pRightsRequired, ppResourceRef)
268 #endif //__nvoc_rs_client_h_disabled
269 
270 NV_STATUS clientGetResourceRefByType_IMPL(struct RsClient *pClient, NvHandle hResource, NvU32 internalClassId, struct RsResourceRef **ppResourceRef);
271 
272 #ifdef __nvoc_rs_client_h_disabled
clientGetResourceRefByType(struct RsClient * pClient,NvHandle hResource,NvU32 internalClassId,struct RsResourceRef ** ppResourceRef)273 static inline NV_STATUS clientGetResourceRefByType(struct RsClient *pClient, NvHandle hResource, NvU32 internalClassId, struct RsResourceRef **ppResourceRef) {
274     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
275     return NV_ERR_NOT_SUPPORTED;
276 }
277 #else //__nvoc_rs_client_h_disabled
278 #define clientGetResourceRefByType(pClient, hResource, internalClassId, ppResourceRef) clientGetResourceRefByType_IMPL(pClient, hResource, internalClassId, ppResourceRef)
279 #endif //__nvoc_rs_client_h_disabled
280 
281 NV_STATUS clientAllocResource_IMPL(struct RsClient *pClient, RsServer *pServer, struct RS_RES_ALLOC_PARAMS_INTERNAL *pParams);
282 
283 #ifdef __nvoc_rs_client_h_disabled
clientAllocResource(struct RsClient * pClient,RsServer * pServer,struct RS_RES_ALLOC_PARAMS_INTERNAL * pParams)284 static inline NV_STATUS clientAllocResource(struct RsClient *pClient, RsServer *pServer, struct RS_RES_ALLOC_PARAMS_INTERNAL *pParams) {
285     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
286     return NV_ERR_NOT_SUPPORTED;
287 }
288 #else //__nvoc_rs_client_h_disabled
289 #define clientAllocResource(pClient, pServer, pParams) clientAllocResource_IMPL(pClient, pServer, pParams)
290 #endif //__nvoc_rs_client_h_disabled
291 
292 NV_STATUS clientCopyResource_IMPL(struct RsClient *pClient, RsServer *pServer, struct RS_RES_DUP_PARAMS_INTERNAL *pParams);
293 
294 #ifdef __nvoc_rs_client_h_disabled
clientCopyResource(struct RsClient * pClient,RsServer * pServer,struct RS_RES_DUP_PARAMS_INTERNAL * pParams)295 static inline NV_STATUS clientCopyResource(struct RsClient *pClient, RsServer *pServer, struct RS_RES_DUP_PARAMS_INTERNAL *pParams) {
296     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
297     return NV_ERR_NOT_SUPPORTED;
298 }
299 #else //__nvoc_rs_client_h_disabled
300 #define clientCopyResource(pClient, pServer, pParams) clientCopyResource_IMPL(pClient, pServer, pParams)
301 #endif //__nvoc_rs_client_h_disabled
302 
303 NV_STATUS clientGenResourceHandle_IMPL(struct RsClient *pClient, NvHandle *pHandle);
304 
305 #ifdef __nvoc_rs_client_h_disabled
clientGenResourceHandle(struct RsClient * pClient,NvHandle * pHandle)306 static inline NV_STATUS clientGenResourceHandle(struct RsClient *pClient, NvHandle *pHandle) {
307     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
308     return NV_ERR_NOT_SUPPORTED;
309 }
310 #else //__nvoc_rs_client_h_disabled
311 #define clientGenResourceHandle(pClient, pHandle) clientGenResourceHandle_IMPL(pClient, pHandle)
312 #endif //__nvoc_rs_client_h_disabled
313 
314 NV_STATUS clientAssignResourceHandle_IMPL(struct RsClient *pClient, NvHandle *phResource);
315 
316 #ifdef __nvoc_rs_client_h_disabled
clientAssignResourceHandle(struct RsClient * pClient,NvHandle * phResource)317 static inline NV_STATUS clientAssignResourceHandle(struct RsClient *pClient, NvHandle *phResource) {
318     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
319     return NV_ERR_NOT_SUPPORTED;
320 }
321 #else //__nvoc_rs_client_h_disabled
322 #define clientAssignResourceHandle(pClient, phResource) clientAssignResourceHandle_IMPL(pClient, phResource)
323 #endif //__nvoc_rs_client_h_disabled
324 
325 NV_STATUS clientUpdatePendingFreeList_IMPL(struct RsClient *pClient, struct RsResourceRef *pTarget, struct RsResourceRef *pReference, NvBool bMove);
326 
327 #ifdef __nvoc_rs_client_h_disabled
clientUpdatePendingFreeList(struct RsClient * pClient,struct RsResourceRef * pTarget,struct RsResourceRef * pReference,NvBool bMove)328 static inline NV_STATUS clientUpdatePendingFreeList(struct RsClient *pClient, struct RsResourceRef *pTarget, struct RsResourceRef *pReference, NvBool bMove) {
329     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
330     return NV_ERR_NOT_SUPPORTED;
331 }
332 #else //__nvoc_rs_client_h_disabled
333 #define clientUpdatePendingFreeList(pClient, pTarget, pReference, bMove) clientUpdatePendingFreeList_IMPL(pClient, pTarget, pReference, bMove)
334 #endif //__nvoc_rs_client_h_disabled
335 
336 NV_STATUS clientAddAccessBackRef_IMPL(struct RsClient *pClient, struct RsResourceRef *pResourceRef);
337 
338 #ifdef __nvoc_rs_client_h_disabled
clientAddAccessBackRef(struct RsClient * pClient,struct RsResourceRef * pResourceRef)339 static inline NV_STATUS clientAddAccessBackRef(struct RsClient *pClient, struct RsResourceRef *pResourceRef) {
340     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
341     return NV_ERR_NOT_SUPPORTED;
342 }
343 #else //__nvoc_rs_client_h_disabled
344 #define clientAddAccessBackRef(pClient, pResourceRef) clientAddAccessBackRef_IMPL(pClient, pResourceRef)
345 #endif //__nvoc_rs_client_h_disabled
346 
347 void clientFreeAccessBackRefs_IMPL(struct RsClient *pClient, RsServer *pServer);
348 
349 #ifdef __nvoc_rs_client_h_disabled
clientFreeAccessBackRefs(struct RsClient * pClient,RsServer * pServer)350 static inline void clientFreeAccessBackRefs(struct RsClient *pClient, RsServer *pServer) {
351     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
352 }
353 #else //__nvoc_rs_client_h_disabled
354 #define clientFreeAccessBackRefs(pClient, pServer) clientFreeAccessBackRefs_IMPL(pClient, pServer)
355 #endif //__nvoc_rs_client_h_disabled
356 
357 NV_STATUS clientSetHandleGenerator_IMPL(struct RsClient *pClient, NvHandle handleRangeStart, NvHandle handleRangeSize);
358 
359 #ifdef __nvoc_rs_client_h_disabled
clientSetHandleGenerator(struct RsClient * pClient,NvHandle handleRangeStart,NvHandle handleRangeSize)360 static inline NV_STATUS clientSetHandleGenerator(struct RsClient *pClient, NvHandle handleRangeStart, NvHandle handleRangeSize) {
361     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
362     return NV_ERR_NOT_SUPPORTED;
363 }
364 #else //__nvoc_rs_client_h_disabled
365 #define clientSetHandleGenerator(pClient, handleRangeStart, handleRangeSize) clientSetHandleGenerator_IMPL(pClient, handleRangeStart, handleRangeSize)
366 #endif //__nvoc_rs_client_h_disabled
367 
368 NV_STATUS clientCanShareResource_IMPL(struct RsClient *pClient, struct RsResourceRef *pResourceRef, RS_SHARE_POLICY *pSharePolicy, struct CALL_CONTEXT *pCallContext);
369 
370 #ifdef __nvoc_rs_client_h_disabled
clientCanShareResource(struct RsClient * pClient,struct RsResourceRef * pResourceRef,RS_SHARE_POLICY * pSharePolicy,struct CALL_CONTEXT * pCallContext)371 static inline NV_STATUS clientCanShareResource(struct RsClient *pClient, struct RsResourceRef *pResourceRef, RS_SHARE_POLICY *pSharePolicy, struct CALL_CONTEXT *pCallContext) {
372     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
373     return NV_ERR_NOT_SUPPORTED;
374 }
375 #else //__nvoc_rs_client_h_disabled
376 #define clientCanShareResource(pClient, pResourceRef, pSharePolicy, pCallContext) clientCanShareResource_IMPL(pClient, pResourceRef, pSharePolicy, pCallContext)
377 #endif //__nvoc_rs_client_h_disabled
378 
379 NV_STATUS clientShareResourceTargetClient_IMPL(struct RsClient *pClient, struct RsResourceRef *pResourceRef, RS_SHARE_POLICY *pSharePolicy, struct CALL_CONTEXT *pCallContext);
380 
381 #ifdef __nvoc_rs_client_h_disabled
clientShareResourceTargetClient(struct RsClient * pClient,struct RsResourceRef * pResourceRef,RS_SHARE_POLICY * pSharePolicy,struct CALL_CONTEXT * pCallContext)382 static inline NV_STATUS clientShareResourceTargetClient(struct RsClient *pClient, struct RsResourceRef *pResourceRef, RS_SHARE_POLICY *pSharePolicy, struct CALL_CONTEXT *pCallContext) {
383     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
384     return NV_ERR_NOT_SUPPORTED;
385 }
386 #else //__nvoc_rs_client_h_disabled
387 #define clientShareResourceTargetClient(pClient, pResourceRef, pSharePolicy, pCallContext) clientShareResourceTargetClient_IMPL(pClient, pResourceRef, pSharePolicy, pCallContext)
388 #endif //__nvoc_rs_client_h_disabled
389 
390 NV_STATUS clientSetRestrictedRange_IMPL(struct RsClient *pClient, NvHandle handleRangeStart, NvU32 handleRangeSize);
391 
392 #ifdef __nvoc_rs_client_h_disabled
clientSetRestrictedRange(struct RsClient * pClient,NvHandle handleRangeStart,NvU32 handleRangeSize)393 static inline NV_STATUS clientSetRestrictedRange(struct RsClient *pClient, NvHandle handleRangeStart, NvU32 handleRangeSize) {
394     NV_ASSERT_FAILED_PRECOMP("RsClient was disabled!");
395     return NV_ERR_NOT_SUPPORTED;
396 }
397 #else //__nvoc_rs_client_h_disabled
398 #define clientSetRestrictedRange(pClient, handleRangeStart, handleRangeSize) clientSetRestrictedRange_IMPL(pClient, handleRangeStart, handleRangeSize)
399 #endif //__nvoc_rs_client_h_disabled
400 
401 #undef PRIVATE_FIELD
402 
403 MAKE_INTRUSIVE_LIST(RsDisabledClientList, RsClient, disabledClientNode);
404 
405 /**
406  * Get an iterator to the elements in the client's resource map
407  * @param[in] pClient
408  * @param[in] pScopeRef Restrict the iteration based on this reference [optional]
409  * @param[in] internalClassId Only iterate over resources with this class id [optional]
410  * @param[in] type RS_ITERATE_CHILDREN, RS_ITERATE_DESCENDANTS, RS_ITERATE_CACHED, RS_ITERATE_DEPENDANTS
411  * @param[in] bExactMatch If true, internalClassId must match exactly; if false, also match classes derived from the internalClassId
412  *
413  * @note If type=RS_ITERATE_CHILDREN, pScopeRef will restrict iteration to children of the scope ref
414  * @note If type=RS_ITERATE_DESCENDANTS, pScopeRef will restrict iteration to descendants of the scope ref
415  * @note If type=RS_ITERATE_CACHED, pScopeRef will restrict iteration to references cached by the scope ref
416  */
417 RS_ITERATOR clientRefIter(struct RsClient *pClient, RsResourceRef *pScopeRef, NvU32 internalClassId, RS_ITER_TYPE type, NvBool bExactMatch);
418 
419 /**
420  * Get the next iterator to the elements in the client's resource map
421  * @param[in] pClient
422  * @param[inout] pIt The iterator
423  */
424 NvBool clientRefIterNext(struct RsClient *pClient, RS_ITERATOR *pIt);
425 
426 /**
427  * Get an iterator to the elements in the client's resource map.
428  *
429  * This iterator will visit all descendants in pre-order according to the parent-child
430  * resource hierarchy.
431  *
432  * @param[in] pClient
433  * @param[in] pScopeRef Restrict the iteration based on this reference [optional]
434  * @param[in] internalClassId Only iterate over resources with this class id [optional]
435  * @param[in] bExactMatch If true, internalClassId must match exactly; if false, also match classes derived from the internalClassId
436  */
437 RS_ORDERED_ITERATOR clientRefOrderedIter(struct RsClient *pClient, RsResourceRef *pScopeRef, NvU32 internalClassId, NvBool bExactMatch);
438 
439 /**
440  * Get the next ordered iterator to the elements in the client's resource map
441  * @param[in] pClient
442  * @param[inout] pIt The iterator
443  */
444 NvBool clientRefOrderedIterNext(struct RsClient *pClient, RS_ORDERED_ITERATOR *pIt);
445 
446 /**
447  * Release all CPU address mappings for a resource
448  *
449  * @param[in] pClient Client that owns the resource
450  * @param[in] pCallContext Caller information (which includes the resource reference whose mappings will be freed)
451  * @param[in] pLockInfo Information about which locks are already held, for recursive calls
452  */
453 NV_STATUS clientUnmapResourceRefMappings(struct RsClient *pClient, CALL_CONTEXT *pCallContext, RS_LOCK_INFO *pLockInfo);
454 
455 /**
456  * RsResource interface to a RsClient
457  *
458  * This allows clients to be interfaced with as-if they were resources (e.g.,
459  * to perform a control call on a client).
460  *
461  * An RsClientResource is automatically allocated under a client as a top-level
462  * object when that client is allocated and cannot be explicitly freed. Only
463  * one RsClientResource is permitted per-client.
464  *
465  * Any resource allocated under a client will be a descendant of the client
466  * proxy resource.
467  *
468  */
469 
470 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
471 // the matching C source file, but causes diagnostics to be issued if another
472 // source file references the field.
473 #ifdef NVOC_RS_CLIENT_H_PRIVATE_ACCESS_ALLOWED
474 #define PRIVATE_FIELD(x) x
475 #else
476 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
477 #endif
478 
479 struct RsClientResource {
480     const struct NVOC_RTTI *__nvoc_rtti;
481     struct RsResource __nvoc_base_RsResource;
482     struct Object *__nvoc_pbase_Object;
483     struct RsResource *__nvoc_pbase_RsResource;
484     struct RsClientResource *__nvoc_pbase_RsClientResource;
485     NvBool (*__clientresShareCallback__)(struct RsClientResource *, struct RsClient *, RsResourceRef *, RS_SHARE_POLICY *);
486     NV_STATUS (*__clientresControl__)(struct RsClientResource *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
487     NV_STATUS (*__clientresUnmap__)(struct RsClientResource *, struct CALL_CONTEXT *, RsCpuMapping *);
488     NV_STATUS (*__clientresMapTo__)(struct RsClientResource *, RS_RES_MAP_TO_PARAMS *);
489     NvU32 (*__clientresGetRefCount__)(struct RsClientResource *);
490     NV_STATUS (*__clientresControlFilter__)(struct RsClientResource *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
491     void (*__clientresAddAdditionalDependants__)(struct RsClient *, struct RsClientResource *, RsResourceRef *);
492     NV_STATUS (*__clientresControlSerialization_Prologue__)(struct RsClientResource *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
493     NvBool (*__clientresCanCopy__)(struct RsClientResource *);
494     NV_STATUS (*__clientresControl_Prologue__)(struct RsClientResource *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
495     NvBool (*__clientresIsPartialUnmapSupported__)(struct RsClientResource *);
496     void (*__clientresPreDestruct__)(struct RsClientResource *);
497     NV_STATUS (*__clientresUnmapFrom__)(struct RsClientResource *, RS_RES_UNMAP_FROM_PARAMS *);
498     NV_STATUS (*__clientresIsDuplicate__)(struct RsClientResource *, NvHandle, NvBool *);
499     void (*__clientresControlSerialization_Epilogue__)(struct RsClientResource *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
500     void (*__clientresControl_Epilogue__)(struct RsClientResource *, struct CALL_CONTEXT *, struct RS_RES_CONTROL_PARAMS_INTERNAL *);
501     NV_STATUS (*__clientresMap__)(struct RsClientResource *, struct CALL_CONTEXT *, RS_CPU_MAP_PARAMS *, RsCpuMapping *);
502     NvBool (*__clientresAccessCallback__)(struct RsClientResource *, struct RsClient *, void *, RsAccessRight);
503     struct RsClient *pClient;
504 };
505 
506 #ifndef __NVOC_CLASS_RsClientResource_TYPEDEF__
507 #define __NVOC_CLASS_RsClientResource_TYPEDEF__
508 typedef struct RsClientResource RsClientResource;
509 #endif /* __NVOC_CLASS_RsClientResource_TYPEDEF__ */
510 
511 #ifndef __nvoc_class_id_RsClientResource
512 #define __nvoc_class_id_RsClientResource 0x083442
513 #endif /* __nvoc_class_id_RsClientResource */
514 
515 extern const struct NVOC_CLASS_DEF __nvoc_class_def_RsClientResource;
516 
517 #define __staticCast_RsClientResource(pThis) \
518     ((pThis)->__nvoc_pbase_RsClientResource)
519 
520 #ifdef __nvoc_rs_client_h_disabled
521 #define __dynamicCast_RsClientResource(pThis) ((RsClientResource*)NULL)
522 #else //__nvoc_rs_client_h_disabled
523 #define __dynamicCast_RsClientResource(pThis) \
524     ((RsClientResource*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(RsClientResource)))
525 #endif //__nvoc_rs_client_h_disabled
526 
527 
528 NV_STATUS __nvoc_objCreateDynamic_RsClientResource(RsClientResource**, Dynamic*, NvU32, va_list);
529 
530 NV_STATUS __nvoc_objCreate_RsClientResource(RsClientResource**, Dynamic*, NvU32, struct CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams);
531 #define __objCreate_RsClientResource(ppNewObj, pParent, createFlags, arg_pCallContext, arg_pParams) \
532     __nvoc_objCreate_RsClientResource((ppNewObj), staticCast((pParent), Dynamic), (createFlags), arg_pCallContext, arg_pParams)
533 
534 #define clientresShareCallback(pResource, pInvokingClient, pParentRef, pSharePolicy) clientresShareCallback_DISPATCH(pResource, pInvokingClient, pParentRef, pSharePolicy)
535 #define clientresControl(pResource, pCallContext, pParams) clientresControl_DISPATCH(pResource, pCallContext, pParams)
536 #define clientresUnmap(pResource, pCallContext, pCpuMapping) clientresUnmap_DISPATCH(pResource, pCallContext, pCpuMapping)
537 #define clientresMapTo(pResource, pParams) clientresMapTo_DISPATCH(pResource, pParams)
538 #define clientresGetRefCount(pResource) clientresGetRefCount_DISPATCH(pResource)
539 #define clientresControlFilter(pResource, pCallContext, pParams) clientresControlFilter_DISPATCH(pResource, pCallContext, pParams)
540 #define clientresAddAdditionalDependants(pClient, pResource, pReference) clientresAddAdditionalDependants_DISPATCH(pClient, pResource, pReference)
541 #define clientresControlSerialization_Prologue(pResource, pCallContext, pParams) clientresControlSerialization_Prologue_DISPATCH(pResource, pCallContext, pParams)
542 #define clientresCanCopy(pResource) clientresCanCopy_DISPATCH(pResource)
543 #define clientresControl_Prologue(pResource, pCallContext, pParams) clientresControl_Prologue_DISPATCH(pResource, pCallContext, pParams)
544 #define clientresIsPartialUnmapSupported(pResource) clientresIsPartialUnmapSupported_DISPATCH(pResource)
545 #define clientresPreDestruct(pResource) clientresPreDestruct_DISPATCH(pResource)
546 #define clientresUnmapFrom(pResource, pParams) clientresUnmapFrom_DISPATCH(pResource, pParams)
547 #define clientresIsDuplicate(pResource, hMemory, pDuplicate) clientresIsDuplicate_DISPATCH(pResource, hMemory, pDuplicate)
548 #define clientresControlSerialization_Epilogue(pResource, pCallContext, pParams) clientresControlSerialization_Epilogue_DISPATCH(pResource, pCallContext, pParams)
549 #define clientresControl_Epilogue(pResource, pCallContext, pParams) clientresControl_Epilogue_DISPATCH(pResource, pCallContext, pParams)
550 #define clientresMap(pResource, pCallContext, pParams, pCpuMapping) clientresMap_DISPATCH(pResource, pCallContext, pParams, pCpuMapping)
551 #define clientresAccessCallback(pResource, pInvokingClient, pAllocParams, accessRight) clientresAccessCallback_DISPATCH(pResource, pInvokingClient, pAllocParams, accessRight)
clientresShareCallback_DISPATCH(struct RsClientResource * pResource,struct RsClient * pInvokingClient,RsResourceRef * pParentRef,RS_SHARE_POLICY * pSharePolicy)552 static inline NvBool clientresShareCallback_DISPATCH(struct RsClientResource *pResource, struct RsClient *pInvokingClient, RsResourceRef *pParentRef, RS_SHARE_POLICY *pSharePolicy) {
553     return pResource->__clientresShareCallback__(pResource, pInvokingClient, pParentRef, pSharePolicy);
554 }
555 
clientresControl_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)556 static inline NV_STATUS clientresControl_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
557     return pResource->__clientresControl__(pResource, pCallContext, pParams);
558 }
559 
clientresUnmap_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,RsCpuMapping * pCpuMapping)560 static inline NV_STATUS clientresUnmap_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, RsCpuMapping *pCpuMapping) {
561     return pResource->__clientresUnmap__(pResource, pCallContext, pCpuMapping);
562 }
563 
clientresMapTo_DISPATCH(struct RsClientResource * pResource,RS_RES_MAP_TO_PARAMS * pParams)564 static inline NV_STATUS clientresMapTo_DISPATCH(struct RsClientResource *pResource, RS_RES_MAP_TO_PARAMS *pParams) {
565     return pResource->__clientresMapTo__(pResource, pParams);
566 }
567 
clientresGetRefCount_DISPATCH(struct RsClientResource * pResource)568 static inline NvU32 clientresGetRefCount_DISPATCH(struct RsClientResource *pResource) {
569     return pResource->__clientresGetRefCount__(pResource);
570 }
571 
clientresControlFilter_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)572 static inline NV_STATUS clientresControlFilter_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
573     return pResource->__clientresControlFilter__(pResource, pCallContext, pParams);
574 }
575 
clientresAddAdditionalDependants_DISPATCH(struct RsClient * pClient,struct RsClientResource * pResource,RsResourceRef * pReference)576 static inline void clientresAddAdditionalDependants_DISPATCH(struct RsClient *pClient, struct RsClientResource *pResource, RsResourceRef *pReference) {
577     pResource->__clientresAddAdditionalDependants__(pClient, pResource, pReference);
578 }
579 
clientresControlSerialization_Prologue_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)580 static inline NV_STATUS clientresControlSerialization_Prologue_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
581     return pResource->__clientresControlSerialization_Prologue__(pResource, pCallContext, pParams);
582 }
583 
clientresCanCopy_DISPATCH(struct RsClientResource * pResource)584 static inline NvBool clientresCanCopy_DISPATCH(struct RsClientResource *pResource) {
585     return pResource->__clientresCanCopy__(pResource);
586 }
587 
clientresControl_Prologue_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)588 static inline NV_STATUS clientresControl_Prologue_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
589     return pResource->__clientresControl_Prologue__(pResource, pCallContext, pParams);
590 }
591 
clientresIsPartialUnmapSupported_DISPATCH(struct RsClientResource * pResource)592 static inline NvBool clientresIsPartialUnmapSupported_DISPATCH(struct RsClientResource *pResource) {
593     return pResource->__clientresIsPartialUnmapSupported__(pResource);
594 }
595 
clientresPreDestruct_DISPATCH(struct RsClientResource * pResource)596 static inline void clientresPreDestruct_DISPATCH(struct RsClientResource *pResource) {
597     pResource->__clientresPreDestruct__(pResource);
598 }
599 
clientresUnmapFrom_DISPATCH(struct RsClientResource * pResource,RS_RES_UNMAP_FROM_PARAMS * pParams)600 static inline NV_STATUS clientresUnmapFrom_DISPATCH(struct RsClientResource *pResource, RS_RES_UNMAP_FROM_PARAMS *pParams) {
601     return pResource->__clientresUnmapFrom__(pResource, pParams);
602 }
603 
clientresIsDuplicate_DISPATCH(struct RsClientResource * pResource,NvHandle hMemory,NvBool * pDuplicate)604 static inline NV_STATUS clientresIsDuplicate_DISPATCH(struct RsClientResource *pResource, NvHandle hMemory, NvBool *pDuplicate) {
605     return pResource->__clientresIsDuplicate__(pResource, hMemory, pDuplicate);
606 }
607 
clientresControlSerialization_Epilogue_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)608 static inline void clientresControlSerialization_Epilogue_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
609     pResource->__clientresControlSerialization_Epilogue__(pResource, pCallContext, pParams);
610 }
611 
clientresControl_Epilogue_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,struct RS_RES_CONTROL_PARAMS_INTERNAL * pParams)612 static inline void clientresControl_Epilogue_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) {
613     pResource->__clientresControl_Epilogue__(pResource, pCallContext, pParams);
614 }
615 
clientresMap_DISPATCH(struct RsClientResource * pResource,struct CALL_CONTEXT * pCallContext,RS_CPU_MAP_PARAMS * pParams,RsCpuMapping * pCpuMapping)616 static inline NV_STATUS clientresMap_DISPATCH(struct RsClientResource *pResource, struct CALL_CONTEXT *pCallContext, RS_CPU_MAP_PARAMS *pParams, RsCpuMapping *pCpuMapping) {
617     return pResource->__clientresMap__(pResource, pCallContext, pParams, pCpuMapping);
618 }
619 
clientresAccessCallback_DISPATCH(struct RsClientResource * pResource,struct RsClient * pInvokingClient,void * pAllocParams,RsAccessRight accessRight)620 static inline NvBool clientresAccessCallback_DISPATCH(struct RsClientResource *pResource, struct RsClient *pInvokingClient, void *pAllocParams, RsAccessRight accessRight) {
621     return pResource->__clientresAccessCallback__(pResource, pInvokingClient, pAllocParams, accessRight);
622 }
623 
624 NV_STATUS clientresConstruct_IMPL(struct RsClientResource *arg_pClientRes, struct CALL_CONTEXT *arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL *arg_pParams);
625 
626 #define __nvoc_clientresConstruct(arg_pClientRes, arg_pCallContext, arg_pParams) clientresConstruct_IMPL(arg_pClientRes, arg_pCallContext, arg_pParams)
627 void clientresDestruct_IMPL(struct RsClientResource *pClientRes);
628 
629 #define __nvoc_clientresDestruct(pClientRes) clientresDestruct_IMPL(pClientRes)
630 #undef PRIVATE_FIELD
631 
632 
633 /**
634  * Client destruction parameters
635  */
636 struct RS_CLIENT_FREE_PARAMS_INTERNAL
637 {
638     NvHandle hDomain;           ///< [in] The parent domain
639     NvHandle hClient;           ///< [in] The client handle
640     NvBool   bHiPriOnly;        ///< [in] Only free high priority resources
641     NvBool   bDisableOnly;      ///< [in] Only disable the listed clients, do not free them yet
642     NvU32    state;             ///< [in] User-defined state
643 
644     RS_RES_FREE_PARAMS_INTERNAL *pResFreeParams; ///< [in] Necessary for locking state
645     API_SECURITY_INFO *pSecInfo;                 ///< [in] Security Info
646 };
647 
648 /**
649  * Return an iterator to a resource reference multi-map
650  * @param[in] pIndex The multi-map to iterate
651  * @param[in] index Return only the references belonging to this index
652  */
653 RsIndexIter indexRefIter(RsIndex *pIndex, NvU32 index);
654 
655 /**
656  * Return an iterator to all resource references in a multi-map
657  * @param[in] pIndex The multi-map to iterate
658  */
659 RsIndexIter indexRefIterAll(RsIndex *pIndex);
660 
661 /**
662  * Get the next iterator in a resource reference multi-map
663  * @param[in] pIt Iterator
664  */
665 NvBool indexRefIterNext(RsIndexIter *pIt);
666 
667 /* @} */
668 
669 #ifdef __cplusplus
670 }
671 #endif
672 
673 #endif
674 
675 #ifdef __cplusplus
676 } // extern "C"
677 #endif
678 
679 #endif // _G_RS_CLIENT_NVOC_H_
680