1 #ifndef _G_CRASHCAT_REPORT_NVOC_H_
2 #define _G_CRASHCAT_REPORT_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
11  * SPDX-License-Identifier: MIT
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  */
31 
32 #include "g_crashcat_report_nvoc.h"
33 
34 #ifndef CRASHCAT_REPORT_H
35 #define CRASHCAT_REPORT_H
36 
37 #include "nv-crashcat.h"
38 #include "nvoc/object.h"
39 
40 struct CrashCatEngine;
41 
42 #ifndef __NVOC_CLASS_CrashCatEngine_TYPEDEF__
43 #define __NVOC_CLASS_CrashCatEngine_TYPEDEF__
44 typedef struct CrashCatEngine CrashCatEngine;
45 #endif /* __NVOC_CLASS_CrashCatEngine_TYPEDEF__ */
46 
47 #ifndef __nvoc_class_id_CrashCatEngine
48 #define __nvoc_class_id_CrashCatEngine 0x654166
49 #endif /* __nvoc_class_id_CrashCatEngine */
50 
51 
52 
53 typedef NvU64 CrashCatImplementer;
54 
55 #define CRASHCAT_IMPLEMENTER_UNSPECIFIED    0ull
56 #define CRASHCAT_IMPLEMENTER_LIBOS2         0x4C49424F53322E30ull   // "LIBOS2.0"
57 #define CRASHCAT_IMPLEMENTER_LIBOS3         0x4C49424F53332E31ull   // "LIBOS3.1"
58 
59 struct CrashCatReportHal {
60     unsigned short __nvoc_HalVarIdx;
61 };
62 typedef struct CrashCatReportHal CrashCatReportHal;
63 void __nvoc_init_halspec_CrashCatReportHal(CrashCatReportHal*, NV_CRASHCAT_PACKET_FORMAT_VERSION, CrashCatImplementer);
64 
65 #ifdef NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED
66 #define PRIVATE_FIELD(x) x
67 #else
68 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
69 #endif
70 struct __nvoc_inner_struc_CrashCatReport_1__ {
71     NvCrashCatReport_V1 report;
72     NvCrashCatRiscv64CsrState_V1 riscv64CsrState;
73     NvCrashCatRiscv64GprState_V1 riscv64GprState;
74     NvCrashCatRiscv64Trace_V1 *pRiscv64Trace;
75     NvCrashCatIo32State_V1 *pIo32State;
76 };
77 
78 
79 struct CrashCatReport {
80     const struct NVOC_RTTI *__nvoc_rtti;
81     struct Object __nvoc_base_Object;
82     struct Object *__nvoc_pbase_Object;
83     struct CrashCatReport *__nvoc_pbase_CrashCatReport;
84     void (*__crashcatReportLogReporter__)(struct CrashCatReport *);
85     void (*__crashcatReportLogSource__)(struct CrashCatReport *);
86     struct CrashCatReportHal reportHal;
87     struct CrashCatEngine *PRIVATE_FIELD(pEngine);
88     NvU32 PRIVATE_FIELD(validTags);
89     struct __nvoc_inner_struc_CrashCatReport_1__ PRIVATE_FIELD(v1);
90 };
91 
92 #ifndef __NVOC_CLASS_CrashCatReport_TYPEDEF__
93 #define __NVOC_CLASS_CrashCatReport_TYPEDEF__
94 typedef struct CrashCatReport CrashCatReport;
95 #endif /* __NVOC_CLASS_CrashCatReport_TYPEDEF__ */
96 
97 #ifndef __nvoc_class_id_CrashCatReport
98 #define __nvoc_class_id_CrashCatReport 0xde4777
99 #endif /* __nvoc_class_id_CrashCatReport */
100 
101 extern const struct NVOC_CLASS_DEF __nvoc_class_def_CrashCatReport;
102 
103 #define __staticCast_CrashCatReport(pThis) \
104     ((pThis)->__nvoc_pbase_CrashCatReport)
105 
106 #ifdef __nvoc_crashcat_report_h_disabled
107 #define __dynamicCast_CrashCatReport(pThis) ((CrashCatReport*)NULL)
108 #else //__nvoc_crashcat_report_h_disabled
109 #define __dynamicCast_CrashCatReport(pThis) \
110     ((CrashCatReport*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(CrashCatReport)))
111 #endif //__nvoc_crashcat_report_h_disabled
112 
113 
114 NV_STATUS __nvoc_objCreateDynamic_CrashCatReport(CrashCatReport**, Dynamic*, NvU32, va_list);
115 
116 NV_STATUS __nvoc_objCreate_CrashCatReport(CrashCatReport**, Dynamic*, NvU32,
117         NV_CRASHCAT_PACKET_FORMAT_VERSION CrashCatReportHal_version, CrashCatImplementer CrashCatReportHal_implementer, void ** arg_ppReportBytes, NvLength arg_bytesRemaining);
118 #define __objCreate_CrashCatReport(ppNewObj, pParent, createFlags, CrashCatReportHal_version, CrashCatReportHal_implementer, arg_ppReportBytes, arg_bytesRemaining) \
119     __nvoc_objCreate_CrashCatReport((ppNewObj), staticCast((pParent), Dynamic), (createFlags), CrashCatReportHal_version, CrashCatReportHal_implementer, arg_ppReportBytes, arg_bytesRemaining)
120 
121 #define crashcatReportLogReporter(arg0) crashcatReportLogReporter_DISPATCH(arg0)
122 #define crashcatReportLogReporter_HAL(arg0) crashcatReportLogReporter_DISPATCH(arg0)
123 #define crashcatReportLogSource(arg0) crashcatReportLogSource_DISPATCH(arg0)
124 #define crashcatReportLogSource_HAL(arg0) crashcatReportLogSource_DISPATCH(arg0)
125 void crashcatReportDestruct_V1(struct CrashCatReport *arg0);
126 
127 
128 #define __nvoc_crashcatReportDestruct(arg0) crashcatReportDestruct_V1(arg0)
129 void *crashcatReportExtract_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
130 
131 
132 #ifdef __nvoc_crashcat_report_h_disabled
133 static inline void *crashcatReportExtract(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) {
134     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
135     return NULL;
136 }
137 #else //__nvoc_crashcat_report_h_disabled
138 #define crashcatReportExtract(arg0, pReportBytes, bytesRemaining) crashcatReportExtract_V1(arg0, pReportBytes, bytesRemaining)
139 #endif //__nvoc_crashcat_report_h_disabled
140 
141 #define crashcatReportExtract_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtract(arg0, pReportBytes, bytesRemaining)
142 
143 void *crashcatReportExtractReport_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
144 
145 
146 #ifdef __nvoc_crashcat_report_h_disabled
147 static inline void *crashcatReportExtractReport(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) {
148     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
149     return NULL;
150 }
151 #else //__nvoc_crashcat_report_h_disabled
152 #define crashcatReportExtractReport(arg0, pReportBytes, bytesRemaining) crashcatReportExtractReport_V1(arg0, pReportBytes, bytesRemaining)
153 #endif //__nvoc_crashcat_report_h_disabled
154 
155 #define crashcatReportExtractReport_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractReport(arg0, pReportBytes, bytesRemaining)
156 
157 void *crashcatReportExtractRiscv64CsrState_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
158 
159 
160 #ifdef __nvoc_crashcat_report_h_disabled
161 static inline void *crashcatReportExtractRiscv64CsrState(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) {
162     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
163     return NULL;
164 }
165 #else //__nvoc_crashcat_report_h_disabled
166 #define crashcatReportExtractRiscv64CsrState(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64CsrState_V1(arg0, pReportBytes, bytesRemaining)
167 #endif //__nvoc_crashcat_report_h_disabled
168 
169 #define crashcatReportExtractRiscv64CsrState_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64CsrState(arg0, pReportBytes, bytesRemaining)
170 
171 void *crashcatReportExtractRiscv64GprState_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
172 
173 
174 #ifdef __nvoc_crashcat_report_h_disabled
175 static inline void *crashcatReportExtractRiscv64GprState(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) {
176     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
177     return NULL;
178 }
179 #else //__nvoc_crashcat_report_h_disabled
180 #define crashcatReportExtractRiscv64GprState(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64GprState_V1(arg0, pReportBytes, bytesRemaining)
181 #endif //__nvoc_crashcat_report_h_disabled
182 
183 #define crashcatReportExtractRiscv64GprState_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64GprState(arg0, pReportBytes, bytesRemaining)
184 
185 void *crashcatReportExtractRiscv64Trace_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
186 
187 
188 #ifdef __nvoc_crashcat_report_h_disabled
189 static inline void *crashcatReportExtractRiscv64Trace(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) {
190     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
191     return NULL;
192 }
193 #else //__nvoc_crashcat_report_h_disabled
194 #define crashcatReportExtractRiscv64Trace(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64Trace_V1(arg0, pReportBytes, bytesRemaining)
195 #endif //__nvoc_crashcat_report_h_disabled
196 
197 #define crashcatReportExtractRiscv64Trace_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64Trace(arg0, pReportBytes, bytesRemaining)
198 
199 void *crashcatReportExtractIo32State_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
200 
201 
202 #ifdef __nvoc_crashcat_report_h_disabled
203 static inline void *crashcatReportExtractIo32State(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) {
204     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
205     return NULL;
206 }
207 #else //__nvoc_crashcat_report_h_disabled
208 #define crashcatReportExtractIo32State(arg0, pReportBytes, bytesRemaining) crashcatReportExtractIo32State_V1(arg0, pReportBytes, bytesRemaining)
209 #endif //__nvoc_crashcat_report_h_disabled
210 
211 #define crashcatReportExtractIo32State_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractIo32State(arg0, pReportBytes, bytesRemaining)
212 
213 void crashcatReportLogRiscv64CsrState_V1(struct CrashCatReport *arg0);
214 
215 
216 #ifdef __nvoc_crashcat_report_h_disabled
217 static inline void crashcatReportLogRiscv64CsrState(struct CrashCatReport *arg0) {
218     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
219 }
220 #else //__nvoc_crashcat_report_h_disabled
221 #define crashcatReportLogRiscv64CsrState(arg0) crashcatReportLogRiscv64CsrState_V1(arg0)
222 #endif //__nvoc_crashcat_report_h_disabled
223 
224 #define crashcatReportLogRiscv64CsrState_HAL(arg0) crashcatReportLogRiscv64CsrState(arg0)
225 
226 void crashcatReportLogRiscv64GprState_V1(struct CrashCatReport *arg0);
227 
228 
229 #ifdef __nvoc_crashcat_report_h_disabled
230 static inline void crashcatReportLogRiscv64GprState(struct CrashCatReport *arg0) {
231     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
232 }
233 #else //__nvoc_crashcat_report_h_disabled
234 #define crashcatReportLogRiscv64GprState(arg0) crashcatReportLogRiscv64GprState_V1(arg0)
235 #endif //__nvoc_crashcat_report_h_disabled
236 
237 #define crashcatReportLogRiscv64GprState_HAL(arg0) crashcatReportLogRiscv64GprState(arg0)
238 
239 void crashcatReportLogRiscv64Trace_V1(struct CrashCatReport *arg0);
240 
241 
242 #ifdef __nvoc_crashcat_report_h_disabled
243 static inline void crashcatReportLogRiscv64Trace(struct CrashCatReport *arg0) {
244     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
245 }
246 #else //__nvoc_crashcat_report_h_disabled
247 #define crashcatReportLogRiscv64Trace(arg0) crashcatReportLogRiscv64Trace_V1(arg0)
248 #endif //__nvoc_crashcat_report_h_disabled
249 
250 #define crashcatReportLogRiscv64Trace_HAL(arg0) crashcatReportLogRiscv64Trace(arg0)
251 
252 void crashcatReportLogIo32State_V1(struct CrashCatReport *arg0);
253 
254 
255 #ifdef __nvoc_crashcat_report_h_disabled
256 static inline void crashcatReportLogIo32State(struct CrashCatReport *arg0) {
257     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
258 }
259 #else //__nvoc_crashcat_report_h_disabled
260 #define crashcatReportLogIo32State(arg0) crashcatReportLogIo32State_V1(arg0)
261 #endif //__nvoc_crashcat_report_h_disabled
262 
263 #define crashcatReportLogIo32State_HAL(arg0) crashcatReportLogIo32State(arg0)
264 
265 void crashcatReportLogReporter_V1_GENERIC(struct CrashCatReport *arg0);
266 
267 void crashcatReportLogReporter_V1_LIBOS2(struct CrashCatReport *arg0);
268 
269 static inline void crashcatReportLogReporter_DISPATCH(struct CrashCatReport *arg0) {
270     arg0->__crashcatReportLogReporter__(arg0);
271 }
272 
273 void crashcatReportLogSource_V1_GENERIC(struct CrashCatReport *arg0);
274 
275 void crashcatReportLogSource_V1_LIBOS2(struct CrashCatReport *arg0);
276 
277 static inline void crashcatReportLogSource_DISPATCH(struct CrashCatReport *arg0) {
278     arg0->__crashcatReportLogSource__(arg0);
279 }
280 
281 NV_STATUS crashcatReportConstruct_IMPL(struct CrashCatReport *arg_, void **arg_ppReportBytes, NvLength arg_bytesRemaining);
282 
283 #define __nvoc_crashcatReportConstruct(arg_, arg_ppReportBytes, arg_bytesRemaining) crashcatReportConstruct_IMPL(arg_, arg_ppReportBytes, arg_bytesRemaining)
284 void crashcatReportLog_IMPL(struct CrashCatReport *arg0);
285 
286 #ifdef __nvoc_crashcat_report_h_disabled
287 static inline void crashcatReportLog(struct CrashCatReport *arg0) {
288     NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!");
289 }
290 #else //__nvoc_crashcat_report_h_disabled
291 #define crashcatReportLog(arg0) crashcatReportLog_IMPL(arg0)
292 #endif //__nvoc_crashcat_report_h_disabled
293 
294 #undef PRIVATE_FIELD
295 
296 #ifndef NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED
297 #undef crashcatReportLogReporter
298 void NVOC_PRIVATE_FUNCTION(crashcatReportLogReporter)(struct CrashCatReport *arg0);
299 
300 #undef crashcatReportLogReporter_HAL
301 void NVOC_PRIVATE_FUNCTION(crashcatReportLogReporter_HAL)(struct CrashCatReport *arg0);
302 
303 #undef crashcatReportLogSource
304 void NVOC_PRIVATE_FUNCTION(crashcatReportLogSource)(struct CrashCatReport *arg0);
305 
306 #undef crashcatReportLogSource_HAL
307 void NVOC_PRIVATE_FUNCTION(crashcatReportLogSource_HAL)(struct CrashCatReport *arg0);
308 
309 #ifndef __nvoc_crashcat_report_h_disabled
310 #undef crashcatReportExtract
311 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtract)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
312 #endif //__nvoc_crashcat_report_h_disabled
313 
314 #ifndef __nvoc_crashcat_report_h_disabled
315 #undef crashcatReportExtractReport
316 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractReport)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
317 #endif //__nvoc_crashcat_report_h_disabled
318 
319 #ifndef __nvoc_crashcat_report_h_disabled
320 #undef crashcatReportExtractRiscv64CsrState
321 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractRiscv64CsrState)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
322 #endif //__nvoc_crashcat_report_h_disabled
323 
324 #ifndef __nvoc_crashcat_report_h_disabled
325 #undef crashcatReportExtractRiscv64GprState
326 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractRiscv64GprState)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
327 #endif //__nvoc_crashcat_report_h_disabled
328 
329 #ifndef __nvoc_crashcat_report_h_disabled
330 #undef crashcatReportExtractRiscv64Trace
331 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractRiscv64Trace)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
332 #endif //__nvoc_crashcat_report_h_disabled
333 
334 #ifndef __nvoc_crashcat_report_h_disabled
335 #undef crashcatReportExtractIo32State
336 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractIo32State)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining);
337 #endif //__nvoc_crashcat_report_h_disabled
338 
339 #ifndef __nvoc_crashcat_report_h_disabled
340 #undef crashcatReportLogRiscv64CsrState
341 void NVOC_PRIVATE_FUNCTION(crashcatReportLogRiscv64CsrState)(struct CrashCatReport *arg0);
342 #endif //__nvoc_crashcat_report_h_disabled
343 
344 #ifndef __nvoc_crashcat_report_h_disabled
345 #undef crashcatReportLogRiscv64GprState
346 void NVOC_PRIVATE_FUNCTION(crashcatReportLogRiscv64GprState)(struct CrashCatReport *arg0);
347 #endif //__nvoc_crashcat_report_h_disabled
348 
349 #ifndef __nvoc_crashcat_report_h_disabled
350 #undef crashcatReportLogRiscv64Trace
351 void NVOC_PRIVATE_FUNCTION(crashcatReportLogRiscv64Trace)(struct CrashCatReport *arg0);
352 #endif //__nvoc_crashcat_report_h_disabled
353 
354 #ifndef __nvoc_crashcat_report_h_disabled
355 #undef crashcatReportLogIo32State
356 void NVOC_PRIVATE_FUNCTION(crashcatReportLogIo32State)(struct CrashCatReport *arg0);
357 #endif //__nvoc_crashcat_report_h_disabled
358 
359 #endif // NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED
360 
361 
362 // Utility to convert a cause code to a user-friendly string
363 const char *crashcatReportRiscvCauseToString(NvU64 xcause);
364 
365 // Log indentation used for multi-line reports
366 #define CRASHCAT_LOG_INDENT "    "
367 
368 // Prefix used for multi-line reports
369 #if defined(NVRM)
370 #define CRASHCAT_LOG_PREFIX "NVRM: "
371 #else
372 #define CRASHCAT_LOG_PREFIX
373 #endif
374 
375 #define CRASHCAT_REPORT_LOG_PACKET_TYPE(pReport, fmt, ...)                  \
376     crashcatEnginePrintf(pReport->pEngine, NV_FALSE,                        \
377         CRASHCAT_LOG_PREFIX CRASHCAT_LOG_INDENT fmt, ##__VA_ARGS__)
378 #define CRASHCAT_REPORT_LOG_DATA(pReport, fmt, ...)                         \
379     crashcatEnginePrintf(pReport->pEngine, NV_FALSE,                        \
380         CRASHCAT_LOG_PREFIX CRASHCAT_LOG_INDENT CRASHCAT_LOG_INDENT fmt,    \
381         ##__VA_ARGS__)
382 
383 #endif // CRASHCAT_REPORT_H
384 
385 #ifdef __cplusplus
386 } // extern "C"
387 #endif
388 #endif // _G_CRASHCAT_REPORT_NVOC_H_
389