forked from cyring/CoreFreq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorefreq-api.h
1275 lines (1193 loc) · 38.8 KB
/
corefreq-api.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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* CoreFreq
* Copyright (C) 2015-2021 CYRIL INGENIERIE
* Licenses: GPL2
*/
#define DRV_DEVNAME "corefreqk"
#define DRV_FILENAME "/dev/"DRV_DEVNAME
#define ID_RO_VMA_PROC (CORE_COUNT + 0)
#define ID_RW_VMA_PROC (CORE_COUNT + ID_RO_VMA_PROC)
#define ID_RO_VMA_GATE (CORE_COUNT + ID_RW_VMA_PROC)
#define ID_RO_VMA_CORE (CORE_COUNT + ID_RO_VMA_GATE)
#define ID_RW_VMA_CORE (CORE_COUNT + ID_RO_VMA_CORE)
#define ID_ANY_VMA_JAIL (CORE_COUNT + ID_RW_VMA_CORE)
#define WAKEUP_RATIO 4
#define LOOP_MIN_MS 100
#define LOOP_MAX_MS ((1000 - 1) * WAKEUP_RATIO)
#define LOOP_DEF_MS 1000
#define TICK_DEF_MS 2000
typedef struct
{
struct
{
unsigned char Chr[4];
} AX, BX, CX, DX;
} BRAND;
#define LEVEL_INVALID 0
#define LEVEL_THREAD 1
#define LEVEL_CORE 2
typedef struct {
union {
struct
{
unsigned int
SHRbits : 5-0,
Unused1 : 32-5;
};
unsigned int Register;
} AX;
union {
struct
{
unsigned int
Threads : 16-0,
Unused1 : 32-16;
};
unsigned int Register;
} BX;
union {
struct
{
unsigned int
Level : 8-0,
Type : 16-8,
Unused1 : 32-16;
};
unsigned int Register;
} CX;
union {
struct
{
unsigned int
x2ApicID: 32-0;
};
unsigned int Register;
} DX;
} CPUID_TOPOLOGY_LEAF;
typedef union
{
unsigned long long value;
struct
{
unsigned long long
ReservedBits1 : 8-0,
BSP : 9-8,
ReservedBits2 : 10-9,
x2APIC_EN : 11-10, /* Intel Nehalem [06_1A]; AMD[F17h] */
APIC_EN : 12-11, /* Intel P4, Xeon, P6; AMD */
Addr : 64-12;
};
} LOCAL_APIC;
typedef struct
{
LOCAL_APIC Base;
signed int ApicID,
CoreID,
ThreadID,
PackageID;
union {
unsigned int ID; /* AMD-17h MSR(0x0000002a) */
struct {
unsigned int Node : 8-0, /* CPUID(0x8000001e):ECX[8-0] */
CCX : 16-8, /* CPUID(0x8000001e):EAX[32-0]:[3] */
CCD : 24-16,
CMP : 32-24;
};
} Cluster;
struct CACHE_INFO
{
union
{
struct
{ /* Intel */
unsigned int
Type : 5-0, /* Cache Type* */
Level : 8-5, /* Cache Level (starts at 1) */
Init : 9-8, /* Self Init. cache level */
Assoc : 10-9, /* Fully Associative cache */
Unused : 14-10,
MxThrdID: 26-14, /* Max threads w/ this cache */
MxCoreID: 32-26; /* Max cores for this cache */
};
struct
{ /* AMD L1 */
unsigned int
ISize : 8-0, /* Inst. TLB number/entries */
IAssoc : 16-8, /* Inst. TLB associativity */
DSize : 24-16, /* Data TLB number/entries */
DAssoc : 32-24; /* Data TLB associativity */
} CPUID_0x80000005_L1Tlb2and4M; /* 2 MB & 4 MB pages */
struct
{ /* AMD L2 */
unsigned int
ISize : 12-0,
IAssoc : 16-12,
DSize : 28-16,
DAssoc : 32-28;
} CPUID_0x80000006_L2ITlb2and4M;
unsigned int AX;
};
union
{
struct
{ /* Intel */
unsigned int
LineSz : 12-0, /* L=Sys Coherency Line Size */
Part : 22-12, /* P=Phys Line partitions */
Way : 32-22; /* W=Ways of associativity */
};
struct
{ /* AMD L1 */
unsigned int
ISize : 8-0, /* Inst. TLB number/entries */
IAssoc : 16-8, /* Inst. TLB associativity* */
DSize : 24-16, /* Data TLB number/entries */
DAssoc : 32-24; /* Data TLB associativity* */
} CPUID_0x80000005_L1Tlb4K; /* for 4 KB pages */
struct
{ /* AMD L2 */
unsigned int
ISize : 12-0,
IAssoc : 16-12,
DSize : 28-16,
DAssoc : 32-28;
} CPUID_0x80000006_L2Tlb4K;
unsigned int BX;
};
union
{ /* Intel */
unsigned int Set; /* S=Number of Sets */
struct
{ /* AMD L1-Data */
unsigned int
LineSz : 8-0, /* L1-D cache line size (B) */
ClPerTag: 16-8, /* L1-D cache lines per tag */
Assoc : 24-16, /* L1-D cache associativity* */
Size : 32-24; /* L1-D cache size (KB) */
} CPUID_0x80000005_L1D;
struct
{ /* AMD L2 */
unsigned int
LineSz : 8-0, /* L2 cache line size (B) */
ClPerTag: 12-8, /* L2 cache lines per tag */
Assoc : 16-12, /* L2 cache associativity** */
Size : 32-16; /* L2 cache size (KB)*** */
} CPUID_0x80000006_L2;
unsigned int CX;
};
union
{
struct
{ /* Intel */
unsigned int
WrBack : 1-0, /* Write-Back** */
Inclus : 2-1, /* Cache Inclusiveness*** */
Direct : 3-2, /* Cache Indexing**** */
Resrvd : 32-3;
};
struct
{ /* AMD L1-Instruction */
unsigned int
LineSz : 8-0, /* L1-I cache line size (B) */
ClPerTag: 16-8, /* L1-I cache lines per tag */
Assoc : 24-16, /* L1-I cache associativity */
Size : 32-24; /* L1-I cache size (KB) */
} CPUID_0x80000005_L1I;
struct
{ /* AMD L3 */
unsigned int
LineSz : 8-0, /* L3 cache line (B) */
ClPerTag: 12-8, /* L3 cache lines per tag */
Assoc : 16-12, /* L3 cache associativity */
Reserved: 18-16,
Size : 32-18; /* L3 cache size */
} CPUID_0x80000006_L3;
unsigned int DX;
};
unsigned int Size;
} Cache[CACHE_MAX_LEVEL];
} CACHE_TOPOLOGY;
/*
--- Intel Cache Parameters Leaf ---
* Cache Type Field
0 = Null - No more caches
1 = Data Cache
2 = Instruction Cache
3 = Unified Cache
4-31 = Reserved
** Write-Back Invalidate/Invalidate
0 = WBINVD/INVD from threads sharing this cache
acts upon lower level caches for threads sharing this cache.
1 = WBINVD/INVD is not guaranteed to act upon lower level caches
of non-originating threads sharing this cache.
*** Cache Inclusiveness
0 = Cache is not inclusive of lower cache levels.
1 = Cache is inclusive of lower cache levels.
**** Complex Cache Indexing
0 = Direct mapped cache.
1 = A complex function is used to index the cache,
potentially using all address bits.
--- AMD Cache Identifiers ---
* L1 data cache associativity
Bits Description
00h Reserved
01h 1 way (direct mapped)
02h 2 way
03h 3 way
FEh-04h [L1IcAssoc] way
FFh Fully associative
** L2 cache associativity
Bits Description Bits Description
0h Disabled. 8h 16 ways
1h 1 way (direct mapped) 9h Reserved
2h 2 ways Ah 32 ways
3h Reserved Bh 48 ways
4h 4 ways Ch 64 ways
5h Reserved Dh 96 ways
6h 8 ways Eh 128 ways
7h Reserved Fh Fully associative
*** L2 cache size
Bits Description
03FFh-0000h Reserved
0400h 1 MB
07FFh-0401h Reserved
0800h 2 MB
FFFFh-0801h Reserved
*/
typedef struct
{
THERMAL_PARAM Param;
unsigned int Sensor;
signed int VID;
struct {
enum THERM_PWR_EVENTS Events;
};
PERF_CONTROL PerfControl;
CLOCK_MODULATION ClockModulation;
ENERGY_PERF_BIAS PerfEnergyBias;
MISC_PWR_MGMT PwrManagement;
HWP_CAPABILITIES HWP_Capabilities;
HWP_INTERRUPT HWP_Interrupt;
HWP_REQUEST HWP_Request;
} POWER_THERMAL;
typedef struct
{
Bit64 OffLine __attribute__ ((aligned (8)));
struct
{
unsigned long long TSC;
} Overhead __attribute__ ((aligned (8)));
struct
{
unsigned long long INST;
struct
{
unsigned long long
UCC,
URC;
} C0;
unsigned long long
C3,
C6,
C7,
TSC;
unsigned long long C1;
struct
{
unsigned long long ACCU;
} Power;
} Counter[2] __attribute__ ((aligned (8)));
struct
{
unsigned long long
C1,
C2,
C3,
C4,
C5,
C6,
C7;
} VPMC __attribute__ ((aligned (8)));
struct
{
unsigned long long
INST;
struct
{
unsigned long long
UCC,
URC;
} C0;
unsigned long long
C3,
C6,
C7,
TSC,
C1;
struct
{
unsigned long long ACCU;
} Power;
unsigned int SMI;
} Delta __attribute__ ((aligned (8)));
POWER_THERMAL PowerThermal;
struct
{
unsigned int SMI;
struct {
unsigned int
LOCAL,
UNKNOWN,
PCISERR,
IOCHECK;
} NMI;
} Interrupt;
union {
struct /* Intel */
{
CORE_GLOBAL_PERF_CONTROL Core_GlobalPerfControl;
CORE_FIXED_PERF_CONTROL Core_FixedPerfControl;
};
struct /* AMD */
{
unsigned long long Core_PerfEventsCtrsControl;
HWCR Core_HardwareConfiguration;
};
} SaveArea;
struct
{
CPUID_0x00000000 StdFunc;
CPUID_0x80000000 ExtFunc;
struct {
unsigned long long
CfgLock : 1-0, /* Core */
IORedir : 2-1, /* Core */
Unused : 32-3,
Microcode:64-32; /* Thread */
};
unsigned short int CStateLimit;
struct {
unsigned short int CStateInclude; /* Intel */
unsigned short int CStateBaseAddr; /* Any I/O BAR */
};
} Query;
CACHE_TOPOLOGY T;
struct {
Bit64 RFLAGS __attribute__ ((aligned (8))),
CR0 __attribute__ ((aligned (8))),
CR3 __attribute__ ((aligned (8))),
CR4 __attribute__ ((aligned (8))),
CR8 __attribute__ ((aligned (8))),
EFER __attribute__ ((aligned (8)));
union {
Bit64 EFCR __attribute__ ((aligned (8)));
VM_CR VMCR;
};
} SystemRegister;
unsigned int Bind;
CLOCK Clock;
CPUID_STRUCT CpuID[CPUID_MAX_FUNC];
unsigned int Boost[BOOST(SIZE)];
COF_UNION Ratio;
} CORE_RO;
typedef struct
{
struct /* 64-byte cache line size. */
{
Bit64 V,
_pad[7];
} Sync __attribute__ ((aligned (8)));
} CORE_RW;
typedef struct
{
struct {
union {
struct {
/* 100h */ P945_MC_DRAM_RANK_BOUND DRB[4]; /* 4x8 bits */
/* 110h */ P945_MC_DRAM_TIMING_R0 DRT0; /* 32 bits */
/* 114h */ P945_MC_DRAM_TIMING_R1 DRT1; /* 32 bits */
/* 118h */ P945_MC_DRAM_TIMING_R2 DRT2; /* 32 bits */
/* 10Eh */ P945_MC_DRAM_BANK_ARCH BANK; /* 16 bits */
/* 40Ch */ P945_MC_DRAM_RANK_WIDTH WIDTH; /* 16 bits */
} P945;
struct {
/* 100h */ P945_MC_DRAM_RANK_BOUND DRB[4]; /* 4x8 bits */
/* 114h */ P955_MC_DRAM_TIMING_R1 DRT1; /* 32 bits */
/* 10Eh */ P945_MC_DRAM_BANK_ARCH BANK; /* 16 bits */
/* 40Ch */ P945_MC_DRAM_RANK_WIDTH WIDTH; /* 16 bits */
} P955;
struct {
/* 29Ch */ P965_MC_ODTCTRL DRT0; /* 32 bits */
/* 250h */ P965_MC_CYCTRK_PCHG DRT1; /* 16 bits */
/* 252h */ P965_MC_CYCTRK_ACT DRT2; /* 32 bits */
/* 256h */ P965_MC_CYCTRK_WR DRT3; /* 16 bits */
/* 258h */ P965_MC_CYCTRK_RD DRT4; /* 24 bits */
} P965;
struct {
/* 1210h */ G965_MC_DRAM_TIMING_R0 DRT0; /* 32 bits */
/* 1214h */ G965_MC_DRAM_TIMING_R1 DRT1; /* 32 bits */
/* 1218h */ G965_MC_DRAM_TIMING_R2 DRT2; /* 32 bits */
/* 121Ch */ G965_MC_DRAM_TIMING_R3 DRT3; /* 32 bits */
} G965;
struct {
/* 265h */ P35_MC_UNKNOWN_R0 DRT0; /* 16 bits */
/* 250h */ P35_MC_CYCTRK_PCHG DRT1; /* 16 bits */
/* 252h */ P35_MC_CYCTRK_ACT DRT2; /* 32 bits */
/* 256h */ P35_MC_CYCTRK_WR DRT3; /* 16 bits */
/* 258h */ P35_MC_CYCTRK_RD DRT4; /* 24 bits */
/* 25Dh */ P35_MC_UNKNOWN_R1 DRT5; /* 16 bits */
} P35;
struct {
NHM_IMC_MRS_VALUE_0_1 MR0_1;
NHM_IMC_MRS_VALUE_2_3 MR2_3;
NHM_IMC_RANK_TIMING_A Rank_A;
NHM_IMC_RANK_TIMING_B Rank_B;
NHM_IMC_BANK_TIMING Bank;
NHM_IMC_REFRESH_TIMING Refresh;
NHM_IMC_CKE_TIMING CKE_Timing;
NHM_IMC_SCHEDULER_PARAMS Params;
} NHM;
struct {
/* 4000h */ SNB_IMC_TC_DBP DBP; /* 32 bits */
/* 4004h */ SNB_IMC_TC_RAP RAP; /* 32 bits */
/* 4298h */ SNB_IMC_TC_RFTP RFTP; /* 32 bits */
} SNB;
struct {
/* 200h */ SNB_IMC_TC_DBP DBP; /* 32 bits */
/* 204h */ SNB_IMC_TC_RAP RAP; /* 32 bits */
/* 208h */ SNB_IMC_TC_RWP RWP; /* 32 bits */
/* 214h */ SNB_IMC_TC_RFTP RFTP; /* 32 bits */
} SNB_EP;
struct {
/* 4C00h */ HSW_DDR_TIMING_4C00 REG4C00; /*32 bits */
/* 4C04h */ HSW_DDR_TIMING Timing; /* 32 bits */
/* 4C08h */ HSW_DDR_RANK_TIMING_A Rank_A; /* 32 bits */
/* 4C0Ch */ HSW_DDR_RANK_TIMING_B Rank_B; /* 32 bits */
/* 4C14h */ HSW_DDR_RANK_TIMING Rank; /* 32 bits */
/* 4E98h */ HSW_TC_REFRESH_TIMING Refresh; /*32 bits */
} HSW;
struct {
/* 4000h */ SKL_IMC_CR_TC_PRE Timing; /* 32 bits */
/* 4004h */ SKL_IMC_CR_TC_ACT ACT; /* 32 bits */
/* 400Ch */ SKL_IMC_CR_TC_RDRD RDRD; /* 32 bits */
/* 4010h */ SKL_IMC_CR_TC_RDWR RDWR; /* 32 bits */
/* 4014h */ SKL_IMC_CR_TC_WRRD WRRD; /* 32 bits */
/* 4018h */ SKL_IMC_CR_TC_WRWR WRWR; /* 32 bits */
/* 401Ch */ SKL_IMC_CR_SC_CFG Sched; /* 32 bits */
/* 4070h */ SKL_IMC_CR_TC_ODT ODT; /* 32 bits */
/* 423Ch */ SKL_IMC_REFRESH_TC Refresh; /*32 bits */
} SKL;
struct {
/* 4000h */ RKL_IMC_CR_TC_PRE Timing; /* 32 bits */
/* 4004h */ RKL_IMC_CR_TC_ACT ACT; /* 32 bits */
/* 400Ch */ RKL_IMC_CR_TC_RDRD RDRD; /* 32 bits */
/* 4010h */ RKL_IMC_CR_TC_RDWR RDWR; /* 32 bits */
/* 4014h */ RKL_IMC_CR_TC_WRRD WRRD; /* 32 bits */
/* 4018h */ RKL_IMC_CR_TC_WRWR WRWR; /* 32 bits */
/* 4050h */ RKL_IMC_TC_PWDEN PWDEN; /* 64-bits */
/* 4070h */ RKL_IMC_CR_TC_ODT ODT; /* 64 bits */
/* 4088h */ RKL_IMC_SC_GS_CFG Sched; /* 64 bits */
/* 423Ch */ RKL_IMC_REFRESH_TC Refresh; /*32 bits */
} RKL;
struct {
/* 4000h */ TGL_IMC_CR_TC_PRE Timing; /* 32 bits */
/* 4008h */ TGL_IMC_CR_TC_ACT ACT; /* 32 bits */
/* 400Ch */ TGL_IMC_CR_TC_RDRD RDRD; /* 32 bits */
/* 4010h */ TGL_IMC_CR_TC_RDWR RDWR; /* 32 bits */
/* 4014h */ TGL_IMC_CR_TC_WRRD WRRD; /* 32 bits */
/* 4018h */ TGL_IMC_CR_TC_WRWR WRWR; /* 32 bits */
/* 4050h */ TGL_IMC_TC_PWDEN PWDEN; /* 64-bits */
/* 4070h */ TGL_IMC_CR_TC_ODT ODT; /* 64 bits */
/* 4088h */ TGL_IMC_SC_GS_CFG Sched; /* 64 bits */
/* 423Ch */ TGL_IMC_REFRESH_TC Refresh; /*32 bits */
} TGL;
struct {
/* 88h */ AMD_0F_DRAM_TIMING_LOW DTRL; /* 32 bits */
} AMD0Fh;
struct
{
unsigned int Ranks;
AMD_17_UMC_ECC_CAP_HI ECC; /* 32 bits */
struct {
struct {
unsigned int value;
} Chip, /* 32 bits */
Mask; /* 32 bits */
} CHIP[4][2];
AMD_17_UMC_SPAZ_CTRL SPAZ; /* 32 bits */
AMD_17_UMC_CFG_MISC MISC; /* 32 bits */
AMD_17_UMC_TIMING_DTR1 DTR1; /* 32 bits */
AMD_17_UMC_TIMING_DTR2 DTR2; /* 32 bits */
AMD_17_UMC_TIMING_DTR3 DTR3; /* 32 bits */
AMD_17_UMC_TIMING_DTR4 DTR4; /* 32 bits */
AMD_17_UMC_TIMING_DTR5 DTR5; /* 32 bits */
AMD_17_UMC_TIMING_DTR6 DTR6; /* 32 bits */
AMD_17_UMC_TIMING_DTR7 DTR7; /* 32 bits */
AMD_17_UMC_TIMING_DTR8 DTR8; /* 32 bits */
AMD_17_UMC_TIMING_DTR9 DTR9; /* 32 bits */
AMD_17_UMC_TIMING_DTR10 DTR10; /* 32 bits */
AMD_17_UMC_TIMING_DTR12 DTR12; /* 32 bits */
AMD_17_UMC_TIMING_DTR13 DTR13; /* 32 bits */
AMD_17_UMC_TIMING_DTR20 DTR20; /* 32 bits */
AMD_17_UMC_TIMING_DTR21 DTR21; /* 32 bits */
AMD_17_UMC_TIMING_DTR22 DTR22; /* 32 bits */
AMD_17_UMC_TIMING_DTRFC DTRFC; /* 32 bits */
AMD_17_UMC_TIMING_DTR35 DTR35; /* 32 bits */
struct {
unsigned int value; /* 32 bits */
} BGS,
BGS_ALT;
} AMD17h;
};
union {
/* 1208h */ G965_MC_DRAM_RANK_ATTRIB DRA; /* 32 bits */
/* 48h */ NHM_IMC_DOD_CHANNEL DOD; /* 32 bits */
/* 80h */ SNB_EP_DIMM_MTR MTR; /* 32 bits */
/* 40h */ AMD_0F_DRAM_CS_BASE_ADDR MBA; /* 32 bits */
/* 5003{0,4}h*/ AMD_17_UMC_DRAM_ADDR_CFG DAC; /* 32 bits */
} DIMM[MC_MAX_DIMM];
} Channel[MC_MAX_CHA];
union {
struct {
/* 200h */ P945_MC_DCC DCC; /* 32 bits */
} P945;
struct {
/* 200h */ P945_MC_DCC DCC; /* 32 bits */
} P955;
struct {
/* 260h */ P965_MC_CKECTRL CKE0, /* 32 bits */
CKE1; /* 32 bits */
} P965;
struct {
/* 1200h */ G965_MC_DRB_0_1 DRB0, /* 32 bits @ channel0 */
/* 1300h */ DRB1; /* 32 bits @ channel1 */
} G965;
struct {
/* 260h */ P35_MC_CKECTRL CKE0, /* 32 bits */
CKE1; /* 32 bits */
} P35;
struct {
/* 0F00h */ SOC_MC_DRP DRP; /* 32 bits */
/* 0F00h */ SOC_MC_DTR0 DTR0; /* 32 bits */
/* 0F00h */ SOC_MC_DTR1 DTR1; /* 32 bits */
/* 0F00h */ SOC_MC_DTR2 DTR2; /* 32 bits */
/* 0F00h */ SOC_MC_DTR3 DTR3; /* 32 bits */
/* 0F00h */ SOC_MC_DRFC DRFC; /* 32 bits */
/* 0F00h */ SOC_MC_BIOS_CFG BIOS_CFG; /* 32 bits */
} SLM;
struct {
/* 3:0-48h */ NHM_IMC_CONTROL CONTROL; /* 32 bits */
/* 3:0 4Ch */ NHM_IMC_STATUS STATUS; /* 32 bits */
} NHM;
struct {
/* 5004h */ SNB_IMC_MAD_CHANNEL MAD0, /* 32 bits */
/* 5008h */ MAD1; /* 32 bits */
} SNB;
struct {
SNB_EP_MC_TECH TECH; /* 32 bits */
/* 80h */ SNB_EP_TADWAYNESS TAD; /* 12x32 bits */
} SNB_EP;
struct {
/* 5000h */ SKL_IMC_MAD_MAPPING MADCH; /* 32 bits */
/* 5004h */ SKL_IMC_MAD_CHANNEL MADC0, /* 32 bits */
/* 5008h */ MADC1; /* 32 bits */
/* 500Ch */ SKL_IMC_MAD_DIMM MADD0, /* 32 bits */
/* 5010h */ MADD1; /* 32 bits */
} SKL;
struct {
/* 5000h */ RKL_IMC_MAD_MAPPING MADCH; /* 32 bits */
/* 5004h */ RKL_IMC_MAD_CHANNEL MADC0, /* 32 bits */
/* 5008h */ MADC1; /* 32 bits */
/* 500Ch */ RKL_IMC_MAD_DIMM MADD0, /* 32 bits */
/* 5010h */ MADD1; /* 32 bits */
} RKL;
struct {
/* 5000h */ TGL_IMC_MAD_MAPPING MADCH; /* 32 bits */
/* 5004h */ TGL_IMC_MAD_CHANNEL MADC0, /* 32 bits */
/* 5008h */ MADC1; /* 32 bits */
/* 500Ch */ TGL_IMC_MAD_DIMM MADD0, /* 32 bits */
/* 5010h */ MADD1; /* 32 bits */
} TGL;
struct {
/* 90h */ AMD_0F_DRAM_CONFIG_LOW DCRL; /* 32 bits */
/* 94h */ AMD_0F_DRAM_CONFIG_HIGH DCRH; /* 32 bits */
} AMD0Fh;
};
union {
struct {
/* 64h */ NHM_IMC_MAX_DOD DOD; /* 32 bits */
} NHM;
struct {
/* 80h */ AMD_0F_DRAM_CS_MAPPING CS; /* 32 bits */
} AMD0Fh;
} MaxDIMMs;
unsigned short SlotCount, ChannelCount;
} MC_REGISTERS;
typedef struct
{
union {
struct {
MCH_CLKCFG ClkCfg;
};
struct {
NHM_IMC_CLK_RATIO_STATUS DimmClock;
QPI_FREQUENCY QuickPath;
};
struct {
SNB_CAPID SNB_Cap;
IVB_CAPID IVB_Cap;
};
struct {
SNB_EP_CAPID0 SNB_EP_Cap0;
SNB_EP_CAPID1 SNB_EP_Cap1;
SNB_EP_CAPID2 SNB_EP_Cap2;
SNB_EP_CAPID3 SNB_EP_Cap3;
SNB_EP_CAPID4 SNB_EP_Cap4;
};
struct {
SKL_CAPID_A SKL_Cap_A;
SKL_CAPID_B SKL_Cap_B;
SKL_CAPID_C SKL_Cap_C;
};
struct {
RKL_CAPID_A RKL_Cap_A;
RKL_CAPID_B RKL_Cap_B;
RKL_CAPID_C RKL_Cap_C;
};
struct {
TGL_CAPID_A TGL_Cap_A;
TGL_CAPID_B TGL_Cap_B;
TGL_CAPID_C TGL_Cap_C;
TGL_CAPID_E TGL_Cap_E;
};
struct {
AMD_0F_HTT_NODE_ID NodeID;
AMD_0F_HTT_UNIT_ID UnitID;
AMD_0F_HTT_FREQUENCY LDTi_Freq[3];
};
};
union {
struct {
AMD_IOMMU_CTRL_REG IOMMU_CR; /* 64 bits */
AMD_IOMMU_CAP_HEADER IOMMU_HDR; /* 32 bits */
};
struct {
Intel_IOMMU_CAP_REG IOMMU_Cap; /* 64 bits */
Intel_IOMMU_VER_REG IOMMU_Ver; /* 32 bits */
};
};
} BUS_REGISTERS;
typedef struct {
int taskCount;
TASK_MCB taskList[TASK_LIMIT];
MEM_MCB memInfo;
unsigned int kernelVersionNumber;
char sysname[MAX_UTS_LEN],
release[MAX_UTS_LEN],
version[MAX_UTS_LEN],
machine[MAX_UTS_LEN];
} SYSGATE_RO; /* RO Pages */
#define CHIP_MAX_PCI 24
typedef struct
{
struct
{
unsigned long long PTSC, /* Package Time Stamp Counter */
PC02, /* Goldmont, Sandy-Bridge, Phi */
PC03, /* Goldmont, Nehalem, Sandy-Bridge, Phi */
PC04, /* Atom [06_27h] */
PC06, /* Goldmont, Nehalem, Sandy-Bridge, Phi */
PC07, /* Nehalem, Sandy-Bridge, Phi */
PC08, /* Haswell */
PC09, /* Haswell */
PC10, /* Goldmont, Haswell */
MC6; /* Atom, Silervmont: per Module */
struct {
unsigned long long FC0; /* Uncore fixed counter #0 */
} Uncore;
struct {
unsigned long long ACCU[PWR_DOMAIN(SIZE)];
} Power;
} Counter[2] __attribute__ ((aligned (8)));
struct
{
unsigned long long PTSC,
PC02,
PC03,
PC04,
PC06,
PC07,
PC08,
PC09,
PC10,
MC6;
struct {
unsigned long long FC0;
} Uncore;
} Delta __attribute__ ((aligned (8)));
struct
{
union {
UNCORE_GLOBAL_PERF_CONTROL Uncore_GlobalPerfControl;
UNCORE_PMON_GLOBAL_CONTROL Uncore_PMonGlobalControl;
};
UNCORE_FIXED_PERF_CONTROL Uncore_FixedPerfControl;
} SaveArea;
FEATURES Features;
BitCC CR_Mask __attribute__ ((aligned (16)));
BitCC TM_Mask __attribute__ ((aligned (16)));
BitCC ODCM_Mask __attribute__ ((aligned (16)));
BitCC DCU_Mask __attribute__ ((aligned (16)));
BitCC PowerMgmt_Mask __attribute__ ((aligned (16)));
BitCC SpeedStep_Mask __attribute__ ((aligned (16)));
BitCC TurboBoost_Mask __attribute__ ((aligned (16)));
BitCC HWP_Mask __attribute__ ((aligned (16)));
BitCC C1E_Mask __attribute__ ((aligned (16)));
BitCC /* NHM */ C3A_Mask __attribute__ ((aligned (16)));
BitCC /* NHM */ C1A_Mask __attribute__ ((aligned (16)));
BitCC /* SNB */ C3U_Mask __attribute__ ((aligned (16)));
BitCC /* SNB */ C1U_Mask __attribute__ ((aligned (16)));
BitCC /* AMD */ CC6_Mask __attribute__ ((aligned (16)));
BitCC /* AMD */ PC6_Mask __attribute__ ((aligned (16)));
BitCC SPEC_CTRL_Mask __attribute__ ((aligned (16)));
BitCC ARCH_CAP_Mask __attribute__ ((aligned (16)));
BitCC WDT_Mask __attribute__ ((aligned (16)));
enum THERMAL_FORMULAS thermalFormula;
enum VOLTAGE_FORMULAS voltageFormula;
enum POWER_FORMULAS powerFormula;
unsigned int SleepInterval,
tickReset,
tickStep;
struct {
unsigned int Count,
OnLine;
} CPU;
SERVICE_PROC Service;
signed int ArchID;
struct {
unsigned int Boost[UNCORE_BOOST(SIZE)];
BUS_REGISTERS Bus;
MC_REGISTERS MC[MC_MAX_CTRL];
unsigned short CtrlCount;
struct CHIP_ST {
unsigned short VID, DID;
} Chip[CHIP_MAX_PCI];
} Uncore;
struct {
THERMAL_PARAM Param;
unsigned int Sensor;
struct {
signed int CPU, SOC;
} VID;
enum THERM_PWR_EVENTS Events;
RAPL_POWER_UNIT Unit;
union {
struct {
/*64-bits*/ DOMAIN_POWER_LIMIT PowerLimit[PWR_DOMAIN(SIZE)];
/*64-bits*/ DOMAIN_POWER_INFO PowerInfo;
/*32-bits*/ struct {
unsigned int TDC : 1-0,
_Unused : 32-1;
} Enable_Limit;
/*16-bits*/ unsigned short EDC;
/*16-bits*/ unsigned short TDC;
};
struct {
/*64-bits*/ unsigned long long _pad64[PWR_DOMAIN(SIZE)];
/*32-bits*/ AMD_17_MTS_MCM_PWR PWR;
/*32-bits*/ AMD_17_MTS_MCM_TDP TDP;
/*32-bits*/ AMD_17_MTS_MCM_EDC EDC;
/*32-bits*/ unsigned int _pad32;
} Zen;
};
} PowerThermal;
struct {
struct {
size_t Size;
int Order;
} ReqMem;
} Gate;
OS_DRIVER OS;
struct {
Bit64 NMI;
signed int AutoClock,
Experimental,
HotPlug,
PCI;
KERNEL_DRIVER Driver;
} Registration;
enum HYPERVISOR HypervisorID;
char Architecture[CODENAME_LEN];
SMBIOS_ST SMB;
FOOTPRINT FootPrint;
} PROC_RO; /* RO Pages */
typedef struct
{
struct
{
struct {
unsigned long long ACCU[PWR_DOMAIN(SIZE)];
} Power;
} Delta __attribute__ ((aligned (8)));
BitCC TM1 __attribute__ ((aligned (16)));
BitCC TM2 __attribute__ ((aligned (16)));
BitCC ODCM __attribute__ ((aligned (16)));
BitCC L1_HW_Prefetch __attribute__ ((aligned (16)));
BitCC L1_HW_IP_Prefetch __attribute__((aligned (16)));
BitCC L2_HW_Prefetch __attribute__ ((aligned (16)));
BitCC L2_HW_CL_Prefetch __attribute__((aligned (16)));
BitCC PowerMgmt __attribute__ ((aligned (16)));
BitCC SpeedStep __attribute__ ((aligned (16)));
BitCC TurboBoost __attribute__ ((aligned (16)));
BitCC HWP __attribute__ ((aligned (16)));
BitCC C1E __attribute__ ((aligned (16)));
BitCC C3A __attribute__ ((aligned (16)));
BitCC C1A __attribute__ ((aligned (16)));
BitCC C3U __attribute__ ((aligned (16)));
BitCC C1U __attribute__ ((aligned (16)));
BitCC CC6 __attribute__ ((aligned (16)));
BitCC PC6 __attribute__ ((aligned (16)));
BitCC SMM __attribute__ ((aligned (16)));
BitCC VM __attribute__ ((aligned (16)));
BitCC IBRS __attribute__ ((aligned (16)));
BitCC STIBP __attribute__ ((aligned (16)));
BitCC SSBD __attribute__ ((aligned (16)));
BitCC PSFD __attribute__ ((aligned (16)));
BitCC RDCL_NO __attribute__ ((aligned (16)));
BitCC IBRS_ALL __attribute__ ((aligned (16)));
BitCC RSBA __attribute__ ((aligned (16)));
BitCC L1DFL_VMENTRY_NO __attribute__ ((aligned (16)));
BitCC SSB_NO __attribute__ ((aligned (16)));
BitCC MDS_NO __attribute__ ((aligned (16)));
BitCC PSCHANGE_MC_NO __attribute__ ((aligned (16)));
BitCC TAA_NO __attribute__ ((aligned (16)));
BitCC STLB __attribute__ ((aligned (16)));
BitCC FUSA __attribute__ ((aligned (16)));
BitCC RSM_CPL0 __attribute__ ((aligned (16)));
BitCC SPLA __attribute__ ((aligned (16)));
BitCC SNOOP_FILTER __attribute__ ((aligned (16)));
BitCC WDT __attribute__ ((aligned (16)));
struct {
Bit64 Signal __attribute__ ((aligned (8)));
} OS;
} PROC_RW; /* RW Pages */
#ifndef PCI_VENDOR_ID_INTEL
#define PCI_VENDOR_ID_INTEL 0x8086
#endif
#ifndef PCI_VENDOR_ID_AMD
#define PCI_VENDOR_ID_AMD 0x1022
#endif
#define DID_INTEL_82945P_HB 0x2770
#define DID_INTEL_82945GM_HB 0x27a0
#define DID_INTEL_82955_HB 0x2774
/* Source: /drivers/char/agp/intel-agp.h */
#define DID_INTEL_82945GME_HB 0x27ac
#define DID_INTEL_82946GZ_HB 0x2970
#define DID_INTEL_82965Q_HB 0x2990
#define DID_INTEL_82965G_HB 0x29a0
#define DID_INTEL_82965GM_HB 0x2a00
#define DID_INTEL_82965GME_HB 0x2a10
#define DID_INTEL_GM45_HB 0x2a40
#define DID_INTEL_Q35_HB 0x29b0
#define DID_INTEL_G33_HB 0x29c0
#define DID_INTEL_Q33_HB 0x29d0
/* Source: /drivers/edac/x38_edac.c */
#define DID_INTEL_X38_HB 0x29e0
/* Source: /drivers/edac/i3200_edac.c */
#define DID_INTEL_3200_HB 0x29f0
/* Source: /drivers/char/agp/intel-agp.h */
#define DID_INTEL_Q45_HB 0x2e10
#define DID_INTEL_G45_HB 0x2e20
#define DID_INTEL_G41_HB 0x2e30
/* Source: SoC / Silvermont / Processor Transaction Router */
#define DID_INTEL_SLM_PTR 0x0f00
/* Source: /include/linux/pci_ids.h */
#define DID_INTEL_I7_MCR 0x2c18
#define DID_INTEL_I7_MC_CH0_CTRL 0x2c20
#define DID_INTEL_I7_MC_CH1_CTRL 0x2c28
#define DID_INTEL_I7_MC_CH2_CTRL 0x2c30
#define DID_INTEL_I7_MC_TEST 0x2c1c
#define DID_INTEL_I7_MC_CH0_ADDR 0x2c21
#define DID_INTEL_I7_MC_CH1_ADDR 0x2c29
#define DID_INTEL_I7_MC_CH2_ADDR 0x2c31
#define DID_INTEL_BLOOMFIELD_NON_CORE 0x2c41
#define DID_INTEL_C5500_NON_CORE 0x2c58
#define DID_INTEL_LYNNFIELD_NON_CORE 0x2c51
#define DID_INTEL_CLARKSFIELD_NON_CORE 0x2c52
#define DID_INTEL_CLARKDALE_NON_CORE 0x2c61
#define DID_INTEL_LYNNFIELD_MCR 0x2c98