-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathohgodatool-common.h
470 lines (419 loc) · 10.8 KB
/
ohgodatool-common.h
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
#ifndef __OHGODATOOL_COMMON_H
#define __OHGODATOOL_COMMON_H
#include <stdint.h>
#pragma pack(push, 1)
typedef struct _AtomBIOSCommonTableHeader
{
uint16_t Size;
uint8_t FormatRevision;
uint8_t TableContentRevision;
} AtomBIOSCommonTableHeader;
typedef struct _PPTableHeader
{
AtomBIOSCommonTableHeader CommonTblHdr; // Offset: 0x00
uint8_t DataRevision; // Offset: 0x04
uint16_t DataSize; // Offset: 0x05
uint32_t GoldenPPID; // Offset: 0x07
uint32_t GoldenRevision; // Offset: 0x0B
uint16_t FormatID; // Offset: 0x0F
uint16_t VoltageTimeInus; // Offset: 0x11
uint32_t PlatformCapabilities; // Offset: 0x13
uint32_t MaxODCoreClk; // Offset: 0x17
uint32_t MaxODMemClk; // Offset: 0x1A
uint16_t PowerControlLimit; // Offset: 0x1E
uint16_t UlvVoltageOffset; // Offset: 0x20
// Table locations (offsets)
uint16_t StateArrayOffset; // Offset: 0x22
uint16_t FanTableOffset; // Offset: 0x24
uint16_t ThermalControlOffset; // Offset: 0x26
uint16_t Reserved0; // Offset: 0x28
uint16_t MemClkDepTableOffset; // Offset: 0x2A
uint16_t CoreClkDepTableOffset;
uint16_t VDDCLookupTableOffset;
uint16_t VDDCGFXLookupTableOffset;
uint16_t MMDependencyTableOffset;
uint16_t VCEStateTableOffset;
uint16_t PPMTableOffset;
uint16_t PowerTuneTableOffset;
uint16_t HardLimitTableOffset;
uint16_t PCIETableOffset;
uint16_t GPIOTableOffset;
uint16_t Reserved1[6];
} PPTableHeader;
typedef struct _Vega10PPTableHeader
{
AtomBIOSCommonTableHeader CommonTblHdr;
uint8_t DataRevision;
uint16_t DataSize;
uint32_t GoldenPPID;
uint32_t GoldenRevision;
uint16_t FormatID;
uint32_t PlatformCapabilities;
uint32_t MaxODCoreClk;
uint32_t MaxODMemClk;
uint16_t PowerControlLimit;
uint16_t UlvVoltageOffset;
uint16_t UlvSmnclkDid;
uint16_t UlvMp1clkDid;
uint16_t UlvGfxclkBypass;
uint16_t GfxClkSlewRate;
uint8_t GfxVoltageMode;
uint8_t SocVoltageMode;
uint8_t UclkVoltageMode;
uint8_t UvdVoltageMode;
uint8_t VceVoltageMode;
uint8_t Mp0VoltageMode;
uint8_t DcefVoltageMode;
uint16_t StateArrayOffset;
uint16_t FanTableOffset;
uint16_t ThermalControlOffset;
uint16_t SocClkDependencyTableOffset;
uint16_t MemClkDepTableOffset;
uint16_t GFXClkDependencyTableOffset;
uint16_t DcefClkDependencyTableOffset;
uint16_t VDDCLookupTableOffset;
uint16_t VDDMemLookupTableOffset;
uint16_t MMDependencyTableOffset;
uint16_t VCEStateTableOffset;
uint16_t Reserved;
uint16_t PowerTuneTableOffset;
uint16_t HardLimitTableOffset;
uint16_t VDDCILookupTableOffset;
uint16_t PCIETableOffset;
uint16_t PixClkDependencyTableOffset;
uint16_t DispClkDependencyTableOffset;
uint16_t PhyClkDependencyTableOffset;
} Vega10PPTableHeader;
typedef struct _Vega10VoltageLookupRecord
{
uint16_t VDD;
} Vega10VoltageLookupRecord;
typedef struct _Vega10VoltageLookupTable
{
uint8_t RevisionID;
uint8_t NumEntries;
Vega10VoltageLookupRecord Entries[1];
} Vega10VoltageLookupTable;
typedef struct _VegaClkDepRecord
{
uint32_t Clock;
uint8_t VDDCIndex;
} VegaClkDepRecord;
typedef struct _Vega10SOCClkDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
VegaClkDepRecord Entries[1];
} Vega10SOCClkDepTable;
typedef struct _Vega10GFXClkDepRecordV1
{
uint32_t Clock;
uint8_t VDDCIdx;
uint16_t CKSVOffsetandDisable;
uint16_t AVFSOffset;
} Vega10GFXClkDepRecordV1;
typedef struct _Vega10GFXClkDepRecordV2
{
uint32_t Clock;
uint8_t VDDCIdx;
uint16_t CKSVOffsetandDisable;
uint16_t AVFSOffset;
uint8_t ACGEnable;
uint8_t Reserved[3];
} Vega10GFXClkDepRecordV2;
typedef struct _Vega10GFXClkDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
Vega10GFXClkDepRecordV1 Entries[1];
} Vega10GFXClkDepTable;
typedef struct _Vega10MemClkDepRecord
{
uint32_t MemClk;
uint8_t VDDCIdx;
uint8_t MVDDCIdx;
uint8_t VDDCIIdx;
} Vega10MemClkDepRecord;
typedef struct _Vega10MemClkDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
Vega10MemClkDepRecord Entries[1];
} Vega10MemClkDepTable;
// RevId == 5
typedef struct _Vega10PowerTuneTableV1
{
uint8_t RevId;
uint16_t SocketPowerLimit;
uint16_t BatteryPowerLimit;
uint16_t SmallPowerLimit;
uint16_t TDCLimit;
uint16_t EDCLimit;
uint16_t SoftwareShutdownTemp;
uint16_t TemperatureLimitHotspot;
uint16_t TemperatureLimitLiquid1;
uint16_t TemperatureLimitLiquid2;
uint16_t TemperatureLimitHBM;
uint16_t TemperatureLimitVrSoc;
uint16_t TemperatureLimitVrMem;
uint16_t TemperatureLimitPlx;
uint16_t LoadLineResistance;
uint8_t Liquid1_I2C_Address;
uint8_t Liquid2_I2C_Address;
uint8_t Vr_I2C_Address;
uint8_t Plx_I2C_Address;
uint8_t Liquid_I2C_LineSCL;
uint8_t Liquid_I2C_LineSDA;
uint8_t Vr_I2C_LineSCL;
uint8_t Vr_I2C_LineSDA;
uint8_t Plx_I2C_LineSCL;
uint8_t Plx_I2C_LineSDA;
uint16_t TemperatureLimitTedge;
} Vega10PowerTuneTableV1;
// RevId == 6
typedef struct _Vega10PowerTuneTableV2
{
uint8_t RevId;
uint16_t SocketPowerLimit;
uint16_t BatteryPowerLimit;
uint16_t SmallPowerLimit;
uint16_t TDCLimit;
uint16_t EDCLimit;
uint16_t SoftwareShutdownTemp;
uint16_t TemperatureLimitHotspot;
uint16_t TemperatureLimitLiquid1;
uint16_t TemperatureLimitLiquid2;
uint16_t TemperatureLimitHBM;
uint16_t TemperatureLimitVrSoc;
uint16_t TemperatureLimitVrMem;
uint16_t TemperatureLimitPlx;
uint16_t LoadLineResistance;
uint8_t Liquid1_I2C_Address;
uint8_t Liquid2_I2C_Address;
uint8_t Liquid_I2C_Line;
uint8_t Vr_I2C_Address;
uint8_t Vr_I2C_Line;
uint8_t Plx_I2C_Address;
uint8_t Plx_I2C_Line;
uint16_t TemperatureLimitTedge;
} Vega10PowerTuneTableV2;
// RevId == 7
typedef struct _Vega10PowerTuneTableV3
{
uint8_t RevId;
uint16_t SocketPowerLimit;
uint16_t BatteryPowerLimit;
uint16_t SmallPowerLimit;
uint16_t TDCLimit;
uint16_t EDCLimit;
uint16_t SoftwareShutdownTemp;
uint16_t TemperatureLimitHotspot;
uint16_t TemperatureLimitLiquid1;
uint16_t TemperatureLimitLiquid2;
uint16_t TemperatureLimitHBM;
uint16_t TemperatureLimitVrSoc;
uint16_t TemperatureLimitVrMem;
uint16_t TemperatureLimitPlx;
uint16_t LoadLineResistance;
uint8_t Liquid1_I2C_Address;
uint8_t Liquid2_I2C_Address;
uint8_t Liquid_I2C_Line;
uint8_t Vr_I2C_Address;
uint8_t Vr_I2C_Line;
uint8_t Plx_I2C_Address;
uint8_t Plx_I2C_Line;
uint16_t TemperatureLimitTedge;
uint16_t BoostStartTemperature;
uint16_t BoostStopTemperature;
uint32_t BoostClock;
uint32_t Reserved[2];
} Vega10PowerTuneTableV3;
typedef struct _PolarisPowerTuneTable
{
uint8_t RevId;
uint16_t TDP;
uint16_t ConfigurableTDP;
uint16_t TDC;
uint16_t BatteryPowerLimit;
uint16_t SmallPowerLimit;
uint16_t LowCACLeakage;
uint16_t HighCACLeakage;
uint16_t MaximumPowerDeliveryLimit;
uint16_t TjMax;
uint16_t PowerTuneDataSetID;
uint16_t EDCLimit;
uint16_t SoftwareShutdownTemp;
uint16_t ClockStretchAmount;
uint16_t TemperatureLimitHotspot;
uint16_t TemperatureLimitLiquid1;
uint16_t TemperatureLimitLiquid2;
uint16_t TemperatureLimitVrVddc;
uint16_t TemperatureLimitVrMvdd;
uint16_t TemperatureLimitPlx;
uint8_t Liquid1_I2C_Address;
uint8_t Liquid2_I2C_Address;
uint8_t Liquid_I2C_Line;
uint8_t Vr_I2C_Address;
uint8_t Vr_I2C_Line;
uint8_t Plx_I2C_Address;
uint8_t Plx_I2C_Line;
uint16_t Reserved;
} PolarisPowerTuneTable;
typedef struct _TongaPowerTuneTable
{
uint8_t RevId;
uint16_t TDP;
uint16_t ConfigurableTDP;
uint16_t TDC;
uint16_t BatteryPowerLimit;
uint16_t SmallPowerLimit;
uint16_t LowCACLeakage;
uint16_t HighCACLeakage;
uint16_t MaximumPowerDeliveryLimit;
uint16_t TjMax;
uint16_t PowerTuneDataSetID;
uint16_t EDCLimit;
uint16_t SoftwareShutdownTemp;
uint16_t ClockStretchAmount;
uint16_t Reserved[2];
} TongaPowerTuneTable;
typedef struct _PolarisPPMTable
{
uint8_t RevisionID;
uint8_t PPMDesign;
uint16_t CPUCoreNumber;
uint32_t PlatformTDP;
uint32_t SmallACPPlatformTDP;
uint32_t PlatformTDC;
uint32_t SmallACPPlatformTDC;
uint32_t APUTDP;
uint32_t DGPUTDP;
uint32_t DGPUULVPower;
uint32_t TjMax;
} PolarisPPMTable;
typedef struct _PolarisMemClkDepRecord
{
uint8_t VDDC;
uint16_t VDDCI;
int16_t VDDCGFXOffset;
uint16_t MVDD;
uint32_t MemClk;
uint16_t Reserved;
} PolarisMemClkDepRecord;
typedef struct _PolarisMemClkDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisMemClkDepRecord Entries[1];
} PolarisMemClkDepTable;
typedef struct _PolarisCoreClkDepRecord
{
uint8_t VDDC;
int16_t VDDCOffset;
uint32_t CoreClk;
uint16_t EDCCurrent;
uint8_t ReliabilityTemperature;
uint8_t CKSOffsetAndDisable; // bits 0-6: volt offset, 7: enable/disable
int32_t SClkOffset; // Polaris only!
} PolarisCoreClkDepRecord;
typedef struct _TongaCoreClkDepRecord
{
uint8_t VDDC;
int16_t VDDCOffset;
uint32_t CoreClk;
uint16_t EDCCurrent;
uint8_t ReliabilityTemperature;
uint8_t CKSOffsetAndDisable; // bits 0-6: volt offset, 7: enable/disable
} TongaCoreClkDepRecord;
typedef struct _TongaCoreClkDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
TongaCoreClkDepRecord Entries[1];
} TongaCoreClkDepTable;
typedef struct _PolarisCoreClkDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisCoreClkDepRecord Entries[1];
} PolarisCoreClkDepTable;
typedef struct _PolarisVoltageLookupRecord
{
uint16_t VDD;
uint16_t CACLow;
uint16_t CACMid;
uint16_t CACHigh;
} PolarisVoltageLookupRecord;
typedef struct _PolarisVoltageLookupTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisVoltageLookupRecord Entries[1];
} PolarisVoltageLookupTable;
typedef struct _PolarisMMDepRecord
{
uint8_t VDDC;
int16_t VDDCGFXOffset; // Offset relative to VDDC
uint32_t DClk; // UVD D-clock
uint32_t VClk; // UVD V-clock
uint32_t EClk; // VCE clock
uint32_t AClk; // ACP clock?
uint32_t SAMUClk;
} PolarisMMDepRecord;
typedef struct _PolarisMMDepTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisMMDepRecord Entries[1];
} PolarisMMDepTable;
typedef struct _PolarisVCEStateRecord
{
uint8_t VCEClockIdx; // References MM dep table, the VCEDependencyTableOffset value
uint8_t Flag; // 2 bits indicates memory p-states?
uint8_t SCLKIdx;
uint8_t MCLKIdx;
} PolarisVCEStateRecord;
typedef struct _PolarisVCEStateTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisVCEStateRecord Entries[1];
} PolarisVCEStateTable;
typedef struct _PolarisHardLimitRecord
{
uint32_t CoreClkLimit;
uint32_t MemClkLimit;
uint16_t VDDCLimit;
uint16_t VDDCILimit;
uint16_t VDDGFXLimit;
} PolarisHardLimitRecord;
typedef struct _PolarisHardLimitTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisHardLimitRecord Entries[1];
} PolarisHardLimitTable;
typedef struct _PolarisState
{
uint8_t CoreClockIdxHigh;
uint8_t CoreClockIdxLow;
uint8_t MemClockIdxHigh;
uint8_t MemClockIdxLow;
uint8_t PCIEGenLow;
uint8_t PCIEGenHigh;
uint8_t PCIELaneLow;
uint8_t PCIELaneHigh;
uint16_t Classification;
uint32_t CapsAndSettings;
uint16_t Classification2;
uint8_t Unused[4];
} PolarisState;
typedef struct _PolarisStateArrayTable
{
uint8_t RevisionID;
uint8_t NumEntries;
PolarisState Entries[1];
} PolarisStateArrayTable;
void GetGPUHWMonPath(char **HWMonPath, uint32_t GPUIdx);
#pragma pack(pop)
#endif