1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2006-2021 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/ctrl2080/ctrl2080fb.finn
31 //
32 
33 #include "ctrl/ctrl2080/ctrl2080base.h"
34 
35 /* NV20_SUBDEVICE_XX fb control commands and parameters */
36 
37 #include "nvlimits.h"
38 
39 /*
40  * NV2080_CTRL_FB_INFO
41  *
42  * This structure represents a single 32bit fb engine value.  Clients
43  * request a particular fb engine value by specifying a unique fb
44  * information index.
45  *
46  * Legal fb information index values are:
47  *   NV2080_CTRL_FB_INFO_INDEX_TILE_REGION_COUNT
48  *     This index is used to request the number of tiled regions supported
49  *     by the associated subdevice.  The return value is GPU
50  *     implementation-dependent.  A return value of 0 indicates the GPU
51  *     does not support tiling.
52  *   NV2080_CTRL_FB_INFO_INDEX_COMPRESSION_SIZE
53  *     This index is used to request the amount of compression (in bytes)
54  *     supported by the associated subdevice.  The return value is GPU
55  *     implementation-dependent.  A return value of 0 indicates the GPU
56  *     does not support compression.
57  *   Nv2080_CTRL_FB_INFO_INDEX_DRAM_PAGE_STRIDE
58  *     This index is used to request the DRAM page stride (in bytes)
59  *     supported by the associated subdevice.  The return value is GPU
60  *     implementation-dependent.
61  *   NV2080_CTRL_FB_INFO_INDEX_TILE_REGION_FREE_COUNT
62  *     This index is used to request the number of free tiled regions on
63  *     the associated subdevice.  The return value represents the current
64  *     number of free tiled regions at the time the command is processed and
65  *     is not guaranteed to remain unchanged.  A return value of 0 indicates
66  *     that there are no available tiled regions on the associated subdevice.
67  *   NV2080_CTRL_FB_INFO_INDEX_PARTITION_COUNT
68  *     This index is used to request the number of frame buffer partitions
69  *     on the associated subdevice. Starting with Fermi there are now two units
70  *     with the name framebuffer partitions. On those chips this index returns
71  *     the number of FBPAs. For number of FBPs use
72  *     NV2080_CTRL_FB_INFO_INDEX_FBP_COUNT.
73  *     This an SMC aware attribute, thus necessary partition subscription is
74  *     required if the device is partitioned.
75  *   NV2080_CTRL_FB_INFO_INDEX_RAM_SIZE
76  *     This index is used to request the amount of framebuffer memory in
77  *     kilobytes physically present on the associated subdevice.  This
78  *     value will never exceed the value reported by
79  *     NV2080_CTRL_FB_INFO_INDEX_TOTAL_RAM_SIZE.
80  *     This an SMC aware attribute, so the per-partition framebuffer memory
81  *     size will be returned when the client has a partition subscription.
82  *   NV2080_CTRL_FB_INFO_INDEX_TOTAL_RAM_SIZE
83  *     This index is used to request the total amount of video memory in
84  *     kilobytes for use with the associated subdevice.  This value will
85  *     reflect both framebuffer memory as well as any system memory dedicated
86  *     for use with the subdevice.
87  *     This an SMC aware attribute, so the per-partition video memory size
88  *     will be returned when the client has a partition subscription.
89  *   NV2080_CTRL_FB_INFO_INDEX_HEAP_SIZE
90  *     This index is used to request the amount of total RAM in kilobytes
91  *     available for user allocations.  This value reflects the total ram
92  *     size less the amount of memory reserved for internal use.
93  *     This an SMC aware attribute, thus necessary partition subscription is
94  *     required if the device is partitioned.
95  *   NV2080_CTRL_FB_INFO_INDEX_HEAP_START
96  *     This index is used to request the offset for start of heap in
97  *     kilobytes.
98  *     This an SMC aware attribute, thus necessary partition subscription is
99  *     required if the device is partitioned.
100  *   NV2080_CTRL_FB_INFO_INDEX_HEAP_FREE
101  *     This index is used to request the available amount of video memory in
102  *     kilobytes for use with the associated subdevice or the SMC partition.
103  *     This an SMC aware attribute, thus necessary partition subscription is
104  *     required to query per partition information, if the device is partitioned.
105  *     Alternatively, the SMC/MIG monitor capability can be acquired to query
106  *     aggregate available memory across all the valid partitions.
107  *   NV2080_CTRL_FB_INFO_INDEX_MAPPABLE_HEAP_SIZE
108  *     This index reflects the amount of heap memory in kilobytes that
109  *     is accessible by the CPU.  On subdevices with video memory sizes that
110  *     exceed the amount that can be bus mappable this value will be less
111  *     than that reported by NV2080_CTRL_FB_INFO_INDEX_HEAP_SIZE.
112  *     This an SMC aware attribute, thus necessary partition subscription is
113  *     required if the device is partitioned.
114  *   NV2080_CTRL_FB_INFO_INDEX_BUS_WIDTH
115  *     This index is used to request the FB bus bandwidth on the associated
116  *     subdevice.
117  *   NV2080_CTRL_FB_INFO_INDEX_RAM_CFG
118  *     This index is used to request the implementation-dependent RAM
119  *     configuration value of the associated subdevice.
120  *   NV2080_CTRL_FB_INFO_INDEX_RAM_TYPE
121  *     This index is used to request the type of RAM used for the framebuffer
122  *     on the associated subdevice.  Legal RAM types include:
123  *       NV2080_CTRL_FB_INFO_RAM_TYPE_UNKNOWN
124  *       NV2080_CTRL_FB_INFO_RAM_TYPE_SDRAM
125  *       NV2080_CTRL_FB_INFO_RAM_TYPE_DDR1
126  *       NV2080_CTRL_FB_INFO_RAM_TYPE_DDR2
127  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR2
128  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR3
129  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR4
130  *       NV2080_CTRL_FB_INFO_RAM_TYPE_DDR3
131  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR5
132  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR5X
133  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR6
134  *       NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR6X
135  *       NV2080_CTRL_FB_INFO_RAM_TYPE_LPDDR2
136  *       NV2080_CTRL_FB_INFO_RAM_TYPE_LPDDR4
137  *       NV2080_CTRL_FB_INFO_RAM_TYPE_LPDDR5
138  *   NV2080_CTRL_FB_INFO_INDEX_BANK_COUNT
139  *     This index is used to request the number of FB banks on the associated
140  *     subdevice.
141  *   NV2080_CTRL_FB_INFO_INDEX_OVERLAY_OFFSET_ADJUSTMENT
142  *     This index is used to request the offset relative to the start of the
143  *     overlay surface(s), in bytes, at which scanout should happen if the
144  *     primary and the overlay surfaces are all aligned on large page
145  *     boundaries.
146  *   NV2080_CTRL_FB_INFO_INDEX_GPU_VADDR_SPACE_SIZE_KB
147  *     This index is used to request the size of the GPU's virtual address
148  *     space in kilobytes.
149  *   NV2080_CTRL_FB_INFO_INDEX_GPU_VADDR_HEAP_SIZE_KB
150  *     This index is used to request the size of the GPU's virtual address
151  *     space heap (minus RM-reserved space) in kilobytes.
152  *   NV2080_CTRL_FB_INFO_INDEX_GPU_VADDR_MAPPBLE_SIZE_KB
153  *     This index is used to request the size of the GPU's BAR1 mappable
154  *     virtual address space in kilobytes.
155  *   NV2080_CTRL_FB_INFO_INDEX_EFFECTIVE_BW
156  *     This index is deprecated, and returns zero value.
157  *   NV2080_CTRL_FB_INFO_INDEX_PARTITION_MASK
158  *     This index is used to request the mask of currently active partitions.
159  *     Each  active partition has an ID that's equivalent to the corresponding
160  *     bit position in the mask.
161  *     This an SMC aware attribute, thus necessary partition subscription is
162  *     required if the device is partitioned.
163  *   NV2080_CTRL_FB_INFO_INDEX_VISTA_RESERVED_HEAP_SIZE
164  *     This index is used to request the amount of total RAM in kilobytes
165  *     reserved for internal RM allocations on Vista.  This will need to
166  *     be subtracted from the total heap size to get the amount available to
167  *     KMD.
168  *     This an SMC aware attribute, thus necessary partition subscription is
169  *     required if the device is partitioned.
170  *   NV2080_CTRL_FB_INFO_INDEX_RAM_LOCATION
171  *     This index is used to distinguish between different memory
172  *     configurations.
173  *   NV2080_CTRL_FB_INFO_INDEX_FB_IS_BROKEN
174  *     This index is used to check if the FB is functional
175  *   NV2080_CTRL_FB_INFO_INDEX_FBP_COUNT
176  *     This index is used to get the number of FBPs on the subdevice. This
177  *     field is not to be confused with
178  *     NV2080_CTRL_FB_INFO_INDEX_PARTITION_COUNT (returns number of FBPAs).
179  *     Starting with Fermi the term partition is an ambiguous term, both FBP
180  *     and FBPA mean FB partitions. The FBPA is the low level DRAM controller,
181  *     while a FBP is the aggregation of one or more FBPAs, L2, ROP, and some
182  *     other units.
183  *     This an SMC aware attribute, thus necessary partition subscription is
184  *     required if the device is partitioned.
185  *   NV2080_CTRL_FB_INFO_INDEX_L2CACHE_SIZE
186  *     This index is used to get the size of the L2 cache in Bytes.
187  *     A value of zero indicates that the L2 cache isn't supported on the
188  *     associated subdevice.
189  *   NV2080_CTRL_FB_INFO_INDEX_MEMORYINFO_VENDOR_ID
190  *     This index is used to get the memory vendor ID information from
191  *     the Memory Information Table in the VBIOS.  Legal memory Vendor ID
192  *     values include:
193  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_UNKNOWN
194  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_RESERVED
195  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_SAMSUNG
196  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_QIMONDA
197  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_ELPIDA
198  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_ETRON
199  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_NANYA
200  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_HYNIX
201  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_MOSEL
202  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_WINBOND
203  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_ESMT
204  *       NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_MICRON
205  *   NV2080_CTRL_FB_INFO_INDEX_BAR1_AVAIL_SIZE
206  *     This index is used to request the amount of unused bar1 space. The
207  *     data returned is a value in KB. It is not guaranteed to be entirely
208  *     accurate since it is a snapshot at a particular time and can
209  *     change quickly.
210  *   NV2080_CTRL_FB_INFO_INDEX_BAR1_MAX_CONTIGUOUS_AVAIL_SIZE
211  *     This index is used to request the amount of largest unused contiguous
212  *     block in bar1 space.  The data returned is a value in KB. It is not
213  *     guaranteed to be entirely accurate since it is a snapshot at a particular
214  *     time and can change quickly.
215  *   NV2080_CTRL_FB_INFO_INDEX_USABLE_RAM_SIZE
216  *     This index is used to request the amount of usable framebuffer memory in
217  *     kilobytes physically present on the associated subdevice.  This
218  *     value will never exceed the value reported by
219  *     NV2080_CTRL_FB_INFO_INDEX_TOTAL_RAM_SIZE.
220  *     This an SMC aware attribute, thus necessary partition subscription is
221  *     required if the device is partitioned.
222  *   NV2080_CTRL_FB_INFO_INDEX_LTC_COUNT
223  *     Returns the active LTC count across all active FBPs.
224  *     This an SMC aware attribute, thus necessary partition subscription is
225  *     required if the device is partitioned.
226  *   NV2080_CTRL_FB_INFO_INDEX_LTS_COUNT
227  *     Returns the active LTS count across all active LTCs.
228  *     This an SMC aware attribute, thus necessary partition subscription is
229  *     required if the device is partitioned.
230  *   NV2080_CTRL_FB_INFO_INDEX_PSEUDO_CHANNEL_MODE
231  *     This is used to identify if pseudo-channel mode is enabled for HBM
232  *   NV2080_CTRL_FB_INFO_INDEX_SMOOTHDISP_RSVD_BAR1_SIZE
233  *     This is used by WDDM-KMD to determine whether and how much RM reserved BAR1 for smooth transition
234  *   NV2080_CTRL_FB_INFO_INDEX_HEAP_OFFLINE_SIZE
235  *     Returns the total size of the all dynamically offlined pages in KiB
236  *   NV2080_CTRL_FB_INFO_INDEX_1TO1_COMPTAG_ENABLED
237  *     Returns true if 1to1 comptag is enabled
238  *   NV2080_CTRL_FB_INFO_INDEX_SUSPEND_RESUME_RSVD_SIZE
239  *     Returns the total size of the memory(FB) that will saved/restored during save/restore cycle
240  *   NV2080_CTRL_FB_INFO_INDEX_ALLOW_PAGE_RETIREMENT
241  *     Returns true if page retirement is allowed
242  *   NV2080_CTRL_FB_INFO_POISON_FUSE_ENABLED
243  *     Returns true if poison fuse is enabled
244  *   NV2080_CTRL_FB_INFO_FBPA_ECC_ENABLED
245  *     Returns true if ECC is enabled for FBPA
246  *   NV2080_CTRL_FB_INFO_DYNAMIC_PAGE_OFFLINING_ENABLED
247  *     Returns true if dynamic page blacklisting is enabled
248  *   NV2080_CTRL_FB_INFO_INDEX_FORCED_BAR1_64KB_MAPPING_ENABLED
249  *     Returns true if 64KB mapping on BAR1 is force-enabled
250  *   NV2080_CTRL_FB_INFO_INDEX_P2P_MAILBOX_SIZE
251  *     Returns the P2P mailbox size to be allocated by the client.
252  *     Returns 0 if the P2P mailbox is allocated by RM.
253  *   NV2080_CTRL_FB_INFO_INDEX_P2P_MAILBOX_ALIGNMENT_SIZE
254  *     Returns the P2P mailbox alignment requirement.
255  *     Returns 0 if the P2P mailbox is allocated by RM.
256  *   NV2080_CTRL_FB_INFO_INDEX_P2P_MAILBOX_BAR1_MAX_OFFSET_64KB
257  *     Returns the P2P mailbox max offset requirement.
258  *     Returns 0 if the P2P mailbox is allocated by RM.
259  *   NV2080_CTRL_FB_INFO_INDEX_PROTECTED_MEM_SIZE_TOTAL_KB
260  *     Returns total protected memory when memory protection is enabled
261  *     Returns 0 when memory protection is not enabled.
262  *   NV2080_CTRL_FB_INFO_INDEX_PROTECTED_MEM_SIZE_FREE_KB
263  *     Returns protected memory available for allocation when memory
264  *     protection is enabled.
265  *     Returns 0 when memory protection is not enabled.
266  *   NV2080_CTRL_FB_INFO_INDEX_ECC_STATUS_SIZE
267  *     Returns the ECC status size (corresponds to subpartitions or channels
268  *     depending on architecture/memory type).
269  */
270 typedef NVXXXX_CTRL_XXX_INFO NV2080_CTRL_FB_INFO;
271 
272 /* valid fb info index values */
273 #define NV2080_CTRL_FB_INFO_INDEX_TILE_REGION_COUNT                (0x00000000U) // Deprecated
274 #define NV2080_CTRL_FB_INFO_INDEX_COMPRESSION_SIZE                 (0x00000001U)
275 #define NV2080_CTRL_FB_INFO_INDEX_DRAM_PAGE_STRIDE                 (0x00000002U)
276 #define NV2080_CTRL_FB_INFO_INDEX_TILE_REGION_FREE_COUNT           (0x00000003U)
277 #define NV2080_CTRL_FB_INFO_INDEX_PARTITION_COUNT                  (0x00000004U)
278 #define NV2080_CTRL_FB_INFO_INDEX_BAR1_SIZE                        (0x00000005U)
279 #define NV2080_CTRL_FB_INFO_INDEX_BANK_SWIZZLE_ALIGNMENT           (0x00000006U)
280 #define NV2080_CTRL_FB_INFO_INDEX_RAM_SIZE                         (0x00000007U)
281 #define NV2080_CTRL_FB_INFO_INDEX_TOTAL_RAM_SIZE                   (0x00000008U)
282 #define NV2080_CTRL_FB_INFO_INDEX_HEAP_SIZE                        (0x00000009U)
283 #define NV2080_CTRL_FB_INFO_INDEX_MAPPABLE_HEAP_SIZE               (0x0000000AU)
284 #define NV2080_CTRL_FB_INFO_INDEX_BUS_WIDTH                        (0x0000000BU)
285 #define NV2080_CTRL_FB_INFO_INDEX_RAM_CFG                          (0x0000000CU)
286 #define NV2080_CTRL_FB_INFO_INDEX_RAM_TYPE                         (0x0000000DU)
287 #define NV2080_CTRL_FB_INFO_INDEX_BANK_COUNT                       (0x0000000EU)
288 #define NV2080_CTRL_FB_INFO_INDEX_OVERLAY_OFFSET_ADJUSTMENT        (0x0000000FU) // Deprecated (index reused to return 0)
289 #define NV2080_CTRL_FB_INFO_INDEX_GPU_VADDR_SPACE_SIZE_KB          (0x0000000FU) // Deprecated (index reused to return 0)
290 #define NV2080_CTRL_FB_INFO_INDEX_GPU_VADDR_HEAP_SIZE_KB           (0x0000000FU) // Deprecated (index reused to return 0)
291 #define NV2080_CTRL_FB_INFO_INDEX_GPU_VADDR_MAPPBLE_SIZE_KB        (0x0000000FU) // Deprecated (index reused to return 0)
292 #define NV2080_CTRL_FB_INFO_INDEX_EFFECTIVE_BW                     (0x0000000FU) // Deprecated (index reused to return 0)
293 #define NV2080_CTRL_FB_INFO_INDEX_FB_TAX_SIZE_KB                   (0x00000010U)
294 #define NV2080_CTRL_FB_INFO_INDEX_HEAP_BASE_KB                     (0x00000011U)
295 #define NV2080_CTRL_FB_INFO_INDEX_LARGEST_FREE_REGION_SIZE_KB      (0x00000012U)
296 #define NV2080_CTRL_FB_INFO_INDEX_LARGEST_FREE_REGION_BASE_KB      (0x00000013U)
297 #define NV2080_CTRL_FB_INFO_INDEX_PARTITION_MASK                   (0x00000014U)
298 #define NV2080_CTRL_FB_INFO_INDEX_VISTA_RESERVED_HEAP_SIZE         (0x00000015U)
299 #define NV2080_CTRL_FB_INFO_INDEX_HEAP_FREE                        (0x00000016U)
300 #define NV2080_CTRL_FB_INFO_INDEX_RAM_LOCATION                     (0x00000017U)
301 #define NV2080_CTRL_FB_INFO_INDEX_FB_IS_BROKEN                     (0x00000018U)
302 #define NV2080_CTRL_FB_INFO_INDEX_FBP_COUNT                        (0x00000019U)
303 #define NV2080_CTRL_FB_INFO_INDEX_FBP_MASK                         (0x0000001AU)
304 #define NV2080_CTRL_FB_INFO_INDEX_L2CACHE_SIZE                     (0x0000001BU)
305 #define NV2080_CTRL_FB_INFO_INDEX_MEMORYINFO_VENDOR_ID             (0x0000001CU)
306 #define NV2080_CTRL_FB_INFO_INDEX_BAR1_AVAIL_SIZE                  (0x0000001DU)
307 #define NV2080_CTRL_FB_INFO_INDEX_HEAP_START                       (0x0000001EU)
308 #define NV2080_CTRL_FB_INFO_INDEX_BAR1_MAX_CONTIGUOUS_AVAIL_SIZE   (0x0000001FU)
309 #define NV2080_CTRL_FB_INFO_INDEX_USABLE_RAM_SIZE                  (0x00000020U)
310 #define NV2080_CTRL_FB_INFO_INDEX_TRAINIG_2T                       (0x00000021U)
311 #define NV2080_CTRL_FB_INFO_INDEX_LTC_COUNT                        (0x00000022U)
312 #define NV2080_CTRL_FB_INFO_INDEX_LTS_COUNT                        (0x00000023U)
313 #define NV2080_CTRL_FB_INFO_INDEX_L2CACHE_ONLY_MODE                (0x00000024U)
314 #define NV2080_CTRL_FB_INFO_INDEX_PSEUDO_CHANNEL_MODE              (0x00000025U)
315 #define NV2080_CTRL_FB_INFO_INDEX_SMOOTHDISP_RSVD_BAR1_SIZE        (0x00000026U)
316 #define NV2080_CTRL_FB_INFO_INDEX_HEAP_OFFLINE_SIZE                (0x00000027U)
317 #define NV2080_CTRL_FB_INFO_INDEX_1TO1_COMPTAG_ENABLED             (0x00000028U)
318 #define NV2080_CTRL_FB_INFO_INDEX_SUSPEND_RESUME_RSVD_SIZE         (0x00000029U)
319 #define NV2080_CTRL_FB_INFO_INDEX_ALLOW_PAGE_RETIREMENT            (0x0000002AU)
320 #define NV2080_CTRL_FB_INFO_INDEX_LTC_MASK                         (0x0000002BU)
321 #define NV2080_CTRL_FB_INFO_POISON_FUSE_ENABLED                    (0x0000002CU)
322 #define NV2080_CTRL_FB_INFO_FBPA_ECC_ENABLED                       (0x0000002DU)
323 #define NV2080_CTRL_FB_INFO_DYNAMIC_PAGE_OFFLINING_ENABLED         (0x0000002EU)
324 #define NV2080_CTRL_FB_INFO_INDEX_FORCED_BAR1_64KB_MAPPING_ENABLED (0x0000002FU)
325 #define NV2080_CTRL_FB_INFO_INDEX_P2P_MAILBOX_SIZE                 (0x00000030U)
326 #define NV2080_CTRL_FB_INFO_INDEX_P2P_MAILBOX_ALIGNMENT            (0x00000031U)
327 #define NV2080_CTRL_FB_INFO_INDEX_P2P_MAILBOX_BAR1_MAX_OFFSET_64KB (0x00000032U)
328 #define NV2080_CTRL_FB_INFO_INDEX_PROTECTED_MEM_SIZE_TOTAL_KB      (0x00000033U)
329 #define NV2080_CTRL_FB_INFO_INDEX_PROTECTED_MEM_SIZE_FREE_KB       (0x00000034U)
330 #define NV2080_CTRL_FB_INFO_INDEX_ECC_STATUS_SIZE                  (0x00000035U)
331 #define NV2080_CTRL_FB_INFO_MAX_LIST_SIZE                          (0x00000036U)
332 
333 #define NV2080_CTRL_FB_INFO_INDEX_MAX                              (0x35U) /* finn: Evaluated from "(NV2080_CTRL_FB_INFO_MAX_LIST_SIZE - 1)" */
334 
335 /* valid fb RAM type values */
336 #define NV2080_CTRL_FB_INFO_RAM_TYPE_UNKNOWN                       (0x00000000U)
337 #define NV2080_CTRL_FB_INFO_RAM_TYPE_SDRAM                         (0x00000001U)
338 #define NV2080_CTRL_FB_INFO_RAM_TYPE_DDR1                          (0x00000002U) /* SDDR and GDDR (aka DDR1 and GDDR1) */
339 #define NV2080_CTRL_FB_INFO_RAM_TYPE_SDDR2                         (0x00000003U) /* SDDR2 Used on NV43 and later */
340 #define NV2080_CTRL_FB_INFO_RAM_TYPE_DDR2                          NV2080_CTRL_FB_INFO_RAM_TYPE_SDDR2 /* Deprecated alias */
341 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR2                         (0x00000004U) /* GDDR2 Used on NV30 and some NV36 */
342 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR3                         (0x00000005U) /* GDDR3 Used on NV40 and later */
343 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR4                         (0x00000006U) /* GDDR4 Used on G80 and later (deprecated) */
344 #define NV2080_CTRL_FB_INFO_RAM_TYPE_SDDR3                         (0x00000007U) /* SDDR3 Used on G9x and later */
345 #define NV2080_CTRL_FB_INFO_RAM_TYPE_DDR3                          NV2080_CTRL_FB_INFO_RAM_TYPE_SDDR3 /* Deprecated alias */
346 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR5                         (0x00000008U) /* GDDR5 Used on GT21x and later */
347 #define NV2080_CTRL_FB_INFO_RAM_TYPE_LPDDR2                        (0x00000009U) /* LPDDR (Low Power SDDR) used on T2x and later. */
348 
349 
350 #define NV2080_CTRL_FB_INFO_RAM_TYPE_SDDR4                         (0x0000000CU) /* SDDR4 Used on Maxwell and later */
351 #define NV2080_CTRL_FB_INFO_RAM_TYPE_LPDDR4                        (0x0000000DU) /* LPDDR (Low Power SDDR) used on T21x and later.*/
352 #define NV2080_CTRL_FB_INFO_RAM_TYPE_HBM1                          (0x0000000EU) /* HBM1 (High Bandwidth Memory) used on GP100 */
353 #define NV2080_CTRL_FB_INFO_RAM_TYPE_HBM2                          (0x0000000FU) /* HBM2 (High Bandwidth Memory-pseudo channel) */
354 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR5X                        (0x00000010U) /* GDDR5X Used on GP10x */
355 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR6                         (0x00000011U) /* GDDR6 Used on TU10x */
356 #define NV2080_CTRL_FB_INFO_RAM_TYPE_GDDR6X                        (0x00000012U) /* GDDR6X Used on GA10x */
357 #define NV2080_CTRL_FB_INFO_RAM_TYPE_LPDDR5                        (0x00000013U) /* LPDDR (Low Power SDDR) used on T23x and later.*/
358 #define NV2080_CTRL_FB_INFO_RAM_TYPE_HBM3                          (0x00000014U) /* HBM3 (High Bandwidth Memory) v3 */
359 
360 /* valid RAM LOCATION types */
361 #define NV2080_CTRL_FB_INFO_RAM_LOCATION_GPU_DEDICATED             (0x00000000U)
362 #define NV2080_CTRL_FB_INFO_RAM_LOCATION_SYS_SHARED                (0x00000001U)
363 #define NV2080_CTRL_FB_INFO_RAM_LOCATION_SYS_DEDICATED             (0x00000002U)
364 
365 /* valid Memory Vendor ID values */
366 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_SAMSUNG           (0x00000001U)
367 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_QIMONDA           (0x00000002U)
368 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_ELPIDA            (0x00000003U)
369 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_ETRON             (0x00000004U)
370 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_NANYA             (0x00000005U)
371 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_HYNIX             (0x00000006U)
372 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_MOSEL             (0x00000007U)
373 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_WINBOND           (0x00000008U)
374 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_ESMT              (0x00000009U)
375 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_MICRON            (0x0000000FU)
376 #define NV2080_CTRL_FB_INFO_MEMORYINFO_VENDOR_ID_UNKNOWN           (0xFFFFFFFFU)
377 
378 #define NV2080_CTRL_FB_INFO_PSEUDO_CHANNEL_MODE_UNSUPPORTED        (0x00000000U)
379 #define NV2080_CTRL_FB_INFO_PSEUDO_CHANNEL_MODE_DISABLED           (0x00000001U)
380 #define NV2080_CTRL_FB_INFO_PSEUDO_CHANNEL_MODE_ENABLED            (0x00000002U)
381 
382 /**
383  * NV2080_CTRL_CMD_FB_GET_INFO
384  *
385  * This command returns fb engine information for the associated GPU.
386  * Requests to retrieve fb information use a list of one or more
387  * NV2080_CTRL_FB_INFO structures.
388  *
389  *   fbInfoListSize
390  *     This field specifies the number of entries on the caller's
391  *     fbInfoList.
392  *   fbInfoList
393  *     This field specifies a pointer in the caller's address space
394  *     to the buffer into which the fb information is to be returned.
395  *     This buffer must be at least as big as fbInfoListSize multiplied
396  *     by the size of the NV2080_CTRL_FB_INFO structure.
397  *
398  * Possible status values returned are:
399  *   NV_OK
400  *   NV_ERR_INVALID_PARAM_STRUCT
401  *   NV_ERR_INVALID_ARGUMENT
402  *   NV_ERR_OPERATING_SYSTEM
403  */
404 #define NV2080_CTRL_CMD_FB_GET_INFO                                (0x20801301U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_INFO_PARAMS_MESSAGE_ID" */
405 
406 #define NV2080_CTRL_FB_GET_INFO_PARAMS_MESSAGE_ID (0x1U)
407 
408 typedef struct NV2080_CTRL_FB_GET_INFO_PARAMS {
409     NvU32 fbInfoListSize;
410     NV_DECLARE_ALIGNED(NvP64 fbInfoList, 8);
411 } NV2080_CTRL_FB_GET_INFO_PARAMS;
412 
413 #define NV2080_CTRL_CMD_FB_GET_INFO_V2 (0x20801303U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_INFO_V2_PARAMS_MESSAGE_ID" */
414 
415 #define NV2080_CTRL_FB_GET_INFO_V2_PARAMS_MESSAGE_ID (0x3U)
416 
417 typedef struct NV2080_CTRL_FB_GET_INFO_V2_PARAMS {
418     NvU32               fbInfoListSize;
419     NV2080_CTRL_FB_INFO fbInfoList[NV2080_CTRL_FB_INFO_MAX_LIST_SIZE];
420 } NV2080_CTRL_FB_GET_INFO_V2_PARAMS;
421 
422 /*
423  * NV2080_CTRL_CMD_FB_GET_BAR1_OFFSET
424  *
425  * This command returns the GPU virtual address of a bar1
426  * allocation, given the CPU virtual address.
427  *
428  *   cpuVirtAddress
429  *     This field specifies the associated CPU virtual address of the
430  *     memory allocation.
431  *   gpuVirtAddress
432  *     The GPU virtual address associated with the allocation
433  *     is returned in this field.
434  *
435  * Possible status values returned are
436  *   NV_OK
437  *   NV_ERR_INVALID_PARAM_STRUCT
438  *   NV_ERR_NOT_SUPPORTED
439  *   NV_ERR_INVALID_ARGUMENT
440  */
441 #define NV2080_CTRL_CMD_FB_GET_BAR1_OFFSET (0x20801310U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_BAR1_OFFSET_PARAMS_MESSAGE_ID" */
442 
443 #define NV2080_CTRL_FB_GET_BAR1_OFFSET_PARAMS_MESSAGE_ID (0x10U)
444 
445 typedef struct NV2080_CTRL_FB_GET_BAR1_OFFSET_PARAMS {
446     NV_DECLARE_ALIGNED(NvP64 cpuVirtAddress, 8);
447     NV_DECLARE_ALIGNED(NvU64 gpuVirtAddress, 8);
448 } NV2080_CTRL_FB_GET_BAR1_OFFSET_PARAMS;
449 
450 /*
451  * Note: Returns Zeros if no System carveout address info
452  *
453  * NV2080_CTRL_CMD_FB_GET_CARVEOUT_ADDRESS_INFO
454  *
455  * This command returns FB carveout address space information
456  *
457  *   StartAddr
458  *     Returns the system memory address of the start of carveout space.
459  *   SpaceSize
460  *     Returns the size of carveout space.
461  *
462  * Possible status values returned are:
463  *   NV_OK
464  *   NV_ERR_INVALID_PARAM_STRUCT
465  *   NV_ERR_NOT_SUPPORTED
466  */
467 
468 #define NV2080_CTRL_CMD_FB_GET_CARVEOUT_ADDRESS_INFO (0x2080130bU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_SYSTEM_CARVEOUT_ADDRESS_SPACE_INFO_MESSAGE_ID" */
469 
470 #define NV2080_CTRL_FB_GET_SYSTEM_CARVEOUT_ADDRESS_SPACE_INFO_MESSAGE_ID (0xBU)
471 
472 typedef struct NV2080_CTRL_FB_GET_SYSTEM_CARVEOUT_ADDRESS_SPACE_INFO {
473     NV_DECLARE_ALIGNED(NvU64 StartAddr, 8);
474     NV_DECLARE_ALIGNED(NvU64 SpaceSize, 8);
475 } NV2080_CTRL_FB_GET_SYSTEM_CARVEOUT_ADDRESS_SPACE_INFO;
476 
477 /*
478  * NV2080_CTRL_FB_CMD_GET_CALIBRATION_LOCK_FAILED
479  *
480  * This command returns the failure counts for calibration.
481  *
482  *   uFlags
483  *     Just one for now -- ehether to reset the counts.
484  *   driveStrengthRiseCount
485  *     This parameter specifies the failure count for drive strength rising.
486  *   driveStrengthFallCount
487  *     This parameter specifies the failure count for drive strength falling.
488  *   driveStrengthTermCount
489  *     This parameter specifies the failure count for drive strength
490  *     termination.
491  *   slewStrengthRiseCount
492  *     This parameter specifies the failure count for slew strength rising.
493  *   slewStrengthFallCount
494  *     This parameter specifies the failure count for slew strength falling.
495  *   slewStrengthTermCount
496  *     This parameter specifies the failure count for slew strength
497  *     termination.
498  *
499  *   Possible status values returned are:
500  *     NV_OK
501  *     NVOS_STATUS_INVALID_PARAM_STRUCT
502  *     NVOS_STATUS_NOT_SUPPORTED
503  *     NV_ERR_INVALID_ARGUMENT
504  */
505 #define NV2080_CTRL_CMD_FB_GET_CALIBRATION_LOCK_FAILED (0x2080130cU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_CALIBRATION_LOCK_FAILED_PARAMS_MESSAGE_ID" */
506 
507 #define NV2080_CTRL_FB_GET_CALIBRATION_LOCK_FAILED_PARAMS_MESSAGE_ID (0xCU)
508 
509 typedef struct NV2080_CTRL_FB_GET_CALIBRATION_LOCK_FAILED_PARAMS {
510     NvU32 flags;
511     NvU32 driveStrengthRiseCount;
512     NvU32 driveStrengthFallCount;
513     NvU32 driveStrengthTermCount;
514     NvU32 slewStrengthRiseCount;
515     NvU32 slewStrengthFallCount;
516 } NV2080_CTRL_FB_GET_CALIBRATION_LOCK_FAILED_PARAMS;
517 
518 /* valid flags parameter values */
519 #define NV2080_CTRL_CMD_FB_GET_CAL_FLAG_NONE         (0x00000000U)
520 #define NV2080_CTRL_CMD_FB_GET_CAL_FLAG_RESET        (0x00000001U)
521 
522 /*
523  * NV2080_CTRL_CMD_FB_FLUSH_GPU_CACHE
524  *
525  * This command flushes a cache on the GPU which all memory accesses go
526  * through.  The types of flushes supported by this API may not be supported by
527  * all hardware.  Attempting an unsupported flush type will result in an error.
528  *
529  *   addressArray
530  *     An array of physical addresses in the aperture defined by
531  *     NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_APERTURE.  Each entry points to a
532  *     contiguous block of memory of size memBlockSizeBytes.  The addresses are
533  *     aligned down to addressAlign before coalescing adjacent addresses and
534  *     sending flushes to hardware.
535  *   addressAlign
536  *     Used to align-down addresses held in addressArray.  A value of 0 will be
537  *     forced to 1 to avoid a divide by zero.  Value is treated as minimum
538  *     alignment and any hardware alignment requirements above this value will
539  *     be honored.
540  *   addressArraySize
541  *     The number of entries in addressArray.
542  *   memBlockSizeBytes
543  *     The size in bytes of each memory block pointed to by addressArray.
544  *   flags
545  *     Contains flags to control various aspects of the flush.  Valid values
546  *     are defined in NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS*.  Not all flags are
547  *     valid for all defined FLUSH_MODEs or all GPUs.
548  *
549  * Possible status values returned are:
550  *   NV_OK
551  *   NV_ERR_NOT_SUPPORTED
552  *   NV_ERR_INVALID_STATE
553  *   NV_ERR_INVALID_ARGUMENT
554  *
555  * See Also:
556  *   NV0080_CTRL_CMD_DMA_FLUSH
557  *     Performs flush operations in broadcast for the GPU cache and other hardware
558  *     engines.  Use this call if you want to flush all GPU caches in a
559  *     broadcast device.
560  *    NV0041_CTRL_CMD_SURFACE_FLUSH_GPU_CACHE
561  *     Flushes memory associated with a single allocation if the hardware
562  *     supports it.  Use this call if you want to flush a single allocation and
563  *     you have a memory object describing the physical memory.
564  */
565 #define NV2080_CTRL_CMD_FB_FLUSH_GPU_CACHE           (0x2080130eU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_FLUSH_GPU_CACHE_PARAMS_MESSAGE_ID" */
566 
567 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_MAX_ADDRESSES 500U
568 
569 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_PARAMS_MESSAGE_ID (0xEU)
570 
571 typedef struct NV2080_CTRL_FB_FLUSH_GPU_CACHE_PARAMS {
572     NV_DECLARE_ALIGNED(NvU64 addressArray[NV2080_CTRL_FB_FLUSH_GPU_CACHE_MAX_ADDRESSES], 8);
573     NvU32 addressArraySize;
574     NvU32 addressAlign;
575     NV_DECLARE_ALIGNED(NvU64 memBlockSizeBytes, 8);
576     NvU32 flags;
577 } NV2080_CTRL_FB_FLUSH_GPU_CACHE_PARAMS;
578 
579 /* valid fields and values for flags */
580 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_APERTURE              1:0
581 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_APERTURE_VIDEO_MEMORY    (0x00000000U)
582 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_APERTURE_SYSTEM_MEMORY   (0x00000001U)
583 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_APERTURE_PEER_MEMORY     (0x00000002U)
584 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_WRITE_BACK            2:2
585 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_WRITE_BACK_NO            (0x00000000U)
586 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_WRITE_BACK_YES           (0x00000001U)
587 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_INVALIDATE            3:3
588 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_INVALIDATE_NO            (0x00000000U)
589 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_INVALIDATE_YES           (0x00000001U)
590 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_FLUSH_MODE            4:4
591 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_FLUSH_MODE_ADDRESS_ARRAY (0x00000000U)
592 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_FLUSH_MODE_FULL_CACHE    (0x00000001U)
593 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_FB_FLUSH              5:5
594 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_FB_FLUSH_NO              (0x00000000U)
595 #define NV2080_CTRL_FB_FLUSH_GPU_CACHE_FLAGS_FB_FLUSH_YES             (0x00000001U)
596 
597 /*
598  * NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY (deprecated; use NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2 instead)
599  *
600  * These commands access the cache allocation policy on a specific
601  * engine, if supported.
602  *
603  *   engine
604  *     Specifies the target engine.  Possible values are defined in
605  *     NV2080_ENGINE_TYPE.
606  *   allocPolicy
607  *     Specifies the read/write allocation policy of the cache on the specified
608  *     engine. Possible values are defined in
609  *     NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_READS and
610  *     NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_WRITES.
611  *
612  */
613 typedef struct NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_PARAMS {
614     NvU32 engine;
615     NvU32 allocPolicy;
616 } NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_PARAMS;
617 
618 /* valid values for allocPolicy */
619 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_READS                0:0
620 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_READS_NO   (0x00000000U)
621 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_READS_YES  (0x00000001U)
622 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_WRITES               1:1
623 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_WRITES_NO  (0x00000000U)
624 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_WRITES_YES (0x00000001U)
625 
626 
627 /*
628  * NV2080_CTRL_CMD_FB_SET_GPU_CACHE_ALLOC_POLICY
629  *
630  * This command is deprecated.
631  * Use NV2080_CTRL_CMD_FB_SET_GPU_CACHE_ALLOC_POLICY_V2 instead.
632  *
633  * This command sets the state of the cache allocation policy on a specific
634  * engine, if supported.
635  *
636  * Possible status values returned are:
637  *   NV_OK
638  *   NV_ERR_NOT_SUPPORTED
639  *   NV_ERR_INVALID_ARGUMENT
640  */
641 #define NV2080_CTRL_CMD_FB_SET_GPU_CACHE_ALLOC_POLICY    (0x2080130fU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_SET_GPU_CACHE_ALLOC_POLICY_PARAMS_MESSAGE_ID" */
642 
643 #define NV2080_CTRL_FB_SET_GPU_CACHE_ALLOC_POLICY_PARAMS_MESSAGE_ID (0xFU)
644 
645 typedef NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_PARAMS NV2080_CTRL_FB_SET_GPU_CACHE_ALLOC_POLICY_PARAMS;
646 
647 /*
648  * NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_PARAM
649  *
650  * These commands access the cache allocation policy on a specific
651  * client, if supported.
652  *
653  *   count
654  *     Specifies the number of entries in entry.
655  *   entry
656  *     Specifies an array of allocation policy entries.
657  *
658  * NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY
659  *
660  *   clients
661  *     Specifies the target client.  Possible values are defined in
662  *     NV2080_CLIENT_TYPE_*.
663  *   allocPolicy
664  *     Specifies the read/write allocation policy of the cache on the specified
665  *     engine. Possible values are defined in
666  *     NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS and
667  *     NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES.
668  *
669  * NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY_SIZE
670  *
671  *     Specifies the maximum number of allocation policy entries allowed
672  */
673 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY_SIZE 11U
674 
675 typedef struct NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY {
676     NvU32 client;
677     NvU32 allocPolicy;
678 } NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY;
679 
680 typedef struct NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_PARAMS {
681     NvU32                                          count;
682     NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY entry[NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_ENTRY_SIZE];
683 } NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_PARAMS;
684 
685 /* valid values for allocPolicy */
686 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS             0:0
687 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS_DISABLE    (0x00000000U)
688 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS_ENABLE     (0x00000001U)
689 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS_ALLOW       1:1
690 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS_ALLOW_NO   (0x00000000U)
691 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_READS_ALLOW_YES  (0x00000001U)
692 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES            2:2
693 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES_DISABLE   (0x00000000U)
694 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES_ENABLE    (0x00000001U)
695 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES_ALLOW      3:3
696 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES_ALLOW_NO  (0x00000000U)
697 #define NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_WRITES_ALLOW_YES (0x00000001U)
698 
699 
700 /*
701  * NV2080_CTRL_CMD_FB_SET_GPU_CACHE_ALLOC_POLICY_V2
702  *
703  * This command sets the state of the cache allocation policy on a specific
704  * engine, if supported.
705  *
706  * Possible status values returned are:
707  *   NV_OK
708  *   NV_ERR_NOT_SUPPORTED
709  *   NV_ERR_INVALID_ARGUMENT
710  */
711 #define NV2080_CTRL_CMD_FB_SET_GPU_CACHE_ALLOC_POLICY_V2          (0x20801318U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_SET_GPU_CACHE_ALLOC_POLICY_V2_PARAMS_MESSAGE_ID" */
712 
713 #define NV2080_CTRL_FB_SET_GPU_CACHE_ALLOC_POLICY_V2_PARAMS_MESSAGE_ID (0x18U)
714 
715 typedef NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_PARAMS NV2080_CTRL_FB_SET_GPU_CACHE_ALLOC_POLICY_V2_PARAMS;
716 
717 /*
718  * NV2080_CTRL_CMD_FB_GET_GPU_CACHE_ALLOC_POLICY (deprecated; use NV2080_CTRL_CMD_FB_GET_GPU_CACHE_ALLOC_POLICY_V2 instead)
719  *
720  * This command gets the state of the cache allocation policy on a specific
721  * engine, if supported.
722  *
723  * Possible status values returned are:
724  *   NV_OK
725  *   NV_ERR_NOT_SUPPORTED
726  *   NV_ERR_INVALID_ARGUMENT
727  */
728 #define NV2080_CTRL_CMD_FB_GET_GPU_CACHE_ALLOC_POLICY (0x20801312U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_GPU_CACHE_ALLOC_POLICY_PARAMS_MESSAGE_ID" */
729 
730 #define NV2080_CTRL_FB_GET_GPU_CACHE_ALLOC_POLICY_PARAMS_MESSAGE_ID (0x12U)
731 
732 typedef NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_PARAMS NV2080_CTRL_FB_GET_GPU_CACHE_ALLOC_POLICY_PARAMS;
733 
734 /*
735  * NV2080_CTRL_CMD_FB_GET_GPU_CACHE_ALLOC_POLICY_V2
736  *
737  * This command gets the state of the cache allocation policy on a specific
738  * engine, if supported.
739  *
740  * Possible status values returned are:
741  *   NV_OK
742  *   NV_ERR_NOT_SUPPORTED
743  *   NV_ERR_INVALID_ARGUMENT
744  */
745 #define NV2080_CTRL_CMD_FB_GET_GPU_CACHE_ALLOC_POLICY_V2 (0x20801319U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_GPU_CACHE_ALLOC_POLICY_V2_PARAMS_MESSAGE_ID" */
746 
747 #define NV2080_CTRL_FB_GET_GPU_CACHE_ALLOC_POLICY_V2_PARAMS_MESSAGE_ID (0x19U)
748 
749 typedef NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_PARAMS NV2080_CTRL_FB_GET_GPU_CACHE_ALLOC_POLICY_V2_PARAMS;
750 
751 
752 /*
753  * NV2080_CTRL_CMD_FB_IS_KIND
754  *
755  * This command is used to perform various operations like 'IS_KIND_VALID',
756  * 'IS_KIND_COMPRESSIBLE'on the kind passed by the caller. The operation to be
757  * performed should be passed in the 'operation' parameter of
758  * NV2080_CTRL_FB_IS_KIND_PARAMS, the kind on which the operation is to be
759  * performed should be passed in the 'kind' parameter. The result of the
760  * operation (true/false) will be returned in the 'result' parameter.
761  *
762  *   operation
763  *     Specifies what operation is to be performed on the kind passed by the
764  *     caller. The supported operations are
765  *       NV2080_CTRL_FB_IS_KIND_OPERATION_SUPPORTED
766  *         This operation checks whether the kind passed in the 'kind'
767  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure is
768  *         supported for this GPU. Returns nonzero value in 'result' parameter
769  *         if the input kind is supported, else returns zero in the result.
770  *       NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE
771  *         This operation checks whether the kind passed in the 'kind'
772  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure is
773  *         compressible. Returns nonzero value in 'result' parameter if the
774  *         input kind is compressible, else returns zero in the result.
775  *       NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE_1
776  *         This operation checks whether the kind passed in the 'kind'
777  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure supports
778  *         1 bit compression. Returns nonzero value in 'result' parameter if
779  *         kind supports 1 bit compression, else returns zero in the result.
780  *       NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE_2
781  *         This operation checks whether the kind passed in the 'kind'
782  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure supports
783  *         2 bit compression. Returns nonzero value in 'result' parameter if
784  *         kind supports 1 bit compression, else returns zero in the result.
785  *       NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE_4
786  *         This operation checks whether the kind passed in the 'kind'
787  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure supports
788  *         4 bit compression. Returns nonzero value in 'result' parameter if
789  *         kind supports 4 bit compression, else returns zero in the result.
790  *       NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC
791  *         This operation checks whether the kind passed in the 'kind'
792  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure
793  *         supports ZBC. Returns nonzero value in 'result' parameter if the
794  *         input kind supports ZBC, else returns zero in the result.
795  *       NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC_ALLOWS_1
796  *         This operation checks whether the kind passed in the 'kind'
797  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure
798  *         supports 1 bit ZBC. Returns nonzero value in 'result' parameter if
799  *         the input kind supports 1 bit ZBC, else returns zero in the result.
800  *       NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC_ALLOWS_2
801  *         This operation checks whether the kind passed in the 'kind'
802  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure
803  *         supports 2 bit ZBC. Returns nonzero value in 'result' parameter if
804  *         the input kind supports 2 bit ZBC, else returns zero in the result.
805  *       NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC_ALLOWS_4
806  *         This operation checks whether the kind passed in the 'kind'
807  *         parameter of the 'NV2080_CTRL_FB_IS_KIND_PARAMS' structure
808  *         supports 4 bit ZBC. Returns nonzero value in 'result' parameter if
809  *         the input kind supports 4 bit ZBC, else returns zero in the result.
810  *   kind
811  *     Specifies the kind on which the operation is to be carried out. The
812  *     legal range of values for the kind parameter is different on different
813  *     GPUs. For e.g. on Fermi, valid range is 0x00 to 0xfe. Still, some values
814  *     inside this legal range can be invalid i.e. not defined.
815  *     So its always better to first check if a particular kind is supported on
816  *     the current GPU with 'NV2080_CTRL_FB_IS_KIND_SUPPORTED' operation.
817  *   result
818  *     Upon return, this parameter will hold the result (true/false) of the
819  *     operation performed on the kind.
820  *
821  * Possible status values returned are:
822  *   NV_OK
823  *   NV_ERR_INVALID_ARGUMENT
824  */
825 #define NV2080_CTRL_CMD_FB_IS_KIND (0x20801313U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_IS_KIND_PARAMS_MESSAGE_ID" */
826 
827 #define NV2080_CTRL_FB_IS_KIND_PARAMS_MESSAGE_ID (0x13U)
828 
829 typedef struct NV2080_CTRL_FB_IS_KIND_PARAMS {
830     NvU32  operation;
831     NvU32  kind;
832     NvBool result;
833 } NV2080_CTRL_FB_IS_KIND_PARAMS;
834 
835 /* valid values for operation */
836 #define NV2080_CTRL_FB_IS_KIND_OPERATION_SUPPORTED      (0x00000000U)
837 #define NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE   (0x00000001U)
838 #define NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE_1 (0x00000002U)
839 #define NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE_2 (0x00000003U)
840 #define NV2080_CTRL_FB_IS_KIND_OPERATION_COMPRESSIBLE_4 (0x00000004U)
841 #define NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC            (0x00000005U)
842 #define NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC_ALLOWS_1   (0x00000006U)
843 #define NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC_ALLOWS_2   (0x00000007U)
844 #define NV2080_CTRL_FB_IS_KIND_OPERATION_ZBC_ALLOWS_4   (0x00000008U)
845 
846 /**
847  * NV2080_CTRL_CMD_FB_GET_GPU_CACHE_INFO
848  *
849  * This command returns the state of a cache which all GPU memory accesess go
850  * through.
851  *
852  *   powerState
853  *     Returns the power state of the cache.  Possible values are defined in
854  *     NV2080_CTRL_FB_GET_GPU_CACHE_INFO_POWER_STATE.
855  *
856  *   writeMode
857  *     Returns the write mode of the cache.  Possible values are defined in
858  *     NV2080_CTRL_FB_GET_GPU_CACHE_INFO_WRITE_MODE.
859  *
860  *   bypassMode
861  *     Returns the bypass mode of the L2 cache.  Possible values are defined in
862  *     NV2080_CTRL_FB_GET_GPU_CACHE_INFO_BYPASS_MODE.
863  *
864  *   rcmState
865  *     Returns the RCM state of the cache.  Possible values are defined in
866  *     NV2080_CTRL_FB_GET_GPU_CACHE_INFO_RCM_STATE.
867  *
868  *
869  * Possible status values returned are:
870  *   NV_OK
871  *   NV_ERR_NOT_SUPPORTED
872  *   NV_ERR_INVALID_STATE
873  *   NV_ERR_INVALID_ARGUMENT
874  */
875 
876 #define NV2080_CTRL_CMD_FB_GET_GPU_CACHE_INFO           (0x20801315U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_GPU_CACHE_INFO_PARAMS_MESSAGE_ID" */
877 
878 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_PARAMS_MESSAGE_ID (0x15U)
879 
880 typedef struct NV2080_CTRL_FB_GET_GPU_CACHE_INFO_PARAMS {
881     NvU32 powerState;
882     NvU32 writeMode;
883     NvU32 bypassMode;
884     NvU32 rcmState;
885 } NV2080_CTRL_FB_GET_GPU_CACHE_INFO_PARAMS;
886 
887 /* valid values for powerState */
888 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_POWER_STATE_ENABLED     (0x00000000U)
889 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_POWER_STATE_DISABLED    (0x00000001U)
890 /* valid values for writeMode */
891 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_WRITE_MODE_WRITETHROUGH (0x00000000U)
892 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_WRITE_MODE_WRITEBACK    (0x00000001U)
893 /* valid values for bypassMode */
894 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_BYPASS_MODE_DISABLED    (0x00000000U)
895 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_BYPASS_MODE_ENABLED     (0x00000001U)
896 /* valid values for rcmState */
897 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_RCM_STATE_FULL          (0x00000000U)
898 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_RCM_STATE_TRANSITIONING (0x00000001U)
899 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_RCM_STATE_REDUCED       (0x00000002U)
900 #define NV2080_CTRL_FB_GET_GPU_CACHE_INFO_RCM_STATE_ZERO_CACHE    (0x00000003U)
901 
902 /*
903  * NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY
904  *
905  * These commands access the cache promotion policy on a specific
906  * engine, if supported by the hardware.
907  *
908  * Cache promotion refers to the GPU promoting a memory read to a larger
909  * size to preemptively fill the cache so future reads to nearby memory
910  * addresses will hit in the cache.
911  *
912  *   engine
913  *     Specifies the target engine.  Possible values are defined in
914  *     NV2080_ENGINE_TYPE.
915  *   promotionPolicy
916  *     Specifies the promotion policy of the cache on the specified
917  *     engine. Possible values are defined by
918  *     NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_*.  These values are in terms
919  *     of the hardware cache line size.
920  *
921  */
922 typedef struct NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_PARAMS {
923     NvU32 engine;
924     NvU32 promotionPolicy;
925 } NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_PARAMS;
926 
927 /* valid values for promotionPolicy */
928 #define NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_NONE    (0x00000000U)
929 #define NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_QUARTER (0x00000001U)
930 #define NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_HALF    (0x00000002U)
931 #define NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_FULL    (0x00000003U)
932 
933 
934 /*
935  * NV2080_CTRL_CMD_FB_SET_GPU_CACHE_PROMOTION_POLICY
936  *
937  * This command sets the cache promotion policy on a specific engine, if
938  * supported by the hardware.
939  *
940  * Possible status values returned are:
941  *   NV_OK
942  *   NV_ERR_NOT_SUPPORTED
943  *   NV_ERR_INVALID_ARGUMENT
944  */
945 #define NV2080_CTRL_CMD_FB_SET_GPU_CACHE_PROMOTION_POLICY (0x20801316U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x16" */ // Deprecated, removed form RM
946 
947 
948 /*
949  * NV2080_CTRL_CMD_FB_GET_GPU_CACHE_PROMOTION_POLICY
950  *
951  * This command gets the cache promotion policy on a specific engine, if
952  * supported by the hardware.
953  *
954  * Possible status values returned are:
955  *   NV_OK
956  *   NV_ERR_NOT_SUPPORTED
957  *   NV_ERR_INVALID_ARGUMENT
958  */
959 #define NV2080_CTRL_CMD_FB_GET_GPU_CACHE_PROMOTION_POLICY (0x20801317U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x17" */ // Deprecated, removed form RM
960 
961 /*
962  * NV2080_CTRL_FB_CMD_GET_FB_REGION_INFO
963  *
964  * This command returns the FB memory region characteristics.
965  *
966  *   numFBRegions
967  *     Number of valid regions returned in fbRegion[]
968  *   fbRegion[].base
969  *     Base address of region.  The first valid address in the range
970  *     [base..limit].
971  *   fbRegion[].limit
972  *     Last/end address of region.  The last valid address in the range
973  *     [base..limit].
974  *     (limit - base + 1) = size of the region
975  *   fbRegion[].reserved
976  *     Amount of memory that RM speculatively needs within the region.  A
977  *     client doing its own memory management should leave at least this much
978  *     memory available for RM use.  This particularly applies to a driver
979  *     model like LDDM.
980  *   fbRegion[].performance
981  *     Relative performance of this region compared to other regions.
982  *     The definition is vague, and only connotes relative bandwidth or
983  *     performance.  The higher the value, the higher the performance.
984  *   fbRegion[].supportCompressed
985  *     TRUE if compressed surfaces/kinds are supported
986  *     FALSE if compressed surfaces/kinds are not allowed to be allocated in
987  *     this region
988  *   fbRegion[].supportISO
989  *     TRUE if ISO surfaces/kinds are supported (Display, cursor, video)
990  *     FALSE if ISO surfaces/kinds are not allowed to be allocated in this
991  *     region
992  *   fbRegion[].bProtected
993  *     TRUE if this region is a protected memory region.  If true only
994  *     allocations marked as protected (NVOS32_ALLOC_FLAGS_PROTECTED) can be
995  *     allocated in this region.
996  *   fbRegion[].blackList[] - DEPRECATED: Use supportISO
997  *     TRUE for each NVOS32_TYPE_IMAGE* that is NOT allowed in this region.
998  *
999  *   Possible status values returned are:
1000  *     NV_OK
1001  *     NV_ERR_NOT_SUPPORTED
1002  */
1003 #define NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO             (0x20801320U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS_MESSAGE_ID" */
1004 
1005 #define NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MEM_TYPES   17U
1006 
1007 typedef NvBool NV2080_CTRL_CMD_FB_GET_FB_REGION_SURFACE_MEM_TYPE_FLAG[NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MEM_TYPES];
1008 
1009 typedef struct NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO {
1010     NV_DECLARE_ALIGNED(NvU64 base, 8);
1011     NV_DECLARE_ALIGNED(NvU64 limit, 8);
1012     NV_DECLARE_ALIGNED(NvU64 reserved, 8);
1013     NvU32                                                  performance;
1014     NvBool                                                 supportCompressed;
1015     NvBool                                                 supportISO;
1016     NvBool                                                 bProtected;
1017     NV2080_CTRL_CMD_FB_GET_FB_REGION_SURFACE_MEM_TYPE_FLAG blackList;
1018 } NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO;
1019 
1020 #define NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MAX_ENTRIES 16U
1021 
1022 #define NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS_MESSAGE_ID (0x20U)
1023 
1024 typedef struct NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS {
1025     NvU32 numFBRegions;
1026     NV_DECLARE_ALIGNED(NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO fbRegion[NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MAX_ENTRIES], 8);
1027 } NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS;
1028 
1029 /*
1030  * NV2080_CTRL_CMD_FB_OFFLINE_PAGES
1031  *
1032  * This command adds video memory page addresses to the list of offlined
1033  * addresses so that they're not allocated to any client. The newly offlined
1034  * addresses take effect after a reboot.
1035  *
1036  *   offlined
1037  *     This input parameter is an array of NV2080_CTRL_FB_OFFLINED_ADDRESS_INFO
1038  *     structures, containing the video memory physical page numbers that
1039  *     are to be blacklisted. This array can hold a maximum of NV2080_CTRL_FB_
1040  *     BLACKLIST_PAGES_MAX_PAGES address pairs. Valid entries are adjacent.
1041  *   pageSize
1042  *     This input parameter contains the size of the page that is to be
1043  *     blacklisted.
1044  *   validEntries
1045  *     This input parameter specifies the number of valid entries in the
1046  *     offlined array.
1047  *   numPagesAdded
1048  *     This output parameter specifies how many of the validEntries were
1049  *     actually offlined. If numPagesAdded < validEntries, it
1050  *     means that only addresses from offlined[0] to offlined[numPagesAdded - 1]
1051  *     were added to the list of offlined addresses.
1052  *
1053  * Possible status values returned are:
1054  *   NV_OK
1055  *   NV_ERR_NOT_SUPPORTED
1056  *   NV_ERR_INVALID_ARGUMENT
1057  */
1058 #define NV2080_CTRL_CMD_FB_OFFLINE_PAGES              (0x20801321U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_OFFLINE_PAGES_PARAMS_MESSAGE_ID" */
1059 
1060 #define NV2080_CTRL_FB_OFFLINED_PAGES_MAX_PAGES       (0x00000040U)
1061 #define NV2080_CTRL_FB_OFFLINED_PAGES_INVALID_ADDRESS (0xffffffffffffffffULL)
1062 #define NV2080_CTRL_FB_OFFLINED_PAGES_PAGE_SIZE_4K    (0x00000000U)
1063 #define NV2080_CTRL_FB_OFFLINED_PAGES_PAGE_SIZE_64K   (0x00000001U)
1064 #define NV2080_CTRL_FB_OFFLINED_PAGES_PAGE_SIZE_128K  (0x00000002U)
1065 
1066 /*
1067  * NV2080_CTRL_FB_OFFLINED_ADDRESS_INFO
1068  *
1069  *   pageAddressWithEccOn
1070  *     Address of the memory page retired when ECC is enabled on the board.
1071  *   pageAddressWithEccOff
1072  *     Address of the memory page retired when ECC is disabled on the board.
1073  *   rbcAddress
1074  *     Row/Bank/Column Address of the faulty memory which caused the page to
1075  *     be retired
1076  *   source
1077  *     The reason for the page to be retired
1078  *   status
1079  *      Non-exceptional reasons for a page retirement failure
1080  *         NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_OK
1081  *            No error
1082  *         NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_PENDING_RETIREMENT
1083  *            The given address is already pending retirement or has
1084  *            been retired during the current driver run. The page
1085  *            will be offlined during the next driver run.
1086  *         NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_BLACKLISTING_FAILED
1087  *            The given page was retired on a previous driver run,
1088  *            so it should not be accessible unless offlining failed.
1089  *            Failing to offline a page is strongly indicative of a
1090  *            driver offlining bug.
1091  *         NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_TABLE_FULL
1092  *            The PBL is full and no more pages can be retired
1093  *         NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_INTERNAL_ERROR
1094  *            Internal driver error
1095  *
1096  */
1097 
1098 
1099 
1100 typedef struct NV2080_CTRL_FB_OFFLINED_ADDRESS_INFO {
1101     NV_DECLARE_ALIGNED(NvU64 pageAddressWithEccOn, 8);
1102     NV_DECLARE_ALIGNED(NvU64 pageAddressWithEccOff, 8);
1103     NvU32 rbcAddress;
1104     NvU32 source;
1105     NvU32 status;
1106     NvU32 timestamp;
1107 } NV2080_CTRL_FB_OFFLINED_ADDRESS_INFO;
1108 
1109 /* valid values for source */
1110 #define NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_DPR_MULTIPLE_SBE    (0x00000002U)
1111 #define NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_DPR_DBE             (0x00000004U)
1112 
1113 
1114 
1115 /* valid values for status */
1116 #define NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_OK                  (0x00000000U)
1117 #define NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_PENDING_RETIREMENT  (0x00000001U)
1118 #define NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_BLACKLISTING_FAILED (0x00000002U)
1119 #define NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_TABLE_FULL          (0x00000003U)
1120 #define NV2080_CTRL_FB_OFFLINED_PAGES_STATUS_INTERNAL_ERROR      (0x00000004U)
1121 
1122 /* deprecated */
1123 #define NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_MULTIPLE_SBE        NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_DPR_MULTIPLE_SBE
1124 #define NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_DBE                 NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_DPR_DBE
1125 
1126 
1127 #define NV2080_CTRL_FB_OFFLINE_PAGES_PARAMS_MESSAGE_ID (0x21U)
1128 
1129 typedef struct NV2080_CTRL_FB_OFFLINE_PAGES_PARAMS {
1130     NV_DECLARE_ALIGNED(NV2080_CTRL_FB_OFFLINED_ADDRESS_INFO offlined[NV2080_CTRL_FB_OFFLINED_PAGES_MAX_PAGES], 8);
1131     NvU32 pageSize;
1132     NvU32 validEntries;
1133     NvU32 numPagesAdded;
1134 } NV2080_CTRL_FB_OFFLINE_PAGES_PARAMS;
1135 
1136 /*
1137  * NV2080_CTRL_CMD_FB_GET_OFFLINED_PAGES
1138  *
1139  * This command returns the list of video memory page addresses in the
1140  * Inforom's blacklist.
1141  *
1142  *   offlined
1143  *     This output parameter is an array of NV2080_CTRL_FB_BLACKLIST_ADDRESS_
1144  *     INFO structures, containing the video memory physical page numbers that
1145  *     are blacklisted. This array can hold a maximum of NV2080_CTRL_FB_
1146  *     BLACKLIST_PAGES_MAX_PAGES address pairs. Valid entries are adjacent.
1147  *     The array also contains the Row/Bank/Column Address and source.
1148  *   validEntries
1149  *     This output parameter specifies the number of valid entries in the
1150  *     offlined array.
1151  *   bRetirementPending (DEPRECATED, use retirementPending instead)
1152  *     This output parameter returns if any pages on the list are pending
1153  *     retirement.
1154  *   retirementPending
1155  *     Communicates to the caller whether retirement updates are pending and the
1156  *     reason for the updates. Possible fields are:
1157  *     NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_*:
1158  *       NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_SBE:
1159  *         Indicates whether pages are pending retirement due to SBE.
1160  *       NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_DBE:
1161  *         Indicates whether pages are pending retirement due to DBE. Driver
1162  *         reload needed to retire bad memory pages and allow compute app runs.
1163  *
1164  * Possible status values returned are:
1165  *   NV_OK
1166  *   NV_ERR_NOT_SUPPORTED
1167  */
1168 
1169 
1170 
1171 #define NV2080_CTRL_CMD_FB_GET_OFFLINED_PAGES                            (0x20801322U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_OFFLINED_PAGES_PARAMS_MESSAGE_ID" */
1172 
1173 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_SBE          0:0
1174 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_SBE_FALSE   0U
1175 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_SBE_TRUE    1U
1176 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_DBE          1:1
1177 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_DBE_FALSE   0U
1178 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_RETIREMENT_PENDING_DBE_TRUE    1U
1179 
1180 
1181 
1182 #define NV2080_CTRL_FB_GET_OFFLINED_PAGES_PARAMS_MESSAGE_ID (0x22U)
1183 
1184 typedef struct NV2080_CTRL_FB_GET_OFFLINED_PAGES_PARAMS {
1185     NV_DECLARE_ALIGNED(NV2080_CTRL_FB_OFFLINED_ADDRESS_INFO offlined[NV2080_CTRL_FB_OFFLINED_PAGES_MAX_PAGES], 8);
1186     NvU32  validEntries;
1187     NvBool bRetirementPending;
1188     NvU8   retirementPending;
1189 } NV2080_CTRL_FB_GET_OFFLINED_PAGES_PARAMS;
1190 
1191 /*
1192  * NV2080_CTRL_CMD_FB_QUERY_ACR_REGION
1193  *
1194  * This control command is used to query the secured region allocated
1195  *
1196  * queryType
1197  *          NV2080_CTRL_CMD_FB_ACR_QUERY_GET_REGION_STATUS: Provides the alloc
1198  *          status and ACR region ID.
1199  *          NV2080_CTRL_CMD_FB_QUERY_MAP_REGION : Maps the region on BAR1
1200  *           it returns the "pCpuAddr" and pPriv to user.
1201  *          NV2080_CTRL_CMD_FB_QUERY_UNMAP_REGION: Unmaps the mapped region.
1202  *          it takes the pPriv as input
1203  *
1204  * clientReq : struct ACR_REQUEST_PARAMS
1205  *          It is used to find the allocated ACR region for that client
1206  *          clientId     : ACR Client ID
1207  *          reqReadMask  : read mask of ACR region
1208  *          reqWriteMask : Write mask of ACR region
1209  *          regionSize   : ACR region Size
1210  *
1211  * clientReqStatus : struct ACR_STATUS_PARAMS
1212  *          This struct is stores the output of requested ACR region.
1213  *          allocStatus     : Allocated Status of ACR region
1214  *          regionId        : ACR region ID
1215  *          physicalAddress : Physical address on FB
1216  *
1217  *
1218  * NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_CODE
1219  *          NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_NONE : Control command executed successfully
1220  *          NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_INVALID_CLIENT_REQUEST : Please check the parameter
1221  *                      for ACR client request
1222  *          NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_FAILED_TO_MAP_ON_BAR1 : RM Fails to map ACR region
1223  *                      on BAR1
1224  *
1225  * Possible status values returned are:
1226  *   NV_OK
1227  *   NV_ERR_NOT_SUPPORTED
1228 */
1229 #define NV2080_CTRL_CMD_FB_QUERY_ACR_REGION (0x20801325U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_QUERY_ACR_REGION_PARAMS_MESSAGE_ID" */
1230 
1231 //
1232 // We can create an ACR region by using RMCreateAcrRegion[1|2] regkey or mods -acr[1|2]_size
1233 // Client ID for such region is 2 in RM.
1234 //
1235 #define NV2080_CTRL_CMD_FB_ACR_CLIENT_ID    2U
1236 
1237 typedef enum NV2080_CTRL_CMD_FB_ACR_QUERY_TYPE {
1238     NV2080_CTRL_CMD_FB_ACR_QUERY_GET_CLIENT_REGION_STATUS = 0,
1239     NV2080_CTRL_CMD_FB_ACR_QUERY_GET_REGION_PROPERTY = 1,
1240     NV2080_CTRL_CMD_FB_ACR_QUERY_GET_FALCON_STATUS = 2,
1241 } NV2080_CTRL_CMD_FB_ACR_QUERY_TYPE;
1242 
1243 typedef enum NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_CODE {
1244     NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_NONE = 0,
1245     NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_INVALID_CLIENT_REQUEST = 1,
1246 } NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_CODE;
1247 
1248 typedef struct ACR_REQUEST_PARAMS {
1249     NvU32 clientId;
1250     NvU32 reqReadMask;
1251     NvU32 reqWriteMask;
1252     NvU32 regionSize;
1253 } ACR_REQUEST_PARAMS;
1254 
1255 typedef struct ACR_REGION_ID_PROP {
1256     NvU32 regionId;
1257     NvU32 readMask;
1258     NvU32 writeMask;
1259     NvU32 regionSize;
1260     NvU32 clientMask;
1261     NV_DECLARE_ALIGNED(NvU64 physicalAddress, 8);
1262 } ACR_REGION_ID_PROP;
1263 
1264 typedef struct ACR_STATUS_PARAMS {
1265     NvU32 allocStatus;
1266     NvU32 regionId;
1267     NV_DECLARE_ALIGNED(NvU64 physicalAddress, 8);
1268 } ACR_STATUS_PARAMS;
1269 
1270 typedef struct ACR_REGION_HANDLE {
1271     NvHandle hClient;
1272     NvHandle hParent;
1273     NvHandle hMemory;
1274     NvU32    hClass;
1275     NvHandle hDevice;
1276 } ACR_REGION_HANDLE;
1277 
1278 typedef struct ACR_FALCON_LS_STATUS {
1279     NvU16  falconId;
1280     NvBool bIsInLs;
1281 } ACR_FALCON_LS_STATUS;
1282 
1283 #define NV2080_CTRL_CMD_FB_QUERY_ACR_REGION_PARAMS_MESSAGE_ID (0x25U)
1284 
1285 typedef struct NV2080_CTRL_CMD_FB_QUERY_ACR_REGION_PARAMS {
1286     NV2080_CTRL_CMD_FB_ACR_QUERY_TYPE       queryType;
1287     NV2080_CTRL_CMD_FB_ACR_QUERY_ERROR_CODE errorCode;
1288     NV_DECLARE_ALIGNED(ACR_REGION_ID_PROP acrRegionIdProp, 8);
1289     ACR_REQUEST_PARAMS                      clientReq;
1290     NV_DECLARE_ALIGNED(ACR_STATUS_PARAMS clientReqStatus, 8);
1291     ACR_REGION_HANDLE                       handle;
1292     ACR_FALCON_LS_STATUS                    falconStatus;
1293 } NV2080_CTRL_CMD_FB_QUERY_ACR_REGION_PARAMS;
1294 
1295 /*
1296  * NV2080_CTRL_CMD_FB_CLEAR_OFFLINED_PAGES
1297  *
1298  * This command clears offlined video memory page addresses from the Inforom.
1299  *
1300  *   sourceMask
1301  *     This is a bit mask of NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE. Pages
1302  *     offlined from the specified sources will be cleared/removed from the
1303  *     Inforom PBL object denylist.
1304  *
1305  * Possible status values returned are:
1306  *   NV_OK
1307  *   NV_ERR_NOT_SUPPORTED
1308  */
1309 #define NV2080_CTRL_CMD_FB_CLEAR_OFFLINED_PAGES (0x20801326U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_CLEAR_OFFLINED_PAGES_PARAMS_MESSAGE_ID" */
1310 
1311 #define NV2080_CTRL_FB_CLEAR_OFFLINED_PAGES_PARAMS_MESSAGE_ID (0x26U)
1312 
1313 typedef struct NV2080_CTRL_FB_CLEAR_OFFLINED_PAGES_PARAMS {
1314     NvU32 sourceMask;
1315 } NV2080_CTRL_FB_CLEAR_OFFLINED_PAGES_PARAMS;
1316 
1317 /*!
1318  * NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_INFO
1319  *
1320  * Gets pointer to then object of class CompBitCopy, which is used for swizzling
1321  * compression bits in the compression backing store. The caller is expected to
1322  * have the appropriate headers for class CompBitCopy. Also retrieves values of some
1323  * parameters needed to call the compbit swizzling method.
1324  *
1325  * @params[out] void *pCompBitCopyObj
1326  *     Opaque pointer to object of class CompBitCopy
1327  * @params[out] void *pSwizzleParams
1328  *     Opaque pointer to values needed to call the compbit
1329  *     swizzle method.
1330  *
1331  * Possible status values returned are:
1332  *   NV_OK NV_ERR_NOT_SUPPORTED
1333  */
1334 #define NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_INFO (0x20801327U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_INFO_PARAMS_MESSAGE_ID" */
1335 
1336 #define NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_INFO_PARAMS_MESSAGE_ID (0x27U)
1337 
1338 typedef struct NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_INFO_PARAMS {
1339     NV_DECLARE_ALIGNED(NvP64 pCompBitCopyObj, 8);
1340     NV_DECLARE_ALIGNED(NvP64 pSwizzleParams, 8);
1341 } NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_INFO_PARAMS;
1342 
1343 /*
1344  * NV2080_CTRL_CMD_FB_GET_LTC_INFO_FOR_FBP
1345  *
1346  * Gets the count and mask of LTCs for a given FBP.
1347  *
1348  *   fbpIndex
1349  *     The physical index of the FBP to get LTC info for.
1350  *   ltcMask
1351  *     The mask of active LTCs for the given FBP.
1352  *   ltcCount
1353  *     The count of active LTCs for the given FBP.
1354  *   ltsMask
1355  *      The mask of active LTSs for the given FBP
1356  *   ltsCount
1357  *      The count of active LTSs for the given FBP
1358  *
1359  * Possible status values returned are:
1360  *   NV_OK
1361  *   NV_ERR_NOT_SUPPORTED
1362  */
1363 #define NV2080_CTRL_CMD_FB_GET_LTC_INFO_FOR_FBP (0x20801328U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_LTC_INFO_FOR_FBP_PARAMS_MESSAGE_ID" */
1364 
1365 #define NV2080_CTRL_FB_GET_LTC_INFO_FOR_FBP_PARAMS_MESSAGE_ID (0x28U)
1366 
1367 typedef struct NV2080_CTRL_FB_GET_LTC_INFO_FOR_FBP_PARAMS {
1368     NvU8  fbpIndex;
1369     NvU32 ltcMask;
1370     NvU32 ltcCount;
1371     NvU32 ltsMask;
1372     NvU32 ltsCount;
1373 } NV2080_CTRL_FB_GET_LTC_INFO_FOR_FBP_PARAMS;
1374 
1375 
1376 /*!
1377  * NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_CONTEXT               < Deprecated >
1378  *
1379  * "set the context" for following CompBitCopy member functions.
1380  * These are the CompBitCopy member variables that remain connstant
1381  * over multiple CompBitCopy member function calls, yet stay the same
1382  * throughout a single surface eviction.
1383  *
1384  * @params[in] UINT64  backingStorePA;
1385  *     Physical Address of the Backing Store
1386  * @params[in] UINT08 *backingStoreVA;
1387  *     Virtual Address of the Backing Store
1388  * @params[in] UINT64  backingStoreChunkPA;
1389  *     Physical Address of the "Chunk Buffer"
1390  * @params[in] UINT08 *backingStoreChunkVA;
1391  *     Virtual Address of the "Chunk Buffer"
1392  * @params[in] UINT32  backingStoreChunkSize;
1393  *     Size of the "Chunk Buffer"
1394  * @params[in] UINT08 *cacheWriteBitMap;
1395  *     Pointer to the bitmap which parts of the
1396  *     "Chunk" was updated.
1397  * @params[in] bool    backingStoreChunkOverfetch;
1398  *     Overfetch factor.
1399  * @params[in] UINT32  PageSizeSrc;
1400  *     Page size of Source Surface.
1401  * @params[in] UINT32  PageSizeDest;
1402  *     page size of Destination Surface.
1403  *
1404  * Possible status values returned are:
1405  *   NV_OK
1406  *   NV_ERR_NOT_SUPPORTED
1407  */
1408 #define NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_CONTEXT (0x20801329U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x29" */
1409 
1410 typedef struct NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_CONTEXT_PARAMS {
1411     NvU32  CBCBaseAddress;
1412     NV_DECLARE_ALIGNED(NvU64 backingStorePA, 8);
1413     NV_DECLARE_ALIGNED(NvU8 *backingStoreVA, 8);
1414     NV_DECLARE_ALIGNED(NvU64 backingStoreChunkPA, 8);
1415     NV_DECLARE_ALIGNED(NvU8 *backingStoreChunkVA, 8);
1416     NvU32  backingStoreChunkSize;
1417     NV_DECLARE_ALIGNED(NvU8 *cacheWriteBitMap, 8);
1418     NvBool backingStoreChunkOverfetch;
1419     NvU32  PageSizeSrc;
1420     NvU32  PageSizeDest;
1421 } NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_CONTEXT_PARAMS;
1422 
1423 /*!
1424  * NV2080_CTRL_CMD_FB_COMPBITCOPY_GET_COMPBITS              < Deprecated >
1425  *
1426  * Retrieves the Compression and Fast Clear bits for the surface+offset given.
1427  *
1428  * @params[out] NvU32  *fcbits;
1429  *     Fast Clear Bits returned
1430  * @params[out] NvU32  *compbits;
1431  *     Compression Bits returned
1432  * @params[in] NvU64  dataPhysicalStart;
1433  *     Start Address of Data
1434  * @params[in] NvU64  surfaceOffset;
1435  *     Offset in the surface
1436  * @params[in] NvU32  comptagLine;
1437  *     Compression Tag Number
1438  * @params[in] NvBool upper64KBCompbitSel;
1439  *     Selects Upper or Lower 64K
1440  *
1441  * Possible status values returned are:
1442  *   NV_OK
1443  *   NV_ERR_NOT_SUPPORTEDD
1444  */
1445 #define NV2080_CTRL_CMD_FB_COMPBITCOPY_GET_COMPBITS (0x2080132aU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x2A" */
1446 
1447 typedef struct NV2080_CTRL_CMD_FB_COMPBITCOPY_GET_COMPBITS_PARAMS {
1448     NV_DECLARE_ALIGNED(NvU32 *fcbits, 8);
1449     NV_DECLARE_ALIGNED(NvU32 *compbits, 8);
1450     NV_DECLARE_ALIGNED(NvU64 dataPhysicalStart, 8);
1451     NV_DECLARE_ALIGNED(NvU64 surfaceOffset, 8);
1452     NvU32  comptagLine;
1453     NvBool upper64KBCompbitSel;
1454 } NV2080_CTRL_CMD_FB_COMPBITCOPY_GET_COMPBITS_PARAMS;
1455 
1456 /*!
1457  * NV2080_CTRL_CMD_FB_COMPBITCOPY_PUT_COMPBITS              < Deprecated >
1458  *
1459  * Sets the Compression and Fast Clear bits for the surface+offset given.
1460  *
1461  * @params[in] NvU32  fcbits;
1462  *     Fast Clear Bits to write.
1463  * @params[in] NvU32  compbits;
1464  *     Compression Bits to write
1465  * @params[in] NvBool writeFc;
1466  *     Indicates if Fast Clear Bits should be written
1467  * @params[in] NvU64  dataPhysicalStart;
1468  *     Start Address of Data
1469  * @params[in] NvU64  surfaceOffset;
1470  *     Offset in the surface
1471  * @params[in] NvU32  comptagLine;
1472  *     Compression Tag Number
1473  * @params[in] NvBool upper64KBCompbitSel;
1474  *     Selects Upper or Lower 64K
1475  *
1476  * Possible status values returned are:
1477  *   NV_OK
1478  *   NV_ERR_NOT_SUPPORTED
1479  */
1480 #define NV2080_CTRL_CMD_FB_COMPBITCOPY_PUT_COMPBITS (0x2080132bU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x2B" */
1481 
1482 typedef struct NV2080_CTRL_CMD_FB_COMPBITCOPY_PUT_COMPBITS_PARAMS {
1483     NvU32  fcbits;
1484     NvU32  compbits;
1485     NvBool writeFc;
1486     NV_DECLARE_ALIGNED(NvU64 dataPhysicalStart, 8);
1487     NV_DECLARE_ALIGNED(NvU64 surfaceOffset, 8);
1488     NvU32  comptagLine;
1489     NvBool upper64KBCompbitSel;
1490 } NV2080_CTRL_CMD_FB_COMPBITCOPY_PUT_COMPBITS_PARAMS;
1491 
1492 /*!
1493  * NV2080_CTRL_CMD_FB_COMPBITCOPY_READ_COMPBITS64KB         < Deprecated >
1494  *
1495  * Read 64KB chunk of CompBits
1496  *
1497  * @params[in] NvU64  SrcDataPhysicalStart;
1498  *     Start Address of Data
1499  * @params[in] NvU32  SrcComptagLine;
1500  *     Compression Tag Number
1501  * @params[in] NvU32  page64KB;
1502  *     Which 64K block to read from.
1503  * @params[out] NvU32  *compbitBuffer;
1504  *     Buffer for CompBits read,
1505  * @params[in] NvBool upper64KBCompbitSel;
1506  *     Selects Upper or Lower 64K
1507  *
1508  * Possible status values returned are:
1509  *   NV_OK
1510  *   NV_ERR_NOT_SUPPORTED
1511  */
1512 #define NV2080_CTRL_CMD_FB_COMPBITCOPY_READ_COMPBITS64KB (0x2080132cU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x2C" */
1513 
1514 typedef struct NV2080_CTRL_CMD_FB_COMPBITCOPY_READ_COMPBITS64KB_PARAMS {
1515     NV_DECLARE_ALIGNED(NvU64 SrcDataPhysicalStart, 8);
1516     NvU32  SrcComptagLine;
1517     NvU32  page64KB;
1518     NV_DECLARE_ALIGNED(NvU32 *compbitBuffer, 8);
1519     NvBool upper64KBCompbitSel;
1520 } NV2080_CTRL_CMD_FB_COMPBITCOPY_READ_COMPBITS64KB_PARAMS;
1521 
1522 /*!
1523  * NV2080_CTRL_CMD_FB_COMPBITCOPY_WRITE_COMPBITS64KB        < Deprecated >
1524  *
1525  * Write 64K chunk of COmpBits.
1526  *
1527  * @params[in] NvU64  SrcDataPhysicalStart;
1528  *     Start Address of Data
1529  * @params[in] NvU32  SrcComptagLine;
1530  *     Compression Tag Number
1531  * @params[in] NvU32  page64KB;
1532  *     Which 64K block to read from.
1533  * @params[in] NvU32  *compbitBuffer;
1534  *     Buffer for CompBits to write.
1535  * @params[in] NvBool upper64KBCompbitSel
1536  *     Selects Upper or Lower 64K
1537  *
1538  * Possible status values returned are:
1539  *   NV_OK
1540  *   NV_ERR_NOT_SUPPORTED
1541  */
1542 #define NV2080_CTRL_CMD_FB_COMPBITCOPY_WRITE_COMPBITS64KB (0x2080132dU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x2D" */
1543 
1544 typedef struct NV2080_CTRL_CMD_FB_COMPBITCOPY_WRITE_COMPBITS64KB_PARAMS {
1545     NV_DECLARE_ALIGNED(NvU64 DstDataPhysicalStart, 8);
1546     NvU32  DstComptagLine;
1547     NvU32  page64KB;
1548     NV_DECLARE_ALIGNED(NvU32 *compbitBuffer, 8);
1549     NvBool upper64KBCompbitSel;
1550 } NV2080_CTRL_CMD_FB_COMPBITCOPY_WRITE_COMPBITS64KB_PARAMS;
1551 
1552 /*!
1553  * NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_FORCE_BAR1                    < Deprecated >
1554  *
1555  * Used by MODS (and possibly other clients) to have compbit code write
1556  * write directly to BAR1, rather than a intermediate buffer.
1557  *
1558  * @params[in] NvBool bForceBar1;
1559  *     Enables or disables direct writes to BAR1.
1560  *
1561  * Possible status values returned are:
1562  *   NV_OK
1563  *   NV_ERR_NOT_SUPPORTED
1564  */
1565 #define NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_FORCE_BAR1 (0x20801335U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | 0x35" */
1566 
1567 typedef struct NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_FORCE_BAR1_PARAMS {
1568     NvBool bForceBar1;
1569 } NV2080_CTRL_CMD_FB_COMPBITCOPY_SET_FORCE_BAR1_PARAMS;
1570 
1571 /*!
1572  * NV2080_CTRL_CMD_FB_GET_AMAP_CONF
1573  *
1574  * Fills in fields of a structure of class ConfParamsV1, which is used for
1575  * swizzling compression bits in the compression backing store.
1576  * The caller is expected to have the appropriate headers for class ConfParamsV1.
1577  *
1578  * @params[in|out] void *pAmapConfParms
1579  *     Opaque pointer to structure of values for ConfParamsV1
1580  * @params[in|out] void *pCbcSwizzleParms
1581  *     Opaque pointer to structure of values for CbcSwizzleParamsV1
1582  *
1583  * Possible status values returned are:
1584  *   NV_OK NV_ERR_NOT_SUPPORTED
1585  *
1586  * pCbcSwizzleParams will be filled in with certain parameters from
1587  * @CbcSwizzleParamsV1.  However, the caller is responsible for making sure
1588  * all parameters are filled in before using it.
1589  */
1590 #define NV2080_CTRL_CMD_FB_GET_AMAP_CONF (0x20801336U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_GET_AMAP_CONF_PARAMS_MESSAGE_ID" */
1591 
1592 #define NV2080_CTRL_CMD_FB_GET_AMAP_CONF_PARAMS_MESSAGE_ID (0x36U)
1593 
1594 typedef struct NV2080_CTRL_CMD_FB_GET_AMAP_CONF_PARAMS {
1595     NV_DECLARE_ALIGNED(NvP64 pAmapConfParams, 8);
1596     NV_DECLARE_ALIGNED(NvP64 pCbcSwizzleParams, 8);
1597 } NV2080_CTRL_CMD_FB_GET_AMAP_CONF_PARAMS;
1598 
1599 /*!
1600  * NV2080_CTRL_CMD_FB_CBC_OP
1601  *
1602  * Provides a way for clients to request a CBC Operation
1603  *
1604  * @params[in] CTRL_CMD_FB_CBC_OP fbCBCOp
1605  *      CBC Operation requested.
1606  *      Valid Values:
1607  *          CTRL_CMD_FB_CBC_OP_CLEAN
1608  *          CTRL_CMD_FB_CBC_OP_INVALIDATE
1609  *
1610  * Possible status values returned are:
1611  *   NV_OK NV_ERR_NOT_SUPPORTED NV_ERR_INVALID_ARGUMENT NV_ERR_TIMEOUT
1612  */
1613 #define NV2080_CTRL_CMD_FB_CBC_OP (0x20801337U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_CBC_OP_PARAMS_MESSAGE_ID" */
1614 
1615 /*!
1616  * Permitted CBC Operations
1617  */
1618 typedef enum CTRL_CMD_FB_CBC_OP {
1619     CTRL_CMD_FB_CBC_OP_CLEAN = 0,
1620     CTRL_CMD_FB_CBC_OP_INVALIDATE = 1,
1621 } CTRL_CMD_FB_CBC_OP;
1622 
1623 #define NV2080_CTRL_CMD_FB_CBC_OP_PARAMS_MESSAGE_ID (0x37U)
1624 
1625 typedef struct NV2080_CTRL_CMD_FB_CBC_OP_PARAMS {
1626     CTRL_CMD_FB_CBC_OP fbCBCOp;
1627 } NV2080_CTRL_CMD_FB_CBC_OP_PARAMS;
1628 
1629 /*!
1630  *  NV2080_CTRL_CMD_FB_GET_CTAGS_FOR_CBC_EVICTION
1631  *
1632  *  The call will fetch the compression tags reserved for CBC eviction.
1633  *
1634  *  Each comptag will correspond to a unique compression cacheline. The usage of
1635  *  these comptags is to evict the CBC by making accesses to a dummy compressed page,
1636  *  thereby evicting each CBC line.
1637  *
1638  *  @param [in][out] NvU32 pCompTags
1639  *     Array of reserved compression tags of size @ref NV2080_MAX_CTAGS_FOR_CBC_EVICTION
1640  *  @param [out] numCompTags
1641  *     Number of entries returned in @ref pCompTags
1642  *
1643  *  @returns
1644  *      NV_OK
1645  *      NV_ERR_INVALID_STATE
1646  *      NV_ERR_OUT_OF_RANGE
1647  *      NV_ERR_INVALID_PARAMETER
1648  */
1649 #define NV2080_CTRL_CMD_FB_GET_CTAGS_FOR_CBC_EVICTION (0x20801338U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_CTAGS_FOR_CBC_EVICTION_PARAMS_MESSAGE_ID" */
1650 
1651 /*!
1652  * Max size of @ref NV2080_CTRL_FB_GET_CTAGS_FOR_CBC_EVICTION_PARAMS::pCompTags
1653  * Arbitrary, but sufficiently large number. Should be checked against CBC size.
1654  */
1655 #define NV2080_MAX_CTAGS_FOR_CBC_EVICTION             0x7FU
1656 
1657 
1658 #define NV2080_CTRL_FB_GET_CTAGS_FOR_CBC_EVICTION_PARAMS_MESSAGE_ID (0x38U)
1659 
1660 typedef struct NV2080_CTRL_FB_GET_CTAGS_FOR_CBC_EVICTION_PARAMS {
1661     NvU32 pCompTags[NV2080_MAX_CTAGS_FOR_CBC_EVICTION];
1662     NvU32 numCompTags;
1663 } NV2080_CTRL_FB_GET_CTAGS_FOR_CBC_EVICTION_PARAMS;
1664 
1665 /*!
1666  * NV2080_CTRL_CMD_FB_ALLOC_COMP_RESOURCE
1667  *
1668  * This Call will allocate compression tag
1669  *
1670  * @params[in] NvU32 attr
1671  *      Stores the information:
1672  *          1. NVOS32_ATTR_COMPR_REQUIRED or not
1673  *          2. NVOS32_ATTR_PAGE_SIZE
1674  * @params[in] NvU32 attr2
1675  *      Determine whether to allocate
1676  *      an entire cache line or allocate by size
1677  * @params[in] NvU32 size
1678  *      Specify the size of allocation, in pages not bytes
1679  * @params[in] NvU32 ctagOffset
1680  *      Determine the offset usage of the allocation
1681  * @params[out] NvU32 hwResId
1682  *      Stores the result of the allocation
1683  * @params[out] NvU32 RetcompTagLineMin
1684  *      The resulting min Ctag Number from the allocation
1685  * @params[out] NvU32 RetcompTagLineMax
1686  *      The resulting max Ctag Number from the allocation
1687  * @returns
1688  *      NV_OK
1689  *      NV_ERR_INSUFFICIENT_RESOURCES
1690  *      NV_ERR_INVALID_ARGUMENT
1691  *      NV_ERR_INVALID_STATE
1692  */
1693 
1694 #define NV2080_CTRL_CMD_FB_ALLOC_COMP_RESOURCE (0x20801339U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_ALLOC_COMP_RESOURCE_PARAMS_MESSAGE_ID" */
1695 
1696 #define NV2080_CTRL_CMD_FB_ALLOC_COMP_RESOURCE_PARAMS_MESSAGE_ID (0x39U)
1697 
1698 typedef struct NV2080_CTRL_CMD_FB_ALLOC_COMP_RESOURCE_PARAMS {
1699     NvU32 attr;
1700     NvU32 attr2;
1701     NvU32 size;
1702     NvU32 ctagOffset;
1703     NvU32 hwResId;
1704     NvU32 retCompTagLineMin;
1705     NvU32 retCompTagLineMax;
1706 } NV2080_CTRL_CMD_FB_ALLOC_COMP_RESOURCE_PARAMS;
1707 
1708 /*!
1709  * NV2080_CTRL_CMD_FB_FREE_TILE
1710  *
1711  * This control call is used to release tile back to the free pool
1712  *
1713  * @params[in] NvU32 hwResId
1714  *      Stores the information of a previous allocation
1715  * @returns
1716  *      NV_OK
1717  *      NV_ERR_INVALID_ARGUMENT
1718  *      NV_ERR_INVALID_STATE
1719  */
1720 
1721 #define NV2080_CTRL_CMD_FB_FREE_TILE (0x2080133aU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_FREE_TILE_PARAMS_MESSAGE_ID" */
1722 
1723 #define NV2080_CTRL_CMD_FB_FREE_TILE_PARAMS_MESSAGE_ID (0x3AU)
1724 
1725 typedef struct NV2080_CTRL_CMD_FB_FREE_TILE_PARAMS {
1726     NvU32 hwResId;
1727 } NV2080_CTRL_CMD_FB_FREE_TILE_PARAMS;
1728 
1729 
1730 /*
1731  * NV2080_CTRL_CMD_FB_SETUP_VPR_REGION
1732  *
1733  * This control command is used to request vpr region setup
1734  *
1735  * requestType
1736  *          NV2080_CTRL_CMD_FB_SET_VPR: Request to setup VPR
1737  *
1738  * requestParams : struct VPR_REQUEST_PARAMS
1739  *          It contains the VPR region request details like,
1740  *          startAddr : FB offset from which we need to setup VPR
1741  *          size      : required size of the region
1742  *
1743  * statusParams  : struct VPR_STATUS_PARAMS
1744  *          This struct stores the output of requested VPR region
1745  *          status    : Whether the request was successful
1746  *
1747  * NV2080_CTRL_CMD_FB_VPR_ERROR_CODE :
1748  *          NV2080_CTRL_CMD_FB_VPR_ERROR_GENERIC : Some unknown error occurred
1749  *          NV2080_CTRL_CMD_FB_VPR_ERROR_INVALID_CLIENT_REQUEST : Request was invalid
1750  *
1751  * Possible status values returned are:
1752  *   NV_OK
1753  *   NV_ERR_NOT_SUPPORTED
1754  */
1755 #define NV2080_CTRL_CMD_FB_SETUP_VPR_REGION (0x2080133bU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_SETUP_VPR_REGION_PARAMS_MESSAGE_ID" */
1756 
1757 typedef enum NV2080_CTRL_CMD_FB_VPR_REQUEST_TYPE {
1758     NV2080_CTRL_CMD_FB_SET_VPR = 0,
1759 } NV2080_CTRL_CMD_FB_VPR_REQUEST_TYPE;
1760 
1761 typedef enum NV2080_CTRL_CMD_FB_VPR_ERROR_CODE {
1762     NV2080_CTRL_CMD_FB_VPR_ERROR_GENERIC = 0,
1763     NV2080_CTRL_CMD_FB_VPR_ERROR_INVALID_CLIENT_REQUEST = 1,
1764 } NV2080_CTRL_CMD_FB_VPR_ERROR_CODE;
1765 
1766 typedef struct VPR_REQUEST_PARAMS {
1767     NvU32 startAddr;
1768     NvU32 size;
1769 } VPR_REQUEST_PARAMS;
1770 
1771 typedef struct VPR_STATUS_PARAMS {
1772     NvU32 status;
1773 } VPR_STATUS_PARAMS;
1774 
1775 #define NV2080_CTRL_CMD_FB_SETUP_VPR_REGION_PARAMS_MESSAGE_ID (0x3BU)
1776 
1777 typedef struct NV2080_CTRL_CMD_FB_SETUP_VPR_REGION_PARAMS {
1778     NV2080_CTRL_CMD_FB_VPR_REQUEST_TYPE requestType;
1779     VPR_REQUEST_PARAMS                  requestParams;
1780     VPR_STATUS_PARAMS                   statusParams;
1781 } NV2080_CTRL_CMD_FB_SETUP_VPR_REGION_PARAMS;
1782 typedef struct NV2080_CTRL_CMD_FB_SETUP_VPR_REGION_PARAMS *PNV2080_CTRL_CMD_FB_SETUP_VPR_REGION_PARAMS;
1783 
1784 /*
1785  * NV2080_CTRL_CMD_FB_GET_CLI_MANAGED_OFFLINED_PAGES
1786  *
1787  * This command returns the list of offlined video memory page addresses in the
1788  * region managed by Client
1789  *
1790  *   offlinedPages
1791  *     This output parameter is an array of video memory physical page numbers that
1792  *     are offlined. This array can hold a maximum of NV2080_CTRL_FB_
1793  *     OFFLINED_PAGES_MAX_PAGES addresses.
1794  *   pageSize
1795  *     This output parameter contains the size of the page that is offlined.
1796  *   validEntries
1797  *     This output parameter specifies the number of valid entries in the
1798  *     offlined array.
1799  *
1800  * Possible status values returned are:
1801  *   NV_OK
1802  */
1803 #define NV2080_CTRL_CMD_FB_GET_CLI_MANAGED_OFFLINED_PAGES (0x2080133cU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_CLI_MANAGED_OFFLINED_PAGES_PARAMS_MESSAGE_ID" */
1804 
1805 #define NV2080_CTRL_FB_GET_CLI_MANAGED_OFFLINED_PAGES_PARAMS_MESSAGE_ID (0x3CU)
1806 
1807 typedef struct NV2080_CTRL_FB_GET_CLI_MANAGED_OFFLINED_PAGES_PARAMS {
1808     NvU32 offlinedPages[NV2080_CTRL_FB_OFFLINED_PAGES_MAX_PAGES];    // A 32B can hold enough.
1809     NvU32 pageSize;
1810     NvU32 validEntries;
1811 } NV2080_CTRL_FB_GET_CLI_MANAGED_OFFLINED_PAGES_PARAMS;
1812 
1813 /*!
1814  * NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_CONSTRUCT_INFO
1815  *
1816  * This command returns parameters required to initialize compbit copy object
1817  * used by address mapping library
1818  *
1819  *   defaultPageSize
1820  *     Page size used by @ref CompBitCopy methods
1821  *   comptagsPerCacheLine
1822  *     Number of compression tags in a single compression cache line.
1823  *   unpackedComptagLinesPerCacheLine;
1824  *     From hw (not adjusted for CompBits code)  Number of compression tags
1825  *     in a single compression cache line.
1826  *   compCacheLineSizePerLTC;
1827  *     Size of compression cache line per L2 slice. Size in Bytes.
1828  *   unpackedCompCacheLineSizePerLTC;
1829  *     From hw (not adjusted for CompBits code) size of compression
1830  *     cache line per L2 slice. Size in Bytes
1831  *   slicesPerLTC;
1832  *     Number of L2 slices per L2 cache.
1833  *   numActiveLTCs;
1834  *     Number of active L2 caches. (Not floorswept)
1835  *   familyName;
1836  *     Family name for the GPU.
1837  *   chipName;
1838  *     Chip name for the GPU.
1839  *   bitsPerRAMEntry;
1840  *     Bits per RAM entry. (Need better doc)
1841  *   ramBankWidth;
1842  *     Width of RAM bank. (Need better doc)
1843  *   bitsPerComptagLine;
1844  *     Number of bits per compression tag line.
1845  *   ramEntriesPerCompCacheLine;
1846  *     Number of RAM entries spanned by 1 compression cache line.
1847  *   comptagLineSize;
1848  *     Size of compression tag line, in Bytes.
1849  *
1850  * Possible status values returned are:
1851  *   NV_OK
1852  */
1853 
1854 #define NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_CONSTRUCT_INFO (0x2080133dU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_CONSTRUCT_INFO_PARAMS_MESSAGE_ID" */
1855 
1856 #define NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_CONSTRUCT_INFO_PARAMS_MESSAGE_ID (0x3DU)
1857 
1858 typedef struct NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_CONSTRUCT_INFO_PARAMS {
1859     NvU32 defaultPageSize;
1860     NvU32 comptagsPerCacheLine;
1861     NvU32 unpackedComptagLinesPerCacheLine;
1862     NvU32 compCacheLineSizePerLTC;
1863     NvU32 unpackedCompCacheLineSizePerLTC;
1864     NvU32 slicesPerLTC;
1865     NvU32 numActiveLTCs;
1866     NvU32 familyName;
1867     NvU32 chipName;
1868     NvU32 bitsPerRAMEntry;
1869     NvU32 ramBankWidth;
1870     NvU32 bitsPerComptagLine;
1871     NvU32 ramEntriesPerCompCacheLine;
1872     NvU32 comptagLineSize;
1873 } NV2080_CTRL_CMD_FB_GET_COMPBITCOPY_CONSTRUCT_INFO_PARAMS;
1874 
1875 /*
1876  * NV2080_CTRL_CMD_FB_SET_RRD
1877  *
1878  * Sets the row-to-row delay on the GPU's FB
1879  *
1880  * Possible status values returned are:
1881  *  NV_OK
1882  *  Any error code
1883  */
1884 #define NV2080_CTRL_CMD_FB_SET_RRD (0x2080133eU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_SET_RRD_PARAMS_MESSAGE_ID" */
1885 
1886 #define NV2080_CTRL_FB_SET_RRD_RESET_VALUE (~((NvU32)0))
1887 #define NV2080_CTRL_FB_SET_RRD_PARAMS_MESSAGE_ID (0x3EU)
1888 
1889 typedef struct NV2080_CTRL_FB_SET_RRD_PARAMS {
1890     NvU32 rrd;
1891 } NV2080_CTRL_FB_SET_RRD_PARAMS;
1892 
1893 /*
1894  * NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_PARAMS
1895  *
1896  * This is not a control call of it's own, but there are common definitions for
1897  * the two NV2080_CTRL_CMD_FB_SET_READ/WRITE_LIMIT control calls.
1898  */
1899 typedef struct NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_PARAMS {
1900     NvU8 limit;
1901 } NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_PARAMS;
1902 #define NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_RESET_VALUE (0xffU)
1903 
1904 /*
1905  * NV2080_CTRL_CMD_FB_SET_READ_LIMIT
1906  *
1907  * Sets the READ_LIMIT to be used in the NV_PFB_FBPA_DIR_ARB_CFG0 register
1908  *
1909  *  limit
1910  *      The limit value to use
1911  *
1912  * Possible status values returned are:
1913  *  NV_OK
1914  *  Any error code
1915  */
1916 #define NV2080_CTRL_CMD_FB_SET_READ_LIMIT               (0x2080133fU) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_SET_READ_LIMIT_PARAMS_MESSAGE_ID" */
1917 
1918 #define NV2080_CTRL_FB_SET_READ_LIMIT_RESET_VALUE       NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_RESET_VALUE
1919 #define NV2080_CTRL_FB_SET_READ_LIMIT_PARAMS_MESSAGE_ID (0x3FU)
1920 
1921 typedef NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_PARAMS NV2080_CTRL_FB_SET_READ_LIMIT_PARAMS;
1922 
1923 /*
1924  * NV2080_CTRL_CMD_FB_SET_WRITE_LIMIT
1925  *
1926  * Sets the WRITE_LIMIT to be used in the NV_PFB_FBPA_DIR_ARB_CFG0 register
1927  *
1928  *  limit
1929  *      The limit value to us
1930  *
1931  * Possible status values returned are:
1932  *  NV_OK
1933  *  Any error code
1934  */
1935 #define NV2080_CTRL_CMD_FB_SET_WRITE_LIMIT         (0x20801340U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_SET_WRITE_LIMIT_PARAMS_MESSAGE_ID" */
1936 
1937 #define NV2080_CTRL_FB_SET_WRITE_LIMIT_RESET_VALUE NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_RESET_VALUE
1938 #define NV2080_CTRL_FB_SET_WRITE_LIMIT_PARAMS_MESSAGE_ID (0x40U)
1939 
1940 typedef NV2080_CTRL_FB_SET_READ_WRITE_LIMIT_PARAMS NV2080_CTRL_FB_SET_WRITE_LIMIT_PARAMS;
1941 
1942 /*!
1943  * NV2080_CTRL_CMD_FB_PATCH_PBR_FOR_MINING
1944  *
1945  * Patches some VBIOS values related to PBR to better suit mining applications
1946  *
1947  *  bEnable
1948  *      Set the mining-specific values or reset to the original values
1949  *
1950  * Possible status values returned are:
1951  *  NV_OK
1952  *  Any error code
1953  */
1954 #define NV2080_CTRL_CMD_FB_PATCH_PBR_FOR_MINING (0x20801341U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_PATCH_PBR_FOR_MINING_PARAMS_MESSAGE_ID" */
1955 
1956 #define NV2080_CTRL_FB_PATCH_PBR_FOR_MINING_PARAMS_MESSAGE_ID (0x41U)
1957 
1958 typedef struct NV2080_CTRL_FB_PATCH_PBR_FOR_MINING_PARAMS {
1959     NvBool bEnable;
1960 } NV2080_CTRL_FB_PATCH_PBR_FOR_MINING_PARAMS;
1961 
1962 /*!
1963  * NV2080_CTRL_CMD_FB_GET_MEM_ALIGNMENT
1964  *
1965  * Get memory alignment. Replacement for NVOS32_FUNCTION_GET_MEM_ALIGNMENT
1966  */
1967 #define NV2080_CTRL_CMD_FB_GET_MEM_ALIGNMENT       (0x20801342U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_MEM_ALIGNMENT_PARAMS_MESSAGE_ID" */
1968 
1969 #define NV2080_CTRL_FB_GET_MEM_ALIGNMENT_MAX_BANKS (4U)
1970 #define NV2080_CTRL_FB_GET_MEM_ALIGNMENT_PARAMS_MESSAGE_ID (0x42U)
1971 
1972 typedef struct NV2080_CTRL_FB_GET_MEM_ALIGNMENT_PARAMS {
1973     NvU32 alignType;                                 // Input
1974     NvU32 alignAttr;
1975     NvU32 alignInputFlags;
1976     NvU32 alignHead;
1977     NV_DECLARE_ALIGNED(NvU64 alignSize, 8);
1978     NvU32 alignHeight;
1979     NvU32 alignWidth;
1980     NvU32 alignPitch;
1981     NvU32 alignPad;
1982     NvU32 alignMask;
1983     NvU32 alignOutputFlags[NV2080_CTRL_FB_GET_MEM_ALIGNMENT_MAX_BANKS];
1984     NvU32 alignBank[NV2080_CTRL_FB_GET_MEM_ALIGNMENT_MAX_BANKS];
1985     NvU32 alignKind;
1986     NvU32 alignAdjust;                                // Output -- If non-zero the amount we need to adjust the offset
1987     NvU32 alignAttr2;
1988 } NV2080_CTRL_FB_GET_MEM_ALIGNMENT_PARAMS;
1989 
1990 /*!
1991  * NV2080_CTRL_CMD_FB_GET_CBC_BASEADDR
1992  *
1993  * Get the CBC Base physical address
1994  * This control call is required by error containment tests
1995  * NV2080_CTRL_CMD_FB_GET_AMAP_CONF can also return CBC base address
1996  * but it requires kernel privilege, and it not callalble from SRT test
1997  *
1998  * @params[out] NvU64 cbcBaseAddr
1999  *     Base physical address for CBC data.
2000  *
2001  * Possible status values returned are:
2002  *   NV_OK NV_ERR_NOT_SUPPORTED
2003  *
2004  */
2005 #define NV2080_CTRL_CMD_FB_GET_CBC_BASE_ADDR (0x20801343U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_GET_CBC_BASE_ADDR_PARAMS_MESSAGE_ID" */
2006 
2007 #define NV2080_CTRL_CMD_FB_GET_CBC_BASE_ADDR_PARAMS_MESSAGE_ID (0x43U)
2008 
2009 typedef struct NV2080_CTRL_CMD_FB_GET_CBC_BASE_ADDR_PARAMS {
2010     NvU32 cbcBaseAddress;
2011     NvU32 compCacheLineSize;
2012     NV_DECLARE_ALIGNED(NvU64 backingStoreStartPA, 8);
2013     NV_DECLARE_ALIGNED(NvU64 backingStoreAllocPA, 8);
2014     NvU32 backingStoreChunkOverfetch;
2015 } NV2080_CTRL_CMD_FB_GET_CBC_BASE_ADDR_PARAMS;
2016 
2017 #define NV2080_CTRL_FB_REMAP_ENTRY_FLAGS_PENDING                             0:0
2018 #define NV2080_CTRL_FB_REMAP_ENTRY_FLAGS_PENDING_FALSE 0U
2019 #define NV2080_CTRL_FB_REMAP_ENTRY_FLAGS_PENDING_TRUE  1U
2020 
2021 
2022 
2023 typedef struct NV2080_CTRL_FB_REMAP_ENTRY {
2024     NvU32 remapRegVal;
2025     NvU32 timestamp;
2026     NvU8  fbpa;
2027     NvU8  sublocation;
2028     NvU8  source;
2029     NvU8  flags;
2030 } NV2080_CTRL_FB_REMAP_ENTRY;
2031 
2032 /* valid values for source */
2033 
2034 
2035 #define NV2080_CTRL_FB_REMAPPED_ROW_SOURCE_SBE_FIELD         (0x00000002U)
2036 #define NV2080_CTRL_FB_REMAPPED_ROW_SOURCE_DBE_FIELD         (0x00000003U)
2037 
2038 #define NV2080_CTRL_FB_REMAPPED_ROWS_MAX_ROWS                (0x00000200U)
2039 
2040 /*
2041  * NV2080_CTRL_CMD_FB_GET_REMAPPED_ROWS
2042  *
2043  * This command returns the list of remapped rows stored in the Inforom.
2044  *
2045  *   entryCount
2046  *     This output parameter specifies the number of remapped rows
2047  *   flags
2048  *     This output parameter contains info on whether or not there are pending
2049  *     remappings and whether or not a remapping failed
2050  *   entries
2051  *     This output parameter is an array of NV2080_CTRL_FB_REMAP_ENTRY
2052  *     containing inforomation on the remapping that occurred. This array can
2053  *     hold a maximum of NV2080_CTRL_FB_REMAPPED_ROWS_MAX_ROWS
2054  *
2055  *  Possible status values returned are:
2056  *    NV_OK
2057  *    NV_ERR_INVALID_ARGUMENT
2058  *    NV_ERR_INVALID_POINTER
2059  *    NV_ERR_OBJECT_NOT_FOUND
2060  *    NV_ERR_NOT_SUPPORTED
2061  */
2062 #define NV2080_CTRL_CMD_FB_GET_REMAPPED_ROWS                 (0x20801344U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_REMAPPED_ROWS_PARAMS_MESSAGE_ID" */
2063 
2064 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_FLAGS_PENDING                       \
2065     NV2080_CTRL_FB_REMAP_ENTRY_FLAGS_PENDING
2066 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_FLAGS_PENDING_FALSE NV2080_CTRL_FB_REMAP_ENTRY_FLAGS_PENDING_FALSE
2067 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_FLAGS_PENDING_TRUE  NV2080_CTRL_FB_REMAP_ENTRY_FLAGS_PENDING_TRUE
2068 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_FLAGS_FAILURE                       1:1
2069 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_FLAGS_FAILURE_FALSE 0U
2070 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_FLAGS_FAILURE_TRUE  1U
2071 
2072 #define NV2080_CTRL_FB_GET_REMAPPED_ROWS_PARAMS_MESSAGE_ID (0x44U)
2073 
2074 typedef struct NV2080_CTRL_FB_GET_REMAPPED_ROWS_PARAMS {
2075     NvU32                      entryCount;
2076     NvU8                       flags;
2077     NV2080_CTRL_FB_REMAP_ENTRY entries[NV2080_CTRL_FB_REMAPPED_ROWS_MAX_ROWS];
2078 } NV2080_CTRL_FB_GET_REMAPPED_ROWS_PARAMS;
2079 
2080 // Max size of the queryParams in Bytes, so that the NV2080_CTRL_FB_FS_INFO_QUERY struct is still 32B
2081 #define NV2080_CTRL_FB_FS_INFO_MAX_QUERY_SIZE 24U
2082 
2083 /*!
2084  * Structure holding the out params for NV2080_CTRL_FB_FS_INFO_INVALID_QUERY.
2085  */
2086 typedef struct NV2080_CTRL_FB_FS_INFO_INVALID_QUERY_PARAMS {
2087     // Unused param, will ensure the size of NV2080_CTRL_FB_FS_INFO_QUERY struct to be 32B
2088     NvU8 data[NV2080_CTRL_FB_FS_INFO_MAX_QUERY_SIZE];
2089 } NV2080_CTRL_FB_FS_INFO_INVALID_QUERY_PARAMS;
2090 
2091 /*!
2092  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_FBP_MASK.
2093  */
2094 typedef struct NV2080_CTRL_FB_FS_INFO_FBP_MASK_PARAMS {
2095     /*!
2096      * [IN]: swizzId
2097      * PartitionID associated with a created smc partition. Currently used only for a
2098      * device monitoring client to get the physical values of the FB. The client needs to pass
2099      * 'NV2080_CTRL_GPU_PARTITION_ID_INVALID' explicitly if it wants RM to ignore the swizzId.
2100      * RM will consider this request similar to a legacy case.
2101      * The client's subscription is used only as a capability check and not as an input swizzId.
2102      */
2103     NvU32 swizzId;
2104     /*!
2105      * [OUT]: physical/local fbp mask.
2106      */
2107     NV_DECLARE_ALIGNED(NvU64 fbpEnMask, 8);
2108 } NV2080_CTRL_FB_FS_INFO_FBP_MASK_PARAMS;
2109 
2110 /*!
2111  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_LTC_MASK.
2112  */
2113 typedef struct NV2080_CTRL_FB_FS_INFO_LTC_MASK_PARAMS {
2114     /*!
2115      * [IN]: physical/local FB partition index.
2116      */
2117     NvU32 fbpIndex;
2118     /*!
2119      * [OUT]: physical/local ltc mask.
2120      */
2121     NvU32 ltcEnMask;
2122 } NV2080_CTRL_FB_FS_INFO_LTC_MASK_PARAMS;
2123 
2124 /*!
2125  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_LTS_MASK.
2126  */
2127 typedef struct NV2080_CTRL_FB_FS_INFO_LTS_MASK_PARAMS {
2128     /*!
2129      * [IN]: physical/local FB partition index.
2130      */
2131     NvU32 fbpIndex;
2132     /*!
2133      * [OUT]: physical/local lts mask.
2134      * Note that lts bits are flattened out for all ltc with in a fbp.
2135      */
2136     NvU32 ltsEnMask;
2137 } NV2080_CTRL_FB_FS_INFO_LTS_MASK_PARAMS;
2138 
2139 /*!
2140  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_FBPA_MASK.
2141  */
2142 typedef struct NV2080_CTRL_FB_FS_INFO_FBPA_MASK_PARAMS {
2143     /*!
2144      * [IN]: physical/local FB partition index.
2145      */
2146     NvU32 fbpIndex;
2147     /*!
2148      * [OUT]: physical/local FBPA mask.
2149      */
2150     NvU32 fbpaEnMask;
2151 } NV2080_CTRL_FB_FS_INFO_FBPA_MASK_PARAMS;
2152 
2153 /*!
2154  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_FBPA_SUBP_MASK.
2155  */
2156 typedef struct NV2080_CTRL_FB_FS_INFO_FBPA_SUBP_MASK_PARAMS {
2157     /*!
2158      * [IN]: physical/local FB partition index.
2159      */
2160     NvU32 fbpIndex;
2161     /*!
2162      * [OUT]: physical/local FBPA-SubPartition mask.
2163      */
2164     NvU32 fbpaSubpEnMask;
2165 } NV2080_CTRL_FB_FS_INFO_FBPA_SUBP_MASK_PARAMS;
2166 
2167 /*!
2168  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_FBP_LOGICAL_MAP
2169  */
2170 typedef struct NV2080_CTRL_FB_FS_INFO_FBP_LOGICAL_MAP_PARAMS {
2171     /*!
2172      * [IN]: physical/local FB partition index.
2173      */
2174     NvU32 fbpIndex;
2175     /*!
2176      * [OUT]: Logical/local FBP index
2177      */
2178     NvU32 fbpLogicalIndex;
2179 } NV2080_CTRL_FB_FS_INFO_FBP_LOGICAL_MAP_PARAMS;
2180 
2181 /*!
2182  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_ROP_MASK.
2183  */
2184 typedef struct NV2080_CTRL_FB_FS_INFO_ROP_MASK_PARAMS {
2185     /*!
2186      * [IN]: physical/local FB partition index.
2187      */
2188     NvU32 fbpIndex;
2189     /*!
2190      * [OUT]: physical/local ROP mask.
2191      */
2192     NvU32 ropEnMask;
2193 } NV2080_CTRL_FB_FS_INFO_ROP_MASK_PARAMS;
2194 
2195 /*!
2196  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTC_MASK.
2197  */
2198 typedef struct NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTC_MASK_PARAMS {
2199     /*!
2200      * [IN]: Physical FB partition index.
2201      */
2202     NvU32 fbpIndex;
2203     /*!
2204      * [IN]: swizzId
2205      * PartitionID associated with a created smc partition.
2206      */
2207     NvU32 swizzId;
2208     /*!
2209      * [OUT]: physical ltc mask.
2210      */
2211     NvU32 ltcEnMask;
2212 } NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTC_MASK_PARAMS;
2213 
2214 /*!
2215  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTS_MASK.
2216  */
2217 typedef struct NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTS_MASK_PARAMS {
2218     /*!
2219      * [IN]: Physical FB partition index.
2220      */
2221     NvU32 fbpIndex;
2222     /*!
2223      * [IN]: swizzId
2224      * PartitionID associated with a created smc partition.
2225      */
2226     NvU32 swizzId;
2227     /*!
2228      * [OUT]: physical lts mask.
2229      */
2230     NvU32 ltsEnMask;
2231 } NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTS_MASK_PARAMS;
2232 
2233 /*!
2234  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_MASK.
2235  */
2236 typedef struct NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_MASK_PARAMS {
2237     /*!
2238      * [IN]: Physical FB partition index.
2239      */
2240     NvU32 fbpIndex;
2241     /*!
2242      * [IN]: swizzId
2243      * PartitionID associated with a created smc partition.
2244      */
2245     NvU32 swizzId;
2246     /*!
2247      * [OUT]: physical fbpa mask.
2248      */
2249     NvU32 fbpaEnMask;
2250 } NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_MASK_PARAMS;
2251 
2252 /*!
2253  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_PROFILER_MON_ROP_MASK.
2254  */
2255 typedef struct NV2080_CTRL_FB_FS_INFO_PROFILER_MON_ROP_MASK_PARAMS {
2256     /*!
2257      * [IN]: Physical FB partition index.
2258      */
2259     NvU32 fbpIndex;
2260     /*!
2261      * [IN]: swizzId
2262      * PartitionID associated with a created smc partition.
2263      */
2264     NvU32 swizzId;
2265     /*!
2266      * [OUT]: physical rop mask.
2267      */
2268     NvU32 ropEnMask;
2269 } NV2080_CTRL_FB_FS_INFO_PROFILER_MON_ROP_MASK_PARAMS;
2270 
2271 /*!
2272  * Structure holding the in/out params for NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_SUBP_MASK.
2273  */
2274 typedef struct NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_SUBP_MASK_PARAMS {
2275     /*!
2276      * [IN]: Physical FB partition index.
2277      */
2278     NvU32 fbpIndex;
2279     /*!
2280      * [IN]: swizzId
2281      * PartitionID associated with a created smc partition. Currently used only for a
2282      * device monitoring client to get the physical values of the FB. The client needs to pass
2283      * 'NV2080_CTRL_GPU_PARTITION_ID_INVALID' explicitly if it wants RM to ignore the swizzId.
2284      * RM will consider this request similar to a legacy case.
2285      * The client's subscription is used only as a capability check and not as an input swizzId.
2286      */
2287     NvU32 swizzId;
2288     /*!
2289      * [OUT]: physical FBPA_SubPartition mask associated with requested partition.
2290      */
2291     NV_DECLARE_ALIGNED(NvU64 fbpaSubpEnMask, 8);
2292 } NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_SUBP_MASK_PARAMS;
2293 
2294 // Possible values for queryType
2295 #define NV2080_CTRL_FB_FS_INFO_INVALID_QUERY               0x0U
2296 #define NV2080_CTRL_FB_FS_INFO_FBP_MASK                    0x1U
2297 #define NV2080_CTRL_FB_FS_INFO_LTC_MASK                    0x2U
2298 #define NV2080_CTRL_FB_FS_INFO_LTS_MASK                    0x3U
2299 #define NV2080_CTRL_FB_FS_INFO_FBPA_MASK                   0x4U
2300 #define NV2080_CTRL_FB_FS_INFO_ROP_MASK                    0x5U
2301 #define NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTC_MASK       0x6U
2302 #define NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTS_MASK       0x7U
2303 #define NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_MASK      0x8U
2304 #define NV2080_CTRL_FB_FS_INFO_PROFILER_MON_ROP_MASK       0x9U
2305 #define NV2080_CTRL_FB_FS_INFO_FBPA_SUBP_MASK              0xAU
2306 #define NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_SUBP_MASK 0xBU
2307 #define NV2080_CTRL_FB_FS_INFO_FBP_LOGICAL_MAP             0xCU
2308 
2309 typedef struct NV2080_CTRL_FB_FS_INFO_QUERY {
2310     NvU16 queryType;
2311     NvU8  reserved[2];
2312     NvU32 status;
2313     union {
2314         NV2080_CTRL_FB_FS_INFO_INVALID_QUERY_PARAMS          inv;
2315         NV_DECLARE_ALIGNED(NV2080_CTRL_FB_FS_INFO_FBP_MASK_PARAMS fbp, 8);
2316         NV2080_CTRL_FB_FS_INFO_LTC_MASK_PARAMS               ltc;
2317         NV2080_CTRL_FB_FS_INFO_LTS_MASK_PARAMS               lts;
2318         NV2080_CTRL_FB_FS_INFO_FBPA_MASK_PARAMS              fbpa;
2319         NV2080_CTRL_FB_FS_INFO_ROP_MASK_PARAMS               rop;
2320         NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTC_MASK_PARAMS  dmLtc;
2321         NV2080_CTRL_FB_FS_INFO_PROFILER_MON_LTS_MASK_PARAMS  dmLts;
2322         NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_MASK_PARAMS dmFbpa;
2323         NV2080_CTRL_FB_FS_INFO_PROFILER_MON_ROP_MASK_PARAMS  dmRop;
2324         NV_DECLARE_ALIGNED(NV2080_CTRL_FB_FS_INFO_PROFILER_MON_FBPA_SUBP_MASK_PARAMS dmFbpaSubp, 8);
2325         NV2080_CTRL_FB_FS_INFO_FBPA_SUBP_MASK_PARAMS         fbpaSubp;
2326         NV2080_CTRL_FB_FS_INFO_FBP_LOGICAL_MAP_PARAMS        fbpLogicalMap;
2327     } queryParams;
2328 } NV2080_CTRL_FB_FS_INFO_QUERY;
2329 
2330 // Max number of queries that can be batched in a single call to NV2080_CTRL_CMD_FB_GET_FS_INFO
2331 #define NV2080_CTRL_FB_FS_INFO_MAX_QUERIES 96U
2332 
2333 #define NV2080_CTRL_FB_GET_FS_INFO_PARAMS_MESSAGE_ID (0x46U)
2334 
2335 typedef struct NV2080_CTRL_FB_GET_FS_INFO_PARAMS {
2336     NvU16 numQueries;
2337     NvU8  reserved[6];
2338     NV_DECLARE_ALIGNED(NV2080_CTRL_FB_FS_INFO_QUERY queries[NV2080_CTRL_FB_FS_INFO_MAX_QUERIES], 8);
2339 } NV2080_CTRL_FB_GET_FS_INFO_PARAMS;
2340 
2341 /*!
2342  * NV2080_CTRL_CMD_FB_GET_FS_INFO
2343  *
2344  * This control call returns the fb engine information for a partition/GPU.
2345  * Supports an interface so that the caller can issue multiple queries by batching them
2346  * in a single call. Returns the first error it encounters.
2347  *
2348  * numQueries[IN]
2349  *     - Specifies the number of valid queries.
2350  *
2351  * Possible status values returned are:
2352  *   NV_OK
2353  *   NV_ERR_INVALID_PARAM_STRUCT
2354  *   NV_ERR_INVALID_ARGUMENT
2355  *   NV_ERR_NOT_SUPPORTED
2356  */
2357 #define NV2080_CTRL_CMD_FB_GET_FS_INFO                             (0x20801346U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_FS_INFO_PARAMS_MESSAGE_ID" */
2358 
2359 #define NV2080_CTRL_FB_HISTOGRAM_IDX_NO_REMAPPED_ROWS              (0x0U)
2360 #define NV2080_CTRL_FB_HISTOGRAM_IDX_SINGLE_REMAPPED_ROW           (0x1U)
2361 #define NV2080_CTRL_FB_HISTOGRAM_IDX_MIXED_REMAPPED_REMAINING_ROWS (0x2U)
2362 #define NV2080_CTRL_FB_HISTOGRAM_IDX_SINGLE_REMAINING_ROW          (0x3U)
2363 #define NV2080_CTRL_FB_HISTOGRAM_IDX_MAX_REMAPPED_ROWS             (0x4U)
2364 
2365 #define NV2080_CTRL_FB_GET_ROW_REMAPPER_HISTOGRAM_PARAMS_MESSAGE_ID (0x47U)
2366 
2367 typedef struct NV2080_CTRL_FB_GET_ROW_REMAPPER_HISTOGRAM_PARAMS {
2368     NvU32 histogram[5];
2369 } NV2080_CTRL_FB_GET_ROW_REMAPPER_HISTOGRAM_PARAMS;
2370 
2371 /*!
2372  * NV2080_CTRL_CMD_FB_GET_ROW_REMAPPER_HISTOGRAM
2373  *
2374  * This control call returns stats on the number of banks that have a certain
2375  * number of rows remapped in the bank. Specifically the number of banks that
2376  * have 0, 1, 2 through (max-2), max-1 and max number of rows remapped in the
2377  * bank. Values will be returned in an array.
2378  *
2379  * Index values are:
2380  *
2381  *   NV2080_CTRL_FB_HISTOGRAM_IDX_NO_REMAPPED_ROWS
2382  *     Number of banks with zero rows remapped
2383      NV2080_CTRL_FB_HISTOGRAM_IDX_SINGLE_REMAPPED_ROW
2384  *     Number of banks with one row remapped
2385      NV2080_CTRL_FB_HISTOGRAM_IDX_MIXED_REMAPPED_REMAINING_ROWS
2386  *     Number of banks with 2 through (max-2) rows remapped
2387      NV2080_CTRL_FB_HISTOGRAM_IDX_SINGLE_REMAINING_ROW
2388  *     Number of banks with (max-1) rows remapped
2389      NV2080_CTRL_FB_HISTOGRAM_IDX_MAX_REMAPPED_ROWS
2390  *     Number of banks with max rows remapped
2391  *
2392  *   Possible status values returned are:
2393  *     NV_OK
2394  *     NV_ERR_NOT_SUPPORTED
2395  */
2396 #define NV2080_CTRL_CMD_FB_GET_ROW_REMAPPER_HISTOGRAM (0x20801347U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_ROW_REMAPPER_HISTOGRAM_PARAMS_MESSAGE_ID" */
2397 
2398 /*
2399  * NV2080_CTRL_CMD_FB_GET_DYNAMICALLY_BLACKLISTED_PAGES
2400  *
2401  * This command returns the list of dynamically blacklisted video memory page addresses
2402  * after last driver load.
2403  *
2404  *   blackList
2405  *     This output parameter is an array of NV2080_CTRL_FB_DYNAMIC_BLACKLIST_ADDRESS_INFO
2406  *     This array can hold a maximum of NV2080_CTRL_FB_DYNAMIC_BLACKLIST_MAX_ENTRIES.
2407  *   validEntries
2408  *     This output parameter specifies the number of valid entries in the
2409  *     blackList array.
2410  *   baseIndex
2411  *     With the limit of up to 512 blacklisted pages, the size of this array
2412  *     exceeds the rpc buffer limit. This control call will collect the data
2413  *     in multiple passes. This parameter indicates the start index of the
2414  *     data to be passed back to the caller
2415  *     This cannot be greater than NV2080_CTRL_FB_DYNAMIC_BLACKLIST_MAX_PAGES
2416  *   bMore
2417  *     This parameter indicates whether there are more valid elements to be
2418  *     fetched.
2419  *
2420  * Possible status values returned are:
2421  *   NV_OK
2422  */
2423 #define NV2080_CTRL_CMD_FB_GET_DYNAMIC_OFFLINED_PAGES (0x20801348U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_DYNAMIC_OFFLINED_PAGES_PARAMS_MESSAGE_ID" */
2424 
2425 /* Maximum pages that can be dynamically blacklisted */
2426 #define NV2080_CTRL_FB_DYNAMIC_BLACKLIST_MAX_PAGES    512U
2427 
2428 /*
2429  * Maximum entries that can be sent in a single pass of
2430  * NV2080_CTRL_CMD_FB_GET_DYNAMIC_OFFLINED_PAGES
2431  */
2432 #define NV2080_CTRL_FB_DYNAMIC_BLACKLIST_MAX_ENTRIES  64U
2433 
2434 /**
2435  * NV2080_CTRL_FB_DYNAMIC_OFFLINED_ADDRESS_INFO
2436  *   pageNumber
2437  *     This output parameter specifies the dynamically blacklisted page number.
2438  *   source
2439  *     The reason for the page to be retired. Valid values for
2440  *     this parameter include:
2441  *        NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_INVALID
2442  *           Invalid source.
2443  *        NV2080_CTRL_FB_OFFLINED_PAGES_SOURCE_DPR_DBE
2444  *           Page retired by dynamic page retirement due to a double bit
2445  *           error seen.
2446  */
2447 typedef struct NV2080_CTRL_FB_DYNAMIC_OFFLINED_ADDRESS_INFO {
2448     NV_DECLARE_ALIGNED(NvU64 pageNumber, 8);
2449     NvU8 source;
2450 } NV2080_CTRL_FB_DYNAMIC_OFFLINED_ADDRESS_INFO;
2451 
2452 #define NV2080_CTRL_FB_GET_DYNAMIC_OFFLINED_PAGES_PARAMS_MESSAGE_ID (0x48U)
2453 
2454 typedef struct NV2080_CTRL_FB_GET_DYNAMIC_OFFLINED_PAGES_PARAMS {
2455     NV_DECLARE_ALIGNED(NV2080_CTRL_FB_DYNAMIC_OFFLINED_ADDRESS_INFO offlined[NV2080_CTRL_FB_DYNAMIC_BLACKLIST_MAX_ENTRIES], 8);
2456     NvU32  validEntries;
2457     NvU32  baseIndex;
2458     NvBool bMore;
2459 } NV2080_CTRL_FB_GET_DYNAMIC_OFFLINED_PAGES_PARAMS;
2460 
2461 /* valid values for source */
2462 
2463 #define NV2080_CTRL_FB_DYNAMIC_BLACKLISTED_PAGES_SOURCE_INVALID (0x00000000U)
2464 #define NV2080_CTRL_FB_DYNAMIC_BLACKLISTED_PAGES_SOURCE_DPR_DBE (0x00000001U)
2465 
2466 /*
2467  * NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO
2468  *
2469  * This control command is used by clients to query information pertaining to client allocations.
2470  *
2471  *
2472  * @params [IN/OUT] NvU64 allocCount:
2473  *        Client specifies the allocation count that it received using the
2474  *        previous NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO control call.
2475  *        RM will get the total number of allocations known by RM and fill
2476  *        allocCount with it.
2477  *
2478  * @params [IN] NvP64 pAllocInfo:
2479  *        Pointer to the buffer allocated by client of size NV2080_CTRL_CMD_FB_ALLOCATION_INFO *
2480  *        allocCount. RM returns the info pertaining to each  of the contiguous client
2481  *        allocation chunks in pAllocInfo. The format of the allocation information is given by
2482  *        NV2080_CTRL_CMD_FB_ALLOCATION_INFO. The client has to sort the returned information if
2483  *        it wants to retain the legacy behavior of SORTED BY OFFSET. Information is only returned
2484  *        if and only if allocCount[IN]>=allocCount[OUT] and clientCount[IN]>=clientCount[OUT].
2485  *
2486  * @params [IN/OUT] NvP64 clientCount:
2487  *        Client specifies the client count that it received using the
2488  *        previous NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO control call.
2489  *        RM will get the total number of clients that have allocations with RM
2490  *        and fill clientCount with it.
2491  *
2492  * @params [IN] NvP64 pClientInfo:
2493  *        Pointer to the buffer allocated by client of size NV2080_CTRL_CMD_FB_CLIENT_INFO *
2494  *        clientCount. RM returns the info pertaining to each of the clients that have allocations
2495  *        known about by RM in pClientInfo. The format of the allocation information is given by
2496  *        NV2080_CTRL_CMD_FB_CLIENT_INFO. Information is only returned if and only if
2497  *        allocCount[IN]>=allocCount[OUT] and clientCount[IN]>=clientCount[OUT].
2498  *
2499  * @returns Possible status values returned are:
2500  *   NV_OK
2501  *   NV_ERR_INVALID_POINTER
2502  *   NV_ERR_NO_MEMORY
2503  *
2504  * @Usage: All privileged RM clients for debugging only. Initially, call this with allocCount =
2505  *         clientCount = 0 to get client count, and then call again with allocated memory and sizes.
2506  *         Client can repeat with the new count-sized allocations until a maximum try count is
2507  *         reached or client is out of memory.
2508  */
2509 
2510 #define NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO           (0x20801349U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO_PARAMS_MESSAGE_ID" */
2511 
2512 /*
2513  * These work with the FLD_SET_REF_NUM and FLD_TEST_REF macros and describe the 'flags' member
2514  * of the NV2080_CTRL_CMD_FB_ALLOCATION_INFO struct.
2515  */
2516 
2517 // Address space of the allocation
2518 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_TYPE 4:0
2519 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_TYPE_SYSMEM         0U
2520 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_TYPE_VIDMEM         1U
2521 
2522 // Whether the allocation is shared
2523 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_SHARED 5:5
2524 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_SHARED_FALSE        0U
2525 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_SHARED_TRUE         1U
2526 
2527 // Whether this client owns this allocation
2528 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_OWNER 6:6
2529 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_OWNER_FALSE         0U
2530 #define NV2080_CTRL_CMD_FB_ALLOCATION_FLAGS_OWNER_TRUE          1U
2531 
2532 typedef struct NV2080_CTRL_CMD_FB_ALLOCATION_INFO {
2533     NvU32 client;                        /* [OUT] Identifies the client that made or shares the allocation (index into pClientInfo)*/
2534     NvU32 flags;                         /* [OUT] Flags associated with the allocation (see previous defines) */
2535     NV_DECLARE_ALIGNED(NvU64 beginAddr, 8);   /* [OUT] Starting physical address of the chunk */
2536     NV_DECLARE_ALIGNED(NvU64 size, 8);   /* [OUT] Size of the allocated contiguous chunk in bytes */
2537 } NV2080_CTRL_CMD_FB_ALLOCATION_INFO;
2538 
2539 typedef struct NV2080_CTRL_CMD_FB_CLIENT_INFO {
2540     NvHandle handle;                                    /* [OUT] Handle of the client that made or shares the allocation */
2541     NvU32    pid;                                       /* [OUT] PID of the client that made or shares the allocation */
2542 
2543     /* For the definition of the subprocessID and subprocessName params, see NV0000_CTRL_CMD_SET_SUB_PROCESS_ID */
2544     NvU32    subProcessID;                              /* [OUT] Subprocess ID of the client that made or shares the allocation */
2545     char     subProcessName[NV_PROC_NAME_MAX_LENGTH];   /* [OUT] Subprocess Name of the client that made or shares the allocation */
2546 } NV2080_CTRL_CMD_FB_CLIENT_INFO;
2547 
2548 #define NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO_PARAMS_MESSAGE_ID (0x49U)
2549 
2550 typedef struct NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO_PARAMS {
2551     NV_DECLARE_ALIGNED(NvU64 allocCount, 8);
2552     NV_DECLARE_ALIGNED(NvP64 pAllocInfo, 8);
2553     NV_DECLARE_ALIGNED(NvU64 clientCount, 8);
2554     NV_DECLARE_ALIGNED(NvP64 pClientInfo, 8);
2555 } NV2080_CTRL_CMD_FB_GET_CLIENT_ALLOCATION_INFO_PARAMS;
2556 
2557 /*
2558  * NV2080_CTRL_CMD_FB_UPDATE_NUMA_STATUS
2559  *
2560  * This control command is used by clients to update the NUMA status.
2561  *
2562  * @params [IN] NvBool bOnline:
2563  *
2564  * @returns Possible status values returned are:
2565  *   NV_OK
2566  *   NV_ERR_INVALID_STATE
2567  *
2568  */
2569 #define NV2080_CTRL_CMD_FB_UPDATE_NUMA_STATUS (0x20801350U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_UPDATE_NUMA_STATUS_PARAMS_MESSAGE_ID" */
2570 
2571 #define NV2080_CTRL_FB_UPDATE_NUMA_STATUS_PARAMS_MESSAGE_ID (0x50U)
2572 
2573 typedef struct NV2080_CTRL_FB_UPDATE_NUMA_STATUS_PARAMS {
2574     NvBool bOnline;
2575 } NV2080_CTRL_FB_UPDATE_NUMA_STATUS_PARAMS;
2576 
2577 /*
2578  * NV2080_CTRL_CMD_FB_GET_NUMA_INFO
2579  *
2580  * This control command is used by clients to get per-subdevice or
2581  * subscribed MIG partition(when MIG is enabled) NUMA memory information as
2582  * assigned by the system.
2583  *
2584  * numaNodeId[OUT]
2585  *     - Specifies the NUMA node ID.
2586  *
2587  * numaMemAddr[OUT]
2588  *     - Specifies the NUMA memory address.
2589  *
2590  * numaMemSize[OUT]
2591  *     - Specifies the NUMA memory size.
2592  *
2593  * numaOfflineAddressesCount[IN/OUT]
2594  *     - If non-zero, then it specifies the maximum number of entries in
2595  *       numaOfflineAddresses[] for which the information is required.
2596  *       It will be updated with the actual number of entries present in
2597  *       the numaOfflineAddresses[].
2598  *
2599  * numaOfflineAddresses[OUT]
2600  *      - If numaOfflineAddressesCount is non-zero, it contains the addresses
2601  *        of offline pages in the NUMA region.
2602  *
2603  * @returns Possible status values returned are:
2604  *   NV_OK
2605  *   NV_ERR_INVALID_ARGUMENT
2606  */
2607 #define NV2080_CTRL_CMD_FB_GET_NUMA_INFO               (0x20801351U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_NUMA_INFO_PARAMS_MESSAGE_ID" */
2608 
2609 #define NV2080_CTRL_FB_NUMA_INFO_MAX_OFFLINE_ADDRESSES 64U
2610 
2611 #define NV2080_CTRL_FB_GET_NUMA_INFO_PARAMS_MESSAGE_ID (0x51U)
2612 
2613 typedef struct NV2080_CTRL_FB_GET_NUMA_INFO_PARAMS {
2614     NvS32 numaNodeId;
2615     NV_DECLARE_ALIGNED(NvU64 numaMemAddr, 8);
2616     NV_DECLARE_ALIGNED(NvU64 numaMemSize, 8);
2617     NvU32 numaOfflineAddressesCount;
2618     NV_DECLARE_ALIGNED(NvU64 numaOfflineAddresses[NV2080_CTRL_FB_NUMA_INFO_MAX_OFFLINE_ADDRESSES], 8);
2619 } NV2080_CTRL_FB_GET_NUMA_INFO_PARAMS;
2620 
2621 /*
2622  * NV2080_CTRL_CMD_FB_GET_SEMAPHORE_SURFACE_LAYOUT
2623  *
2624  * This control command is used by clients to get NV_SEMAPHORE_SURFACE layout/caps before allocation.
2625  * A semaphore surface can be viewed as an array of independent semaphore entries.
2626  *
2627  * maxSubmittedSemaphoreValueOffset[OUT]
2628  *     - An offset of the max submitted value, relative to the semaphore surface entry start, if used.
2629  *       Used to emulate 64-bit semaphore values on chips where 64-bit semaphores are not supported.
2630  *
2631  * monitoredFenceThresholdOffset[OUT]
2632  *     - An offset of the monitored fence memory, relative to the semaphore surface entry start, if supported.
2633  *
2634  * size[OUT]
2635  *     - A size of a single semaphore surface entry.
2636  *
2637  * caps[OUT]
2638  *     - A mask of NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_CAPS_* values.
2639  */
2640 #define NV2080_CTRL_CMD_FB_GET_SEMAPHORE_SURFACE_LAYOUT                             (0x20801352U) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FB_INTERFACE_ID << 8) | NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_PARAMS_MESSAGE_ID" */
2641 
2642 #define NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_CAPS_MONITORED_FENCE_SUPPORTED  (0x00000001U)
2643 #define NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_CAPS_64BIT_SEMAPHORES_SUPPORTED (0x00000002U)
2644 
2645 #define NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_PARAMS_MESSAGE_ID (0x52U)
2646 
2647 typedef struct NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_PARAMS {
2648     NV_DECLARE_ALIGNED(NvU64 maxSubmittedSemaphoreValueOffset, 8);
2649     NV_DECLARE_ALIGNED(NvU64 monitoredFenceThresholdOffset, 8);
2650     NV_DECLARE_ALIGNED(NvU64 size, 8);
2651     NvU32 caps;
2652 } NV2080_CTRL_FB_GET_SEMAPHORE_SURFACE_LAYOUT_PARAMS;
2653 
2654 /* _ctrl2080fb_h_ */
2655