1 /*============================================================================== 2 Copyright(c) 2022 Intel Corporation 3 Permission is hereby granted, free of charge, to any person obtaining a 4 copy of this software and associated documentation files(the "Software"), 5 to deal in the Software without restriction, including without limitation 6 the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 and / or sell copies of the Software, and to permit persons to whom the 8 Software is furnished to do so, subject to the following conditions: 9 10 The above copyright notice and this permission notice shall be included 11 in all copies or substantial portions of the Software. 12 13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 17 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 OTHER DEALINGS IN THE SOFTWARE. 20 ============================================================================*/ 21 22 #pragma once 23 24 #ifdef __cplusplus 25 #include "../GmmCachePolicyCommon.h" 26 27 #define GMM_NUM_PAT_ENTRIES_Xe_LPG (16) 28 29 namespace GmmLib 30 { 31 class NON_PAGED_SECTION GmmXe_LPGCachePolicy : 32 public GmmGen12CachePolicy 33 { 34 protected: 35 uint32_t CurrentMaxPATIndex; 36 37 public: 38 39 /* Constructors */ GmmXe_LPGCachePolicy(GMM_CACHE_POLICY_ELEMENT * pCachePolicyContext,Context * pGmmLibContext)40 GmmXe_LPGCachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicyContext, Context *pGmmLibContext) 41 : GmmGen12CachePolicy(pCachePolicyContext, pGmmLibContext) 42 { 43 NumPATRegisters = GMM_NUM_PAT_ENTRIES_Xe_LPG; 44 CurrentMaxPATIndex = 0; 45 } ~GmmXe_LPGCachePolicy()46 virtual ~GmmXe_LPGCachePolicy() 47 { 48 } 49 50 /* Function prototypes */ 51 GMM_STATUS InitCachePolicy(); 52 uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable); 53 GMM_STATUS SetupPAT(); 54 void SetUpMOCSTable(); 55 void GMM_STDCALL SetL1CachePolicy(uint32_t Usage); 56 virtual uint32_t GMM_STDCALL GetSurfaceStateL1CachePolicy(GMM_RESOURCE_USAGE_TYPE Usage); 57 virtual MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage); 58 59 }; 60 61 } 62 #endif // #ifdef __cplusplus 63