1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2007-2023 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 #pragma once
25 
26 #include <nvtypes.h>
27 
28 //
29 // This file was generated with FINN, an NVIDIA coding tool.
30 // Source file:      ctrl/ctrl906f.finn
31 //
32 
33 
34 
35 
36 /* GF100_GPFIFO control commands and parameters */
37 
38 #include "ctrl/ctrlxxxx.h"
39 #define NV906F_CTRL_CMD(cat,idx)  \
40     NVXXXX_CTRL_CMD(0x906F, NV906F_CTRL_##cat, idx)
41 
42 /* GF100_GPFIFO command categories (6bits) */
43 #define NV906F_CTRL_RESERVED (0x00)
44 #define NV906F_CTRL_GPFIFO   (0x01)
45 #define NV906F_CTRL_EVENT    (0x02)
46 
47 
48 /*
49  * NV906F_CTRL_CMD_NULL
50  *
51  * This command does nothing.
52  * This command does not take any parameters.
53  *
54  * Possible status values returned are:
55  *   NV_OK
56  */
57 #define NV906F_CTRL_CMD_NULL (0x906f0000) /* finn: Evaluated from "(FINN_GF100_CHANNEL_GPFIFO_RESERVED_INTERFACE_ID << 8) | 0x0" */
58 
59 
60 
61 
62 
63 
64 /*
65  * NV906F_CTRL_GET_CLASS_ENGINEID
66  *
67  * Takes an object handle as input and returns
68  * the Class and Engine that this object uses.
69  *
70  * hObject
71  *   Handle to an object created. For example a
72  *   handle to object of type FERMI_A created by
73  *   the client. This is supplied by the client
74  *   of this call.
75  *
76  * classEngineID
77  *   A concatenation of class and engineid
78  *   that the object with handle hObject
79  *   belongs to. This is returned by RM. The internal
80  *   format of this data structure is opaque to clients.
81  *
82  * classID
83  *   ClassID for object represented by hObject
84  *
85  * engineID
86  *   EngineID for object represented by hObject
87  *
88  * Possible status values returned are:
89  *   NV_OK
90  *   If the call was successful.
91  *
92  *   NV_ERR_INVALID_OBJECT_HANDLE
93  *   No object of handle hObject was found.
94  */
95 #define NV906F_CTRL_GET_CLASS_ENGINEID (0x906f0101) /* finn: Evaluated from "(FINN_GF100_CHANNEL_GPFIFO_GPFIFO_INTERFACE_ID << 8) | NV906F_CTRL_GET_CLASS_ENGINEID_PARAMS_MESSAGE_ID" */
96 
97 #define NV906F_CTRL_GET_CLASS_ENGINEID_PARAMS_MESSAGE_ID (0x1U)
98 
99 typedef struct NV906F_CTRL_GET_CLASS_ENGINEID_PARAMS {
100     NvHandle hObject;
101     NvU32    classEngineID;
102     NvU32    classID;
103     NvU32    engineID;
104 } NV906F_CTRL_GET_CLASS_ENGINEID_PARAMS;
105 
106 /*
107  * NV906F_CTRL_RESET_CHANNEL
108  *
109  * This command resets the channel corresponding to specified engine and also
110  * resets the specified engine.
111  *
112  * Takes an engine ID as input.
113  *
114  * engineID
115  *   This parameter specifies the engine to be reset.  See the description of the
116  *   NV2080_ENGINE_TYPE values in cl2080.h for more information.
117  * subdeviceInstance
118  *   This parameter specifies the subdevice to be reset when in SLI.
119  * resetReason
120  *   Specifies reason to reset a channel.
121  *
122  * bIsRcPending
123  *   Specifies if an RC is pending on the channel
124  *
125  * Possible status values returned are:
126  *   NV_OK
127  */
128 #define NV906F_CTRL_CMD_RESET_CHANNEL_REASON_DEFAULT             0
129 #define NV906F_CTRL_CMD_RESET_CHANNEL_REASON_VERIF               1
130 #define NV906F_CTRL_CMD_RESET_CHANNEL_REASON_MMU_FLT             2
131 #define NV906F_CTRL_CMD_RESET_CHANNEL_REASON_ENUM_MAX            3
132 /*
133  * Internal values for NV906F_CTRL_CMD_RESET_REASON. External values will be
134  * checked and enforced to be < NV906F_CTRL_CMD_RESET_CHANNEL_REASON_ENUM_MAX
135  */
136 #define NV906F_CTRL_CMD_INTERNAL_RESET_CHANNEL_REASON_FAKE_ERROR (0x4) /* finn: Evaluated from "NV906F_CTRL_CMD_RESET_CHANNEL_REASON_ENUM_MAX + 1" */
137 
138 
139 #define NV906F_CTRL_CMD_RESET_CHANNEL                            (0x906f0102) /* finn: Evaluated from "((FINN_GF100_CHANNEL_GPFIFO_GPFIFO_INTERFACE_ID << 8) | NV906F_CTRL_CMD_RESET_CHANNEL_PARAMS_MESSAGE_ID)" */
140 
141 #define NV906F_CTRL_CMD_RESET_CHANNEL_PARAMS_MESSAGE_ID (0x2U)
142 
143 typedef struct NV906F_CTRL_CMD_RESET_CHANNEL_PARAMS {
144     NvU32  engineID;
145     NvU32  subdeviceInstance;
146     NvU32  resetReason;
147     NvBool bIsRcPending;
148 } NV906F_CTRL_CMD_RESET_CHANNEL_PARAMS;
149 
150 /*
151  * NV906F_CTRL_CMD_EVENT_SET_NOTIFICATION
152  *
153  * This command sets event notification state for the associated channel.
154  * This command requires that an instance of NV01_EVENT has been previously
155  * bound to the associated channel object.
156  *
157  *   event
158  *     This parameter specifies the type of event to which the specified
159  *     action is to be applied.  This parameter must specify a valid
160  *     NV906F_NOTIFIERS value (see cl906f.h for more details) and should
161  *     not exceed one less NV906F_NOTIFIERS_MAXCOUNT.
162  *   action
163  *     This parameter specifies the desired event notification action.
164  *     Valid notification actions include:
165  *       NV906F_CTRL_SET_EVENT_NOTIFICATION_ACTION_DISABLE
166  *         This action disables event notification for the specified
167  *         event for the associated channel object.
168  *       NV906F_CTRL_SET_EVENT_NOTIFICATION_ACTION_SINGLE
169  *         This action enables single-shot event notification for the
170  *         specified event for the associated channel object.
171  *       NV906F_CTRL_SET_EVENT_NOTIFICATION_ACTION_REPEAT
172  *         This action enables repeated event notification for the specified
173  *         event for the associated channel object.
174  *
175  * Possible status values returned are:
176  *   NV_OK
177  *   NV_ERR_INVALID_PARAM_STRUCT
178  *   NV_ERR_INVALID_ARGUMENT
179  *   NV_ERR_INVALID_STATE
180  */
181 #define NV906F_CTRL_CMD_EVENT_SET_NOTIFICATION (0x906f0203) /* finn: Evaluated from "(FINN_GF100_CHANNEL_GPFIFO_EVENT_INTERFACE_ID << 8) | NV906F_CTRL_EVENT_SET_NOTIFICATION_PARAMS_MESSAGE_ID" */
182 
183 #define NV906F_CTRL_EVENT_SET_NOTIFICATION_PARAMS_MESSAGE_ID (0x3U)
184 
185 typedef struct NV906F_CTRL_EVENT_SET_NOTIFICATION_PARAMS {
186     NvU32 event;
187     NvU32 action;
188 } NV906F_CTRL_EVENT_SET_NOTIFICATION_PARAMS;
189 
190 /* valid action values */
191 #define NV906F_CTRL_EVENT_SET_NOTIFICATION_ACTION_DISABLE (0x00000000)
192 #define NV906F_CTRL_EVENT_SET_NOTIFICATION_ACTION_SINGLE  (0x00000001)
193 #define NV906F_CTRL_EVENT_SET_NOTIFICATION_ACTION_REPEAT  (0x00000002)
194 
195 /*
196  * NV906F_CTRL_CMD_GET_DEFER_RC_STATE
197  *
198  * If SM Debugger is attached then on a MMU fault, RM defers the RC error
199  * recovery and keeps a flag indicating that RC is deferred. This command
200  * checks whether or not deferred RC is pending in RM for the associated
201  * channel.
202  *
203  *   bDeferRCPending
204  *     The output are TRUE and FALSE.
205  *
206  * Possible status values returned are:
207  *   NV_OK
208  */
209 #define NV906F_CTRL_CMD_GET_DEFER_RC_STATE (0x906f0105) /* finn: Evaluated from "(FINN_GF100_CHANNEL_GPFIFO_GPFIFO_INTERFACE_ID << 8) | NV906F_CTRL_CMD_GET_DEFER_RC_STATE_PARAMS_MESSAGE_ID" */
210 
211 #define NV906F_CTRL_CMD_GET_DEFER_RC_STATE_PARAMS_MESSAGE_ID (0x5U)
212 
213 typedef struct NV906F_CTRL_CMD_GET_DEFER_RC_STATE_PARAMS {
214     NvBool bDeferRCPending;
215 } NV906F_CTRL_CMD_GET_DEFER_RC_STATE_PARAMS;
216 
217 #define NV906F_CTRL_CMD_GET_MMU_FAULT_INFO                         (0x906f0106) /* finn: Evaluated from "(FINN_GF100_CHANNEL_GPFIFO_GPFIFO_INTERFACE_ID << 8) | NV906F_CTRL_GET_MMU_FAULT_INFO_PARAMS_MESSAGE_ID" */
218 
219 /*
220  * Shader types supported by MMU fault info
221  * The types before compute shader refer to NV9097_SET_PIPELINE_SHADER_TYPE
222  */
223 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_VERTEX_CULL_BEFORE_FETCH 0x00000000
224 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_VERTEX                   0x00000001
225 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_TESSELLATION_INIT        0x00000002
226 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_TESSELLATION             0x00000003
227 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_GEOMETRY                 0x00000004
228 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_PIXEL                    0x00000005
229 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPE_COMPUTE                  0x00000006
230 #define NV906F_CTRL_MMU_FAULT_SHADER_TYPES                         7
231 
232 /*
233  * NV906F_CTRL_CMD_GET_MMU_FAULT_INFO
234  *
235  * This command returns MMU fault information for a given channel. The MMU
236  * fault information will be cleared once this command is executed.
237  *
238  *   addrHi - [out]
239  *      Upper 32 bits of faulting address
240  *   addrLo [out]
241  *      Lower 32 bits of faulting address
242  *   faultType [out]
243  *      MMU fault type. Please see NV_PFIFO_INTR_MMU_FAULT_INFO_TYPE_* in
244  *      dev_fifo.h for details about MMU fault type.
245  *   faultString [out]
246  *      String indicating the MMU fault type
247  *   shaderProgramVA [out]
248  *      an array of shader program virtual addresses to indicate faulted shaders in the pipeline
249  *
250  * Possible status values returned are:
251  *   NV_OK
252  */
253 #define NV906F_CTRL_MMU_FAULT_STRING_LEN                           32
254 #define NV906F_CTRL_GET_MMU_FAULT_INFO_PARAMS_MESSAGE_ID (0x6U)
255 
256 typedef struct NV906F_CTRL_GET_MMU_FAULT_INFO_PARAMS {
257     NvU32 addrHi;
258     NvU32 addrLo;
259     NvU32 faultType;
260     char  faultString[NV906F_CTRL_MMU_FAULT_STRING_LEN];
261     NV_DECLARE_ALIGNED(NvU64 shaderProgramVA[NV906F_CTRL_MMU_FAULT_SHADER_TYPES], 8);
262 } NV906F_CTRL_GET_MMU_FAULT_INFO_PARAMS;
263 
264 
265 /* _ctrl906f.h_ */
266