xref: /open-nvidia-gpu/src/common/sdk/nvidia/inc/nvcd.h (revision 1739a20e)
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2002-2002 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
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 
24 #ifndef NVCD_H
25 #define NVCD_H
26 
27 //******************************************************************************
28 //
29 // Module Name: NVCD.H
30 //
31 // This file contains structures and constants that define the NV specific
32 // data to be returned by the miniport's new VideoBugCheckCallback. The callback
33 // can return up to 4k bytes of data that will be appended to the dump file.
34 // The bugcheck callback is currently only invoked for bugcheck 0xEA failures.
35 // The buffer returned contains a top level header, followed by a variable
36 // number of data records. The top level header contains an ASCII signature
37 // that can be located with a search as well as a GUID for unique identification
38 // of the crash dump layout, i.e. future bugcheck callbacks can define a new
39 // GUID to redefine the entire crash dump layout. A checksum and crash dump
40 // size values are also included to insure crash dump data integrity. The
41 // data records each contain a header indicating what group the data belongs to
42 // as well as the actual record type and size. This flexibility allows groups
43 // to define and extend the information in their records without adversely
44 // affecting the code in the debugger extension that has to parse and display
45 // this information. The structures for these individual data records are
46 // contained in separate header files for each group.
47 //
48 //******************************************************************************
49 #include "nvtypes.h"
50 
51 // Define the GUID type for non-Windows OSes
52 
53 #ifndef GUID_DEFINED
54 #define GUID_DEFINED
55 typedef struct _GUID {
56     NvU32   Data1;
57     NvU16   Data2;
58     NvU16   Data3;
59     NvU8    Data4[8];
60 } GUID, *LPGUID;
61 #endif
62 
63 // Define the crash dump ASCII tag value and the dump format GUIDs
64 #define NVCD_SIGNATURE      0x4443564E  /* ASCII crash dump signature "NVCD" */
65 
66 #define GUID_NVCD_DUMP_V1   { /* e3d5dc6e-db7d-4e28-b09e-f59a942f4a24 */    \
67                             0xe3d5dc6e, 0xdb7d, 0x4e28,                     \
68                             {0xb0, 0x9e, 0xf5, 0x9a, 0x94, 0x2f, 0x4a, 0x24}\
69 };
70 #define GUID_NVCD_DUMP_V2   { /* cd978ac1-3aa1-494b-bb5b-e93daf2b0536 */    \
71                             0xcd978ac1, 0x3aa1, 0x494b,                     \
72                             {0xbb, 0x5b, 0xe9, 0x3d, 0xaf, 0x2b, 0x05, 0x36}\
73 };
74 #define GUID_NVCDMP_RSVD1   { /* 391fc656-a37c-4574-8d57-b29a562f909b */    \
75                             0x391fc656, 0xa37c, 0x4574,                     \
76                             {0x8d, 0x57, 0xb2, 0x9a, 0x56, 0x2f, 0x90, 0x9b}\
77 };
78 #define GUID_NVCDMP_RSVD2   { /* c6d9982d-1ba9-4f80-badd-3dc992d41b46 */    \
79                             0xc6d9982d, 0x1ba9, 0x4f80,                     \
80                             {0xba, 0xdd, 0x3d, 0xc9, 0x92, 0xd4, 0x1b, 0x46}\
81 };
82 
83 // RC 2.0 NVCD (NV crash dump) GUID
84 #define GUID_NVCD_RC2_V1    {  /* d3793533-a4a6-46d3-97f2-1446cfdc1ee7 */   \
85                             0xd3793533, 0xa4a6, 0x46d3,                     \
86                             {0x97, 0xf2, 0x14, 0x46, 0xcf, 0xdc, 0x1e, 0xe7}\
87 };
88 
89 
90 // Define NVIDIA crash dump header structure (First data block in crash dump)
91 typedef struct
92 {
93     NvU32   dwSignature;            // ASCII crash dump signature "NVCD"
94     GUID    gVersion;               // GUID for crashdump file (Version)
95     NvU32   dwSize;                 // Size of the crash dump data
96     NvU8    cCheckSum;              // Crash dump checksum (Zero = ignore)
97     NvU8    cFiller[3];             // Filler (Possible CRC value)
98 } NVCD_HEADER;
99 typedef NVCD_HEADER *PNVCD_HEADER;
100 
101 // Define the crash dump record groups
102 typedef enum
103 {
104     NvcdGroup               = 0,    // NVIDIA crash dump group (System NVCD records)
105     RmGroup                 = 1,    // Resource manager group (RM records)
106     DriverGroup             = 2,    // Driver group (Driver/miniport records)
107     HardwareGroup           = 3,    // Hardware group (Hardware records)
108     InstrumentationGroup    = 4,    // Instrumentation group (Special records)
109 } NVCD_GROUP_TYPE;
110 
111 // Define the crash dump group record types (Single end of data record type)
112 typedef enum
113 {
114     EndOfData               = 0,    // End of crash dump data record
115     CompressedDataHuffman   = 1,    // Compressed huffman data
116 } NVCD_RECORD_TYPE;
117 
118 // Define the crash dump data record header
119 typedef struct
120 {
121     NvU8    cRecordGroup;           // Data record group (NVCD_GROUP_TYPE)
122     NvU8    cRecordType;            // Data record type (See group header)
123     NvU16   wRecordSize;            // Size of the data record in bytes
124 } NVCD_RECORD;
125 typedef NVCD_RECORD *PNVCD_RECORD;
126 
127 // Define the EndOfData record structure
128 typedef struct
129 {
130     NVCD_RECORD Header;             // End of data record header
131 } EndOfData_RECORD;
132 typedef EndOfData_RECORD *PEndOfData_RECORD;
133 
134 //
135 // Generic mini-record type (keep the size at 64bits)
136 //
137 typedef struct
138 {
139     NVCD_RECORD     Header;         // header for mini record
140     NvU32           Payload;        // 32 bit payload value
141 } NVCDMiniRecord;
142 typedef NVCDMiniRecord *PNVCDMiniRecord;
143 
144 //
145 // Generic record collection type
146 //
147 typedef struct
148 {
149     NVCD_RECORD     Header;         // generic header to binary type this in OCA buffer
150                                     // size is actual size of this struct + all items in collection
151     NvU32           NumRecords;     // number of records this collection contain
152     NVCD_RECORD     FirstRecord;    // first record, its data follow
153 } NVCDRecordCollection;
154 typedef NVCDRecordCollection *PNVCDRecordCollection;
155 
156 #define COLL_HEADER_SIZEOF (sizeof(NVCDRecordCollection) - sizeof(NVCD_RECORD))
157 
158 
159 #endif  // NVCD_H
160