xref: /aosp_15_r20/external/mesa3d/src/nouveau/headers/nvidia/classes/cl906f.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*******************************************************************************
2     Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3 
4     Permission is hereby granted, free of charge, to any person obtaining a
5     copy of this software and associated documentation files (the "Software"),
6     to deal in the Software without restriction, including without limitation
7     the rights to use, copy, modify, merge, publish, distribute, sublicense,
8     and/or sell copies of the Software, and to permit persons to whom the
9     Software is furnished to do so, subject to the following conditions:
10 
11     The above copyright notice and this permission notice shall be included in
12     all copies or substantial portions of the Software.
13 
14     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17     THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20     DEALINGS IN THE SOFTWARE.
21 
22 *******************************************************************************/
23 #ifndef _cl906f_h_
24 #define _cl906f_h_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include "nvtypes.h"
31 
32 /* class GF100_CHANNEL_GPFIFO  */
33 /*
34  * Documentation for GF100_CHANNEL_GPFIFO can be found in dev_pbdma.ref,
35  * chapter "User Control Registers". It is documented as device NV_UDMA.
36  * The GPFIFO format itself is also documented in dev_pbdma.ref,
37  * NV_PPBDMA_GP_ENTRY_*. The pushbuffer format is documented in dev_ram.ref,
38  * chapter "FIFO DMA RAM", NV_FIFO_DMA_*.
39  *
40  */
41 #define  GF100_CHANNEL_GPFIFO                                  (0x0000906F)
42 
43 /* pio method data structure */
44 typedef volatile struct _cl906f_tag0 {
45  NvV32 Reserved00[0x7c0];
46 } Nv906fTypedef, GF100ChannelGPFifo;
47 #define NV906F_TYPEDEF                                         GF100ChannelGPFifo
48 /* dma flow control data structure */
49 typedef volatile struct _cl906f_tag1 {
50  NvU32 Ignored00[0x010];        /*                                  0000-0043*/
51  NvU32 Put;                     /* put offset, read/write           0040-0043*/
52  NvU32 Get;                     /* get offset, read only            0044-0047*/
53  NvU32 Reference;               /* reference value, read only       0048-004b*/
54  NvU32 PutHi;                   /* high order put offset bits       004c-004f*/
55  NvU32 SetReferenceThreshold;   /* set reference value threshold    0050-0053*/
56  NvU32 Ignored01[0x001];        /*                                  0054-0057*/
57  NvU32 TopLevelGet;             /* top level get offset, read only  0058-005b*/
58  NvU32 TopLevelGetHi;           /* high order top level get bits    005c-005f*/
59  NvU32 GetHi;                   /* high order get offset bits       0060-0063*/
60  NvU32 Ignored02[0x007];        /*                                  0064-007f*/
61  NvU32 Ignored03;               /* used to be engine yield          0080-0083*/
62  NvU32 Ignored04[0x001];        /*                                  0084-0087*/
63  NvU32 GPGet;                   /* GP FIFO get offset, read only    0088-008b*/
64  NvU32 GPPut;                   /* GP FIFO put offset               008c-008f*/
65  NvU32 Ignored05[0x3dc];
66 } Nv906fControl, GF100ControlGPFifo;
67 /* fields and values */
68 #define NV906F_NUMBER_OF_SUBCHANNELS                               (8)
69 #define NV906F_SET_OBJECT                                          (0x00000000)
70 #define NV906F_SET_OBJECT_NVCLASS                                         15:0
71 #define NV906F_SET_OBJECT_ENGINE                                         20:16
72 #define NV906F_SET_OBJECT_ENGINE_SW                                 0x0000001f
73 #define NV906F_ILLEGAL                                             (0x00000004)
74 #define NV906F_ILLEGAL_HANDLE                                             31:0
75 #define NV906F_NOP                                                 (0x00000008)
76 #define NV906F_NOP_HANDLE                                                 31:0
77 #define NV906F_SEMAPHOREA                                          (0x00000010)
78 #define NV906F_SEMAPHOREA_OFFSET_UPPER                                     7:0
79 #define NV906F_SEMAPHOREB                                          (0x00000014)
80 #define NV906F_SEMAPHOREB_OFFSET_LOWER                                    31:2
81 #define NV906F_SEMAPHOREC                                          (0x00000018)
82 #define NV906F_SEMAPHOREC_PAYLOAD                                         31:0
83 #define NV906F_SEMAPHORED                                          (0x0000001C)
84 #define NV906F_SEMAPHORED_OPERATION                                        3:0
85 #define NV906F_SEMAPHORED_OPERATION_ACQUIRE                         0x00000001
86 #define NV906F_SEMAPHORED_OPERATION_RELEASE                         0x00000002
87 #define NV906F_SEMAPHORED_OPERATION_ACQ_GEQ                         0x00000004
88 #define NV906F_SEMAPHORED_OPERATION_ACQ_AND                         0x00000008
89 #define NV906F_SEMAPHORED_ACQUIRE_SWITCH                                 12:12
90 #define NV906F_SEMAPHORED_ACQUIRE_SWITCH_DISABLED                   0x00000000
91 #define NV906F_SEMAPHORED_ACQUIRE_SWITCH_ENABLED                    0x00000001
92 #define NV906F_SEMAPHORED_RELEASE_WFI                                    20:20
93 #define NV906F_SEMAPHORED_RELEASE_WFI_EN                            0x00000000
94 #define NV906F_SEMAPHORED_RELEASE_WFI_DIS                           0x00000001
95 #define NV906F_SEMAPHORED_RELEASE_SIZE                                   24:24
96 #define NV906F_SEMAPHORED_RELEASE_SIZE_16BYTE                       0x00000000
97 #define NV906F_SEMAPHORED_RELEASE_SIZE_4BYTE                        0x00000001
98 #define NV906F_NON_STALL_INTERRUPT                                 (0x00000020)
99 #define NV906F_NON_STALL_INTERRUPT_HANDLE                                 31:0
100 #define NV906F_FB_FLUSH                                            (0x00000024)
101 #define NV906F_FB_FLUSH_HANDLE                                            31:0
102 #define NV906F_MEM_OP_A                                            (0x00000028)
103 #define NV906F_MEM_OP_A_OPERAND_LOW                                       31:2
104 #define NV906F_MEM_OP_A_TLB_INVALIDATE_ADDR                               29:2
105 #define NV906F_MEM_OP_A_TLB_INVALIDATE_TARGET                            31:30
106 #define NV906F_MEM_OP_A_TLB_INVALIDATE_TARGET_VID_MEM               0x00000000
107 #define NV906F_MEM_OP_A_TLB_INVALIDATE_TARGET_SYS_MEM_COHERENT      0x00000002
108 #define NV906F_MEM_OP_A_TLB_INVALIDATE_TARGET_SYS_MEM_NONCOHERENT   0x00000003
109 #define NV906F_MEM_OP_B                                            (0x0000002c)
110 #define NV906F_MEM_OP_B_OPERAND_HIGH                                       7:0
111 #define NV906F_MEM_OP_B_OPERATION                                        31:27
112 #define NV906F_MEM_OP_B_OPERATION_SYSMEMBAR_FLUSH                   0x00000005
113 #define NV906F_MEM_OP_B_OPERATION_SOFT_FLUSH                        0x00000006
114 #define NV906F_MEM_OP_B_OPERATION_MMU_TLB_INVALIDATE                0x00000009
115 #define NV906F_MEM_OP_B_OPERATION_L2_PEERMEM_INVALIDATE             0x0000000d
116 #define NV906F_MEM_OP_B_OPERATION_L2_SYSMEM_INVALIDATE              0x0000000e
117 #define NV906F_MEM_OP_B_OPERATION_L2_CLEAN_COMPTAGS                 0x0000000f
118 #define NV906F_MEM_OP_B_OPERATION_L2_FLUSH_DIRTY                    0x00000010
119 #define NV906F_MEM_OP_B_MMU_TLB_INVALIDATE_PDB                             0:0
120 #define NV906F_MEM_OP_B_MMU_TLB_INVALIDATE_PDB_ONE                  0x00000000
121 #define NV906F_MEM_OP_B_MMU_TLB_INVALIDATE_PDB_ALL                  0x00000001
122 #define NV906F_MEM_OP_B_MMU_TLB_INVALIDATE_GPC                             1:1
123 #define NV906F_MEM_OP_B_MMU_TLB_INVALIDATE_GPC_ENABLE               0x00000000
124 #define NV906F_MEM_OP_B_MMU_TLB_INVALIDATE_GPC_DISABLE              0x00000001
125 #define NV906F_SET_REFERENCE                                       (0x00000050)
126 #define NV906F_SET_REFERENCE_COUNT                                        31:0
127 #define NV906F_CRC_CHECK                                           (0x0000007c)
128 #define NV906F_CRC_CHECK_VALUE                                            31:0
129 #define NV906F_YIELD                                               (0x00000080)
130 #define NV906F_YIELD_OP                                                    1:0
131 #define NV906F_YIELD_OP_NOP                                         0x00000000
132 
133 
134 /* GPFIFO entry format */
135 #define NV906F_GP_ENTRY__SIZE                                   8
136 #define NV906F_GP_ENTRY0_FETCH                                0:0
137 #define NV906F_GP_ENTRY0_FETCH_UNCONDITIONAL           0x00000000
138 #define NV906F_GP_ENTRY0_FETCH_CONDITIONAL             0x00000001
139 #define NV906F_GP_ENTRY0_NO_CONTEXT_SWITCH                    1:1
140 #define NV906F_GP_ENTRY0_NO_CONTEXT_SWITCH_FALSE       0x00000000
141 #define NV906F_GP_ENTRY0_NO_CONTEXT_SWITCH_TRUE        0x00000001
142 #define NV906F_GP_ENTRY0_GET                                 31:2
143 #define NV906F_GP_ENTRY0_OPERAND                             31:0
144 #define NV906F_GP_ENTRY1_GET_HI                               7:0
145 #define NV906F_GP_ENTRY1_PRIV                                 8:8
146 #define NV906F_GP_ENTRY1_PRIV_USER                     0x00000000
147 #define NV906F_GP_ENTRY1_PRIV_KERNEL                   0x00000001
148 #define NV906F_GP_ENTRY1_LEVEL                                9:9
149 #define NV906F_GP_ENTRY1_LEVEL_MAIN                    0x00000000
150 #define NV906F_GP_ENTRY1_LEVEL_SUBROUTINE              0x00000001
151 #define NV906F_GP_ENTRY1_LENGTH                             30:10
152 #define NV906F_GP_ENTRY1_SYNC                               31:31
153 #define NV906F_GP_ENTRY1_SYNC_PROCEED                  0x00000000
154 #define NV906F_GP_ENTRY1_SYNC_WAIT                     0x00000001
155 #define NV906F_GP_ENTRY1_OPCODE                               7:0
156 #define NV906F_GP_ENTRY1_OPCODE_NOP                    0x00000000
157 #define NV906F_GP_ENTRY1_OPCODE_ILLEGAL                0x00000001
158 #define NV906F_GP_ENTRY1_OPCODE_GP_CRC                 0x00000002
159 #define NV906F_GP_ENTRY1_OPCODE_PB_CRC                 0x00000003
160 
161 /* dma method formats */
162 #define NV906F_DMA_METHOD_ADDRESS_OLD                              12:2
163 #define NV906F_DMA_METHOD_ADDRESS                                  11:0
164 #define NV906F_DMA_SUBDEVICE_MASK                                  15:4
165 #define NV906F_DMA_METHOD_SUBCHANNEL                               15:13
166 #define NV906F_DMA_TERT_OP                                         17:16
167 #define NV906F_DMA_TERT_OP_GRP0_INC_METHOD                         (0x00000000)
168 #define NV906F_DMA_TERT_OP_GRP0_SET_SUB_DEV_MASK                   (0x00000001)
169 #define NV906F_DMA_TERT_OP_GRP0_STORE_SUB_DEV_MASK                 (0x00000002)
170 #define NV906F_DMA_TERT_OP_GRP0_USE_SUB_DEV_MASK                   (0x00000003)
171 #define NV906F_DMA_TERT_OP_GRP2_NON_INC_METHOD                     (0x00000000)
172 #define NV906F_DMA_METHOD_COUNT_OLD                                28:18
173 #define NV906F_DMA_METHOD_COUNT                                    28:16
174 #define NV906F_DMA_IMMD_DATA                                       28:16
175 #define NV906F_DMA_SEC_OP                                          31:29
176 #define NV906F_DMA_SEC_OP_GRP0_USE_TERT                            (0x00000000)
177 #define NV906F_DMA_SEC_OP_INC_METHOD                               (0x00000001)
178 #define NV906F_DMA_SEC_OP_GRP2_USE_TERT                            (0x00000002)
179 #define NV906F_DMA_SEC_OP_NON_INC_METHOD                           (0x00000003)
180 #define NV906F_DMA_SEC_OP_IMMD_DATA_METHOD                         (0x00000004)
181 #define NV906F_DMA_SEC_OP_ONE_INC                                  (0x00000005)
182 #define NV906F_DMA_SEC_OP_RESERVED6                                (0x00000006)
183 #define NV906F_DMA_SEC_OP_END_PB_SEGMENT                           (0x00000007)
184 /* dma incrementing method format */
185 #define NV906F_DMA_INCR_ADDRESS                                    11:0
186 #define NV906F_DMA_INCR_SUBCHANNEL                                 15:13
187 #define NV906F_DMA_INCR_COUNT                                      28:16
188 #define NV906F_DMA_INCR_OPCODE                                     31:29
189 #define NV906F_DMA_INCR_OPCODE_VALUE                               (0x00000001)
190 #define NV906F_DMA_INCR_DATA                                       31:0
191 /* dma non-incrementing method format */
192 #define NV906F_DMA_NONINCR_ADDRESS                                 11:0
193 #define NV906F_DMA_NONINCR_SUBCHANNEL                              15:13
194 #define NV906F_DMA_NONINCR_COUNT                                   28:16
195 #define NV906F_DMA_NONINCR_OPCODE                                  31:29
196 #define NV906F_DMA_NONINCR_OPCODE_VALUE                            (0x00000003)
197 #define NV906F_DMA_NONINCR_DATA                                    31:0
198 /* dma increment-once method format */
199 #define NV906F_DMA_ONEINCR_ADDRESS                                 11:0
200 #define NV906F_DMA_ONEINCR_SUBCHANNEL                              15:13
201 #define NV906F_DMA_ONEINCR_COUNT                                   28:16
202 #define NV906F_DMA_ONEINCR_OPCODE                                  31:29
203 #define NV906F_DMA_ONEINCR_OPCODE_VALUE                            (0x00000005)
204 #define NV906F_DMA_ONEINCR_DATA                                    31:0
205 /* dma no-operation format */
206 #define NV906F_DMA_NOP                                             (0x00000000)
207 /* dma immediate-data format */
208 #define NV906F_DMA_IMMD_ADDRESS                                    11:0
209 #define NV906F_DMA_IMMD_SUBCHANNEL                                 15:13
210 #define NV906F_DMA_IMMD_DATA                                       28:16
211 #define NV906F_DMA_IMMD_OPCODE                                     31:29
212 #define NV906F_DMA_IMMD_OPCODE_VALUE                               (0x00000004)
213 /* dma set sub-device mask format */
214 #define NV906F_DMA_SET_SUBDEVICE_MASK_VALUE                        15:4
215 #define NV906F_DMA_SET_SUBDEVICE_MASK_OPCODE                       31:16
216 #define NV906F_DMA_SET_SUBDEVICE_MASK_OPCODE_VALUE                 (0x00000001)
217 /* dma store sub-device mask format */
218 #define NV906F_DMA_STORE_SUBDEVICE_MASK_VALUE                      15:4
219 #define NV906F_DMA_STORE_SUBDEVICE_MASK_OPCODE                     31:16
220 #define NV906F_DMA_STORE_SUBDEVICE_MASK_OPCODE_VALUE               (0x00000002)
221 /* dma use sub-device mask format */
222 #define NV906F_DMA_USE_SUBDEVICE_MASK_OPCODE                       31:16
223 #define NV906F_DMA_USE_SUBDEVICE_MASK_OPCODE_VALUE                 (0x00000003)
224 /* dma end-segment format */
225 #define NV906F_DMA_ENDSEG_OPCODE                                   31:29
226 #define NV906F_DMA_ENDSEG_OPCODE_VALUE                             (0x00000007)
227 /* dma legacy incrementing/non-incrementing formats */
228 #define NV906F_DMA_ADDRESS                                         12:2
229 #define NV906F_DMA_SUBCH                                           15:13
230 #define NV906F_DMA_OPCODE3                                         17:16
231 #define NV906F_DMA_OPCODE3_NONE                                    (0x00000000)
232 #define NV906F_DMA_COUNT                                           28:18
233 #define NV906F_DMA_OPCODE                                          31:29
234 #define NV906F_DMA_OPCODE_METHOD                                   (0x00000000)
235 #define NV906F_DMA_OPCODE_NONINC_METHOD                            (0x00000002)
236 #define NV906F_DMA_DATA                                            31:0
237 
238 #ifdef __cplusplus
239 };     /* extern "C" */
240 #endif
241 
242 #endif /* _cl906f_h_ */
243