1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2006-2019 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 #pragma once
24 
25 #include <nvtypes.h>
26 
27 //
28 // This file was generated with FINN, an NVIDIA coding tool.
29 // Source file:      ctrl/ctrl5080.finn
30 //
31 
32 #include "ctrl/ctrlxxxx.h"
33 #include "ctrl/ctrl0080/ctrl0080dma.h"  /* NV0080_CTRL_DMA_FILL_PTE_MEM_PARAMS */
34 #include "ctrl/ctrl2080/ctrl2080dma.h"  /* NV2080_CTRL_DMA_* */
35 #include "ctrl/ctrl2080/ctrl2080fb.h"   /* NV2080_CTRL_FB_* */
36 #include "ctrl/ctrl2080/ctrl2080fifo.h" /* NV2080_CTRL_FIFO_* */
37 #include "ctrl/ctrl2080/ctrl2080gpu.h"  /* NV2080_CTRL_GPU_* */
38 #include "ctrl/ctrl2080/ctrl2080gr.h"   /* NV2080_CTRL_GR_* */
39 /* NV5080_DEFERRED_API - deferred RmControl commands */
40 
41 
42 #define NV5080_CTRL_CMD(cat,idx) NVXXXX_CTRL_CMD(0x5080, NV5080_CTRL_##cat,idx)
43 
44 /* Command categories (6bits) */
45 #define NV5080_CTRL_RESERVED (0x00)
46 #define NV5080_CTRL_DEFERRED (0x01)
47 
48 /*
49  * NV5080_CTRL_CMD_NULL
50  *
51  * This command does nothing.
52  * This command does not take any parameters.
53  *
54  * Possible status values returned are:
55  *    NV_OK
56  */
57 #define NV5080_CTRL_CMD_NULL (0x50800000) /* finn: Evaluated from "(FINN_NV50_DEFERRED_API_CLASS_RESERVED_INTERFACE_ID << 8) | 0x0" */
58 
59 
60 
61 
62 
63 
64 /*
65  * NV5080_CTRL_CMD_DEFERRED_API (deprecated; use NV5080_CTRL_CMD_DEFERRED_API_V2 instead)
66  *
67  * This command sets up a deferred api call.
68  *    hApiHandle
69  *      Client Unique Handle which is used as the data of a sw method to invoke
70  *      the api in the future
71  *    cmd
72  *      The rmcontrol cmd to invoke as a deferred api.
73  *    flags_delete
74  *      Indicates if an explicit delete is needed (default behavior is to
75  *      auto delete after SW method has executed/completed).
76  *    flags_wait_for_tlb_flush
77  *      Indicates if the API should wait for an InvalidateTlb to also occur
78  *      (not just that it's executed) before being considered completed and
79  *      works in conjunction with flags_delete.
80  *    hClientVA, hDeviceVA
81  *      Client/Device handles of the owner of the virtual address space to
82  *      to be updated (used with the FillPteMem API bundle)
83  * Possible status values returned are:
84  *   NV_OK
85  *   NV_ERR_INVALID_PARAM_STRUCT
86  */
87 
88 #define NV5080_CTRL_CMD_DEFERRED_API (0x50800101) /* finn: Evaluated from "(FINN_NV50_DEFERRED_API_CLASS_DEFERRED_INTERFACE_ID << 8) | NV5080_CTRL_DEFERRED_API_PARAMS_MESSAGE_ID" */
89 
90 #define NV5080_CTRL_DEFERRED_API_PARAMS_MESSAGE_ID (0x1U)
91 
92 typedef struct NV5080_CTRL_DEFERRED_API_PARAMS {
93     NvHandle hApiHandle;
94     NvU32    cmd;
95     NvU32    flags;
96     NvHandle hClientVA;
97     NvHandle hDeviceVA;
98 
99     union {
100         NV_DECLARE_ALIGNED(NV2080_CTRL_GPU_INITIALIZE_CTX_PARAMS InitCtx, 8);
101 
102         NV_DECLARE_ALIGNED(NV2080_CTRL_GPU_PROMOTE_CTX_PARAMS PromoteCtx, 8);
103 
104         NV2080_CTRL_GPU_EVICT_CTX_PARAMS                 EvictCtx;
105 
106         NV2080_CTRL_DMA_INVALIDATE_TLB_PARAMS            InvalidateTlb;
107 
108         NV_DECLARE_ALIGNED(NV0080_CTRL_DMA_FILL_PTE_MEM_PARAMS FillPteMem, 8);
109 
110         NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_PARAMS     CacheAllocPolicy;
111 
112         NV_DECLARE_ALIGNED(NV2080_CTRL_GR_CTXSW_ZCULL_BIND_PARAMS ZcullCtxsw, 8);
113 
114         NV_DECLARE_ALIGNED(NV2080_CTRL_GR_CTXSW_PM_BIND_PARAMS PmCtxsw, 8);
115 
116         NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_PARAMS CachePromotePolicy;
117 
118         NV_DECLARE_ALIGNED(NV2080_CTRL_GR_CTXSW_PREEMPTION_BIND_PARAMS PreemptionCtxsw, 8);
119     } api_bundle;
120 } NV5080_CTRL_DEFERRED_API_PARAMS;
121 
122 #define NV5080_CTRL_CMD_DEFERRED_API_FLAGS_DELETE                       0:0
123 #define NV5080_CTRL_CMD_DEFERRED_API_FLAGS_DELETE_EXPLICIT          (0x00000001)
124 #define NV5080_CTRL_CMD_DEFERRED_API_FLAGS_DELETE_IMPLICIT          (0x00000000)
125 
126 #define NV5080_CTRL_CMD_DEFERRED_API_FLAGS_WAIT_FOR_TLB_FLUSH           1:1
127 #define NV5080_CTRL_CMD_DEFERRED_API_FLAGS_WAIT_FOR_TLB_FLUSH_FALSE (0x00000000)
128 #define NV5080_CTRL_CMD_DEFERRED_API_FLAGS_WAIT_FOR_TLB_FLUSH_TRUE  (0x00000001)
129 /*
130  * NV5080_CTRL_CMD_DEFERRED_API_V2
131  *
132  * This command sets up a deferred api call.
133  *    hApiHandle
134  *      Client Unique Handle which is used as the data of a sw method to invoke
135  *      the api in the future
136  *    cmd
137  *      The rmcontrol cmd to invoke as a deferred api.
138  *    flags_delete
139  *      Indicates if an explicit delete is needed (default behavior is to
140  *      auto delete after SW method has executed/completed).
141  *    flags_wait_for_tlb_flush
142  *      Indicates if the API should wait for an InvalidateTlb to also occur
143  *      (not just that it's executed) before being considered completed and
144  *      works in conjunction with flags_delete.
145  *    hClientVA, hDeviceVA
146  *      Client/Device handles of the owner of the virtual address space to
147  *      to be updated (used with the FillPteMem API bundle)
148  * Possible status values returned are:
149  *   NV_OK
150  *   NV_ERR_INVALID_PARAM_STRUCT
151  */
152 
153 #define NV5080_CTRL_CMD_DEFERRED_API_V2                             (0x50800103) /* finn: Evaluated from "(FINN_NV50_DEFERRED_API_CLASS_DEFERRED_INTERFACE_ID << 8) | NV5080_CTRL_DEFERRED_API_V2_PARAMS_MESSAGE_ID" */
154 
155 #define NV5080_CTRL_DEFERRED_API_V2_PARAMS_MESSAGE_ID (0x3U)
156 
157 typedef struct NV5080_CTRL_DEFERRED_API_V2_PARAMS {
158     NvHandle hApiHandle;
159     NvU32    cmd;
160     NvU32    flags;
161     NvHandle hClientVA;
162     NvHandle hDeviceVA;
163 
164     union {
165         NV_DECLARE_ALIGNED(NV2080_CTRL_GPU_INITIALIZE_CTX_PARAMS InitCtx, 8);
166 
167         NV_DECLARE_ALIGNED(NV2080_CTRL_GPU_PROMOTE_CTX_PARAMS PromoteCtx, 8);
168 
169         NV2080_CTRL_GPU_EVICT_CTX_PARAMS                 EvictCtx;
170 
171         NV2080_CTRL_DMA_INVALIDATE_TLB_PARAMS            InvalidateTlb;
172 
173         NV_DECLARE_ALIGNED(NV0080_CTRL_DMA_FILL_PTE_MEM_PARAMS FillPteMem, 8);
174 
175         NV2080_CTRL_FB_GPU_CACHE_ALLOC_POLICY_V2_PARAMS  CacheAllocPolicy;
176 
177         NV_DECLARE_ALIGNED(NV2080_CTRL_GR_CTXSW_ZCULL_BIND_PARAMS ZcullCtxsw, 8);
178 
179         NV_DECLARE_ALIGNED(NV2080_CTRL_GR_CTXSW_PM_BIND_PARAMS PmCtxsw, 8);
180 
181         NV2080_CTRL_FB_GPU_CACHE_PROMOTION_POLICY_PARAMS CachePromotePolicy;
182 
183         NV_DECLARE_ALIGNED(NV2080_CTRL_FIFO_DISABLE_CHANNELS_PARAMS DisableChannels, 8);
184 
185         NV_DECLARE_ALIGNED(NV2080_CTRL_GR_CTXSW_PREEMPTION_BIND_PARAMS PreemptionCtxsw, 8);
186 
187         NV_DECLARE_ALIGNED(NV2080_CTRL_FIFO_UPDATE_CHANNEL_INFO_PARAMS ChannelInfoUpdate, 8);
188     } api_bundle;
189 } NV5080_CTRL_DEFERRED_API_V2_PARAMS;
190 
191 /*
192  * NV5080_CTRL_CMD_REMOVE_API
193  *
194  * This command removes an explicit deferred api call.
195  *    hApiHandle
196  *      Client Unique Handle which is used as the data of a sw method to invoke
197  *      the api in the future
198  * Possible status values returned are:
199  *   NV_OK
200  *   NV_ERR_INVALID_PARAM_STRUCT
201  */
202 
203 #define NV5080_CTRL_CMD_REMOVE_API (0x50800102) /* finn: Evaluated from "(FINN_NV50_DEFERRED_API_CLASS_DEFERRED_INTERFACE_ID << 8) | NV5080_CTRL_REMOVE_API_PARAMS_MESSAGE_ID" */
204 
205 #define NV5080_CTRL_REMOVE_API_PARAMS_MESSAGE_ID (0x2U)
206 
207 typedef struct NV5080_CTRL_REMOVE_API_PARAMS {
208     NvHandle hApiHandle;
209 } NV5080_CTRL_REMOVE_API_PARAMS;
210 
211 /* _ctrl5080_h_ */
212 
213