1 /* 2 * SPDX-FileCopyrightText: Copyright (c) 2008-2015 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/ctrl2080tmr.finn 31 // 32 33 #include "ctrl/ctrl2080/ctrl2080base.h" 34 35 /* NV20_SUBDEVICE_TIMER related control commands and parameters */ 36 37 /* 38 * NV2080_CTRL_CMD_TIMER_SCHEDULE 39 * 40 * This command schedules a GPU timer event to fire at the specified time interval. 41 * Can be called without API & GPU locks if NVOS54_FLAGS_IRQL_RAISED and 42 * NVOS54_FLAGS_LOCK_BYPASS are set in NVOS54_PARAMETERS.flags 43 * 44 * time_nsec 45 * This parameter specifies the time in nanoseconds at which the GPU timer 46 * event is to fire. 47 * flags 48 * This parameter determines the interpretation of the value specified by 49 * the time_nsec parameter: 50 * NV2080_CTRL_TIMER_SCHEDULE_FLAGS_TIME_ABS 51 * This flag indicates that time_nsec is in absolute time. 52 * NV2080_CTRL_TIMER_SCHEDULE_FLAGS_TIME_REL 53 * This flag indicates that time_nsec is in relative time. 54 * 55 * Possible status values returned are: 56 * NV_OK 57 * NV_ERR_INVALID_PARAM_STRUCT 58 * NV_ERR_INVALID_ARGUMENT 59 * NV_ERR_INVALID_STATE 60 */ 61 #define NV2080_CTRL_CMD_TIMER_SCHEDULE (0x20800401) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_TIMER_INTERFACE_ID << 8) | NV2080_CTRL_CMD_TIMER_SCHEDULE_PARAMS_MESSAGE_ID" */ 62 63 #define NV2080_CTRL_CMD_TIMER_SCHEDULE_PARAMS_MESSAGE_ID (0x1U) 64 65 typedef struct NV2080_CTRL_CMD_TIMER_SCHEDULE_PARAMS { 66 NV_DECLARE_ALIGNED(NvU64 time_nsec, 8); 67 NvU32 flags; 68 } NV2080_CTRL_CMD_TIMER_SCHEDULE_PARAMS; 69 70 /* valid flag values */ 71 #define NV2080_CTRL_TIMER_SCHEDULE_FLAGS_TIME 0:0 72 #define NV2080_CTRL_TIMER_SCHEDULE_FLAGS_TIME_ABS (0x00000000) 73 #define NV2080_CTRL_TIMER_SCHEDULE_FLAGS_TIME_REL (0x00000001) 74 75 /* 76 * NV2080_CTRL_CMD_TIMER_CANCEL 77 * 78 * This command cancels any pending timer events initiated with the 79 * NV2080_CTRL_CMD_TIMER_SCHEDULE command. 80 * 81 * Possible status values returned are: 82 * NV_OK 83 * NV_ERR_INVALID_ARGUMENT 84 */ 85 #define NV2080_CTRL_CMD_TIMER_CANCEL (0x20800402) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_TIMER_INTERFACE_ID << 8) | 0x2" */ 86 87 /* 88 * NV2080_CTRL_CMD_TIMER_GET_TIME 89 * 90 * This command returns the current GPU timer value. The current time is 91 * expressed in elapsed nanoseconds since 00:00 GMT, January 1, 1970 92 * (zero hour) with a resolution of 32 nanoseconds. 93 * 94 * Can be called without API & GPU locks if NVOS54_FLAGS_IRQL_RAISED and 95 * NVOS54_FLAGS_LOCK_BYPASS are set in NVOS54_PARAMETERS.flags 96 * 97 * Possible status values returned are: 98 * NV_OK 99 * NV_ERR_INVALID_ARGUMENT 100 */ 101 #define NV2080_CTRL_CMD_TIMER_GET_TIME (0x20800403) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_TIMER_INTERFACE_ID << 8) | NV2080_CTRL_TIMER_GET_TIME_PARAMS_MESSAGE_ID" */ 102 103 #define NV2080_CTRL_TIMER_GET_TIME_PARAMS_MESSAGE_ID (0x3U) 104 105 typedef struct NV2080_CTRL_TIMER_GET_TIME_PARAMS { 106 NV_DECLARE_ALIGNED(NvU64 time_nsec, 8); 107 } NV2080_CTRL_TIMER_GET_TIME_PARAMS; 108 109 /* 110 * NV2080_CTRL_CMD_TIMER_GET_REGISTER_OFFSET 111 * 112 * The command returns the offset of the timer registers, so that clients may 113 * map them directly. 114 * 115 * Possible status values returned are: 116 * NV_OK 117 */ 118 119 #define NV2080_CTRL_CMD_TIMER_GET_REGISTER_OFFSET (0x20800404) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_TIMER_INTERFACE_ID << 8) | NV2080_CTRL_TIMER_GET_REGISTER_OFFSET_PARAMS_MESSAGE_ID" */ 120 121 #define NV2080_CTRL_TIMER_GET_REGISTER_OFFSET_PARAMS_MESSAGE_ID (0x4U) 122 123 typedef struct NV2080_CTRL_TIMER_GET_REGISTER_OFFSET_PARAMS { 124 NvU32 tmr_offset; 125 } NV2080_CTRL_TIMER_GET_REGISTER_OFFSET_PARAMS; 126 127 /* 128 * NV2080_CTRL_TIMER_GPU_CPU_TIME_SAMPLE 129 * 130 * This structure describes the information obtained with 131 * NV2080_CTRL_CMD_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO command. 132 * 133 * gpuTime 134 * GPU time is the value of GPU global timer (PTIMER) with a resolution 135 * of 32 nano seconds. 136 * cpuTime 137 * CPU time. Resolution of the cpu time depends on its source. Refer to 138 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_* for more information. 139 140 */ 141 typedef struct NV2080_CTRL_TIMER_GPU_CPU_TIME_SAMPLE { 142 NV_DECLARE_ALIGNED(NvU64 cpuTime, 8); 143 NV_DECLARE_ALIGNED(NvU64 gpuTime, 8); 144 } NV2080_CTRL_TIMER_GPU_CPU_TIME_SAMPLE; 145 146 147 /* 148 * NV2080_CTRL_CMD_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO 149 * 150 * This command returns correlation information between GPU time and CPU time 151 * for a given CPU clock type. 152 * 153 * cpuClkId 154 * This parameter specifies the source of the CPU clock. This parameter is 155 * composed of two fields: 156 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_SOURCE 157 * This field specifies source ID of the CPU clock in question. Legal 158 * values for this parameter include: 159 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_OSTIME 160 * This clock id will provide real time in microseconds since 161 * 00:00:00 UTC on January 1, 1970, as reported by the host OS. 162 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PLATFORM_API 163 * This clock id will provide time stamp that is constant-rate, high 164 * precision using platform API that is also available in the user 165 * mode. 166 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_TSC 167 * This clock id will provide time stamp using CPU's time stamp 168 * counter. 169 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR 170 * This field specifies the processor whose clock should be used for the 171 * source. The control call and cpuClkId parameter remain named for the 172 * CPU specifically for legacy reasons. Not all processors will support 173 * all clock sources. Legal values for this parameter include: 174 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR_CPU 175 * The clock information will be fulfilled by the CPU. This value 176 * is defined to be 0 so that it is the default for backwards 177 * compatibility. 178 * NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR_GSP 179 * The clock information will be fulfilled by the GSP. 180 * 181 * sampleCount 182 * This field specifies the number of clock samples to be taken. 183 * This value cannot exceed NV2080_CTRL_TIMER_GPU_CPU_TIME_MAX_SAMPLES. 184 * 185 * samples 186 * This field returns an array of requested samples. Refer to 187 * NV2080_CTRL_TIMER_GPU_CPU_TIME_SAMPLE to get details about each entry 188 * in the array. 189 * 190 * Possible status values returned are: 191 * NV_OK 192 * NV_ERR_NOT_SUPPORTED 193 * NV_ERR_INVALID_ARGUMENT 194 */ 195 #define NV2080_CTRL_CMD_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO (0x20800406) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_TIMER_INTERFACE_ID << 8) | NV2080_CTRL_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO_PARAMS_MESSAGE_ID" */ 196 197 #define NV2080_CTRL_TIMER_GPU_CPU_TIME_MAX_SAMPLES 16 198 199 #define NV2080_CTRL_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO_PARAMS_MESSAGE_ID (0x6U) 200 201 typedef struct NV2080_CTRL_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO_PARAMS { 202 NvU8 cpuClkId; 203 NvU8 sampleCount; 204 NV_DECLARE_ALIGNED(NV2080_CTRL_TIMER_GPU_CPU_TIME_SAMPLE samples[NV2080_CTRL_TIMER_GPU_CPU_TIME_MAX_SAMPLES], 8); 205 } NV2080_CTRL_TIMER_GET_GPU_CPU_TIME_CORRELATION_INFO_PARAMS; 206 207 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_SOURCE 3:0 208 209 /* Legal NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_SOURCE values */ 210 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_OSTIME (0x00000001) 211 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_TSC (0x00000002) 212 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PLATFORM_API (0x00000003) 213 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_GSP_OS (0x00000004) 214 215 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR 7:4 216 217 /* Legal NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR values */ 218 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR_CPU (0x00000000) 219 #define NV2080_TIMER_GPU_CPU_TIME_CPU_CLK_ID_PROCESSOR_GSP (0x00000001) 220 221 222 /*! 223 * NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ 224 * 225 * This command changes the frequency at which Graphics Engine time stamp is 226 * updated. Frequency can either be set to max or restored to default. 227 * Clients can independently use this call to increase the timer frequency 228 * as a global reference count is maintained for requests to Max frequency. 229 * Client is assured that the system stays in this state till the requested 230 * client releases the state or is killed. Timer frequency will automatically 231 * be restored to default when there is no pending request to increase. 232 * 233 * Note that recursive requests for the same state from the same client 234 * are considered invalid. 235 * 236 * bSetMaxFreq 237 * Set to NV_TRUE if GR tick frequency needs to be set to Max. 238 * 239 * See @ref NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ_PARAMS for 240 * documentation of parameters. 241 * 242 * Possible status values returned are 243 * NV_OK 244 * NV_ERR_NOT_SUPPORTED 245 * NV_ERR_STATE_IN_USE 246 * NV_ERR_INVALID_OPERATION 247 * NV_ERR_INVALID_STATE 248 */ 249 #define NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ (0x20800407) /* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_TIMER_INTERFACE_ID << 8) | NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ_PARAMS_MESSAGE_ID" */ 250 251 /*! 252 * This struct contains bSetMaxFreq flag. 253 */ 254 #define NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ_PARAMS_MESSAGE_ID (0x7U) 255 256 typedef struct NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ_PARAMS { 257 NvBool bSetMaxFreq; 258 } NV2080_CTRL_CMD_TIMER_SET_GR_TICK_FREQ_PARAMS; 259 260 /* _ctrl2080tmr_h_ */ 261