1 
2 #ifndef _G_CRASHCAT_ENGINE_NVOC_H_
3 #define _G_CRASHCAT_ENGINE_NVOC_H_
4 #include "nvoc/runtime.h"
5 
6 // Version of generated metadata structures
7 #ifdef NVOC_METADATA_VERSION
8 #undef NVOC_METADATA_VERSION
9 #endif
10 #define NVOC_METADATA_VERSION 0
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /*
17  * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
18  * SPDX-License-Identifier: MIT
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining a
21  * copy of this software and associated documentation files (the "Software"),
22  * to deal in the Software without restriction, including without limitation
23  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
24  * and/or sell copies of the Software, and to permit persons to whom the
25  * Software is furnished to do so, subject to the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be included in
28  * all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
33  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
36  * DEALINGS IN THE SOFTWARE.
37  */
38 
39 #pragma once
40 #include "g_crashcat_engine_nvoc.h"
41 
42 #ifndef CRASHCAT_ENGINE_H
43 #define CRASHCAT_ENGINE_H
44 
45 #include "containers/map.h"
46 #include "nvoc/object.h"
47 #include "nvport/inline/util_valist.h"
48 #include "nv-crashcat.h"
49 
50 
51 struct CrashCatReport;
52 
53 #ifndef __NVOC_CLASS_CrashCatReport_TYPEDEF__
54 #define __NVOC_CLASS_CrashCatReport_TYPEDEF__
55 typedef struct CrashCatReport CrashCatReport;
56 #endif /* __NVOC_CLASS_CrashCatReport_TYPEDEF__ */
57 
58 #ifndef __nvoc_class_id_CrashCatReport
59 #define __nvoc_class_id_CrashCatReport 0xde4777
60 #endif /* __nvoc_class_id_CrashCatReport */
61 
62 
63 
64 struct CrashCatWayfinder;
65 
66 #ifndef __NVOC_CLASS_CrashCatWayfinder_TYPEDEF__
67 #define __NVOC_CLASS_CrashCatWayfinder_TYPEDEF__
68 typedef struct CrashCatWayfinder CrashCatWayfinder;
69 #endif /* __NVOC_CLASS_CrashCatWayfinder_TYPEDEF__ */
70 
71 #ifndef __nvoc_class_id_CrashCatWayfinder
72 #define __nvoc_class_id_CrashCatWayfinder 0x085e32
73 #endif /* __nvoc_class_id_CrashCatWayfinder */
74 
75 
76 
77 typedef struct {
78     void *pEngPriv;
79     void *pMapping;
80     NvBool bRegistered;
81     NV_CRASHCAT_MEM_APERTURE aperture;
82     NvU64 physOffset;
83     NvLength size;
84     MapNode registeredBufferMapNode;
85     MapNode mappedBufferMapNode;
86 } CrashCatBufferDescriptor;
87 
88 MAKE_INTRUSIVE_MAP(CrashCatRegisteredBufferMap, CrashCatBufferDescriptor, registeredBufferMapNode);
89 MAKE_INTRUSIVE_MAP(CrashCatMappedBufferMap, CrashCatBufferDescriptor, mappedBufferMapNode);
90 
91 // Base class for engine-specific accessors - must be implemented by the host codebase.
92 
93 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for
94 // the matching C source file, but causes diagnostics to be issued if another
95 // source file references the field.
96 #ifdef NVOC_CRASHCAT_ENGINE_H_PRIVATE_ACCESS_ALLOWED
97 #define PRIVATE_FIELD(x) x
98 #else
99 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
100 #endif
101 
102 
103 struct CrashCatEngine {
104 
105     // Metadata
106     const struct NVOC_RTTI *__nvoc_rtti;
107 
108     // Ancestor object pointers for `staticCast` feature
109     struct CrashCatEngine *__nvoc_pbase_CrashCatEngine;    // crashcatEngine
110 
111     // Vtable with 10 per-object function pointers
112     void (*__crashcatEngineUnload__)(struct CrashCatEngine * /*this*/);  // virtual
113     NvBool (*__crashcatEngineConfigured__)(struct CrashCatEngine * /*this*/);  // pure virtual
114     void (*__crashcatEngineVprintf__)(struct CrashCatEngine * /*this*/, NvBool, const char *, va_list);  // pure virtual
115     NvU32 (*__crashcatEnginePriRead__)(struct CrashCatEngine * /*this*/, NvU32);  // pure virtual
116     void (*__crashcatEnginePriWrite__)(struct CrashCatEngine * /*this*/, NvU32, NvU32);  // pure virtual
117     void * (*__crashcatEngineMapBufferDescriptor__)(struct CrashCatEngine * /*this*/, CrashCatBufferDescriptor *);  // pure virtual
118     void (*__crashcatEngineUnmapBufferDescriptor__)(struct CrashCatEngine * /*this*/, CrashCatBufferDescriptor *);  // pure virtual
119     void (*__crashcatEngineSyncBufferDescriptor__)(struct CrashCatEngine * /*this*/, CrashCatBufferDescriptor *, NvU32, NvU32);  // pure virtual
120     const NvU32 * (*__crashcatEngineGetScratchOffsets__)(struct CrashCatEngine * /*this*/, NV_CRASHCAT_SCRATCH_GROUP_ID);  // pure virtual
121     NvU32 (*__crashcatEngineGetWFL0Offset__)(struct CrashCatEngine * /*this*/);  // pure virtual
122 
123     // Data members
124     NvBool PRIVATE_FIELD(bEnabled);
125     struct CrashCatWayfinder *PRIVATE_FIELD(pWayfinder);
126     CrashCatRegisteredBufferMap PRIVATE_FIELD(registeredCrashBuffers);
127     CrashCatMappedBufferMap PRIVATE_FIELD(mappedCrashBuffers);
128 };
129 
130 #ifndef __NVOC_CLASS_CrashCatEngine_TYPEDEF__
131 #define __NVOC_CLASS_CrashCatEngine_TYPEDEF__
132 typedef struct CrashCatEngine CrashCatEngine;
133 #endif /* __NVOC_CLASS_CrashCatEngine_TYPEDEF__ */
134 
135 #ifndef __nvoc_class_id_CrashCatEngine
136 #define __nvoc_class_id_CrashCatEngine 0x654166
137 #endif /* __nvoc_class_id_CrashCatEngine */
138 
139 // Casting support
140 extern const struct NVOC_CLASS_DEF __nvoc_class_def_CrashCatEngine;
141 
142 #define __staticCast_CrashCatEngine(pThis) \
143     ((pThis)->__nvoc_pbase_CrashCatEngine)
144 
145 #ifdef __nvoc_crashcat_engine_h_disabled
146 #define __dynamicCast_CrashCatEngine(pThis) ((CrashCatEngine*)NULL)
147 #else //__nvoc_crashcat_engine_h_disabled
148 #define __dynamicCast_CrashCatEngine(pThis) \
149     ((CrashCatEngine*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(CrashCatEngine)))
150 #endif //__nvoc_crashcat_engine_h_disabled
151 
152 NV_STATUS __nvoc_objCreateDynamic_CrashCatEngine(CrashCatEngine**, Dynamic*, NvU32, va_list);
153 
154 NV_STATUS __nvoc_objCreate_CrashCatEngine(CrashCatEngine**, Dynamic*, NvU32);
155 #define __objCreate_CrashCatEngine(ppNewObj, pParent, createFlags) \
156     __nvoc_objCreate_CrashCatEngine((ppNewObj), staticCast((pParent), Dynamic), (createFlags))
157 
158 
159 // Wrapper macros
160 #define crashcatEngineUnload_FNPTR(arg_this) arg_this->__crashcatEngineUnload__
161 #define crashcatEngineUnload(arg_this) crashcatEngineUnload_DISPATCH(arg_this)
162 #define crashcatEngineConfigured_FNPTR(arg_this) arg_this->__crashcatEngineConfigured__
163 #define crashcatEngineConfigured(arg_this) crashcatEngineConfigured_DISPATCH(arg_this)
164 #define crashcatEngineVprintf_FNPTR(arg_this) arg_this->__crashcatEngineVprintf__
165 #define crashcatEngineVprintf(arg_this, bReportStart, fmt, args) crashcatEngineVprintf_DISPATCH(arg_this, bReportStart, fmt, args)
166 #define crashcatEnginePriRead_FNPTR(arg_this) arg_this->__crashcatEnginePriRead__
167 #define crashcatEnginePriRead(arg_this, offset) crashcatEnginePriRead_DISPATCH(arg_this, offset)
168 #define crashcatEnginePriWrite_FNPTR(arg_this) arg_this->__crashcatEnginePriWrite__
169 #define crashcatEnginePriWrite(arg_this, offset, data) crashcatEnginePriWrite_DISPATCH(arg_this, offset, data)
170 #define crashcatEngineMapBufferDescriptor_FNPTR(arg_this) arg_this->__crashcatEngineMapBufferDescriptor__
171 #define crashcatEngineMapBufferDescriptor(arg_this, pBufDesc) crashcatEngineMapBufferDescriptor_DISPATCH(arg_this, pBufDesc)
172 #define crashcatEngineUnmapBufferDescriptor_FNPTR(arg_this) arg_this->__crashcatEngineUnmapBufferDescriptor__
173 #define crashcatEngineUnmapBufferDescriptor(arg_this, pBufDesc) crashcatEngineUnmapBufferDescriptor_DISPATCH(arg_this, pBufDesc)
174 #define crashcatEngineSyncBufferDescriptor_FNPTR(arg_this) arg_this->__crashcatEngineSyncBufferDescriptor__
175 #define crashcatEngineSyncBufferDescriptor(arg_this, pBufDesc, offset, size) crashcatEngineSyncBufferDescriptor_DISPATCH(arg_this, pBufDesc, offset, size)
176 #define crashcatEngineGetScratchOffsets_FNPTR(arg_this) arg_this->__crashcatEngineGetScratchOffsets__
177 #define crashcatEngineGetScratchOffsets(arg_this, scratchId) crashcatEngineGetScratchOffsets_DISPATCH(arg_this, scratchId)
178 #define crashcatEngineGetWFL0Offset_FNPTR(arg_this) arg_this->__crashcatEngineGetWFL0Offset__
179 #define crashcatEngineGetWFL0Offset(arg_this) crashcatEngineGetWFL0Offset_DISPATCH(arg_this)
180 
181 // Dispatch functions
crashcatEngineUnload_DISPATCH(struct CrashCatEngine * arg_this)182 static inline void crashcatEngineUnload_DISPATCH(struct CrashCatEngine *arg_this) {
183     arg_this->__crashcatEngineUnload__(arg_this);
184 }
185 
crashcatEngineConfigured_DISPATCH(struct CrashCatEngine * arg_this)186 static inline NvBool crashcatEngineConfigured_DISPATCH(struct CrashCatEngine *arg_this) {
187     return arg_this->__crashcatEngineConfigured__(arg_this);
188 }
189 
crashcatEngineVprintf_DISPATCH(struct CrashCatEngine * arg_this,NvBool bReportStart,const char * fmt,va_list args)190 static inline void crashcatEngineVprintf_DISPATCH(struct CrashCatEngine *arg_this, NvBool bReportStart, const char *fmt, va_list args) {
191     arg_this->__crashcatEngineVprintf__(arg_this, bReportStart, fmt, args);
192 }
193 
crashcatEnginePriRead_DISPATCH(struct CrashCatEngine * arg_this,NvU32 offset)194 static inline NvU32 crashcatEnginePriRead_DISPATCH(struct CrashCatEngine *arg_this, NvU32 offset) {
195     return arg_this->__crashcatEnginePriRead__(arg_this, offset);
196 }
197 
crashcatEnginePriWrite_DISPATCH(struct CrashCatEngine * arg_this,NvU32 offset,NvU32 data)198 static inline void crashcatEnginePriWrite_DISPATCH(struct CrashCatEngine *arg_this, NvU32 offset, NvU32 data) {
199     arg_this->__crashcatEnginePriWrite__(arg_this, offset, data);
200 }
201 
crashcatEngineMapBufferDescriptor_DISPATCH(struct CrashCatEngine * arg_this,CrashCatBufferDescriptor * pBufDesc)202 static inline void * crashcatEngineMapBufferDescriptor_DISPATCH(struct CrashCatEngine *arg_this, CrashCatBufferDescriptor *pBufDesc) {
203     return arg_this->__crashcatEngineMapBufferDescriptor__(arg_this, pBufDesc);
204 }
205 
crashcatEngineUnmapBufferDescriptor_DISPATCH(struct CrashCatEngine * arg_this,CrashCatBufferDescriptor * pBufDesc)206 static inline void crashcatEngineUnmapBufferDescriptor_DISPATCH(struct CrashCatEngine *arg_this, CrashCatBufferDescriptor *pBufDesc) {
207     arg_this->__crashcatEngineUnmapBufferDescriptor__(arg_this, pBufDesc);
208 }
209 
crashcatEngineSyncBufferDescriptor_DISPATCH(struct CrashCatEngine * arg_this,CrashCatBufferDescriptor * pBufDesc,NvU32 offset,NvU32 size)210 static inline void crashcatEngineSyncBufferDescriptor_DISPATCH(struct CrashCatEngine *arg_this, CrashCatBufferDescriptor *pBufDesc, NvU32 offset, NvU32 size) {
211     arg_this->__crashcatEngineSyncBufferDescriptor__(arg_this, pBufDesc, offset, size);
212 }
213 
crashcatEngineGetScratchOffsets_DISPATCH(struct CrashCatEngine * arg_this,NV_CRASHCAT_SCRATCH_GROUP_ID scratchId)214 static inline const NvU32 * crashcatEngineGetScratchOffsets_DISPATCH(struct CrashCatEngine *arg_this, NV_CRASHCAT_SCRATCH_GROUP_ID scratchId) {
215     return arg_this->__crashcatEngineGetScratchOffsets__(arg_this, scratchId);
216 }
217 
crashcatEngineGetWFL0Offset_DISPATCH(struct CrashCatEngine * arg_this)218 static inline NvU32 crashcatEngineGetWFL0Offset_DISPATCH(struct CrashCatEngine *arg_this) {
219     return arg_this->__crashcatEngineGetWFL0Offset__(arg_this);
220 }
221 
222 void crashcatEngineUnload_IMPL(struct CrashCatEngine *arg1);
223 
224 NV_STATUS crashcatEngineConstruct_IMPL(struct CrashCatEngine *arg_);
225 
226 #define __nvoc_crashcatEngineConstruct(arg_) crashcatEngineConstruct_IMPL(arg_)
227 void crashcatEngineDestruct_IMPL(struct CrashCatEngine *arg1);
228 
229 #define __nvoc_crashcatEngineDestruct(arg1) crashcatEngineDestruct_IMPL(arg1)
230 struct CrashCatReport *crashcatEngineGetNextCrashReport_IMPL(struct CrashCatEngine *arg1);
231 
232 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineGetNextCrashReport(struct CrashCatEngine * arg1)233 static inline struct CrashCatReport *crashcatEngineGetNextCrashReport(struct CrashCatEngine *arg1) {
234     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
235     return NULL;
236 }
237 #else //__nvoc_crashcat_engine_h_disabled
238 #define crashcatEngineGetNextCrashReport(arg1) crashcatEngineGetNextCrashReport_IMPL(arg1)
239 #endif //__nvoc_crashcat_engine_h_disabled
240 
241 NV_STATUS crashcatEngineRegisterCrashBuffer_IMPL(struct CrashCatEngine *arg1, NV_CRASHCAT_MEM_APERTURE aperture, NvU64 offset, NvU64 size, void *pEngPriv);
242 
243 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineRegisterCrashBuffer(struct CrashCatEngine * arg1,NV_CRASHCAT_MEM_APERTURE aperture,NvU64 offset,NvU64 size,void * pEngPriv)244 static inline NV_STATUS crashcatEngineRegisterCrashBuffer(struct CrashCatEngine *arg1, NV_CRASHCAT_MEM_APERTURE aperture, NvU64 offset, NvU64 size, void *pEngPriv) {
245     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
246     return NV_ERR_NOT_SUPPORTED;
247 }
248 #else //__nvoc_crashcat_engine_h_disabled
249 #define crashcatEngineRegisterCrashBuffer(arg1, aperture, offset, size, pEngPriv) crashcatEngineRegisterCrashBuffer_IMPL(arg1, aperture, offset, size, pEngPriv)
250 #endif //__nvoc_crashcat_engine_h_disabled
251 
252 void crashcatEngineUnregisterCrashBuffer_IMPL(struct CrashCatEngine *arg1, NV_CRASHCAT_MEM_APERTURE aperture, NvU64 offset, NvU64 size);
253 
254 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineUnregisterCrashBuffer(struct CrashCatEngine * arg1,NV_CRASHCAT_MEM_APERTURE aperture,NvU64 offset,NvU64 size)255 static inline void crashcatEngineUnregisterCrashBuffer(struct CrashCatEngine *arg1, NV_CRASHCAT_MEM_APERTURE aperture, NvU64 offset, NvU64 size) {
256     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
257 }
258 #else //__nvoc_crashcat_engine_h_disabled
259 #define crashcatEngineUnregisterCrashBuffer(arg1, aperture, offset, size) crashcatEngineUnregisterCrashBuffer_IMPL(arg1, aperture, offset, size)
260 #endif //__nvoc_crashcat_engine_h_disabled
261 
262 void *crashcatEngineMapCrashBuffer_IMPL(struct CrashCatEngine *arg1, NV_CRASHCAT_MEM_APERTURE aperture, NvU64 offset, NvU64 size);
263 
264 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineMapCrashBuffer(struct CrashCatEngine * arg1,NV_CRASHCAT_MEM_APERTURE aperture,NvU64 offset,NvU64 size)265 static inline void *crashcatEngineMapCrashBuffer(struct CrashCatEngine *arg1, NV_CRASHCAT_MEM_APERTURE aperture, NvU64 offset, NvU64 size) {
266     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
267     return NULL;
268 }
269 #else //__nvoc_crashcat_engine_h_disabled
270 #define crashcatEngineMapCrashBuffer(arg1, aperture, offset, size) crashcatEngineMapCrashBuffer_IMPL(arg1, aperture, offset, size)
271 #endif //__nvoc_crashcat_engine_h_disabled
272 
273 void crashcatEngineUnmapCrashBuffer_IMPL(struct CrashCatEngine *arg1, void *ptr);
274 
275 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineUnmapCrashBuffer(struct CrashCatEngine * arg1,void * ptr)276 static inline void crashcatEngineUnmapCrashBuffer(struct CrashCatEngine *arg1, void *ptr) {
277     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
278 }
279 #else //__nvoc_crashcat_engine_h_disabled
280 #define crashcatEngineUnmapCrashBuffer(arg1, ptr) crashcatEngineUnmapCrashBuffer_IMPL(arg1, ptr)
281 #endif //__nvoc_crashcat_engine_h_disabled
282 
283 void crashcatEngineSyncCrashBuffer_IMPL(struct CrashCatEngine *arg1, void *ptr, NvU32 offset, NvU32 size);
284 
285 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineSyncCrashBuffer(struct CrashCatEngine * arg1,void * ptr,NvU32 offset,NvU32 size)286 static inline void crashcatEngineSyncCrashBuffer(struct CrashCatEngine *arg1, void *ptr, NvU32 offset, NvU32 size) {
287     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
288 }
289 #else //__nvoc_crashcat_engine_h_disabled
290 #define crashcatEngineSyncCrashBuffer(arg1, ptr, offset, size) crashcatEngineSyncCrashBuffer_IMPL(arg1, ptr, offset, size)
291 #endif //__nvoc_crashcat_engine_h_disabled
292 
293 NV_STATUS crashcatEngineLoadWayfinder_IMPL(struct CrashCatEngine *arg1);
294 
295 #ifdef __nvoc_crashcat_engine_h_disabled
crashcatEngineLoadWayfinder(struct CrashCatEngine * arg1)296 static inline NV_STATUS crashcatEngineLoadWayfinder(struct CrashCatEngine *arg1) {
297     NV_ASSERT_FAILED_PRECOMP("CrashCatEngine was disabled!");
298     return NV_ERR_NOT_SUPPORTED;
299 }
300 #else //__nvoc_crashcat_engine_h_disabled
301 #define crashcatEngineLoadWayfinder(arg1) crashcatEngineLoadWayfinder_IMPL(arg1)
302 #endif //__nvoc_crashcat_engine_h_disabled
303 
304 #undef PRIVATE_FIELD
305 
306 #ifndef NVOC_CRASHCAT_ENGINE_H_PRIVATE_ACCESS_ALLOWED
307 #ifndef __nvoc_crashcat_engine_h_disabled
308 #undef crashcatEngineLoadWayfinder
309 NV_STATUS NVOC_PRIVATE_FUNCTION(crashcatEngineLoadWayfinder)(struct CrashCatEngine *arg1);
310 #endif //__nvoc_crashcat_engine_h_disabled
311 
312 #endif // NVOC_CRASHCAT_ENGINE_H_PRIVATE_ACCESS_ALLOWED
313 
314 
315 #define CRASHCAT_GET_ENGINE(pCrashCatObj) objFindAncestorOfType(CrashCatEngine, pCrashCatObj)
316 
317 // Non-NVOC wrapper for handling variadic arguments
318 void crashcatEnginePrintf(struct CrashCatEngine *, NvBool, const char *, ...);
319 
320 #endif // CRASHCAT_ENGINE_H
321 
322 #ifdef __cplusplus
323 } // extern "C"
324 #endif
325 
326 #endif // _G_CRASHCAT_ENGINE_NVOC_H_
327