1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2010-2015 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/ctrl208f/ctrl208ffbio.finn
31 //
32 
33 #include "ctrl/ctrl208f/ctrl208fbase.h"
34 
35 /*
36  * NV208F_CTRL_CMD_FBIO_SETUP_TRAINING_EXP
37  *
38  * This command defines an fbio training experiment for later use.
39  *
40  * This command has the form of a 'cmd' operation descriminant
41  * followed by a union populated with an operand to match the 'cmd'.
42  *
43  * Possible status values returned are:
44  *   NV_OK
45  *   NV_ERR_INVALID_PARAM_STRUCT
46  *   NV_ERR_INVALID_ARGUMENT
47  *   NV_ERR_INVALID_COMMAND
48  *
49  */
50 #define NV208F_CTRL_CMD_FBIO_SETUP_TRAINING_EXP                     (0x208f0a03) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_DIAG_FBIO_INTERFACE_ID << 8) | NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_PARAMS_MESSAGE_ID" */
51 
52 /*
53  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_NULL
54  *
55  * This command has no effect when used.
56  */
57 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_NULL                    0
58 
59 /*
60  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS
61  *
62  * This command defines the number of register modification slots to be used
63  * in the setup phase of the pass/fail training exercise.  Using this cmd
64  * causes any previously defined modification table to be cleared/released.
65  * The maximum size of the table is defined by
66  *     _SETUP_FBIO_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS__MAX
67  * Using the value of zero for number of mod slots is valid.  "Mod slots"
68  * are defined below.
69  *
70  * Possible status values returned are:
71  *   NV_ERR_INVALID_LIMIT
72  *     if modSlots is > __MAX
73  *   NV_ERR_INSUFFICIENT_RESOURCES
74  *     if we're out of memory setting up the mod slot table
75  */
76 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS 1
77 typedef struct NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS_OPERANDS {
78     NvU32 modSlots;
79 } NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS_OPERANDS;
80 
81 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS__MAX 256
82 
83 /*
84  * NV208F_CTRL_FBIO_SETUPFBIO_TRAINING_EXP_SET_MOD_SLOT
85  *
86  * This command is used to define each individual element of the the sequence
87  * of operations which will be performed before running the pass/fail training
88  * exercise.  Note that this cmd is multi-cmd (with a null cmd all its own,
89  * etc).
90  *
91  * Possible status values returned are:
92  *   NV_ERR_INVALID_INDEX
93  *     if seq is out of range for previously set SET_NUMBER_OF_MOD_SLOTS
94  *     operation.
95  *   NV_ERR_INVALID_COMMAND
96  *     if cmd isn't recognized
97  */
98 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT                 2
99 
100 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_NULL            0
101 
102 /*
103  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_SET_REGISTER
104  *
105  * This cmd is used to define a register transaction to be applied in
106  * sequence before running the pass/fail experiment.  This is where
107  * NV_PFB_TRAINING_ADR, NV_PFB_TRAINING_CMD, NV_PFB_TRAINING_DP(i),
108  * NV_PFB_TRAINING_THRESHOLD and NV_PFB_TRAINING_MASK, etc. should be
109  * configured before calling back with cmd
110  * NV208F_CTRL_CMD_FBIO_RUN_TRAINING_EXP.
111  *
112  *   reg
113  *     This parameter specifies the BAR0 register offset to affect.
114  *   andMask
115  *   orMask
116  *     These parameter specify the RMW values to be used in the following:
117  *       write32(reg, (read32(reg) & andMask) | orMask)
118  */
119 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_SET_REGISTER    1
120 typedef struct NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_SET_REGISTER_OPERANDS {
121     NvU32 reg;
122     NvU32 andMask;
123     NvU32 orMask;
124 } NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_SET_REGISTER_OPERANDS;
125 
126 /*
127  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_DELAY
128  *
129  * This cmd is used to define a delay to be applied in the setup sequence
130  * before running the pass/fail experiment.
131  *
132  *  usec
133  *    Specifies delay to be used in microseconds.
134  */
135 
136 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_DELAY 2
137 typedef struct NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_DELAY_OPERANDS {
138     NvU32 usec;
139 } NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_DELAY_OPERANDS;
140 
141 /*
142  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_INIT_LT
143  *
144  * This cmd is used to define a point where normal link training initialization
145  * may be executed in the sequence before running the pass/fail experiment.
146  * In general, this is not needed since it is done during normal
147  * initialization, but does allow re-initialization during the sequence.
148  */
149 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_INIT_LT  3
150 
151 /*
152  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_RUN_LT
153  *
154  * This cmd is used to define a point where normal link training may be
155  * executed in the sequence before running the pass/fail experiment.
156  * In general, this is not needed since it is somewhat redundant.
157  */
158 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_RUN_LT   4
159 
160 /*
161  * NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_STOP_SEQ
162  *
163  * This cmd is used to define a point where the sequence stops without
164  * running the pass/fail experiment.
165  */
166 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_STOP_SEQ 5
167 
168 
169 
170 typedef struct NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_PARAMS {
171     NvU32 cmd;
172     /* C form: NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_OPERANDS op; */
173     union {
174 
175         NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_SET_REGISTER_OPERANDS setRegister;
176 
177         NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_DELAY_OPERANDS        delay;
178     } op;
179     NvU32 seq;
180 } NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_PARAMS;
181 
182 
183 
184 #define NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_PARAMS_MESSAGE_ID (0x3U)
185 
186 typedef struct NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_PARAMS {
187     NvU32 cmd;
188 
189     /* C form: NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_OPERANDS op; */
190     union {
191 
192         NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_NUMBER_OF_MOD_SLOTS_OPERANDS setNumberOfModSlots;
193 
194         NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_SET_MOD_SLOT_PARAMS              setModSlot;
195     } op;
196 } NV208F_CTRL_FBIO_SETUP_TRAINING_EXP_PARAMS;
197 
198 /*
199  * NV208F_CTRL_CMD_FBIO_RUN_TRAINING_EXP
200  *
201  * This command runs the previously defined experiment and returns status on
202  * pass/fail.  NV_OK is returned in the case of both pass
203  * and fail.
204  *
205  * The risingPasses and fallingPasses outputs represents the results across
206  * all partitions and bytelanes.  Each array entry corresponds to a partition
207  * and the bits within each member represent the bytelane.  So e.g.:
208  * risingPasses[4] represents the rising pass results for all of partition 4's
209  * byte lanes.
210  *
211  * The partitionsValid bitmask represents the partitions for which the results
212  * in risingPasses and fallingPasses are valid (not floorswept).
213  *
214  * The bytelanesValid bitmask represents the bytelanes for which the results
215  * are valid (available bytelanes).
216  *
217  * The failingDebug[] represent debug data for why (if so) a test fails.
218  * This is basically NV_PFB_TRAINING_DEBUG(i)
219  *
220  * Possible status values returned are:
221  *   NV_OK
222  *   NV_ERR_INVALID_PARAM_STRUCT
223  *   NV_ERR_INVALID_ARGUMENT
224  *   NV_ERR_TIMEOUT
225  *       if hardware doesn't respond to request in a timely manner.
226  *   NV_ERR_INVALID_DATA
227  *       if there was some sort of very weird data corruption issue.
228  */
229 #define NV208F_CTRL_CMD_FBIO_RUN_TRAINING_EXP          (0x208f0a04) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_DIAG_FBIO_INTERFACE_ID << 8) | NV208F_CTRL_FBIO_RUN_TRAINING_EXP_PARAMS_MESSAGE_ID" */
230 
231 #define NV208F_CTRL_FBIO_RUN_TRAINING_EXP_RESULT__SIZE 8
232 #define NV208F_CTRL_FBIO_RUN_TRAINING_EXP_PARAMS_MESSAGE_ID (0x4U)
233 
234 typedef struct NV208F_CTRL_FBIO_RUN_TRAINING_EXP_PARAMS {NvU32 risingPasses[NV208F_CTRL_FBIO_RUN_TRAINING_EXP_RESULT__SIZE];
235     NvU32 fallingPasses[NV208F_CTRL_FBIO_RUN_TRAINING_EXP_RESULT__SIZE];
236     NvU32 failingDebug[NV208F_CTRL_FBIO_RUN_TRAINING_EXP_RESULT__SIZE];
237     NvU32 partitionsValid;
238     NvU32 bytelanesValid;
239 } NV208F_CTRL_FBIO_RUN_TRAINING_EXP_PARAMS;
240 
241 #define NV208F_CTRL_CMD_FBIO_GET_TRAINING_CAPS (0x208f0a05) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_DIAG_FBIO_INTERFACE_ID << 8) | NV208F_CTRL_FBIO_GET_TRAINING_CAPS_PARAMS_MESSAGE_ID" */
242 
243 #define NV208F_CTRL_FBIO_GET_TRAINING_CAPS_PARAMS_MESSAGE_ID (0x5U)
244 
245 typedef struct NV208F_CTRL_FBIO_GET_TRAINING_CAPS_PARAMS {
246     NvU32 supported;
247 } NV208F_CTRL_FBIO_GET_TRAINING_CAPS_PARAMS;
248 
249 // _ctrl208ffbio_h_
250