1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2001-2022 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/ctrl0002.finn
31 //
32 
33 #include "ctrl/ctrlxxxx.h"
34 #define NV0002_CTRL_CMD(cat,idx)          NVXXXX_CTRL_CMD(0x0002, NV0002_CTRL_##cat, idx)
35 
36 /* Client command categories (6bits) */
37 #define NV0002_CTRL_RESERVED (0x00)
38 #define NV0002_CTRL_DMA      (0x01)
39 
40 
41 /*
42  * NV0002_CTRL_CMD_NULL
43  *
44  * This command does nothing.
45  * This command does not take any parameters.
46  *
47  * Possible status values returned are:
48  *    NV_OK
49  */
50 
51 #define NV0002_CTRL_CMD_NULL (0x20000) /* finn: Evaluated from "(FINN_NV01_CONTEXT_DMA_RESERVED_INTERFACE_ID << 8) | 0x0" */
52 
53 
54 
55 /*
56  * NV0002_CTRL_CMD_UPDATE_CONTEXTDMA
57  *
58  * This command will update the parameters of the specified context dma.  The
59  * context dma must be bound to a display channel.  The update is limited
60  * to the display view of the context dma. Other use cases will continue to
61  * use the original allocation parameters.
62  *
63  * This is used on platforms where memory may be moved by the operating
64  * system after allocation.
65  *
66  * This control call supports the NVOS54_FLAGS_LOCK_BYPASS flag.
67  *
68  *   baseAddress
69  *     This parameter, if selected by flags, indicates the new baseAddress for
70  *     the ctxdma
71  *   limit
72  *     This parameter, if selected by flags, indicates the new limit of the
73  *     ctxdma.
74  *   hCtxDma
75  *     ContextDma handle on which to operate. Must match the handle given to the control
76  *     call.
77  *   hChannel
78  *     Display channel handle.  This field is ignored.
79  *   hintHandle
80  *     Hint value returned from HeapAllocHint which encodes information about
81  *     the surface.  This is used by chips without generic kind.  Newer chips
82  *     use the COMPR_INFO flag and the hintHandle must be zero.
83  *   flags
84  *     This parameter specifies flags which indicate which other parameters are
85  *     valid.
86  *       FLAGS_PAGESIZE updates the context DMA pagesize field, if not _DEFAULT
87  *       FLAGS_USE_COMPR_INFO uses the surface format specified in the params, instead of hintHandle.
88  *
89  * Possible status values returned are:
90  *    NV_OK
91  *    NV_ERR_INVALID_OBJECT
92  *    NV_ERR_INVALID_ARGUMENT
93  *    NVOS_STATUS_NOT_SUPPORTED
94  */
95 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA (0x20101) /* finn: Evaluated from "(FINN_NV01_CONTEXT_DMA_DMA_INTERFACE_ID << 8) | NV0002_CTRL_UPDATE_CONTEXTDMA_PARAMS_MESSAGE_ID" */
96 
97 #define NV0002_CTRL_UPDATE_CONTEXTDMA_PARAMS_MESSAGE_ID (0x1U)
98 
99 typedef struct NV0002_CTRL_UPDATE_CONTEXTDMA_PARAMS {
100     NV_DECLARE_ALIGNED(NvU64 baseAddress, 8);
101     NV_DECLARE_ALIGNED(NvU64 limit, 8);
102     NvHandle hSubDevice;
103     NvHandle hCtxDma;
104     NvHandle hChannel;
105     NvHandle hintHandle;
106     NvU32    flags;
107 } NV0002_CTRL_UPDATE_CONTEXTDMA_PARAMS;
108 
109 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_BASEADDRESS                        0:0
110 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_BASEADDRESS_INVALID                (0x00000000)
111 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_BASEADDRESS_VALID                  (0x00000001)
112 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_LIMIT                              1:1
113 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_LIMIT_INVALID                      (0x00000000)
114 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_LIMIT_VALID                        (0x00000001)
115 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_HINT                               2:2
116 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_HINT_INVALID                       (0x00000000)
117 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_HINT_VALID                         (0x00000001)
118 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_PAGESIZE                           4:3
119 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_PAGESIZE_DEFAULT                   (0x00000000)
120 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_PAGESIZE_4K                        (0x00000001)
121 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_PAGESIZE_BIG                       (0x00000002)
122 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_USE_COMPR_INFO                     6:5
123 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_USE_COMPR_INFO_NONE                (0x00000000)
124 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_USE_COMPR_INFO_FORMAT_PITCH        (0x00000001)
125 #define NV0002_CTRL_CMD_UPDATE_CONTEXTDMA_FLAGS_USE_COMPR_INFO_FORMAT_BLOCK_LINEAR (0x00000002)
126 
127 /*
128  * NV0002_CTRL_CMD_BIND_CONTEXTDMA
129  *
130  * Bind a context dma to a display channel.  Binding is no longer required for
131  * Host channels, but does silently succeed.
132  *
133  * This control call supports the NVOS54_FLAGS_LOCK_BYPASS flag.
134  *
135  * This control replaces the obsolete RmBindContextDma() API.
136  *
137  * hChannel
138  *     The channel for ctxdma bind
139  *
140  * Possible error codes include
141  *   NV_OK
142  *   NV_ERR_TOO_MANY_PRIMARIES          hash table is full
143  *   NV_ERR_NO_MEMORY                   instance memory is full
144  *   NV_ERR_INVALID_OFFSET              surface is not correctly aligned
145  *   NV_ERR_STATE_IN_USE                context dma was already bound given channel
146  */
147 #define NV0002_CTRL_CMD_BIND_CONTEXTDMA                                            (0x20102) /* finn: Evaluated from "(FINN_NV01_CONTEXT_DMA_DMA_INTERFACE_ID << 8) | NV0002_CTRL_BIND_CONTEXTDMA_PARAMS_MESSAGE_ID" */
148 
149 #define NV0002_CTRL_BIND_CONTEXTDMA_PARAMS_MESSAGE_ID (0x2U)
150 
151 typedef struct NV0002_CTRL_BIND_CONTEXTDMA_PARAMS {
152     NvHandle hChannel;
153 } NV0002_CTRL_BIND_CONTEXTDMA_PARAMS;
154 
155 /*
156  * NV0002_CTRL_CMD_UNBIND_CONTEXTDMA
157  *
158  * Unbind a context dma from a display channel.
159  *
160  * This control call supports the NVOS54_FLAGS_LOCK_BYPASS flag.
161  *
162  * hChannel
163  *     The display channel to unbind from
164  *
165  * Possible error codes include
166  *   NV_OK
167  *   NV_ERR_INVALID_STATE               channel was not bound
168  */
169 #define NV0002_CTRL_CMD_UNBIND_CONTEXTDMA (0x20103) /* finn: Evaluated from "(FINN_NV01_CONTEXT_DMA_DMA_INTERFACE_ID << 8) | NV0002_CTRL_UNBIND_CONTEXTDMA_PARAMS_MESSAGE_ID" */
170 
171 #define NV0002_CTRL_UNBIND_CONTEXTDMA_PARAMS_MESSAGE_ID (0x3U)
172 
173 typedef struct NV0002_CTRL_UNBIND_CONTEXTDMA_PARAMS {
174     NvHandle hChannel;
175 } NV0002_CTRL_UNBIND_CONTEXTDMA_PARAMS;
176 
177 /* _ctrl0002.h_ */
178 
179