1 #ifndef _G_JOURNAL_NVOC_H_
2 #define _G_JOURNAL_NVOC_H_
3 #include "nvoc/runtime.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * SPDX-FileCopyrightText: Copyright (c) 2005-2022 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 #include "g_journal_nvoc.h"
32 
33 #ifndef _JOURNAL_H_
34 #define _JOURNAL_H_
35 
36 //
37 // Journal object defines and Structures
38 //
39 
40 #include "kernel/core/core.h"
41 
42 #include "kernel/core/system.h"
43 #include "kernel/diagnostics/journal_structs.h"
44 #include "kernel/diagnostics/nv_debug_dump.h"
45 #include "kernel/diagnostics/traceable.h"
46 
47 #include "ctrl/ctrl2080/ctrl2080nvd.h"
48 
49 #include "lib/protobuf/prb.h"
50 #include "nvdump.h"
51 
52 // Local definition to set the default MMU Fault Type.
53 #define NV_PFAULT_FAULT_TYPE_UNKNOWN                0x000000FF;
54 // Local definition to set the default MMU Error Source/Client ID.
55 #define NV_PFIFO_INTR_MMU_FAULT_INFO_CLIENT_UNKNOWN 0x000000FF;
56 
57 #define NOCAT_COLLECT_PERF 0
58 #define NOCAT_PROBE_FB_MEMORY 0
59 
60 
61 
62 typedef struct _def_assert_list
63 {
64     NvU32                   QualifyingStackSize;    // The number of stack entries to check in order
65                                                     // to consider a record unique
66     NvU32                   Size;                   // size of list of pointers to records
67     NvU32                   Count;                  // number of records in the record list
68     PRmRCCommonAssert_RECORD *ppList;               // list of pointers to records.
69 } JOURNAL_ASSERT_LIST;
70 
71 typedef struct _def_event_journal
72 {
73     NvU8*                   pBuffer;                // pointer to buffer
74     NvU8*                   pFree;                  // pointer to first free byte in the buffer
75     NVCDRecordCollection*   pCurrCollection;        // current collection being created
76     NvU32                   BufferSize;             // size of buffer in bytes
77     NvU32                   BufferRemaining;        // remaining bytes in buffer;
78     NvU32                   RecordCount;            // total # of records currently in the buffer
79     JOURNAL_ASSERT_LIST     AssertList;             // list of asserts within the journal.
80 } EVENT_JOURNAL;
81 
82 typedef struct _def_sys_error_info
83 {
84     volatile NvU32  InUse;                            // Atomically set when a thread is accessing the structure
85     NvU32           LogCount;                         // Count of Logged Event Messages
86     NvU32           ErrorCount;                       // Count of Logged Event Messages
87     NvU32           TotalErrorCount;                  // Total Number of Errors Encountered
88     void *          pErrorList;                       // Error List
89     void *          pNextError;                       // Used to walk error list
90 } SYS_ERROR_INFO;
91 
92 // Max errors that should be logged into a SYS_ERROR_INFO.
93 #define MAX_ERROR_LOG_COUNT (0x10)
94 
95 // Max error that should be added to SYS_ERROR_INFO.pErrorList
96 #define MAX_ERROR_LIST_COUNT (0x10)
97 
98 typedef struct RING_BUFFER_LOG RING_BUFFER_LOG, *PRING_BUFFER_LOG;
99 
100 // A node in the linked list of ring buffers
101 struct RING_BUFFER_LOG
102 {
103     RMCD_RECORD_TYPE entryType;  // Type of the entries stored in this ring buffer.
104     NvU32            maxEntries; // Capacity of the ring buffer
105     NvU32            maxBufferSize;
106     NvU32            headIndex;  // Index of the first item in the ring buffer.
107     NvU32            refCount;   // Now many GPUs are using this Ring Buffer
108     //
109     // NOTE: If you want to look at the most recent item added to the ring buffer,
110     // you need to look at the entry at (headIndex+numEntries-1)%maxEntries
111     //
112     NvU32            numEntries;
113     NvU32            bufferSize;
114     NvU8             *pBuffer;   // Buffer holding the entries
115     RING_BUFFER_LOG  *pNextRingBuffer;
116 
117 };
118 
119 //
120 // A list of circular buffers. Each circular buffer is capable of
121 // storing the last n events of a particular type.
122 //
123 typedef struct
124 {
125     RING_BUFFER_LOG* pFirstEntry;  // Pointer to the first circular buffer in the list
126     NvU32        NumRingBuffers;
127 
128 } RING_BUFFER_LOG_COLLECTION;
129 
130 typedef struct
131 {
132     RmRCCommonJournal_RECORD common;
133     const PRB_FIELD_DESC *fieldDesc;
134 } RM_DATA_COLLECTION_RECORD;
135 
136 // this is the structure to hold a NOCAT report.
137 typedef struct
138 {
139     NvU32                           id;                 // record id
140     NV2080_NOCAT_JOURNAL_GPU_STATE  nocatGpuState;      // contains the state of the
141                                                         // associated GPU if there is one,
142     NV2080_NOCAT_JOURNAL_ENTRY      nocatJournalEntry;  // the NOCAT report data -- IDs, diag data etc.
143 } RM_NOCAT_JOURNAL_ENTRY;
144 
145 #define ASSERT_CALL_STACK_SIZE 10
146 #define NOCAT_CACHE_FRESHNESS_PERIOD_MS 10ULL
147 typedef struct
148 {
149     NvU32       callStack[ASSERT_CALL_STACK_SIZE];          // Call stack when the assert occurred.
150     NvU32       count;
151 } RM_NOCAT_ASSERT_DIAG_BUFFER;
152 
153 typedef struct _nocatQueueDescriptor
154 {
155     NvU64   loadAddress;
156     NvU32   nextRecordId;
157     NvU32   nextReportedId;
158     NvU32   nocatLastRecordType;
159     NvBool  journalLocked;
160     NvU32   lastRecordId[NV2080_NOCAT_JOURNAL_REC_TYPE_COUNT];
161     RM_NOCAT_ASSERT_DIAG_BUFFER   lastAssertData;
162     NvU8    tag[NV2080_NOCAT_JOURNAL_MAX_STR_LEN];
163     NvU64   cacheFreshnessPeriodticks;
164     NV2080_NOCAT_JOURNAL_GPU_STATE  nocatGpuState;      // cache contains the state of the
165                                                         // associated GPU if there is one.
166 
167     NvU32   nocatEventCounters[NV2080_NOCAT_JOURNAL_REPORT_ACTIVITY_COUNTER_COUNT];
168 } nocatQueueDescriptor;
169 
170 #ifdef NVOC_JOURNAL_H_PRIVATE_ACCESS_ALLOWED
171 #define PRIVATE_FIELD(x) x
172 #else
173 #define PRIVATE_FIELD(x) NVOC_PRIVATE_FIELD(x)
174 #endif
175 struct OBJRCDB {
176     const struct NVOC_RTTI *__nvoc_rtti;
177     struct Object __nvoc_base_Object;
178     struct OBJTRACEABLE __nvoc_base_OBJTRACEABLE;
179     struct Object *__nvoc_pbase_Object;
180     struct OBJTRACEABLE *__nvoc_pbase_OBJTRACEABLE;
181     struct OBJRCDB *__nvoc_pbase_OBJRCDB;
182     NvBool PDB_PROP_RCDB_COMPRESS;
183     NvBool PDB_PROP_RCDB_IN_DEFERRED_DUMP_CODEPATH;
184     SYS_ERROR_INFO ErrorInfo;
185     EVENT_JOURNAL Journal;
186     NvU32 BugcheckCount;
187     RING_BUFFER_LOG_COLLECTION RingBufferColl;
188     NVD_STATE nvDumpState;
189     rcErrorCounterEntry rcErrorCounterArray[10];
190     NvBool bPrevDriverCodeExecuted;
191     char *previousDriverVersion;
192     char *previousDriverBranch;
193     NvU32 prevDriverChangelist;
194     NvU32 driverLoadCount;
195     NvU16 RcErrRptNextIdx;
196     NvBool RcErrRptRecordsDropped;
197     struct Falcon *pCrashedFlcn;
198     nocatQueueDescriptor nocatJournalDescriptor;
199     NvU64 systemTimeReference;
200     NvU64 timeStampFreq;
201 };
202 
203 #ifndef __NVOC_CLASS_OBJRCDB_TYPEDEF__
204 #define __NVOC_CLASS_OBJRCDB_TYPEDEF__
205 typedef struct OBJRCDB OBJRCDB;
206 #endif /* __NVOC_CLASS_OBJRCDB_TYPEDEF__ */
207 
208 #ifndef __nvoc_class_id_OBJRCDB
209 #define __nvoc_class_id_OBJRCDB 0x15dec8
210 #endif /* __nvoc_class_id_OBJRCDB */
211 
212 extern const struct NVOC_CLASS_DEF __nvoc_class_def_OBJRCDB;
213 
214 #define __staticCast_OBJRCDB(pThis) \
215     ((pThis)->__nvoc_pbase_OBJRCDB)
216 
217 #ifdef __nvoc_journal_h_disabled
218 #define __dynamicCast_OBJRCDB(pThis) ((OBJRCDB*)NULL)
219 #else //__nvoc_journal_h_disabled
220 #define __dynamicCast_OBJRCDB(pThis) \
221     ((OBJRCDB*)__nvoc_dynamicCast(staticCast((pThis), Dynamic), classInfo(OBJRCDB)))
222 #endif //__nvoc_journal_h_disabled
223 
224 #define PDB_PROP_RCDB_IN_DEFERRED_DUMP_CODEPATH_BASE_CAST
225 #define PDB_PROP_RCDB_IN_DEFERRED_DUMP_CODEPATH_BASE_NAME PDB_PROP_RCDB_IN_DEFERRED_DUMP_CODEPATH
226 #define PDB_PROP_RCDB_COMPRESS_BASE_CAST
227 #define PDB_PROP_RCDB_COMPRESS_BASE_NAME PDB_PROP_RCDB_COMPRESS
228 
229 NV_STATUS __nvoc_objCreateDynamic_OBJRCDB(OBJRCDB**, Dynamic*, NvU32, va_list);
230 
231 NV_STATUS __nvoc_objCreate_OBJRCDB(OBJRCDB**, Dynamic*, NvU32);
232 #define __objCreate_OBJRCDB(ppNewObj, pParent, createFlags) \
233     __nvoc_objCreate_OBJRCDB((ppNewObj), staticCast((pParent), Dynamic), (createFlags))
234 
235 NV_STATUS rcdbConstruct_IMPL(struct OBJRCDB *arg_pRcdb);
236 
237 #define __nvoc_rcdbConstruct(arg_pRcdb) rcdbConstruct_IMPL(arg_pRcdb)
238 void rcdbDestruct_IMPL(struct OBJRCDB *pRcdb);
239 
240 #define __nvoc_rcdbDestruct(pRcdb) rcdbDestruct_IMPL(pRcdb)
241 NV_STATUS rcdbSavePreviousDriverVersion_IMPL(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb);
242 
243 #ifdef __nvoc_journal_h_disabled
244 static inline NV_STATUS rcdbSavePreviousDriverVersion(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb) {
245     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
246     return NV_ERR_NOT_SUPPORTED;
247 }
248 #else //__nvoc_journal_h_disabled
249 #define rcdbSavePreviousDriverVersion(pGpu, pRcdb) rcdbSavePreviousDriverVersion_IMPL(pGpu, pRcdb)
250 #endif //__nvoc_journal_h_disabled
251 
252 NV_STATUS rcdbClearErrorHistory_IMPL(struct OBJRCDB *pRcdb);
253 
254 #ifdef __nvoc_journal_h_disabled
255 static inline NV_STATUS rcdbClearErrorHistory(struct OBJRCDB *pRcdb) {
256     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
257     return NV_ERR_NOT_SUPPORTED;
258 }
259 #else //__nvoc_journal_h_disabled
260 #define rcdbClearErrorHistory(pRcdb) rcdbClearErrorHistory_IMPL(pRcdb)
261 #endif //__nvoc_journal_h_disabled
262 
263 NV_STATUS rcdbDeleteErrorElement_IMPL(struct OBJRCDB *pRcdb, void *arg0);
264 
265 #ifdef __nvoc_journal_h_disabled
266 static inline NV_STATUS rcdbDeleteErrorElement(struct OBJRCDB *pRcdb, void *arg0) {
267     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
268     return NV_ERR_NOT_SUPPORTED;
269 }
270 #else //__nvoc_journal_h_disabled
271 #define rcdbDeleteErrorElement(pRcdb, arg0) rcdbDeleteErrorElement_IMPL(pRcdb, arg0)
272 #endif //__nvoc_journal_h_disabled
273 
274 void rcdbDestroyRingBufferCollection_IMPL(struct OBJRCDB *pRcdb);
275 
276 #ifdef __nvoc_journal_h_disabled
277 static inline void rcdbDestroyRingBufferCollection(struct OBJRCDB *pRcdb) {
278     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
279 }
280 #else //__nvoc_journal_h_disabled
281 #define rcdbDestroyRingBufferCollection(pRcdb) rcdbDestroyRingBufferCollection_IMPL(pRcdb)
282 #endif //__nvoc_journal_h_disabled
283 
284 NV_STATUS rcdbAllocNextJournalRec_IMPL(struct OBJRCDB *pRcdb, NVCD_RECORD **arg0, NvU8 arg1, NvU8 arg2, NvU16 arg3);
285 
286 #ifdef __nvoc_journal_h_disabled
287 static inline NV_STATUS rcdbAllocNextJournalRec(struct OBJRCDB *pRcdb, NVCD_RECORD **arg0, NvU8 arg1, NvU8 arg2, NvU16 arg3) {
288     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
289     return NV_ERR_NOT_SUPPORTED;
290 }
291 #else //__nvoc_journal_h_disabled
292 #define rcdbAllocNextJournalRec(pRcdb, arg0, arg1, arg2, arg3) rcdbAllocNextJournalRec_IMPL(pRcdb, arg0, arg1, arg2, arg3)
293 #endif //__nvoc_journal_h_disabled
294 
295 NV_STATUS rcdbAddBugCheckRec_IMPL(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, NvU32 bugCheckCode);
296 
297 #ifdef __nvoc_journal_h_disabled
298 static inline NV_STATUS rcdbAddBugCheckRec(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, NvU32 bugCheckCode) {
299     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
300     return NV_ERR_NOT_SUPPORTED;
301 }
302 #else //__nvoc_journal_h_disabled
303 #define rcdbAddBugCheckRec(pGpu, pRcdb, bugCheckCode) rcdbAddBugCheckRec_IMPL(pGpu, pRcdb, bugCheckCode)
304 #endif //__nvoc_journal_h_disabled
305 
306 NV_STATUS rcdbAddPowerStateRec_IMPL(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, NvU32 powerEvent, NvU32 state, NvU32 fastBootPowerState);
307 
308 #ifdef __nvoc_journal_h_disabled
309 static inline NV_STATUS rcdbAddPowerStateRec(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, NvU32 powerEvent, NvU32 state, NvU32 fastBootPowerState) {
310     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
311     return NV_ERR_NOT_SUPPORTED;
312 }
313 #else //__nvoc_journal_h_disabled
314 #define rcdbAddPowerStateRec(pGpu, pRcdb, powerEvent, state, fastBootPowerState) rcdbAddPowerStateRec_IMPL(pGpu, pRcdb, powerEvent, state, fastBootPowerState)
315 #endif //__nvoc_journal_h_disabled
316 
317 NV_STATUS rcdbDumpInitGpuAccessibleFlag_IMPL(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb);
318 
319 #ifdef __nvoc_journal_h_disabled
320 static inline NV_STATUS rcdbDumpInitGpuAccessibleFlag(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb) {
321     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
322     return NV_ERR_NOT_SUPPORTED;
323 }
324 #else //__nvoc_journal_h_disabled
325 #define rcdbDumpInitGpuAccessibleFlag(pGpu, pRcdb) rcdbDumpInitGpuAccessibleFlag_IMPL(pGpu, pRcdb)
326 #endif //__nvoc_journal_h_disabled
327 
328 NvU8 *rcdbCreateRingBuffer_IMPL(struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type, NvU32 maxEntries);
329 
330 #ifdef __nvoc_journal_h_disabled
331 static inline NvU8 *rcdbCreateRingBuffer(struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type, NvU32 maxEntries) {
332     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
333     return NULL;
334 }
335 #else //__nvoc_journal_h_disabled
336 #define rcdbCreateRingBuffer(pRcdb, type, maxEntries) rcdbCreateRingBuffer_IMPL(pRcdb, type, maxEntries)
337 #endif //__nvoc_journal_h_disabled
338 
339 void rcdbDestroyRingBuffer_IMPL(struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type);
340 
341 #ifdef __nvoc_journal_h_disabled
342 static inline void rcdbDestroyRingBuffer(struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type) {
343     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
344 }
345 #else //__nvoc_journal_h_disabled
346 #define rcdbDestroyRingBuffer(pRcdb, type) rcdbDestroyRingBuffer_IMPL(pRcdb, type)
347 #endif //__nvoc_journal_h_disabled
348 
349 void rcdbAddRecToRingBuffer_IMPL(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type, NvU32 recordSize, NvU8 *pRecord);
350 
351 #ifdef __nvoc_journal_h_disabled
352 static inline void rcdbAddRecToRingBuffer(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type, NvU32 recordSize, NvU8 *pRecord) {
353     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
354 }
355 #else //__nvoc_journal_h_disabled
356 #define rcdbAddRecToRingBuffer(pGpu, pRcdb, type, recordSize, pRecord) rcdbAddRecToRingBuffer_IMPL(pGpu, pRcdb, type, recordSize, pRecord)
357 #endif //__nvoc_journal_h_disabled
358 
359 NvU32 rcdbGetOcaRecordSize_IMPL(struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type);
360 
361 #ifdef __nvoc_journal_h_disabled
362 static inline NvU32 rcdbGetOcaRecordSize(struct OBJRCDB *pRcdb, RMCD_RECORD_TYPE type) {
363     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
364     return 0;
365 }
366 #else //__nvoc_journal_h_disabled
367 #define rcdbGetOcaRecordSize(pRcdb, type) rcdbGetOcaRecordSize_IMPL(pRcdb, type)
368 #endif //__nvoc_journal_h_disabled
369 
370 NvU32 rcdbDumpJournal_IMPL(struct OBJRCDB *pRcdb, struct OBJGPU *pGpu, PRB_ENCODER *pPrbEnc, NVD_STATE *pNvDumpState, const PRB_FIELD_DESC *pFieldDesc);
371 
372 #ifdef __nvoc_journal_h_disabled
373 static inline NvU32 rcdbDumpJournal(struct OBJRCDB *pRcdb, struct OBJGPU *pGpu, PRB_ENCODER *pPrbEnc, NVD_STATE *pNvDumpState, const PRB_FIELD_DESC *pFieldDesc) {
374     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
375     return 0;
376 }
377 #else //__nvoc_journal_h_disabled
378 #define rcdbDumpJournal(pRcdb, pGpu, pPrbEnc, pNvDumpState, pFieldDesc) rcdbDumpJournal_IMPL(pRcdb, pGpu, pPrbEnc, pNvDumpState, pFieldDesc)
379 #endif //__nvoc_journal_h_disabled
380 
381 NV_STATUS rcdbDumpComponent_IMPL(struct OBJRCDB *pRcdb, NvU32 component, NVDUMP_BUFFER *pBuffer, NVDUMP_BUFFER_POLICY policy, PrbBufferCallback *pBufferCallback);
382 
383 #ifdef __nvoc_journal_h_disabled
384 static inline NV_STATUS rcdbDumpComponent(struct OBJRCDB *pRcdb, NvU32 component, NVDUMP_BUFFER *pBuffer, NVDUMP_BUFFER_POLICY policy, PrbBufferCallback *pBufferCallback) {
385     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
386     return NV_ERR_NOT_SUPPORTED;
387 }
388 #else //__nvoc_journal_h_disabled
389 #define rcdbDumpComponent(pRcdb, component, pBuffer, policy, pBufferCallback) rcdbDumpComponent_IMPL(pRcdb, component, pBuffer, policy, pBufferCallback)
390 #endif //__nvoc_journal_h_disabled
391 
392 NV_STATUS rcdbDumpSystemInfo_IMPL(struct OBJRCDB *pRcdb, PRB_ENCODER *pPrbEnc, NVD_STATE *pNvDumpState);
393 
394 #ifdef __nvoc_journal_h_disabled
395 static inline NV_STATUS rcdbDumpSystemInfo(struct OBJRCDB *pRcdb, PRB_ENCODER *pPrbEnc, NVD_STATE *pNvDumpState) {
396     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
397     return NV_ERR_NOT_SUPPORTED;
398 }
399 #else //__nvoc_journal_h_disabled
400 #define rcdbDumpSystemInfo(pRcdb, pPrbEnc, pNvDumpState) rcdbDumpSystemInfo_IMPL(pRcdb, pPrbEnc, pNvDumpState)
401 #endif //__nvoc_journal_h_disabled
402 
403 NV_STATUS rcdbDumpSystemFunc_IMPL(struct OBJRCDB *pRcdb, PRB_ENCODER *pPrbEnc, NVD_STATE *pNvDumpState);
404 
405 #ifdef __nvoc_journal_h_disabled
406 static inline NV_STATUS rcdbDumpSystemFunc(struct OBJRCDB *pRcdb, PRB_ENCODER *pPrbEnc, NVD_STATE *pNvDumpState) {
407     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
408     return NV_ERR_NOT_SUPPORTED;
409 }
410 #else //__nvoc_journal_h_disabled
411 #define rcdbDumpSystemFunc(pRcdb, pPrbEnc, pNvDumpState) rcdbDumpSystemFunc_IMPL(pRcdb, pPrbEnc, pNvDumpState)
412 #endif //__nvoc_journal_h_disabled
413 
414 NvU32 rcdbDumpErrorCounters_IMPL(struct OBJRCDB *pRcDB, struct OBJGPU *pGpu, PRB_ENCODER *pPrbEnc);
415 
416 #ifdef __nvoc_journal_h_disabled
417 static inline NvU32 rcdbDumpErrorCounters(struct OBJRCDB *pRcDB, struct OBJGPU *pGpu, PRB_ENCODER *pPrbEnc) {
418     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
419     return 0;
420 }
421 #else //__nvoc_journal_h_disabled
422 #define rcdbDumpErrorCounters(pRcDB, pGpu, pPrbEnc) rcdbDumpErrorCounters_IMPL(pRcDB, pGpu, pPrbEnc)
423 #endif //__nvoc_journal_h_disabled
424 
425 NV_STATUS rcdbGetRcDiagRecBoundaries_IMPL(struct OBJRCDB *pRcdb, NvU16 *arg0, NvU16 *arg1, NvU32 arg2, NvU32 arg3);
426 
427 #ifdef __nvoc_journal_h_disabled
428 static inline NV_STATUS rcdbGetRcDiagRecBoundaries(struct OBJRCDB *pRcdb, NvU16 *arg0, NvU16 *arg1, NvU32 arg2, NvU32 arg3) {
429     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
430     return NV_ERR_NOT_SUPPORTED;
431 }
432 #else //__nvoc_journal_h_disabled
433 #define rcdbGetRcDiagRecBoundaries(pRcdb, arg0, arg1, arg2, arg3) rcdbGetRcDiagRecBoundaries_IMPL(pRcdb, arg0, arg1, arg2, arg3)
434 #endif //__nvoc_journal_h_disabled
435 
436 NV_STATUS rcdbAddRcDiagRec_IMPL(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, RmRcDiag_RECORD *arg0);
437 
438 #ifdef __nvoc_journal_h_disabled
439 static inline NV_STATUS rcdbAddRcDiagRec(struct OBJGPU *pGpu, struct OBJRCDB *pRcdb, RmRcDiag_RECORD *arg0) {
440     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
441     return NV_ERR_NOT_SUPPORTED;
442 }
443 #else //__nvoc_journal_h_disabled
444 #define rcdbAddRcDiagRec(pGpu, pRcdb, arg0) rcdbAddRcDiagRec_IMPL(pGpu, pRcdb, arg0)
445 #endif //__nvoc_journal_h_disabled
446 
447 NV_STATUS rcdbGetRcDiagRec_IMPL(struct OBJRCDB *pRcdb, NvU16 arg0, RmRCCommonJournal_RECORD **arg1, NvU32 arg2, NvU32 arg3);
448 
449 #ifdef __nvoc_journal_h_disabled
450 static inline NV_STATUS rcdbGetRcDiagRec(struct OBJRCDB *pRcdb, NvU16 arg0, RmRCCommonJournal_RECORD **arg1, NvU32 arg2, NvU32 arg3) {
451     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
452     return NV_ERR_NOT_SUPPORTED;
453 }
454 #else //__nvoc_journal_h_disabled
455 #define rcdbGetRcDiagRec(pRcdb, arg0, arg1, arg2, arg3) rcdbGetRcDiagRec_IMPL(pRcdb, arg0, arg1, arg2, arg3)
456 #endif //__nvoc_journal_h_disabled
457 
458 NV_STATUS rcdbUpdateRcDiagRecContext_IMPL(struct OBJRCDB *pRcdb, NvU16 arg0, NvU16 arg1, NvU32 arg2, NvU32 arg3);
459 
460 #ifdef __nvoc_journal_h_disabled
461 static inline NV_STATUS rcdbUpdateRcDiagRecContext(struct OBJRCDB *pRcdb, NvU16 arg0, NvU16 arg1, NvU32 arg2, NvU32 arg3) {
462     NV_ASSERT_FAILED_PRECOMP("OBJRCDB was disabled!");
463     return NV_ERR_NOT_SUPPORTED;
464 }
465 #else //__nvoc_journal_h_disabled
466 #define rcdbUpdateRcDiagRecContext(pRcdb, arg0, arg1, arg2, arg3) rcdbUpdateRcDiagRecContext_IMPL(pRcdb, arg0, arg1, arg2, arg3)
467 #endif //__nvoc_journal_h_disabled
468 
469 void rcdbInitNocatGpuCache_IMPL(struct OBJGPU *pGpu);
470 
471 #define rcdbInitNocatGpuCache(pGpu) rcdbInitNocatGpuCache_IMPL(pGpu)
472 void rcdbCleanupNocatGpuCache_IMPL(struct OBJGPU *pGpu);
473 
474 #define rcdbCleanupNocatGpuCache(pGpu) rcdbCleanupNocatGpuCache_IMPL(pGpu)
475 #undef PRIVATE_FIELD
476 
477 
478 typedef struct
479 {
480     NvU8        recType;
481     NvU32       bugcheck;
482     const char *pSource;
483     NvU32       subsystem;
484     NvU64       errorCode NV_ALIGN_BYTES(8);
485     NvU32       diagBufferLen;
486     NvU8       *pDiagBuffer;
487     const char *pFaultingEngine;
488     NvU32       tdrReason;
489 } NOCAT_JOURNAL_PARAMS;
490 
491 NV_STATUS rcdbAddRmDclMsg(void* msg, NvU16 size, const PRB_FIELD_DESC *fieldDesc);
492 NV_STATUS rcdbAddRmEngDump(struct OBJGPU *pGpu, NvU32 component);
493 NV_STATUS rcdbAddRmGpuDump(struct OBJGPU *pGpu);
494 void rcdbSetCommonJournalRecord(struct OBJGPU *pGpu, PRmRCCommonJournal_RECORD pRec);
495 void rcdbAddCrashedFalcon(struct Falcon *pFlcn);
496 
497 NV_STATUS rcdbAddAssertJournalRec(void* pGpu, void** ppRec, NvU8 jGroup,
498     NvU8 type, NvU16 size, NvU32 level, NvU64 key);
499 NV_STATUS rcdbAddAssertJournalRecWithLine(void *pVoidGpu, NvU32 lineNum,
500     void** ppRec, NvU8 jGroup, NvU8 type, NvU16 size, NvU32 level, NvU64 key);
501 
502 NvU32 rcdbNocatInsertNocatError(struct OBJGPU *pGpu,
503     NOCAT_JOURNAL_PARAMS *nocatJournalEntry);
504 
505 NvU32 rcdbNocatInsertBugcheck(NvU32 deviceInstance, NvU32 bugCheckCode);
506 
507 NV_STATUS rcdbNocatInitEngineErrorEvent(NOCAT_JOURNAL_PARAMS *nocatJournalEntry);
508 NvU32 rcdbNocatInsertEngineError(struct OBJGPU *pGpu,
509     const char *pSource, NvU32 subsystem, NvU64 errorCode,
510     NvU8 *pDiagBuffer, NvU32 diagBufferLen);
511 
512 NvU32 rcdbNocatInsertRMCDErrorEvent(struct OBJGPU *pGpu, NvU32 recType,
513     const char *pSource, NvU32 subsystem, NvU64 errorCode, const char *pFault,
514     RMCD_ERROR_BLOCK *pRcdError);
515 
516 NV_STATUS rcdbNocatInitTDRErrorEvent(NOCAT_JOURNAL_PARAMS *nocatJournalEntry);
517 NvU32 rcdbNocatInsertTDRError(struct OBJGPU *pGpu,
518     const char *pSource, NvU32 subsystem, NvU64 errorCode,
519     NvU32 tdrBucket,
520     NvU8 *pDiagBuffer, NvU32 diagBufferLen,
521     NvU32 tdrReason, const char *pFaultingApp);
522 
523 NV_STATUS rcdbNocatInitRCErrorEvent(NOCAT_JOURNAL_PARAMS *nocatJournalEntry);
524 NvU32 rcdbNocatInsertRCError(struct OBJGPU* pGpu,
525     NvU32 subsystem, NvU64 errorCode,
526     NvU32 rcDiagRecStartIdx, NvU32 rcDiagRecEndIdx,
527     void* pAppId);
528 
529 NV_STATUS rcdbReportNextNocatJournalEntry(NV2080_NOCAT_JOURNAL_RECORD* pReport);
530 
531 NV_STATUS rcdbSetNocatTdrReason(NV2080CtrlNocatJournalDataTdrReason *pReasonData);
532 
533 NvU32 rcdbGetNocatOutstandingCount(Journal *pRcdb);
534 
535 NV_STATUS rcdbNocatJournalReportTestFill(void);
536 
537 #endif // _JOURNAL_H_
538 
539 #ifdef __cplusplus
540 } // extern "C"
541 #endif
542 
543 #endif // _G_JOURNAL_NVOC_H_
544