1 #define NVOC_OS_DESC_MEM_H_PRIVATE_ACCESS_ALLOWED 2 #include "nvoc/runtime.h" 3 #include "nvoc/rtti.h" 4 #include "nvtypes.h" 5 #include "nvport/nvport.h" 6 #include "nvport/inline/util_valist.h" 7 #include "utils/nvassert.h" 8 #include "g_os_desc_mem_nvoc.h" 9 10 #ifdef DEBUG 11 char __nvoc_class_id_uniqueness_check_0xb3dacd = 1; 12 #endif 13 14 extern const struct NVOC_CLASS_DEF __nvoc_class_def_OsDescMemory; 15 16 extern const struct NVOC_CLASS_DEF __nvoc_class_def_Object; 17 18 extern const struct NVOC_CLASS_DEF __nvoc_class_def_RsResource; 19 20 extern const struct NVOC_CLASS_DEF __nvoc_class_def_RmResourceCommon; 21 22 extern const struct NVOC_CLASS_DEF __nvoc_class_def_RmResource; 23 24 extern const struct NVOC_CLASS_DEF __nvoc_class_def_Memory; 25 26 void __nvoc_init_OsDescMemory(OsDescMemory*); 27 void __nvoc_init_funcTable_OsDescMemory(OsDescMemory*); 28 NV_STATUS __nvoc_ctor_OsDescMemory(OsDescMemory*, CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams); 29 void __nvoc_init_dataField_OsDescMemory(OsDescMemory*); 30 void __nvoc_dtor_OsDescMemory(OsDescMemory*); 31 extern const struct NVOC_EXPORT_INFO __nvoc_export_info_OsDescMemory; 32 33 static const struct NVOC_RTTI __nvoc_rtti_OsDescMemory_OsDescMemory = { 34 /*pClassDef=*/ &__nvoc_class_def_OsDescMemory, 35 /*dtor=*/ (NVOC_DYNAMIC_DTOR) &__nvoc_dtor_OsDescMemory, 36 /*offset=*/ 0, 37 }; 38 39 static const struct NVOC_RTTI __nvoc_rtti_OsDescMemory_Object = { 40 /*pClassDef=*/ &__nvoc_class_def_Object, 41 /*dtor=*/ &__nvoc_destructFromBase, 42 /*offset=*/ NV_OFFSETOF(OsDescMemory, __nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource.__nvoc_base_Object), 43 }; 44 45 static const struct NVOC_RTTI __nvoc_rtti_OsDescMemory_RsResource = { 46 /*pClassDef=*/ &__nvoc_class_def_RsResource, 47 /*dtor=*/ &__nvoc_destructFromBase, 48 /*offset=*/ NV_OFFSETOF(OsDescMemory, __nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource), 49 }; 50 51 static const struct NVOC_RTTI __nvoc_rtti_OsDescMemory_RmResourceCommon = { 52 /*pClassDef=*/ &__nvoc_class_def_RmResourceCommon, 53 /*dtor=*/ &__nvoc_destructFromBase, 54 /*offset=*/ NV_OFFSETOF(OsDescMemory, __nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RmResourceCommon), 55 }; 56 57 static const struct NVOC_RTTI __nvoc_rtti_OsDescMemory_RmResource = { 58 /*pClassDef=*/ &__nvoc_class_def_RmResource, 59 /*dtor=*/ &__nvoc_destructFromBase, 60 /*offset=*/ NV_OFFSETOF(OsDescMemory, __nvoc_base_Memory.__nvoc_base_RmResource), 61 }; 62 63 static const struct NVOC_RTTI __nvoc_rtti_OsDescMemory_Memory = { 64 /*pClassDef=*/ &__nvoc_class_def_Memory, 65 /*dtor=*/ &__nvoc_destructFromBase, 66 /*offset=*/ NV_OFFSETOF(OsDescMemory, __nvoc_base_Memory), 67 }; 68 69 static const struct NVOC_CASTINFO __nvoc_castinfo_OsDescMemory = { 70 /*numRelatives=*/ 6, 71 /*relatives=*/ { 72 &__nvoc_rtti_OsDescMemory_OsDescMemory, 73 &__nvoc_rtti_OsDescMemory_Memory, 74 &__nvoc_rtti_OsDescMemory_RmResource, 75 &__nvoc_rtti_OsDescMemory_RmResourceCommon, 76 &__nvoc_rtti_OsDescMemory_RsResource, 77 &__nvoc_rtti_OsDescMemory_Object, 78 }, 79 }; 80 81 const struct NVOC_CLASS_DEF __nvoc_class_def_OsDescMemory = 82 { 83 /*classInfo=*/ { 84 /*size=*/ sizeof(OsDescMemory), 85 /*classId=*/ classId(OsDescMemory), 86 /*providerId=*/ &__nvoc_rtti_provider, 87 #if NV_PRINTF_STRINGS_ALLOWED 88 /*name=*/ "OsDescMemory", 89 #endif 90 }, 91 /*objCreatefn=*/ (NVOC_DYNAMIC_OBJ_CREATE) &__nvoc_objCreateDynamic_OsDescMemory, 92 /*pCastInfo=*/ &__nvoc_castinfo_OsDescMemory, 93 /*pExportInfo=*/ &__nvoc_export_info_OsDescMemory 94 }; 95 96 static NvBool __nvoc_thunk_OsDescMemory_resCanCopy(struct RsResource *pOsDescMemory) { 97 return osdescCanCopy((struct OsDescMemory *)(((unsigned char *)pOsDescMemory) - __nvoc_rtti_OsDescMemory_RsResource.offset)); 98 } 99 100 static NV_STATUS __nvoc_thunk_Memory_osdescCheckMemInterUnmap(struct OsDescMemory *pMemory, NvBool bSubdeviceHandleProvided) { 101 return memCheckMemInterUnmap((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), bSubdeviceHandleProvided); 102 } 103 104 static NvBool __nvoc_thunk_RmResource_osdescShareCallback(struct OsDescMemory *pResource, struct RsClient *pInvokingClient, struct RsResourceRef *pParentRef, RS_SHARE_POLICY *pSharePolicy) { 105 return rmresShareCallback((struct RmResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RmResource.offset), pInvokingClient, pParentRef, pSharePolicy); 106 } 107 108 static NV_STATUS __nvoc_thunk_RsResource_osdescMapTo(struct OsDescMemory *pResource, RS_RES_MAP_TO_PARAMS *pParams) { 109 return resMapTo((struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset), pParams); 110 } 111 112 static NV_STATUS __nvoc_thunk_Memory_osdescGetMapAddrSpace(struct OsDescMemory *pMemory, CALL_CONTEXT *pCallContext, NvU32 mapFlags, NV_ADDRESS_SPACE *pAddrSpace) { 113 return memGetMapAddrSpace((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pCallContext, mapFlags, pAddrSpace); 114 } 115 116 static NvU32 __nvoc_thunk_RsResource_osdescGetRefCount(struct OsDescMemory *pResource) { 117 return resGetRefCount((struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset)); 118 } 119 120 static void __nvoc_thunk_RsResource_osdescAddAdditionalDependants(struct RsClient *pClient, struct OsDescMemory *pResource, RsResourceRef *pReference) { 121 resAddAdditionalDependants(pClient, (struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset), pReference); 122 } 123 124 static NV_STATUS __nvoc_thunk_RmResource_osdescControl_Prologue(struct OsDescMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) { 125 return rmresControl_Prologue((struct RmResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RmResource.offset), pCallContext, pParams); 126 } 127 128 static NvBool __nvoc_thunk_Memory_osdescIsGpuMapAllowed(struct OsDescMemory *pMemory, struct OBJGPU *pGpu) { 129 return memIsGpuMapAllowed((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pGpu); 130 } 131 132 static NV_STATUS __nvoc_thunk_RsResource_osdescUnmapFrom(struct OsDescMemory *pResource, RS_RES_UNMAP_FROM_PARAMS *pParams) { 133 return resUnmapFrom((struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset), pParams); 134 } 135 136 static void __nvoc_thunk_RmResource_osdescControl_Epilogue(struct OsDescMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) { 137 rmresControl_Epilogue((struct RmResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RmResource.offset), pCallContext, pParams); 138 } 139 140 static NV_STATUS __nvoc_thunk_RsResource_osdescControlLookup(struct OsDescMemory *pResource, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams, const struct NVOC_EXPORTED_METHOD_DEF **ppEntry) { 141 return resControlLookup((struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset), pParams, ppEntry); 142 } 143 144 static NV_STATUS __nvoc_thunk_Memory_osdescControl(struct OsDescMemory *pMemory, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) { 145 return memControl((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pCallContext, pParams); 146 } 147 148 static NV_STATUS __nvoc_thunk_Memory_osdescUnmap(struct OsDescMemory *pMemory, CALL_CONTEXT *pCallContext, RsCpuMapping *pCpuMapping) { 149 return memUnmap((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pCallContext, pCpuMapping); 150 } 151 152 static NV_STATUS __nvoc_thunk_Memory_osdescGetMemInterMapParams(struct OsDescMemory *pMemory, RMRES_MEM_INTER_MAP_PARAMS *pParams) { 153 return memGetMemInterMapParams((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pParams); 154 } 155 156 static NV_STATUS __nvoc_thunk_Memory_osdescGetMemoryMappingDescriptor(struct OsDescMemory *pMemory, MEMORY_DESCRIPTOR **ppMemDesc) { 157 return memGetMemoryMappingDescriptor((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), ppMemDesc); 158 } 159 160 static NV_STATUS __nvoc_thunk_RsResource_osdescControlFilter(struct OsDescMemory *pResource, struct CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) { 161 return resControlFilter((struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset), pCallContext, pParams); 162 } 163 164 static NV_STATUS __nvoc_thunk_RmResource_osdescControlSerialization_Prologue(struct OsDescMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) { 165 return rmresControlSerialization_Prologue((struct RmResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RmResource.offset), pCallContext, pParams); 166 } 167 168 static NV_STATUS __nvoc_thunk_Memory_osdescIsReady(struct OsDescMemory *pMemory, NvBool bCopyConstructorContext) { 169 return memIsReady((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), bCopyConstructorContext); 170 } 171 172 static NV_STATUS __nvoc_thunk_Memory_osdescCheckCopyPermissions(struct OsDescMemory *pMemory, struct OBJGPU *pDstGpu, NvHandle hDstClientNvBool) { 173 return memCheckCopyPermissions((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pDstGpu, hDstClientNvBool); 174 } 175 176 static void __nvoc_thunk_RsResource_osdescPreDestruct(struct OsDescMemory *pResource) { 177 resPreDestruct((struct RsResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RsResource.offset)); 178 } 179 180 static NV_STATUS __nvoc_thunk_Memory_osdescIsDuplicate(struct OsDescMemory *pMemory, NvHandle hMemory, NvBool *pDuplicate) { 181 return memIsDuplicate((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), hMemory, pDuplicate); 182 } 183 184 static void __nvoc_thunk_RmResource_osdescControlSerialization_Epilogue(struct OsDescMemory *pResource, CALL_CONTEXT *pCallContext, struct RS_RES_CONTROL_PARAMS_INTERNAL *pParams) { 185 rmresControlSerialization_Epilogue((struct RmResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RmResource.offset), pCallContext, pParams); 186 } 187 188 static NV_STATUS __nvoc_thunk_Memory_osdescMap(struct OsDescMemory *pMemory, CALL_CONTEXT *pCallContext, struct RS_CPU_MAP_PARAMS *pParams, RsCpuMapping *pCpuMapping) { 189 return memMap((struct Memory *)(((unsigned char *)pMemory) + __nvoc_rtti_OsDescMemory_Memory.offset), pCallContext, pParams, pCpuMapping); 190 } 191 192 static NvBool __nvoc_thunk_RmResource_osdescAccessCallback(struct OsDescMemory *pResource, struct RsClient *pInvokingClient, void *pAllocParams, RsAccessRight accessRight) { 193 return rmresAccessCallback((struct RmResource *)(((unsigned char *)pResource) + __nvoc_rtti_OsDescMemory_RmResource.offset), pInvokingClient, pAllocParams, accessRight); 194 } 195 196 const struct NVOC_EXPORT_INFO __nvoc_export_info_OsDescMemory = 197 { 198 /*numEntries=*/ 0, 199 /*pExportEntries=*/ 0 200 }; 201 202 void __nvoc_dtor_Memory(Memory*); 203 void __nvoc_dtor_OsDescMemory(OsDescMemory *pThis) { 204 __nvoc_dtor_Memory(&pThis->__nvoc_base_Memory); 205 PORT_UNREFERENCED_VARIABLE(pThis); 206 } 207 208 void __nvoc_init_dataField_OsDescMemory(OsDescMemory *pThis) { 209 PORT_UNREFERENCED_VARIABLE(pThis); 210 } 211 212 NV_STATUS __nvoc_ctor_Memory(Memory* , CALL_CONTEXT *, struct RS_RES_ALLOC_PARAMS_INTERNAL *); 213 NV_STATUS __nvoc_ctor_OsDescMemory(OsDescMemory *pThis, CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams) { 214 NV_STATUS status = NV_OK; 215 status = __nvoc_ctor_Memory(&pThis->__nvoc_base_Memory, arg_pCallContext, arg_pParams); 216 if (status != NV_OK) goto __nvoc_ctor_OsDescMemory_fail_Memory; 217 __nvoc_init_dataField_OsDescMemory(pThis); 218 219 status = __nvoc_osdescConstruct(pThis, arg_pCallContext, arg_pParams); 220 if (status != NV_OK) goto __nvoc_ctor_OsDescMemory_fail__init; 221 goto __nvoc_ctor_OsDescMemory_exit; // Success 222 223 __nvoc_ctor_OsDescMemory_fail__init: 224 __nvoc_dtor_Memory(&pThis->__nvoc_base_Memory); 225 __nvoc_ctor_OsDescMemory_fail_Memory: 226 __nvoc_ctor_OsDescMemory_exit: 227 228 return status; 229 } 230 231 static void __nvoc_init_funcTable_OsDescMemory_1(OsDescMemory *pThis) { 232 PORT_UNREFERENCED_VARIABLE(pThis); 233 234 pThis->__osdescCanCopy__ = &osdescCanCopy_IMPL; 235 236 pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource.__resCanCopy__ = &__nvoc_thunk_OsDescMemory_resCanCopy; 237 238 pThis->__osdescCheckMemInterUnmap__ = &__nvoc_thunk_Memory_osdescCheckMemInterUnmap; 239 240 pThis->__osdescShareCallback__ = &__nvoc_thunk_RmResource_osdescShareCallback; 241 242 pThis->__osdescMapTo__ = &__nvoc_thunk_RsResource_osdescMapTo; 243 244 pThis->__osdescGetMapAddrSpace__ = &__nvoc_thunk_Memory_osdescGetMapAddrSpace; 245 246 pThis->__osdescGetRefCount__ = &__nvoc_thunk_RsResource_osdescGetRefCount; 247 248 pThis->__osdescAddAdditionalDependants__ = &__nvoc_thunk_RsResource_osdescAddAdditionalDependants; 249 250 pThis->__osdescControl_Prologue__ = &__nvoc_thunk_RmResource_osdescControl_Prologue; 251 252 pThis->__osdescIsGpuMapAllowed__ = &__nvoc_thunk_Memory_osdescIsGpuMapAllowed; 253 254 pThis->__osdescUnmapFrom__ = &__nvoc_thunk_RsResource_osdescUnmapFrom; 255 256 pThis->__osdescControl_Epilogue__ = &__nvoc_thunk_RmResource_osdescControl_Epilogue; 257 258 pThis->__osdescControlLookup__ = &__nvoc_thunk_RsResource_osdescControlLookup; 259 260 pThis->__osdescControl__ = &__nvoc_thunk_Memory_osdescControl; 261 262 pThis->__osdescUnmap__ = &__nvoc_thunk_Memory_osdescUnmap; 263 264 pThis->__osdescGetMemInterMapParams__ = &__nvoc_thunk_Memory_osdescGetMemInterMapParams; 265 266 pThis->__osdescGetMemoryMappingDescriptor__ = &__nvoc_thunk_Memory_osdescGetMemoryMappingDescriptor; 267 268 pThis->__osdescControlFilter__ = &__nvoc_thunk_RsResource_osdescControlFilter; 269 270 pThis->__osdescControlSerialization_Prologue__ = &__nvoc_thunk_RmResource_osdescControlSerialization_Prologue; 271 272 pThis->__osdescIsReady__ = &__nvoc_thunk_Memory_osdescIsReady; 273 274 pThis->__osdescCheckCopyPermissions__ = &__nvoc_thunk_Memory_osdescCheckCopyPermissions; 275 276 pThis->__osdescPreDestruct__ = &__nvoc_thunk_RsResource_osdescPreDestruct; 277 278 pThis->__osdescIsDuplicate__ = &__nvoc_thunk_Memory_osdescIsDuplicate; 279 280 pThis->__osdescControlSerialization_Epilogue__ = &__nvoc_thunk_RmResource_osdescControlSerialization_Epilogue; 281 282 pThis->__osdescMap__ = &__nvoc_thunk_Memory_osdescMap; 283 284 pThis->__osdescAccessCallback__ = &__nvoc_thunk_RmResource_osdescAccessCallback; 285 } 286 287 void __nvoc_init_funcTable_OsDescMemory(OsDescMemory *pThis) { 288 __nvoc_init_funcTable_OsDescMemory_1(pThis); 289 } 290 291 void __nvoc_init_Memory(Memory*); 292 void __nvoc_init_OsDescMemory(OsDescMemory *pThis) { 293 pThis->__nvoc_pbase_OsDescMemory = pThis; 294 pThis->__nvoc_pbase_Object = &pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource.__nvoc_base_Object; 295 pThis->__nvoc_pbase_RsResource = &pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource; 296 pThis->__nvoc_pbase_RmResourceCommon = &pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RmResourceCommon; 297 pThis->__nvoc_pbase_RmResource = &pThis->__nvoc_base_Memory.__nvoc_base_RmResource; 298 pThis->__nvoc_pbase_Memory = &pThis->__nvoc_base_Memory; 299 __nvoc_init_Memory(&pThis->__nvoc_base_Memory); 300 __nvoc_init_funcTable_OsDescMemory(pThis); 301 } 302 303 NV_STATUS __nvoc_objCreate_OsDescMemory(OsDescMemory **ppThis, Dynamic *pParent, NvU32 createFlags, CALL_CONTEXT * arg_pCallContext, struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams) { 304 NV_STATUS status; 305 Object *pParentObj; 306 OsDescMemory *pThis; 307 308 status = __nvoc_handleObjCreateMemAlloc(createFlags, sizeof(OsDescMemory), (void**)&pThis, (void**)ppThis); 309 if (status != NV_OK) 310 return status; 311 312 portMemSet(pThis, 0, sizeof(OsDescMemory)); 313 314 __nvoc_initRtti(staticCast(pThis, Dynamic), &__nvoc_class_def_OsDescMemory); 315 316 pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource.__nvoc_base_Object.createFlags = createFlags; 317 318 if (pParent != NULL && !(createFlags & NVOC_OBJ_CREATE_FLAGS_PARENT_HALSPEC_ONLY)) 319 { 320 pParentObj = dynamicCast(pParent, Object); 321 objAddChild(pParentObj, &pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource.__nvoc_base_Object); 322 } 323 else 324 { 325 pThis->__nvoc_base_Memory.__nvoc_base_RmResource.__nvoc_base_RsResource.__nvoc_base_Object.pParent = NULL; 326 } 327 328 __nvoc_init_OsDescMemory(pThis); 329 status = __nvoc_ctor_OsDescMemory(pThis, arg_pCallContext, arg_pParams); 330 if (status != NV_OK) goto __nvoc_objCreate_OsDescMemory_cleanup; 331 332 *ppThis = pThis; 333 334 return NV_OK; 335 336 __nvoc_objCreate_OsDescMemory_cleanup: 337 // do not call destructors here since the constructor already called them 338 if (createFlags & NVOC_OBJ_CREATE_FLAGS_IN_PLACE_CONSTRUCT) 339 portMemSet(pThis, 0, sizeof(OsDescMemory)); 340 else 341 portMemFree(pThis); 342 343 // coverity[leaked_storage:FALSE] 344 return status; 345 } 346 347 NV_STATUS __nvoc_objCreateDynamic_OsDescMemory(OsDescMemory **ppThis, Dynamic *pParent, NvU32 createFlags, va_list args) { 348 NV_STATUS status; 349 CALL_CONTEXT * arg_pCallContext = va_arg(args, CALL_CONTEXT *); 350 struct RS_RES_ALLOC_PARAMS_INTERNAL * arg_pParams = va_arg(args, struct RS_RES_ALLOC_PARAMS_INTERNAL *); 351 352 status = __nvoc_objCreate_OsDescMemory(ppThis, pParent, createFlags, arg_pCallContext, arg_pParams); 353 354 return status; 355 } 356 357