1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 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/ctrl0050.finn
31 //
32 
33 #include "ctrl/ctrlxxxx.h"
34 
35 #define NV0050_CTRL_CMD(cat, idx) NVXXXX_CTRL_CMD(0x0050, NV0050_CTRL_##cat, idx)
36 
37 #define NV0050_CTRL_RESERVED (0x00U)
38 #define NV0050_CTRL_MEMORY   (0x01U)
39 
40 #define NV0050_CTRL_CMD_NULL (0x5000U) /* finn: Evaluated from "(FINN_NV_CE_UTILS_RESERVED_INTERFACE_ID << 8) | 0x0" */
41 
42 
43 
44 /*
45  * NV0050_CTRL_CMD_MEMSET
46  *
47  * Memsets a memory allocation and releases a semaphore on completion.
48  *
49  * hMemory  [IN]
50  *    Memory handle of the memory descriptor that needs to be memset.
51  *    This is only available for verification purposes.
52  *
53  * offset   [IN]
54  *    Offset into the memory descriptor.
55  *
56  * length   [IN]
57  *    Length of physical memory to be memset.
58  *    Must be less than or equal to memory size.
59  *
60  * pattern  [IN]
61  *    The pattern to memset to
62  *
63  * flags    [IN]
64  *    Can be any of the NV0050_CTRL_MEMSET_FLAGS_*
65  *        DEFAULT
66  *            By default, the memcopy operation will be synchronous and using
67  *            physical copies
68  *        ASYNC
69  *            This flag forces this memset to be asynchronous.
70  *        VIRTUAL
71  *            This flag forces the memset to use Virtual addresses which are
72  *            identity mapped. To use this feature, users need to pass in the
73  *            hVaspace with identity mapped addresses for the entire memory during
74  *            construct.
75  *
76  * submittedWorkId [OUT]
77  *    The work submission token users can poll on to wait for work
78  *    completed by CE. Only valid in case of ASYNC mode.
79  */
80 
81 #define NV0050_CTRL_MEMSET_FLAGS_DEFAULT 0
82 #define NV0050_CTRL_MEMSET_FLAGS_ASYNC    NVBIT(0)
83 #define NV0050_CTRL_MEMSET_FLAGS_VIRTUAL  NVBIT(1)
84 
85 #define NV0050_CTRL_CMD_MEMSET           (0x500101U) /* finn: Evaluated from "(FINN_NV_CE_UTILS_UTILS_INTERFACE_ID << 8) | NV0050_CTRL_MEMSET_PARAMS_MESSAGE_ID" */
86 
87 #define NV0050_CTRL_MEMSET_PARAMS_MESSAGE_ID (0x1U)
88 
89 typedef struct NV0050_CTRL_MEMSET_PARAMS {
90     NvHandle hMemory;
91     NV_DECLARE_ALIGNED(NvU64 offset, 8);
92     NV_DECLARE_ALIGNED(NvU64 length, 8);
93     NvU32    pattern;
94     NV_DECLARE_ALIGNED(NvU64 flags, 8);
95     NV_DECLARE_ALIGNED(NvU64 submittedWorkId, 8);
96 } NV0050_CTRL_MEMSET_PARAMS;
97 
98 /*
99  * NV0050_CTRL_CMD_MEMCOPY
100  *
101  * Copies from a source memoryto ssdestination  memory and releases a semaphore
102  * on completion
103  *
104  * hDstMemory  [IN]
105  *    Memory handle of the memory descriptor to which data will be copied.
106  *    This is only available for verification purposes.
107  *
108  * hSrcMemory  [IN]
109  *    Memory handle of the memory descriptor from which data will be copied.
110  *    This is only available for verification purposes.
111  *
112  * dstOfffset   [IN]
113  *    Offset into the destination memory descriptor.
114  *
115  * srcOffset   [IN]
116  *    Offset into the source memory descriptor.
117  *
118  * length   [IN]
119  *    Length of physical memory to be copied.
120  *    Must be less than or equal to both destination and source memory size.
121  *
122  * flags    [IN]
123  *    Can be any of the NV0050_CTRL_MEMCOPY_FLAGS_*
124  *        DEFAULT
125  *            By default, the memcopy operation will be synchronous and using
126  *            physical copies
127  *        ASYNC
128  *            This flag forces this memset to be asynchronous.
129  *        VIRTUAL
130  *            This flag forces the memset to use Virtual addresses which are
131  *            identity mapped. To use this feature, users need to pass in the
132  *            hVaspace with identity mapped addresses for the entire memory during
133  *            construct.
134  *
135  * submittedWorkId [OUT]
136  *    The work submission token users can poll on to wait for work
137  *    completed by CE. Only valid in case of ASYNC mode.
138  */
139 
140 #define NV0050_CTRL_MEMCOPY_FLAGS_DEFAULT 0
141 #define NV0050_CTRL_MEMCOPY_FLAGS_ASYNC    NVBIT(1)
142 #define NV0050_CTRL_MEMCOPY_FLAGS_VIRTUAL  NVBIT(2)
143 
144 #define NV0050_CTRL_CMD_MEMCOPY           (0x500102U) /* finn: Evaluated from "(FINN_NV_CE_UTILS_UTILS_INTERFACE_ID << 8 | NV0050_CTRL_MEMCOPY_PARAMS_MESSAGE_ID)" */
145 
146 #define NV0050_CTRL_MEMCOPY_PARAMS_MESSAGE_ID (0x2U)
147 
148 typedef struct NV0050_CTRL_MEMCOPY_PARAMS {
149     NvHandle hDstMemory;
150     NvHandle hSrcMemory;
151     NV_DECLARE_ALIGNED(NvU64 dstOffset, 8);
152     NV_DECLARE_ALIGNED(NvU64 srcOffset, 8);
153     NV_DECLARE_ALIGNED(NvU64 length, 8);
154     NV_DECLARE_ALIGNED(NvU64 flags, 8);
155     NV_DECLARE_ALIGNED(NvU64 submittedWorkId, 8);
156 } NV0050_CTRL_MEMCOPY_PARAMS;
157 
158 /*
159  * NV0050_CTRL_CMD_CHECK_PROGRESS
160  *
161  * Check if a previously submitted work item has been completed by HW.
162  *
163  * submittedWorkId  [IN]
164  *    The work submission token users can poll on to wait for work
165  *    completed by CE.
166  *
167  */
168 #define NV0050_CTRL_CHECK_PROGRESS_RESULT_DEFAULT 0
169 #define NV0050_CTRL_CHECK_PROGRESS_RESULT_FINISHED    NVBIT(1)
170 
171 #define NV0050_CTRL_CMD_CHECK_PROGRESS            (0x500103U) /* finn: Evaluated from "(FINN_NV_CE_UTILS_UTILS_INTERFACE_ID << 8 | NV0050_CTRL_CHECK_PROGRESS_PARAMS_MESSAGE_ID)" */
172 
173 #define NV0050_CTRL_CHECK_PROGRESS_PARAMS_MESSAGE_ID (0x3U)
174 
175 typedef struct NV0050_CTRL_CHECK_PROGRESS_PARAMS {
176     NV_DECLARE_ALIGNED(NvU64 submittedWorkId, 8);
177     NvU32 result;
178 } NV0050_CTRL_CHECK_PROGRESS_PARAMS;
179 
180 /* _ctrl0050_h_ */
181