xref: /open-nvidia-gpu/src/common/inc/nvlog_defs.h (revision 26458140)
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2012-2021 NVIDIA CORPORATION & AFFILIATES
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 #ifndef _NVLOG_DEFS_H_
24 #define _NVLOG_DEFS_H_
25 
26 #include "nvtypes.h"
27 /******************* Common Debug & Trace Defines ***************************\
28 *                                                                           *
29 * Module: NVLOG_DEFS.H                                                      *
30 *                                                                           *
31 \****************************************************************************/
32 
33 #define NVLOG_MAX_DBG_MODULES  256
34 
35 /********************************/
36 /*********  Structures  *********/
37 /********************************/
38 
39 // Forward declaration, so it can be used in the function type definition.
40 
41 /**
42  * @brief Struct representing a buffer in NvLog
43  *
44  * All logging (Print, Regtrace, etc) use these buffers.
45  */
46 typedef struct _NVLOG_BUFFER NVLOG_BUFFER;
47 
48 
49 /**
50  * @brief Type of the 'push' function for NvLog buffers
51  *
52  * Function called whenever pushing something to an NvLog buffer
53  */
54 typedef NvBool (*NVLOG_BUFFER_PUSHFUNC) (NVLOG_BUFFER *, NvU8 *, NvU32);
55 
56 
57 
58 /**
59  * @brief Fields specific to ring buffers
60  */
61 typedef struct _NVLOG_RING_BUFFER_EXTRA_FIELDS
62 {
63     /** How many times the ring buffer has overflown */
64     NvU32 overflow;
65 } NVLOG_RING_BUFFER_EXTRA_FIELDS;
66 
67 
68 /**
69  * @brief Struct representing a buffer in NvLog
70  *
71  * All logging (Print, Regtrace, etc) use these buffers.
72  */
73 struct _NVLOG_BUFFER
74 {
75     /** Function to call when writing to this buffer */
76     union
77     {
78         NVLOG_BUFFER_PUSHFUNC fn;
79 
80         // Pad this union to prevent struct size from varying between 32/64 bit platforms
81         NvP64                 padding;
82     } push;
83 
84     /** Size of the buffer data section */
85     NvU32                   size;
86     /** Buffer tag, for easier identification in a dump */
87     NvU32                   tag;
88     /** Flags of the buffer, following NVLOG_BUFFER_FLAGS_* DRF's */
89     NvU32                   flags;
90     /** Position of the next available byte in the buffer */
91     NvU32                   pos;
92     /** Number of threads currently writing to this buffer */
93     volatile NvS32          threadCount;
94     /** Specific buffer types will define their fields here */
95     union
96     {
97         NVLOG_RING_BUFFER_EXTRA_FIELDS ring;
98     } extra;
99     /** Buffer data. */
100     NvU8                    data[1];
101 };
102 
103 #define NVLOG_MAX_BUFFERS_v11       16
104 #define NVLOG_MAX_BUFFERS_v12       256
105 
106 #if NVOS_IS_UNIX
107 #define NVLOG_MAX_BUFFERS           NVLOG_MAX_BUFFERS_v12
108 #define NVLOG_LOGGER_VERSION        12          // v1.2
109 #else
110 #define NVLOG_MAX_BUFFERS           NVLOG_MAX_BUFFERS_v11
111 #define NVLOG_LOGGER_VERSION        11          // v1.1
112 #endif // NVOS_IS_UNIX
113 
114 
115 //
116 // Due to this file's peculiar location, NvPort may or may not be includable
117 // This hack will go away when NvLog is moved into common/shared
118 //
119 #if NVOS_IS_MACINTOSH
120 
121 #if !PORT_IS_KERNEL_BUILD
122 typedef struct PORT_SPINLOCK PORT_SPINLOCK;
123 typedef struct PORT_MUTEX PORT_MUTEX;
124 #else
125 #include "nvport/nvport.h"
126 #endif
127 
128 #elif !defined(PORT_IS_KERNEL_BUILD)
129 typedef struct PORT_SPINLOCK PORT_SPINLOCK;
130 typedef struct PORT_MUTEX PORT_MUTEX;
131 #else
132 #include "nvport/nvport.h"
133 #endif
134 
135 /**
136  * @brief Information about the entire NvLog system
137  */
138 typedef struct _NVLOG_LOGGER
139 {
140     /** NvLog logger version */
141     NvU32           version;
142     /** Logging buffers */
143     NVLOG_BUFFER *  pBuffers[NVLOG_MAX_BUFFERS];
144     /** Index of the first unallocated buffer */
145     NvU32           nextFree;
146     /** Total number of free buffer slots */
147     NvU32           totalFree;
148     /** Lock for some buffer oprations */
149     PORT_SPINLOCK*  mainLock;
150     /** Lock for creating/deleting pBuffers and accessing them from RmCtrls */
151     PORT_MUTEX*  buffersLock;
152 } NVLOG_LOGGER;
153 extern NVLOG_LOGGER NvLogLogger;
154 
155 /**
156  * NvLog uses two locks:
157  * - NVLOG_LOGGER::mainLock is used to protect some accesses to pBuffers, or
158  * an individual pBuffers entry depending on locking flags.
159  * - NVLOG_LOGGER::buffersLock is used to protect creating/deleting pBuffers and accessing them
160  * from certain RmCtrl handlers.
161  *
162  * Historically in most contexts obtaining RMAPI lock would suffice, and mainLock would optionally
163  * be used for certain buffers. Ioctl NV_ESC_RM_NVLOG_CTRL cannot touch RMAPI lock and needs
164  * to access NvLog. The latter operation might race if called at an inopportune time: e.g. if the
165  * ioctl is called during RM init when KGSP creates/deletes GSP NvLog buffers. Using buffersLock is
166  * thus necessary to resolve the potential race.
167  *
168  * This leads to an unfortunate sequence where mainLock and buffersLock are nested. The latter lock
169  * cannot be removed as it is used in IRQ paths.
170  *
171  * This should be refactored to use a single RWLock that does conditional acquire in possible IRQ
172  * paths.
173  */
174 
175 //
176 // Buffer flags
177 //
178 
179 // Logging to this buffer is disabled
180 #define NVLOG_BUFFER_FLAGS_DISABLED                     0:0
181 #define NVLOG_BUFFER_FLAGS_DISABLED_NO                   0
182 #define NVLOG_BUFFER_FLAGS_DISABLED_YES                  1
183 
184 #define NVLOG_BUFFER_FLAGS_TYPE                         2:1
185 #define NVLOG_BUFFER_FLAGS_TYPE_RING                     0
186 #define NVLOG_BUFFER_FLAGS_TYPE_NOWRAP                   1
187 #define NVLOG_BUFFER_FLAGS_TYPE_SYSTEMLOG                2
188 
189 // Expand buffer when full
190 #define NVLOG_BUFFER_FLAGS_EXPANDABLE                   3:3
191 #define NVLOG_BUFFER_FLAGS_EXPANDABLE_NO                 0
192 #define NVLOG_BUFFER_FLAGS_EXPANDABLE_YES                1
193 
194 // Allocate buffer in non paged memory
195 #define NVLOG_BUFFER_FLAGS_NONPAGED                     4:4
196 #define NVLOG_BUFFER_FLAGS_NONPAGED_NO                   0
197 #define NVLOG_BUFFER_FLAGS_NONPAGED_YES                  1
198 
199 //
200 // Type of buffer locking to use
201 // NONE  - No locking performed, for buffers that are inherently single threaded
202 // STATE - Lock only during state change, do memory copying unlocked
203 //         Don't use with tiny buffers that overflow every write or two.
204 // FULL  - Keep everything locked for the full duration of the write
205 //
206 #define NVLOG_BUFFER_FLAGS_LOCKING                      6:5
207 #define NVLOG_BUFFER_FLAGS_LOCKING_NONE                  0
208 #define NVLOG_BUFFER_FLAGS_LOCKING_STATE                 1
209 #define NVLOG_BUFFER_FLAGS_LOCKING_FULL                  2
210 
211 // Store this buffer in OCA minidumps
212 #define NVLOG_BUFFER_FLAGS_OCA                          7:7
213 #define NVLOG_BUFFER_FLAGS_OCA_NO                        0
214 #define NVLOG_BUFFER_FLAGS_OCA_YES                       1
215 
216 // Buffer format (not included in registry key)
217 #define NVLOG_BUFFER_FLAGS_FORMAT                     10:8
218 #define NVLOG_BUFFER_FLAGS_FORMAT_PRINTF                 0
219 #define NVLOG_BUFFER_FLAGS_FORMAT_LIBOS_LOG              1
220 #define NVLOG_BUFFER_FLAGS_FORMAT_MEMTRACK               2
221 
222 // Never deallocate this buffer until RM is unloaded
223 #define NVLOG_BUFFER_FLAGS_PRESERVE                     11:11
224 #define NVLOG_BUFFER_FLAGS_PRESERVE_NO                  0
225 #define NVLOG_BUFFER_FLAGS_PRESERVE_YES                 1
226 
227 // Buffer GPU index
228 #define NVLOG_BUFFER_FLAGS_GPU_INSTANCE              31:24
229 
230 typedef NvU32 NVLOG_BUFFER_HANDLE;
231 
232 //
233 // Utility macros
234 //
235 #define NVLOG_IS_RING_BUFFER(pBuffer)                                          \
236     FLD_TEST_DRF(LOG_BUFFER, _FLAGS, _TYPE, _RING, pBuffer->flags)
237 #define NVLOG_IS_NOWRAP_BUFFER(pBuffer)                                        \
238     FLD_TEST_DRF(LOG_BUFFER, _FLAGS, _TYPE, _NOWRAP, pBuffer->flags)
239 
240 #define NVLOG_PRINT_BUFFER_SIZE(pBuffer)               ((pBuffer)->size)
241 #define NVLOG_BUFFER_SIZE(pBuffer)                                             \
242     (NV_OFFSETOF(NVLOG_BUFFER, data) + NVLOG_PRINT_BUFFER_SIZE(pBuffer))
243 
244 /********************************/
245 /*********  Filtering  **********/
246 /********************************/
247 // TODO - Remove all this once tools are updated
248 
249 #define NVLOG_FILTER_INVALID                            (~0)
250 
251 #define NVLOG_FILTER_VALUE_SIMPLE_NO                     0x0
252 #define NVLOG_FILTER_VALUE_SIMPLE_YES                    0x1
253 #define NVLOG_FILTER_VALUE_EXPLICIT_NO                   0x2
254 #define NVLOG_FILTER_VALUE_EXPLICIT_YES                  0x3
255 
256 #define NVLOG_FILTER_PRINT_LEVEL_REGTRACE                1:0
257 #define NVLOG_FILTER_PRINT_LEVEL_INFO                    3:2
258 #define NVLOG_FILTER_PRINT_LEVEL_NOTICE                  5:4
259 #define NVLOG_FILTER_PRINT_LEVEL_WARNINGS                7:6
260 #define NVLOG_FILTER_PRINT_LEVEL_ERRORS                  9:8
261 #define NVLOG_FILTER_PRINT_LEVEL_HW_ERROR               11:10
262 #define NVLOG_FILTER_PRINT_LEVEL_FATAL                  13:12
263 
264 #define NVLOG_FILTER_PRINT_BUFFER                       18:14
265 #define NVLOG_FILTER_REGTRACE_BUFFER                    22:19
266 
267 #define NVLOG_FILTER_REGTRACE_LOG_READ                  25:23
268 #define NVLOG_FILTER_REGTRACE_LOG_WRITE                 27:26
269 #define NVLOG_FILTER_REGTRACE_BREAK_READ                29:28
270 #define NVLOG_FILTER_REGTRACE_BREAK_WRITE               31:30
271 
272 #define NVLOG_FILTER_VALUE_IS_NO(val)               ((val & 0x1) == 0)
273 #define NVLOG_FILTER_VALUE_IS_YES(val)               (val & 0x1)
274 #define NVLOG_FILTER_PRINT_GET_VALUE(level, num)    ((num >> (level*2)) & 0x3)
275 
276 /**
277  * @brief Type representing a value of a given 16bit range.
278  */
279 typedef struct _NVLOG_RANGE_16
280 {
281     NvU16 low;
282     NvU16 high;
283     NvU32 value;
284 } NVLOG_RANGE_16;
285 
286 
287 /**
288  * @brief Type representing a value of a given 32bit range.
289  */
290 typedef struct _NVLOG_RANGE_32
291 {
292     NvU32 low;
293     NvU32 high;
294     NvU32 value;
295 } NVLOG_RANGE_32;
296 
297 //
298 // Maximum number of files that have a filter assigned to them.
299 //
300 #define NVLOG_MAX_FILES                         1
301 //
302 // Maximum number of line rules (both single line and range) allowed per file
303 //
304 #define NVLOG_FILELINE_FILTER_MAX_RANGES        1
305 
306 /**
307  * @brief Internal type for NVLOG_FILELINE_FILTER.
308  *
309  * Contains filtering info for a single file.
310  */
311 typedef struct _NVLOG_FILELINE_FILTER_FILEHASH
312 {
313     /** ID of the file (24bit MD5) */
314     NvU32 fileId;
315     /** Number of elements in the array 'ranges' */
316     NvU32 numElems;
317     /** Value to use if the given value isn't found in the range array */
318     NvU32 defaultValue;
319     /** Array of ranges representing lines in the file */
320     NVLOG_RANGE_16 ranges[NVLOG_FILELINE_FILTER_MAX_RANGES];
321 } NVLOG_FILELINE_FILTER_FILEHASH;
322 
323 /**
324  * @brief Filter that contains rules that depend on the file and line number.
325  */
326 typedef struct _NVLOG_FILELINE_FILTER
327 {
328     /** Number of elements in the fileHash array */
329     NvU32 numFiles;
330     /** Value to use if a given file isn't found */
331     NvU32 defaultValue;
332     /** Array of file entries, ordered as a hash table */
333     NVLOG_FILELINE_FILTER_FILEHASH fileHash[NVLOG_MAX_FILES];
334 } NVLOG_FILELINE_FILTER;
335 
336 /********************************/
337 /********* Print Logger *********/
338 /********************************/
339 
340 #define NVLOG_PRINT_LOGGER_VERSION                 11     // v1.1
341 // Max buffers cannot be over 32.
342 #define NVLOG_PRINT_MAX_BUFFERS                    8
343 
344 #define NVLOG_PRINT_BUFFER_PRIMARY                 1
345 #define NVLOG_PRINT_BUFFER_SECONDARY               2
346 #define NVLOG_PRINT_BUFFER_SYSTEMLOG               3
347 
348 #define NVLOG_PRINT_DESC1_FILEID                 23:0
349 #define NVLOG_PRINT_DESC1_GPUID                  28:24    // 2^5 = 32 possible
350 #define NVLOG_PRINT_DESC1_MAGIC                  31:29
351 #define NVLOG_PRINT_DESC1_MAGIC_VALUE              5
352 
353 #define NVLOG_PRINT_DESC2_LINEID                 15:0
354 #define NVLOG_PRINT_DESC2_GROUPID                17:16
355 #define NVLOG_PRINT_DESC2_GROUPID_RM               0
356 #define NVLOG_PRINT_DESC2_GROUPID_PMU              1
357 #define NVLOG_PRINT_DESC2_OPT_DATA_COUNT         24:18    // number of dwords
358 #define NVLOG_PRINT_DESC2_OPT_DATA_COUNT_MAX      0x7F
359 #define NVLOG_PRINT_DESC2_RESERVED               28:25
360 #define NVLOG_PRINT_DESC2_MAGIC                  31:29
361 #define NVLOG_PRINT_DESC2_MAGIC_VALUE              6
362 
363 #define NVLOG_UNKNOWN_GPU_INSTANCE                0x1f
364 
365 #define NVLOG_PRINT_MODULE_FILTER_VALUE           1:0
366 #define NVLOG_PRINT_MODULE_FILTER_BUFFER          6:2
367 #define NVLOG_PRINT_MODULE_FILTER_ENABLED         7:7
368 
369 //
370 // Regkey fields - These are copied directly from nvRmReg.h
371 // A copy is necessary as these might be needed on systems that don't
372 // have nvRmReg.h, such as DVS builds for NvWatch
373 //
374 #ifndef NV_REG_STR_RM_NVLOG
375 #define NV_REG_STR_RM_NVLOG                          "RMNvLog"
376 #define NV_REG_STR_RM_NVLOG_BUFFER_FLAGS                7:0
377 #define NV_REG_STR_RM_NVLOG_BUFFER_SIZE                23:8
378 #define NV_REG_STR_RM_NVLOG_BUFFER_SIZE_DEFAULT  ((NVOS_IS_WINDOWS||NVOS_IS_MACINTOSH)?8:250)
379 #define NV_REG_STR_RM_NVLOG_BUFFER_SIZE_DISABLE          0
380 #define NV_REG_STR_RM_NVLOG_RUNTIME_LEVEL              28:25
381 #define NV_REG_STR_RM_NVLOG_TIMESTAMP                  30:29
382 #define NV_REG_STR_RM_NVLOG_TIMESTAMP_NONE               0
383 #define NV_REG_STR_RM_NVLOG_TIMESTAMP_32                 1
384 #define NV_REG_STR_RM_NVLOG_TIMESTAMP_64                 2
385 #define NV_REG_STR_RM_NVLOG_TIMESTAMP_32_DIFF            3
386 #define NV_REG_STR_RM_NVLOG_INITED                     31:31
387 #define NV_REG_STR_RM_NVLOG_INITED_NO                    0
388 #define NV_REG_STR_RM_NVLOG_INITED_YES                   1
389 #endif // NV_REG_STR_RM_NVLOG
390 
391 
392 //
393 // Arg types:
394 //    0:    Special meaning. End of argument list.
395 //    1:    d, u, x, X, i, o             - Integer type
396 //    2:    lld, llu, llx, llX, lli, llo - Long long integer type
397 //    3:    s                            - string type (size is 0)
398 //    4:    p                            - pointer type
399 //    5:    c                            - char type
400 //    6:    f, g, e, F, G, E             - floating point type
401 //    7-14: Unused at the moment, default value is 0
402 //    15:   Special meaning. Error value - unsupported type.
403 //
404 #define NVLOG_PRINT_MAX_ARG_TYPES                 0x10
405 #define NVLOG_PRINT_ARG_TYPE_ARGLIST_END          0x0
406 #define NVLOG_PRINT_ARG_TYPE_INT                  0x1
407 #define NVLOG_PRINT_ARG_TYPE_LONGLONG             0x2
408 #define NVLOG_PRINT_ARG_TYPE_STRING               0x3
409 #define NVLOG_PRINT_ARG_TYPE_POINTER              0x4
410 #define NVLOG_PRINT_ARG_TYPE_CHAR                 0x5
411 #define NVLOG_PRINT_ARG_TYPE_FLOAT                0x6
412 #define NVLOG_PRINT_ARG_TYPE_ERROR                0xf
413 
414 
415 /**
416  * @brief Signature of the database required to decode the print logs
417  *
418  * The sig1-sig3 values are generated randomly at compile time.
419  */
420 typedef struct _NVLOG_DB_SIGNATURE
421 {
422     NvU32 timestamp;
423     NvU32 sig1;
424     NvU32 sig2;
425     NvU32 sig3;
426 } NVLOG_DB_SIGNATURE;
427 
428 /**
429  * @brief Filter that contains all rules used to filter DBG_PRINTF calls
430  */
431 typedef struct _NVLOG_PRINT_FILTER
432 {
433     /** Same file:line filter is shared with the Regtrace system */
434     NVLOG_FILELINE_FILTER *pFileLineFilter;
435     /** Filter based on debug levels. Uses NVLOG_FILTER_PRINT_LEVEL_* DRF's */
436     NvU32 runtimePrintLevelFilter;
437     /** Filter based on debug modules. Uses NVLOG_PRINT_MODULE_FILTER_* DRF's */
438     NvU8  runtimePrintModuleFilter[NVLOG_MAX_DBG_MODULES];
439 } NVLOG_PRINT_FILTER;
440 
441 
442 /**
443  * @brief Enum representing all possible argument types to DBG_PRINTF
444  */
445 typedef enum _NVLOG_ARGTYPE
446 {
447     NVLOG_ARGTYPE_NONE,
448     NVLOG_ARGTYPE_INT,
449     NVLOG_ARGTYPE_LONG_LONG_INT,
450     NVLOG_ARGTYPE_STRING,
451     NVLOG_ARGTYPE_POINTER,
452     NVLOG_ARGTYPE_FLOAT,
453     NVLOG_ARGTYPE__COUNT
454 } NVLOG_ARGTYPE;
455 
456 /**
457  * @brief General info about the NvLog Print system
458  */
459 typedef struct _NVLOG_PRINT_LOGGER
460 {
461     /** NvLog print logger version */
462     NvU32               version;
463     /** Runtime argument sizes (16 different arglist values) */
464     NvU8                runtimeSizes[NVLOG_PRINT_MAX_ARG_TYPES];
465     /** Database signature for decoding */
466     NVLOG_DB_SIGNATURE  signature;
467     /** Filter buffer for print statements */
468     NVLOG_PRINT_FILTER  filter;
469     /** Flags for all NvLog print buffers */
470     NvU32               flags;
471     /** Buffer indices for all nvlog buffers. buffers[1] is default. */
472     NvU32               buffers[NVLOG_PRINT_MAX_BUFFERS];
473     /** Initialized flag, set to true after nvlogPrintInit has executed */
474     NvBool              initialized;
475     /** Paused flag, set to true after nvlogPrintInit has executed */
476     NvBool              paused;
477 } NVLOG_PRINT_LOGGER;
478 extern NVLOG_PRINT_LOGGER NvLogPrintLogger;
479 
480 #define NVLOG_PRINT_BUFFER_TAG(_i)      NvU32_BUILD('t','r','p','0' + (_i))
481 
482 /********************************/
483 /**********  Regtrace  **********/
484 /********************************/
485 
486 #define NVLOG_REGTRACE_LOGGER_VERSION          10   // v1.0
487 #define NVLOG_REGTRACE_MAX_BUFFERS             4
488 
489 #define NVLOG_REGTRACE_READ                    0
490 #define NVLOG_REGTRACE_WRITE                   1
491 
492 #define NVLOG_REGTRACE_DESC1_FILEID            NVLOG_PRINT_DESC1_FILEID
493 #define NVLOG_REGTRACE_DESC1_GPUID             NVLOG_PRINT_DESC1_GPUID
494 #define NVLOG_REGTRACE_DESC1_MAGIC             NVLOG_PRINT_DESC1_MAGIC
495 #define NVLOG_REGTRACE_DESC1_MAGIC_VALUE       (NVLOG_PRINT_DESC1_MAGIC_VALUE-1)
496 
497 #define NVLOG_REGTRACE_DESC2_LINEID            15:0
498 #define NVLOG_REGTRACE_DESC2_READWRITE         16:16
499 #define NVLOG_REGTRACE_DESC2_READWRITE_READ    NVLOG_REGTRACE_READ
500 #define NVLOG_REGTRACE_DESC2_READWRITE_WRITE   NVLOG_REGTRACE_WRITE
501 #define NVLOG_REGTRACE_DESC2_REGSIZE           18:17
502 #define NVLOG_REGTRACE_DESC2_REGSIZE_8         0
503 #define NVLOG_REGTRACE_DESC2_REGSIZE_16        1
504 #define NVLOG_REGTRACE_DESC2_REGSIZE_32        2
505 #define NVLOG_REGTRACE_DESC2_REGSIZE_64        3
506 #define NVLOG_REGTRACE_DESC2_THREADID          28:19
507 #define NVLOG_REGTRACE_DESC2_MAGIC             31:29
508 #define NVLOG_REGTRACE_DESC2_MAGIC_VALUE       3
509 
510 /**
511  * @brief Single entry in an NvLog Regtrace buffer.
512  */
513 typedef struct _NVLOG_REGTRACE_RECORD
514 {
515     /** Uses NVLOG_REGTRACE_DESC1_* DRF's */
516     NvU32 desc1;
517     /** Uses NVLOG_REGTRACE_DESC1_* DRF's */
518     NvU32 desc2;
519     /** Address of the register being accessed */
520     NvU32 address;
521     /** Value that was read/written */
522     NvU32 value;
523 } NVLOG_REGTRACE_RECORD;
524 
525 
526 
527 #define NVLOG_REGTRACE_FILTER_MAX_RANGES       256
528 
529 // Regtrace shares the file:line filter with print
530 
531 
532 /**
533  * @brief Filter that contains all rules used to filter register access logging
534  */
535 typedef struct _NVLOG_REGTRACE_FILTER
536 {
537     /** Number of elements in the 'ranges' array */
538     NvU32 numRanges;
539     /** File:line based filter. Shared with NvLog print system */
540     NVLOG_FILELINE_FILTER *pFileLineFilter;
541     /** Range array for filtering based on register addresses */
542     NVLOG_RANGE_32 ranges[NVLOG_REGTRACE_FILTER_MAX_RANGES];
543 } NVLOG_REGTRACE_FILTER;
544 
545 /**
546  * @brief General info about the NvLog Regtrace system
547  */
548 typedef struct _NVLOG_REGTRACE_LOGGER
549 {
550     /** NvLog regtrace logger version */
551     NvU32 version;
552     /** Filter buffer for regtrace statements */
553     NVLOG_REGTRACE_FILTER filter;
554     /** Buffer indices for all NvLog buffers. First element is default buffer */
555     NvU32 buffers[NVLOG_REGTRACE_MAX_BUFFERS];
556 } NVLOG_REGTRACE_LOGGER;
557 
558 #endif // _NVLOG_DEFS_H_
559