1 /*============================================================================== 2 Copyright(c) 2017 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 23 #pragma once 24 25 //=========================================================================== 26 // typedef: 27 // GMM_RESOURCE_USAGE 28 // 29 // Description: 30 // Defines Usage types for different Resources 31 //---------------------------------------------------------------------------- 32 typedef enum GMM_RESOURCE_USAGE_TYPE_ENUM 33 { 34 35 //Generic Usage 36 GMM_RESOURCE_USAGE_UNKNOWN = 0, // <== MUST EQUAL 0 37 38 #define DEFINE_RESOURCE_USAGE(Usage) Usage, 39 #include "../../../CachePolicy/GmmCachePolicyResourceUsageDefinitions.h" 40 #undef DEFINE_RESOURCE_USAGE 41 42 GMM_RESOURCE_USAGE_MAX // <== MUST BE LAST ELEMENT 43 44 }GMM_RESOURCE_USAGE_TYPE; 45 46 typedef union GMM_PTE_CACHE_CONTROL_BITS_REC 47 { 48 struct 49 { 50 uint64_t Valid : 1; 51 uint64_t CacheControl : 2; 52 uint64_t GFDT : 1; 53 uint64_t : 28; 54 uint64_t : 32; 55 } Gen6; 56 struct 57 { 58 uint64_t Valid : 1; 59 uint64_t CacheControlLo : 3; 60 uint64_t : 7; 61 uint64_t CacheControlHi : 1; 62 uint64_t : 20; 63 uint64_t : 32; 64 } Gen7_5; 65 struct 66 { 67 uint64_t Valid : 1; 68 uint64_t : 2; 69 uint64_t PWT : 1; 70 uint64_t PCD : 1; 71 uint64_t : 2; 72 uint64_t PAT : 1; 73 uint64_t : 24; 74 uint64_t : 32; 75 } Gen8; 76 struct 77 { 78 uint64_t Valid : 1; 79 uint64_t : 2; 80 uint64_t PAT0 : 1; 81 uint64_t PAT1 : 1; 82 uint64_t : 2; 83 uint64_t PAT2 : 1; 84 uint64_t : 24; 85 uint64_t : 30; 86 uint64_t PAT3 : 1; 87 uint64_t : 1; 88 } XE_LPG; 89 struct 90 { 91 uint32_t DwordValue; 92 uint32_t HighDwordValue; 93 }; 94 } GMM_PTE_CACHE_CONTROL_BITS; 95 96 typedef union MEMORY_OBJECT_CONTROL_STATE_REC { 97 struct 98 { 99 uint32_t CacheControl : 2; 100 uint32_t GFDT : 1; 101 uint32_t : 1; 102 uint32_t : 28; 103 } Gen6; 104 struct 105 { 106 uint32_t L3 : 1; 107 uint32_t CacheControl : 1; 108 uint32_t GFDT : 1; 109 uint32_t EncryptedData : 1; 110 uint32_t : 28; 111 } Gen7; 112 struct 113 { 114 uint32_t L3 : 1; 115 uint32_t CacheControl : 2; 116 uint32_t EncryptedData : 1; 117 uint32_t : 28; 118 } Gen7_5; 119 struct 120 { 121 uint32_t Age : 2; 122 uint32_t EncryptedData : 1; 123 uint32_t TargetCache : 2; 124 uint32_t CacheControl : 2; 125 uint32_t : 25; 126 } Gen8; 127 struct 128 { 129 uint32_t EncryptedData : 1; 130 uint32_t Index : 6; 131 uint32_t : 25; 132 } Gen9, Gen10, Gen11, Gen12, XE_HP, XE_LPG; 133 134 uint32_t DwordValue; 135 } MEMORY_OBJECT_CONTROL_STATE; 136 // typedef: 137 // GMM_CACHE_POLICY 138 // 139 // Description: 140 // This struct is used for accessing Cache Policy functions. 141 // Forward Declaration: Defined in GmmCachePolicy.h 142 //--------------------------------------------------------------------------- 143 #ifdef __cplusplus 144 namespace GmmLib 145 { 146 class GmmCachePolicyCommon; 147 } 148 149 typedef GmmLib::GmmCachePolicyCommon GMM_CACHE_POLICY; 150 #else 151 struct GmmCachePolicyCommon; 152 typedef struct GmmCachePolicyCommon GMM_CACHE_POLICY; 153 #endif 154