1 /*============================================================================== 2 Copyright(c) 2019 Intel Corporation 3 4 Permission is hereby granted, free of charge, to any person obtaining a 5 copy of this software and associated documentation files(the "Software"), 6 to deal in the Software without restriction, including without limitation 7 the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 and / or sell copies of the Software, and to permit persons to whom the 9 Software is furnished to do so, subject to the following conditions: 10 11 The above copyright notice and this permission notice shall be included 12 in all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 OTHER DEALINGS IN THE SOFTWARE. 21 ============================================================================*/ 22 #pragma once 23 24 #ifdef __linux__ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif /*__cplusplus*/ 29 30 typedef struct { 31 int(*pfnAllocate)(void *bufMgr, size_t size, size_t alignment, void **bo, void **cpuAddr, uint64_t *gpuAddr); 32 void(*pfnDeallocate)(void *bo); 33 void(*pfnWaitFromCpu)(void *bo);; 34 } GMM_DEVICE_CB_PTRS; 35 36 typedef struct _GMM_DEVICE_CALLBACKS_INT 37 { 38 void *pBufMgr; 39 GMM_DEVICE_CB_PTRS DevCbPtrs_; 40 } GMM_DEVICE_CALLBACKS_INT; 41 42 43 // Add the definition to compatible. 44 typedef struct GMM_TRANSLATIONTABLE_CALLBACKS_REC 45 { 46 int (*pfPrologTranslationTable)(void *pDeviceHandle); 47 48 int (*pfWriteL1Entries)(void *pDeviceHandle, 49 const uint32_t NumEntries, 50 GMM_GFX_ADDRESS GfxAddress, 51 uint32_t *Data); 52 53 int (*pfWriteL2L3Entry)(void *pDeviceHandle, 54 GMM_GFX_ADDRESS GfxAddress, 55 uint64_t Data); 56 57 int (*pfWriteFenceID)(void *pDeviceHandle, 58 GMM_GFX_ADDRESS GfxAddress, 59 uint64_t Data); 60 61 int (*pfEpilogTranslationTable)(void *pDeviceHandle, 62 uint8_t ForceFlush); 63 64 int (*pfCopyL1Entry)(void *pDeviceHandle, 65 GMM_GFX_ADDRESS DstGfxAddress, 66 GMM_GFX_ADDRESS SrcGfxAddress); 67 68 int (*pfWriteL3Adr)(void *pDeviceHandle, 69 GMM_GFX_ADDRESS L3GfxAddress, 70 uint64_t RegOffset); 71 } GMM_TRANSLATIONTABLE_CALLBACKS; 72 73 typedef struct _GMM_DEVICE_CALLBACKS 74 { 75 void *pBufferMgr; 76 int FuncDevice; 77 int(*pfnAllocate)(void *bufMgr, size_t size, size_t alignment, void **bo, void **cpuAddr, uint64_t *gpuAddr); 78 void(*pfnDeallocate)(void *bo); 79 void(*pfnWaitFromCpu)(void *bo);; 80 } GMM_DEVICE_CALLBACKS; 81 82 83 // This definition is only for code sharing. 84 typedef struct GMM_UMD_SYNCCONTEXT_REC 85 { 86 void *pCommandQueueHandle; // pointer to command queue handle 87 void *pUpdateGpuVaInfo; 88 HANDLE BBFenceObj; // BatchBuffer Last Fence, for CPU to wait on before destroying TT pages 89 uint64_t BBLastFence; // BatchBuffer Last Fence for TT 90 } GMM_UMD_SYNCCONTEXT; 91 92 #ifdef __cplusplus 93 } 94 #endif /*__cplusplus*/ 95 96 #endif /*__linux__*/ 97