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 66 // Private field names are wrapped in PRIVATE_FIELD, which does nothing for 67 // the matching C source file, but causes diagnostics to be issued if another 68 // source file references the field. 69 #ifdef NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED 70 #define PRIVATE_FIELD(x) x 71 #else 72 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x) 73 #endif 74 75 struct __nvoc_inner_struc_CrashCatReport_1__ { 76 NvCrashCatReport_V1 report; 77 NvCrashCatRiscv64CsrState_V1 riscv64CsrState; 78 NvCrashCatRiscv64GprState_V1 riscv64GprState; 79 NvCrashCatRiscv64Trace_V1 *pRiscv64StackTrace; 80 NvCrashCatRiscv64Trace_V1 *pRiscv64PcTrace; 81 NvCrashCatIo32State_V1 *pIo32State; 82 }; 83 84 85 struct CrashCatReport { 86 const struct NVOC_RTTI *__nvoc_rtti; 87 struct Object __nvoc_base_Object; 88 struct Object *__nvoc_pbase_Object; 89 struct CrashCatReport *__nvoc_pbase_CrashCatReport; 90 void (*__crashcatReportLogReporter__)(struct CrashCatReport *); 91 void (*__crashcatReportLogSource__)(struct CrashCatReport *); 92 struct CrashCatReportHal reportHal; 93 struct CrashCatEngine *PRIVATE_FIELD(pEngine); 94 NvU32 PRIVATE_FIELD(validTags); 95 struct __nvoc_inner_struc_CrashCatReport_1__ PRIVATE_FIELD(v1); 96 }; 97 98 #ifndef __NVOC_CLASS_CrashCatReport_TYPEDEF__ 99 #define __NVOC_CLASS_CrashCatReport_TYPEDEF__ 100 typedef struct CrashCatReport CrashCatReport; 101 #endif /* __NVOC_CLASS_CrashCatReport_TYPEDEF__ */ 102 103 #ifndef __nvoc_class_id_CrashCatReport 104 #define __nvoc_class_id_CrashCatReport 0xde4777 105 #endif /* __nvoc_class_id_CrashCatReport */ 106 107 extern const struct NVOC_CLASS_DEF __nvoc_class_def_CrashCatReport; 108 109 #define __staticCast_CrashCatReport(pThis) \ 110 ((pThis)->__nvoc_pbase_CrashCatReport) 111 112 #ifdef __nvoc_crashcat_report_h_disabled 113 #define __dynamicCast_CrashCatReport(pThis) ((CrashCatReport*)NULL) 114 #else //__nvoc_crashcat_report_h_disabled 115 #define __dynamicCast_CrashCatReport(pThis) \ 116 ((CrashCatReport*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(CrashCatReport))) 117 #endif //__nvoc_crashcat_report_h_disabled 118 119 120 NV_STATUS __nvoc_objCreateDynamic_CrashCatReport(CrashCatReport**, Dynamic*, NvU32, va_list); 121 122 NV_STATUS __nvoc_objCreate_CrashCatReport(CrashCatReport**, Dynamic*, NvU32, 123 NV_CRASHCAT_PACKET_FORMAT_VERSION CrashCatReportHal_version, CrashCatImplementer CrashCatReportHal_implementer, void ** arg_ppReportBytes, NvLength arg_bytesRemaining); 124 #define __objCreate_CrashCatReport(ppNewObj, pParent, createFlags, CrashCatReportHal_version, CrashCatReportHal_implementer, arg_ppReportBytes, arg_bytesRemaining) \ 125 __nvoc_objCreate_CrashCatReport((ppNewObj), staticCast((pParent), Dynamic), (createFlags), CrashCatReportHal_version, CrashCatReportHal_implementer, arg_ppReportBytes, arg_bytesRemaining) 126 127 #define crashcatReportLogReporter(arg0) crashcatReportLogReporter_DISPATCH(arg0) 128 #define crashcatReportLogReporter_HAL(arg0) crashcatReportLogReporter_DISPATCH(arg0) 129 #define crashcatReportLogSource(arg0) crashcatReportLogSource_DISPATCH(arg0) 130 #define crashcatReportLogSource_HAL(arg0) crashcatReportLogSource_DISPATCH(arg0) 131 void crashcatReportDestruct_V1(struct CrashCatReport *arg0); 132 133 134 #define __nvoc_crashcatReportDestruct(arg0) crashcatReportDestruct_V1(arg0) 135 void *crashcatReportExtract_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 136 137 138 #ifdef __nvoc_crashcat_report_h_disabled 139 static inline void *crashcatReportExtract(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) { 140 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 141 return NULL; 142 } 143 #else //__nvoc_crashcat_report_h_disabled 144 #define crashcatReportExtract(arg0, pReportBytes, bytesRemaining) crashcatReportExtract_V1(arg0, pReportBytes, bytesRemaining) 145 #endif //__nvoc_crashcat_report_h_disabled 146 147 #define crashcatReportExtract_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtract(arg0, pReportBytes, bytesRemaining) 148 149 void *crashcatReportExtractReport_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 150 151 152 #ifdef __nvoc_crashcat_report_h_disabled 153 static inline void *crashcatReportExtractReport(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) { 154 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 155 return NULL; 156 } 157 #else //__nvoc_crashcat_report_h_disabled 158 #define crashcatReportExtractReport(arg0, pReportBytes, bytesRemaining) crashcatReportExtractReport_V1(arg0, pReportBytes, bytesRemaining) 159 #endif //__nvoc_crashcat_report_h_disabled 160 161 #define crashcatReportExtractReport_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractReport(arg0, pReportBytes, bytesRemaining) 162 163 void *crashcatReportExtractRiscv64CsrState_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 164 165 166 #ifdef __nvoc_crashcat_report_h_disabled 167 static inline void *crashcatReportExtractRiscv64CsrState(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) { 168 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 169 return NULL; 170 } 171 #else //__nvoc_crashcat_report_h_disabled 172 #define crashcatReportExtractRiscv64CsrState(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64CsrState_V1(arg0, pReportBytes, bytesRemaining) 173 #endif //__nvoc_crashcat_report_h_disabled 174 175 #define crashcatReportExtractRiscv64CsrState_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64CsrState(arg0, pReportBytes, bytesRemaining) 176 177 void *crashcatReportExtractRiscv64GprState_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 178 179 180 #ifdef __nvoc_crashcat_report_h_disabled 181 static inline void *crashcatReportExtractRiscv64GprState(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) { 182 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 183 return NULL; 184 } 185 #else //__nvoc_crashcat_report_h_disabled 186 #define crashcatReportExtractRiscv64GprState(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64GprState_V1(arg0, pReportBytes, bytesRemaining) 187 #endif //__nvoc_crashcat_report_h_disabled 188 189 #define crashcatReportExtractRiscv64GprState_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64GprState(arg0, pReportBytes, bytesRemaining) 190 191 void *crashcatReportExtractRiscv64Trace_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 192 193 194 #ifdef __nvoc_crashcat_report_h_disabled 195 static inline void *crashcatReportExtractRiscv64Trace(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) { 196 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 197 return NULL; 198 } 199 #else //__nvoc_crashcat_report_h_disabled 200 #define crashcatReportExtractRiscv64Trace(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64Trace_V1(arg0, pReportBytes, bytesRemaining) 201 #endif //__nvoc_crashcat_report_h_disabled 202 203 #define crashcatReportExtractRiscv64Trace_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractRiscv64Trace(arg0, pReportBytes, bytesRemaining) 204 205 void *crashcatReportExtractIo32State_V1(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 206 207 208 #ifdef __nvoc_crashcat_report_h_disabled 209 static inline void *crashcatReportExtractIo32State(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining) { 210 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 211 return NULL; 212 } 213 #else //__nvoc_crashcat_report_h_disabled 214 #define crashcatReportExtractIo32State(arg0, pReportBytes, bytesRemaining) crashcatReportExtractIo32State_V1(arg0, pReportBytes, bytesRemaining) 215 #endif //__nvoc_crashcat_report_h_disabled 216 217 #define crashcatReportExtractIo32State_HAL(arg0, pReportBytes, bytesRemaining) crashcatReportExtractIo32State(arg0, pReportBytes, bytesRemaining) 218 219 void crashcatReportLogRiscv64CsrState_V1(struct CrashCatReport *arg0); 220 221 222 #ifdef __nvoc_crashcat_report_h_disabled 223 static inline void crashcatReportLogRiscv64CsrState(struct CrashCatReport *arg0) { 224 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 225 } 226 #else //__nvoc_crashcat_report_h_disabled 227 #define crashcatReportLogRiscv64CsrState(arg0) crashcatReportLogRiscv64CsrState_V1(arg0) 228 #endif //__nvoc_crashcat_report_h_disabled 229 230 #define crashcatReportLogRiscv64CsrState_HAL(arg0) crashcatReportLogRiscv64CsrState(arg0) 231 232 void crashcatReportLogRiscv64GprState_V1(struct CrashCatReport *arg0); 233 234 235 #ifdef __nvoc_crashcat_report_h_disabled 236 static inline void crashcatReportLogRiscv64GprState(struct CrashCatReport *arg0) { 237 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 238 } 239 #else //__nvoc_crashcat_report_h_disabled 240 #define crashcatReportLogRiscv64GprState(arg0) crashcatReportLogRiscv64GprState_V1(arg0) 241 #endif //__nvoc_crashcat_report_h_disabled 242 243 #define crashcatReportLogRiscv64GprState_HAL(arg0) crashcatReportLogRiscv64GprState(arg0) 244 245 void crashcatReportLogRiscv64Traces_V1(struct CrashCatReport *arg0); 246 247 248 #ifdef __nvoc_crashcat_report_h_disabled 249 static inline void crashcatReportLogRiscv64Traces(struct CrashCatReport *arg0) { 250 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 251 } 252 #else //__nvoc_crashcat_report_h_disabled 253 #define crashcatReportLogRiscv64Traces(arg0) crashcatReportLogRiscv64Traces_V1(arg0) 254 #endif //__nvoc_crashcat_report_h_disabled 255 256 #define crashcatReportLogRiscv64Traces_HAL(arg0) crashcatReportLogRiscv64Traces(arg0) 257 258 void crashcatReportLogIo32State_V1(struct CrashCatReport *arg0); 259 260 261 #ifdef __nvoc_crashcat_report_h_disabled 262 static inline void crashcatReportLogIo32State(struct CrashCatReport *arg0) { 263 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 264 } 265 #else //__nvoc_crashcat_report_h_disabled 266 #define crashcatReportLogIo32State(arg0) crashcatReportLogIo32State_V1(arg0) 267 #endif //__nvoc_crashcat_report_h_disabled 268 269 #define crashcatReportLogIo32State_HAL(arg0) crashcatReportLogIo32State(arg0) 270 271 void crashcatReportLogReporter_V1_GENERIC(struct CrashCatReport *arg0); 272 273 void crashcatReportLogReporter_V1_LIBOS2(struct CrashCatReport *arg0); 274 275 void crashcatReportLogReporter_V1_LIBOS3(struct CrashCatReport *arg0); 276 277 static inline void crashcatReportLogReporter_DISPATCH(struct CrashCatReport *arg0) { 278 arg0->__crashcatReportLogReporter__(arg0); 279 } 280 281 void crashcatReportLogSource_V1_GENERIC(struct CrashCatReport *arg0); 282 283 void crashcatReportLogSource_V1_LIBOS2(struct CrashCatReport *arg0); 284 285 void crashcatReportLogSource_V1_LIBOS3(struct CrashCatReport *arg0); 286 287 static inline void crashcatReportLogSource_DISPATCH(struct CrashCatReport *arg0) { 288 arg0->__crashcatReportLogSource__(arg0); 289 } 290 291 NV_STATUS crashcatReportConstruct_IMPL(struct CrashCatReport *arg_, void **arg_ppReportBytes, NvLength arg_bytesRemaining); 292 293 #define __nvoc_crashcatReportConstruct(arg_, arg_ppReportBytes, arg_bytesRemaining) crashcatReportConstruct_IMPL(arg_, arg_ppReportBytes, arg_bytesRemaining) 294 void crashcatReportLog_IMPL(struct CrashCatReport *arg0); 295 296 #ifdef __nvoc_crashcat_report_h_disabled 297 static inline void crashcatReportLog(struct CrashCatReport *arg0) { 298 NV_ASSERT_FAILED_PRECOMP("CrashCatReport was disabled!"); 299 } 300 #else //__nvoc_crashcat_report_h_disabled 301 #define crashcatReportLog(arg0) crashcatReportLog_IMPL(arg0) 302 #endif //__nvoc_crashcat_report_h_disabled 303 304 #undef PRIVATE_FIELD 305 306 #ifndef NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED 307 #undef crashcatReportLogReporter 308 void NVOC_PRIVATE_FUNCTION(crashcatReportLogReporter)(struct CrashCatReport *arg0); 309 310 #undef crashcatReportLogReporter_HAL 311 void NVOC_PRIVATE_FUNCTION(crashcatReportLogReporter_HAL)(struct CrashCatReport *arg0); 312 313 #undef crashcatReportLogSource 314 void NVOC_PRIVATE_FUNCTION(crashcatReportLogSource)(struct CrashCatReport *arg0); 315 316 #undef crashcatReportLogSource_HAL 317 void NVOC_PRIVATE_FUNCTION(crashcatReportLogSource_HAL)(struct CrashCatReport *arg0); 318 319 #ifndef __nvoc_crashcat_report_h_disabled 320 #undef crashcatReportExtract 321 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtract)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 322 #endif //__nvoc_crashcat_report_h_disabled 323 324 #ifndef __nvoc_crashcat_report_h_disabled 325 #undef crashcatReportExtractReport 326 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractReport)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 327 #endif //__nvoc_crashcat_report_h_disabled 328 329 #ifndef __nvoc_crashcat_report_h_disabled 330 #undef crashcatReportExtractRiscv64CsrState 331 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractRiscv64CsrState)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 332 #endif //__nvoc_crashcat_report_h_disabled 333 334 #ifndef __nvoc_crashcat_report_h_disabled 335 #undef crashcatReportExtractRiscv64GprState 336 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractRiscv64GprState)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 337 #endif //__nvoc_crashcat_report_h_disabled 338 339 #ifndef __nvoc_crashcat_report_h_disabled 340 #undef crashcatReportExtractRiscv64Trace 341 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractRiscv64Trace)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 342 #endif //__nvoc_crashcat_report_h_disabled 343 344 #ifndef __nvoc_crashcat_report_h_disabled 345 #undef crashcatReportExtractIo32State 346 void *NVOC_PRIVATE_FUNCTION(crashcatReportExtractIo32State)(struct CrashCatReport *arg0, void *pReportBytes, NvLength bytesRemaining); 347 #endif //__nvoc_crashcat_report_h_disabled 348 349 #ifndef __nvoc_crashcat_report_h_disabled 350 #undef crashcatReportLogRiscv64CsrState 351 void NVOC_PRIVATE_FUNCTION(crashcatReportLogRiscv64CsrState)(struct CrashCatReport *arg0); 352 #endif //__nvoc_crashcat_report_h_disabled 353 354 #ifndef __nvoc_crashcat_report_h_disabled 355 #undef crashcatReportLogRiscv64GprState 356 void NVOC_PRIVATE_FUNCTION(crashcatReportLogRiscv64GprState)(struct CrashCatReport *arg0); 357 #endif //__nvoc_crashcat_report_h_disabled 358 359 #ifndef __nvoc_crashcat_report_h_disabled 360 #undef crashcatReportLogRiscv64Traces 361 void NVOC_PRIVATE_FUNCTION(crashcatReportLogRiscv64Traces)(struct CrashCatReport *arg0); 362 #endif //__nvoc_crashcat_report_h_disabled 363 364 #ifndef __nvoc_crashcat_report_h_disabled 365 #undef crashcatReportLogIo32State 366 void NVOC_PRIVATE_FUNCTION(crashcatReportLogIo32State)(struct CrashCatReport *arg0); 367 #endif //__nvoc_crashcat_report_h_disabled 368 369 #endif // NVOC_CRASHCAT_REPORT_H_PRIVATE_ACCESS_ALLOWED 370 371 372 // Utility to convert a cause code to a user-friendly string 373 const char *crashcatReportRiscvCauseToString(NvU64 xcause); 374 375 // Log indentation used for multi-line reports 376 #define CRASHCAT_LOG_INDENT " " 377 378 // Prefix used for multi-line reports 379 #if defined(NVRM) 380 #define CRASHCAT_LOG_PREFIX "NVRM: " 381 #else 382 #define CRASHCAT_LOG_PREFIX 383 #endif 384 385 #define CRASHCAT_REPORT_LOG_PACKET_TYPE(pReport, fmt, ...) \ 386 crashcatEnginePrintf(pReport->pEngine, NV_FALSE, \ 387 CRASHCAT_LOG_PREFIX CRASHCAT_LOG_INDENT fmt, ##__VA_ARGS__) 388 #define CRASHCAT_REPORT_LOG_DATA(pReport, fmt, ...) \ 389 crashcatEnginePrintf(pReport->pEngine, NV_FALSE, \ 390 CRASHCAT_LOG_PREFIX CRASHCAT_LOG_INDENT CRASHCAT_LOG_INDENT fmt, \ 391 ##__VA_ARGS__) 392 393 #endif // CRASHCAT_REPORT_H 394 395 #ifdef __cplusplus 396 } // extern "C" 397 #endif 398 399 #endif // _G_CRASHCAT_REPORT_NVOC_H_ 400