1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
pub mod private {
use status::NvAPI_Status;
use handles::NvPhysicalGpuHandle;
use debug_array::Array;
nvstruct! {
pub struct NV_VOLTAGE_STATUS_V1 {
pub version: u32,
pub flags: u32,
pub zero: [u32; 8],
pub value_uV: u32,
pub unknown: [u32; 8],
}
}
nvversion! { NV_VOLTAGE_STATUS_VER_1(NV_VOLTAGE_STATUS_V1 = 4 * (2 + 8 + 1 + 8), 1) }
nvversion! { NV_VOLTAGE_STATUS_VER = NV_VOLTAGE_STATUS_VER_1 }
pub type NV_VOLTAGE_STATUS = NV_VOLTAGE_STATUS_V1;
nvapi! {
pub unsafe fn NvAPI_GPU_GetCurrentVoltage(hPhysicalGPU: NvPhysicalGpuHandle, pVoltageStatus: *mut NV_VOLTAGE_STATUS) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_VOLTAGE_BOOST_PERCENT_V1 {
pub version: u32,
pub percent: u32,
pub unknown: [u32; 8],
}
}
nvversion! { NV_VOLTAGE_BOOST_PERCENT_VER_1(NV_VOLTAGE_BOOST_PERCENT_V1 = 4 * (2 + 8), 1) }
nvversion! { NV_VOLTAGE_BOOST_PERCENT_VER = NV_VOLTAGE_BOOST_PERCENT_VER_1 }
pub type NV_VOLTAGE_BOOST_PERCENT = NV_VOLTAGE_BOOST_PERCENT_V1;
nvapi! {
pub unsafe fn NvAPI_GPU_GetCoreVoltageBoostPercent(hPhysicalGPU: NvPhysicalGpuHandle, pVoltboostPercent: *mut NV_VOLTAGE_BOOST_PERCENT) -> NvAPI_Status;
}
nvapi! {
pub unsafe fn NvAPI_GPU_SetCoreVoltageBoostPercent(hPhysicalGPU: NvPhysicalGpuHandle, pVoltboostPercent: *const NV_VOLTAGE_BOOST_PERCENT) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_VFP_CURVE_GPU_ENTRY {
pub a: u32,
pub freq_kHz: u32,
pub voltage_uV: u32,
pub d: u32,
pub e: u32,
pub f: u32,
pub g: u32,
}
}
pub type NV_VFP_CURVE_MEM_ENTRY = NV_VFP_CURVE_GPU_ENTRY;
debug_array_impl! { [NV_VFP_CURVE_GPU_ENTRY; 80] }
debug_array_impl! { [u32; 1064] }
nvstruct! {
pub struct NV_VFP_CURVE_V1 {
pub version: u32,
pub mask: [u32; 4],
pub unknown: [u32; 12],
pub gpuEntries: Array<[NV_VFP_CURVE_GPU_ENTRY; 80]>,
pub memEntries: [NV_VFP_CURVE_MEM_ENTRY; 23],
pub unknown2: Array<[u32; 1064]>,
}
}
nvversion! { NV_VFP_CURVE_VER_1(NV_VFP_CURVE_V1 = 0x1c28, 1) }
nvversion! { NV_VFP_CURVE_VER = NV_VFP_CURVE_VER_1 }
pub type NV_VFP_CURVE = NV_VFP_CURVE_V1;
nvapi! {
pub unsafe fn NvAPI_GPU_GetVFPCurve(hPhysicalGPU: NvPhysicalGpuHandle, pVfpCurve: *mut NV_VFP_CURVE) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_GPU_POWER_INFO_ENTRY {
pub pstate: u32,
pub b: u32,
pub c: u32,
pub min_power: u32,
pub e: u32,
pub f: u32,
pub def_power: u32,
pub h: u32,
pub i: u32,
pub max_power: u32,
pub k: u32,
}
}
nvstruct! {
pub struct NV_GPU_POWER_INFO_V1 {
pub version: u32,
pub valid: u8,
pub count: u8,
pub padding: [u8; 2],
pub entries: [NV_GPU_POWER_INFO_ENTRY; 4],
}
}
pub type NV_GPU_POWER_INFO = NV_GPU_POWER_INFO_V1;
nvversion! { NV_GPU_POWER_INFO_VER_1(NV_GPU_POWER_INFO_V1 = 4 * 2 + 4 * (4 * 11), 1) }
nvversion! { NV_GPU_POWER_INFO_VER = NV_GPU_POWER_INFO_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_ClientPowerPoliciesGetInfo(hPhysicalGPU: NvPhysicalGpuHandle, pPowerInfo: *mut NV_GPU_POWER_INFO) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_GPU_POWER_STATUS_ENTRY {
pub a: u32,
pub b: u32,
pub power: u32,
pub d: u32,
}
}
nvstruct! {
pub struct NV_GPU_POWER_STATUS_V1 {
pub version: u32,
pub count: u32,
pub entries: [NV_GPU_POWER_STATUS_ENTRY; 4],
}
}
pub type NV_GPU_POWER_STATUS = NV_GPU_POWER_STATUS_V1;
nvversion! { NV_GPU_POWER_STATUS_VER_1(NV_GPU_POWER_STATUS_V1 = 4 * 2 + 4 * (4 * 4), 1) }
nvversion! { NV_GPU_POWER_STATUS_VER = NV_GPU_POWER_STATUS_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_ClientPowerPoliciesGetStatus(hPhysicalGPU: NvPhysicalGpuHandle, pPowerStatus: *mut NV_GPU_POWER_STATUS) -> NvAPI_Status;
}
nvapi! {
pub unsafe fn NvAPI_GPU_ClientPowerPoliciesSetStatus(hPhysicalGPU: NvPhysicalGpuHandle, pPowerStatus: *const NV_GPU_POWER_STATUS) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_GPU_POWER_TOPO_ENTRY {
pub a: u32,
pub b: u32,
pub power: u32,
pub d: u32,
}
}
nvstruct! {
pub struct NV_GPU_POWER_TOPO_V1 {
pub version: u32,
pub count: u32,
pub entries: [NV_GPU_POWER_TOPO_ENTRY; 4],
}
}
pub type NV_GPU_POWER_TOPO = NV_GPU_POWER_TOPO_V1;
nvversion! { NV_GPU_POWER_TOPO_VER_1(NV_GPU_POWER_TOPO_V1 = 4 * 2 + 4 * (4 * 4), 1) }
nvversion! { NV_GPU_POWER_TOPO_VER = NV_GPU_POWER_TOPO_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_ClientPowerTopologyGetStatus(hPhysicalGPU: NvPhysicalGpuHandle, pPowerTopo: *mut NV_GPU_POWER_TOPO) -> NvAPI_Status;
}
nvbits! {
pub enum NV_GPU_PERF_FLAGS / PerfFlags {
NV_GPU_PERF_FLAGS_POWER_LIMIT / POWER_LIMIT = 1,
NV_GPU_PERF_FLAGS_THERMAL_LIMIT / THERMAL_LIMIT = 2,
NV_GPU_PERF_FLAGS_VOLTAGE_REL_LIMIT / VOLTAGE_REL_LIMIT = 4,
NV_GPU_PERF_FLAGS_VOLTAGE_OP_LIMIT / VOLTAGE_OP_LIMIT = 8,
NV_GPU_PERF_FLAGS_NO_LOAD_LIMIT / NO_LOAD_LIMIT = 16,
NV_GPU_PERF_FLAGS_UNKNOWN_32 / UNKNOWN_32 = 32,
}
}
nvenum_display! {
PerfFlags => {
POWER_LIMIT = "Power",
THERMAL_LIMIT = "Temperature",
VOLTAGE_REL_LIMIT = "Reliability Voltage",
VOLTAGE_OP_LIMIT = "Operating Voltage",
NO_LOAD_LIMIT = "No Load",
UNKNOWN_32 = "Unknown32",
_ = _,
}
}
nvstruct! {
pub struct NV_GPU_PERF_INFO_V1 {
pub version: u32,
pub maxUnknown: u32,
pub limitSupport: NV_GPU_PERF_FLAGS,
pub padding: [u32; 16],
}
}
pub type NV_GPU_PERF_INFO = NV_GPU_PERF_INFO_V1;
nvversion! { NV_GPU_PERF_INFO_VER_1(NV_GPU_PERF_INFO_V1 = 76, 1) }
nvversion! { NV_GPU_PERF_INFO_VER = NV_GPU_PERF_INFO_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_PerfPoliciesGetInfo(hPhysicalGPU: NvPhysicalGpuHandle, pPerfInfo: *mut NV_GPU_PERF_INFO) -> NvAPI_Status;
}
debug_array_impl! { [u32; 326] }
nvstruct! {
pub struct NV_GPU_PERF_STATUS_V1 {
pub version: u32,
pub flags: u32,
pub timer: u64,
pub limits: NV_GPU_PERF_FLAGS,
pub zero0: u32,
pub unknown: u32,
pub zero1: u32,
pub timers: [u64; 3],
pub padding: Array<[u32; 326]>,
}
}
pub type NV_GPU_PERF_STATUS = NV_GPU_PERF_STATUS_V1;
nvversion! { NV_GPU_PERF_STATUS_VER_1(NV_GPU_PERF_STATUS_V1 = 0x550, 1) }
nvversion! { NV_GPU_PERF_STATUS_VER = NV_GPU_PERF_STATUS_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_PerfPoliciesGetStatus(hPhysicalGPU: NvPhysicalGpuHandle, pPerfStatus: *mut NV_GPU_PERF_STATUS) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_VOLT_STATUS_V1 {
pub version: u32,
pub flags: u32,
pub count: u32,
pub unknown: u32,
pub value_uV: u32,
pub buf1: [u32; 30],
}
}
pub type NV_VOLT_STATUS = NV_VOLT_STATUS_V1;
nvversion! { NV_VOLT_STATUS_VER_1(NV_VOLT_STATUS_V1 = 140, 1) }
nvversion! { NV_VOLT_STATUS_VER = NV_VOLT_STATUS_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_GetVoltageDomainsStatus(hPhysicalGPU: NvPhysicalGpuHandle, pVoltStatus: *mut NV_VOLT_STATUS) -> NvAPI_Status;
}
nvapi! {
pub unsafe fn NvAPI_GPU_GetVoltageStep(hPhysicalGPU: NvPhysicalGpuHandle, pVoltStep: *mut NV_VOLT_STATUS) -> NvAPI_Status;
}
nvstruct! {
pub struct NV_VOLT_TABLE_ENTRY {
pub voltage_uV: u32,
pub unknown: u32,
}
}
debug_array_impl! { [NV_VOLT_TABLE_ENTRY; 128] }
debug_array_impl! { [u32; 3888] }
nvstruct! {
pub struct NV_VOLT_TABLE_V1 {
pub version: u32,
pub flags: u32,
pub filled: u32,
pub entries: Array<[NV_VOLT_TABLE_ENTRY; 128]>,
pub buf1: Array<[u32; 3888]>,
}
}
pub type NV_VOLT_TABLE = NV_VOLT_TABLE_V1;
nvversion! { NV_VOLT_TABLE_VER_1(NV_VOLT_TABLE_V1 = 0x40cc, 1) }
nvversion! { NV_VOLT_TABLE_VER = NV_VOLT_TABLE_VER_1 }
nvapi! {
pub unsafe fn NvAPI_GPU_GetVoltages(hPhysicalGPU: NvPhysicalGpuHandle, pVolts: *mut NV_VOLT_TABLE) -> NvAPI_Status;
}
}