1 /*
2 * Copyright (c) 2009-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 //! \file mos_os_cp_interface_specific.h
24 //! \brief OS specific implement for CP related functions
25 //!
26
27 #ifndef __MOS_OS_CP_INTERFACE_SPECIFIC_H__
28 #define __MOS_OS_CP_INTERFACE_SPECIFIC_H__
29
30 #include "mos_defs.h"
31 #include "mos_os_hw.h"
32 #include "mos_util_debug.h"
33
OsStubMessage()34 static void OsStubMessage()
35 {
36 MOS_NORMALMESSAGE(
37 MOS_COMPONENT_CP,
38 MOS_CP_SUBCOMP_OS,
39 "This function is stubbed as CP is not enabled.");
40 }
41
42 class MosCpInterface
43 {
44 public:
MosCpInterface()45 MosCpInterface() {}
46
~MosCpInterface()47 virtual ~MosCpInterface() {}
48
RegisterPatchForHM(uint32_t * pPatchAddress,uint32_t bWrite,MOS_HW_COMMAND HwCommandType,uint32_t forceDwordOffset,void * plResource,void * pPatchLocationList)49 virtual MOS_STATUS RegisterPatchForHM(
50 uint32_t * pPatchAddress,
51 uint32_t bWrite,
52 MOS_HW_COMMAND HwCommandType,
53 uint32_t forceDwordOffset,
54 void * plResource,
55 void * pPatchLocationList)
56
57 {
58 MOS_UNUSED(pPatchAddress);
59 MOS_UNUSED(bWrite);
60 MOS_UNUSED(HwCommandType);
61 MOS_UNUSED(forceDwordOffset);
62 MOS_UNUSED(plResource);
63 MOS_UNUSED(pPatchLocationList);
64
65 OsStubMessage();
66 return MOS_STATUS_SUCCESS;
67 }
68
PermeatePatchForHM(void * virt,void * pvCurrentPatch,void * resource)69 virtual MOS_STATUS PermeatePatchForHM(
70 void *virt,
71 void *pvCurrentPatch,
72 void *resource)
73 {
74 MOS_UNUSED(virt);
75 MOS_UNUSED(pvCurrentPatch);
76 MOS_UNUSED(resource);
77
78 OsStubMessage();
79 return MOS_STATUS_SUCCESS;
80 }
81
PermeateBBPatchForHM()82 virtual MOS_STATUS PermeateBBPatchForHM()
83 {
84 OsStubMessage();
85 return MOS_STATUS_SUCCESS;
86 }
87
IsCpEnabled()88 virtual bool IsCpEnabled()
89 {
90 OsStubMessage();
91 return false;
92 }
93
RegisterAndCheckProtectedGemCtx(bool bRegister,void * identifier,bool * bIsStale)94 virtual void RegisterAndCheckProtectedGemCtx(bool bRegister, void *identifier, bool *bIsStale)
95 {
96 OsStubMessage();
97 }
98
SetCpEnabled(bool bIsCpEnabled)99 virtual void SetCpEnabled(bool bIsCpEnabled)
100 {
101 OsStubMessage();
102 }
103
IsHMEnabled()104 virtual bool IsHMEnabled()
105 {
106 OsStubMessage();
107 return false;
108 }
109
IsTSEnabled()110 virtual bool IsTSEnabled()
111 {
112 OsStubMessage();
113 return false;
114 }
115
IsIDMEnabled()116 virtual bool IsIDMEnabled()
117 {
118 OsStubMessage();
119 return false;
120 }
121
IsSMEnabled()122 virtual bool IsSMEnabled()
123 {
124 OsStubMessage();
125 return false;
126 }
127
IsCencCtxBasedSubmissionEnabled()128 virtual bool IsCencCtxBasedSubmissionEnabled()
129 {
130 OsStubMessage();
131 return false;
132 }
133
IsTearDownHappen()134 virtual bool IsTearDownHappen()
135 {
136 OsStubMessage();
137 return false;
138 }
139
SetResourceEncryption(void * pResource,bool bEncryption)140 virtual MOS_STATUS SetResourceEncryption(
141 void *pResource,
142 bool bEncryption)
143
144 {
145 MOS_UNUSED(pResource);
146 MOS_UNUSED(bEncryption);
147
148 OsStubMessage();
149 return MOS_STATUS_UNIMPLEMENTED;
150 }
151
PrepareResources(void * source[],uint32_t sourceCount,void * target[],uint32_t targetCount)152 virtual MOS_STATUS PrepareResources(
153 void * source[],
154 uint32_t sourceCount,
155 void * target[],
156 uint32_t targetCount)
157 {
158 MOS_UNUSED(source);
159 MOS_UNUSED(sourceCount);
160 MOS_UNUSED(target);
161 MOS_UNUSED(targetCount);
162
163 OsStubMessage();
164 return MOS_STATUS_SUCCESS;
165 }
166
RenderBlockedFromCp()167 virtual bool RenderBlockedFromCp()
168 {
169 OsStubMessage();
170 return false;
171 }
172
AllocateTEEPhysicalBuffer(void ** ppTEEBuffer,uint32_t * pBufferSize)173 virtual MOS_STATUS AllocateTEEPhysicalBuffer(
174 void **ppTEEBuffer,
175 uint32_t *pBufferSize)
176 {
177 MOS_UNUSED(ppTEEBuffer);
178 MOS_UNUSED(pBufferSize);
179
180 OsStubMessage();
181 return MOS_STATUS_SUCCESS;
182 }
183
DeAllocateTEEPhysicalBuffer(void * pTEEBuffer)184 virtual MOS_STATUS DeAllocateTEEPhysicalBuffer(
185 void *pTEEBuffer)
186 {
187 MOS_UNUSED(pTEEBuffer);
188
189 OsStubMessage();
190 return MOS_STATUS_SUCCESS;
191 }
192
GetTK(uint32_t ** ppTKs,uint32_t * pTKsSize,uint32_t * pTKsUpdateCnt)193 virtual MOS_STATUS GetTK(
194 uint32_t **ppTKs,
195 uint32_t * pTKsSize,
196 uint32_t * pTKsUpdateCnt)
197 {
198 MOS_UNUSED(ppTKs);
199 MOS_UNUSED(pTKsSize);
200 MOS_UNUSED(pTKsUpdateCnt);
201
202 OsStubMessage();
203 return MOS_STATUS_SUCCESS;
204 }
205
GetOcaDumper()206 void *GetOcaDumper()
207 {
208 OsStubMessage();
209 return nullptr;
210 }
211
CreateOcaDumper()212 MOS_STATUS CreateOcaDumper()
213 {
214 OsStubMessage();
215 return MOS_STATUS_SUCCESS;
216 }
217
CpRegisterAccessible()218 virtual bool CpRegisterAccessible()
219 {
220 OsStubMessage();
221 return false;
222 }
223 };
224
225 //!
226 //! \brief Create MosCpInterface Object
227 //! Must use Delete_MosCpInterface to delete created Object to avoid ULT Memory Leak errors
228 //!
229 //! \param [in] pvOsInterface
230 //! void*
231 //!
232 //! \return Return CP Wrapper Object
233 //!
234 MosCpInterface* Create_MosCpInterface(void* pvOsInterface);
235
236 //!
237 //! \brief Delete the MosCpInterface Object
238 //!
239 //! \param [in] pMosCpInterface
240 //! MosCpInterface
241 //!
242 void Delete_MosCpInterface(MosCpInterface* pMosCpInterface);
243 #endif // __MOS_OS_CP_SPECIFIC_H__
244