Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch/i386/libsaio/platform.h

1/*
2 * platform.h
3 * AsereBLN: reworked and extended
4 *
5 */
6
7#ifndef __LIBSAIO_PLATFORM_H
8#define __LIBSAIO_PLATFORM_H
9
10//#include "libsaio.h"
11
12extern bool platformCPUFeature(uint32_t);
13extern void scan_platform(void);
14extern void dumpPhysAddr(const char * title, void * a, int len);
15
16/* CPUID index into cpuid_raw */
17#define CPUID_00
18#define CPUID_11
19#define CPUID_22
20#define CPUID_33
21#define CPUID_44
22#define CPUID_55
23#define CPUID_66
24#define CPUID_807
25#define CPUID_818
26#define CPUID_859
27#define CPUID_8610
28#define CPUID_8711
29#define CPUID_8812
30#define CPUID_MAX13
31
32#define CPUID_MODEL_ANY0x00
33#define CPUID_MODEL_UNKNOWN0x01
34#define CPUID_MODEL_PRESCOTT0x03// Celeron D, Pentium 4 (90nm)
35#define CPUID_MODEL_NOCONA0x04// Xeon Nocona/Paxville, Irwindale (90nm)
36#define CPUID_MODEL_PRESLER0x06// Pentium 4, Pentium D (65nm)
37#define CPUID_MODEL_PENTIUM_M0x09// Banias Pentium M (130nm)
38#define CPUID_MODEL_DOTHAN0x0D// Dothan Pentium M, Celeron M (90nm)
39#define CPUID_MODEL_YONAH0x0E// Sossaman, Yonah
40#define CPUID_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
41#define CPUID_MODEL_CONROE0x16// Merom, Conroe (65nm), Celeron (45nm)
42#define CPUID_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
43#define CPUID_MODEL_WOLFDALE0x17// Xeon 31xx, 33xx, 52xx, 54xx, Core 2 Quad 8xxx and 9xxx
44#define CPUID_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
45#define CPUID_MODEL_ATOM0x1C// Pineview, Bonnell
46#define CPUID_MODEL_XEON_MP0x1D// MP 7400
47#define CPUID_MODEL_FIELDS0x1E// Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest
48#define CPUID_MODEL_CLARKDALE0x1F// Core i7 and i5 Processor - Nehalem (Havendale, Auburndale)
49#define CPUID_MODEL_DALES0x25// Westmere Client - Clarkdale, Arrandale
50#define CPUID_MODEL_ATOM_SAN0x26// Lincroft
51#define CPUID_MODEL_LINCROFT0x27// Bonnell, penwell
52#define CPUID_MODEL_SANDYBRIDGE0x2A// Sandy Bridge
53#define CPUID_MODEL_WESTMERE0x2C// Gulftown, Westmere-EP, Westmere-WS
54#define CPUID_MODEL_JAKETOWN0x2D// Sandy Bridge-E, Sandy Bridge-EP
55#define CPUID_MODEL_NEHALEM_EX0x2E// Nehalem-EX Xeon - Beckton
56#define CPUID_MODEL_WESTMERE_EX0x2F// Westmere-EX Xeon - Eagleton
57#define CPUID_MODEL_CLOVERVIEW0x35// Atom Family Bonnell, cloverview
58#define CPUID_MODEL_ATOM_20000x36// Cedarview / Saltwell
59#define CPUID_MODEL_ATOM_37000x37// Atom E3000, Z3000 Atom Silvermont **BYT
60#define CPUID_MODEL_IVYBRIDGE0x3A// Ivy Bridge
61#define CPUID_MODEL_HASWELL0x3C// Haswell DT ex.i7 4790K
62#define CPUID_MODEL_HASWELL_U50x3D// Haswell U5 5th generation Broadwell, Core M / Core-AVX2
63#define CPUID_MODEL_IVYBRIDGE_XEON0x3E// Ivy Bridge Xeon
64#define CPUID_MODEL_HASWELL_SVR0x3F// Haswell Server, Xeon E5-2600/1600 v3 (Haswell-E) **HSX
65//#define CPUID_MODEL_HASWELL_H0x??// Haswell H
66#define CPUID_MODEL_HASWELL_ULT0x45// Haswell ULT, 4th gen Core, Xeon E3-12xx v3 C8/C9/C10
67#define CPUID_MODEL_HASWELL_ULX0x46// Crystal Well, 4th gen Core, Xeon E3-12xx v3
68#define CPUID_MODEL_BROADWELL_HQ0x47// Broadwell BDW
69#define CPUID_MODEL_MERRIFIELD0x4A// Future Atom E3000, Z3000 silvermont / atom (Marrifield)
70#define CPUID_MODEL_BRASWELL0x4C// Atom (Braswell)
71#define CPUID_MODEL_AVOTON0x4D// Silvermont/Avoton Atom C2000 **AVN
72#define CPUID_MODEL_SKYLAKE0x4E// Future Core **SKL
73#define CPUID_MODEL_BRODWELL_SVR0x4F// Broadwell Server **BDX
74#define CPUID_MODEL_BRODWELL_MSVR0x56// Broadwell Micro Server, Future Xeon **BDX-DE
75//#define CPUID_MODEL_KNIGHT0x57
76#define CPUID_MODEL_ANNIDALE0x5A// Silvermont, Future Atom E3000, Z3000 (Annidale)
77//#define CPUID_MODEL_GOLDMONT0x5C
78#define CPUID_MODEL_VALLEYVIEW0x5D// Silvermont, Future Atom E3000, Z3000
79#define CPUID_MODEL_SKYLAKE_S0x5E// Skylake **SKL
80//#define CPUID_MODEL_CANNONLAKE0x66
81
82/* CPUID Vendor */
83#defineCPUID_VID_INTEL"GenuineIntel"
84#defineCPUID_VID_AMD"AuthenticAMD"
85
86#define CPUID_VENDOR_INTEL0x756E6547
87#define CPUID_VENDOR_AMD0x68747541
88
89/* This spells out "GenuineIntel". */
90//#define is_intel \
91// ebx == 0x756e6547 && ecx == 0x6c65746e && edx == 0x49656e69
92
93/* This spells out "AuthenticAMD". */
94//#define is_amd \
95// ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65
96
97/* Unknown CPU */
98#define CPU_STRING_UNKNOWN"Unknown CPU Typ"
99
100//definitions from Apple XNU
101
102/* CPU defines */
103#define bit(n)(1ULL << (n))
104#define bitmask(h,l)((bit(h) | (bit(h)-1)) & ~(bit(l)-1))
105#define bitfield(x,h,l)(((x) & bitmask(h,l)) >> l)
106#define hbit(n)(1ULL << ((n)+32))
107#define min(a,b)((a) < (b) ? (a) : (b))
108#define quad32(hi,lo)((((uint32_t)(hi)) << 16) | (((uint32_t)(lo)) & 0xFFFF))
109#define quad64(hi,lo)((((uint64_t)(hi)) << 32) | (((uint64_t)(lo)) & 0xFFFFFFFFUL))
110
111/*
112 * The CPUID_FEATURE_XXX values define 64-bit values
113 * returned in %ecx:%edx to a CPUID request with %eax of 1:
114 */
115#define CPUID_FEATURE_FPUbit(0) /* Floating point unit on-chip */
116#define CPUID_FEATURE_VMEbit(1) /* Virtual Mode Extension */
117#define CPUID_FEATURE_DEbit(2) /* Debugging Extension */
118#define CPUID_FEATURE_PSEbit(3) /* Page Size Extension */
119#define CPUID_FEATURE_TSCbit(4) /* Time Stamp Counter */
120#define CPUID_FEATURE_MSRbit(5) /* Model Specific Registers */
121#define CPUID_FEATURE_PAEbit(6) /* Physical Address Extension */
122#define CPUID_FEATURE_MCEbit(7) /* Machine Check Exception */
123#define CPUID_FEATURE_CX8bit(8) /* CMPXCHG8B */
124#define CPUID_FEATURE_APICbit(9) /* On-chip APIC */
125#define CPUID_FEATURE_SEPbit(11) /* Fast System Call */
126#define CPUID_FEATURE_MTRRbit(12) /* Memory Type Range Register */
127#define CPUID_FEATURE_PGEbit(13) /* Page Global Enable */
128#define CPUID_FEATURE_MCAbit(14) /* Machine Check Architecture */
129#define CPUID_FEATURE_CMOVbit(15) /* Conditional Move Instruction */
130#define CPUID_FEATURE_PATbit(16) /* Page Attribute Table */
131#define CPUID_FEATURE_PSE36bit(17) /* 36-bit Page Size Extension */
132#define CPUID_FEATURE_PSNbit(18) /* Processor Serial Number */
133#define CPUID_FEATURE_CLFSHbit(19) /* CLFLUSH Instruction supported */
134#define CPUID_FEATURE_DSbit(21) /* Debug Store */
135#define CPUID_FEATURE_ACPIbit(22) /* Thermal monitor and Clock Ctrl */
136#define CPUID_FEATURE_MMXbit(23) /* MMX supported */
137#define CPUID_FEATURE_FXSRbit(24) /* Fast floating pt save/restore */
138#define CPUID_FEATURE_SSEbit(25) /* Streaming SIMD extensions */
139#define CPUID_FEATURE_SSE2bit(26) /* Streaming SIMD extensions 2 */
140#define CPUID_FEATURE_SSbit(27) /* Self-Snoop */
141#define CPUID_FEATURE_HTTbit(28) /* Hyper-Threading Technology */
142#define CPUID_FEATURE_TMbit(29) /* Thermal Monitor (TM1) */
143#define CPUID_FEATURE_PBEbit(31) /* Pend Break Enable */
144
145#define CPUID_FEATURE_SSE3hbit(0) /* Streaming SIMD extensions 3 */
146#define CPUID_FEATURE_PCLMULQDQhbit(1) /* PCLMULQDQ Instruction */
147#define CPUID_FEATURE_DTES64hbit(2) /* 64-bit DS layout */
148#define CPUID_FEATURE_MONITORhbit(3) /* Monitor/mwait */
149#define CPUID_FEATURE_DSCPLhbit(4) /* Debug Store CPL */
150#define CPUID_FEATURE_VMXhbit(5) /* VMX */
151#define CPUID_FEATURE_SMXhbit(6) /* SMX */
152#define CPUID_FEATURE_ESThbit(7) /* Enhanced SpeedsTep (GV3) */
153#define CPUID_FEATURE_TM2hbit(8) /* Thermal Monitor 2 */
154#define CPUID_FEATURE_SSSE3hbit(9) /* Supplemental SSE3 instructions */
155#define CPUID_FEATURE_CIDhbit(10) /* L1 Context ID */
156#define CPUID_FEATURE_SEGLIM64hbit(11) /* 64-bit segment limit checking */
157#define CPUID_FEATURE_FMAhbit(12) /* Fused-Multiply-Add support */
158#define CPUID_FEATURE_CX16hbit(13) /* CmpXchg16b instruction */
159#define CPUID_FEATURE_xTPRhbit(14) /* Send Task PRiority msgs */
160#define CPUID_FEATURE_PDCMhbit(15) /* Perf/Debug Capability MSR */
161
162#define CPUID_FEATURE_PCIDhbit(17) /* ASID-PCID support */
163#define CPUID_FEATURE_DCAhbit(18) /* Direct Cache Access */
164#define CPUID_FEATURE_SSE4_1hbit(19) /* Streaming SIMD extensions 4.1 */
165#define CPUID_FEATURE_SSE4_2hbit(20) /* Streaming SIMD extensions 4.2 */
166#define CPUID_FEATURE_x2APIChbit(21) /* Extended APIC Mode */
167#define CPUID_FEATURE_MOVBEhbit(22) /* MOVBE instruction */
168#define CPUID_FEATURE_POPCNThbit(23) /* POPCNT instruction */
169#define CPUID_FEATURE_TSCTMRhbit(24) /* TSC deadline timer */
170#define CPUID_FEATURE_AEShbit(25) /* AES instructions */
171#define CPUID_FEATURE_XSAVEhbit(26) /* XSAVE instructions */
172#define CPUID_FEATURE_OSXSAVEhbit(27) /* XGETBV/XSETBV instructions */
173#define CPUID_FEATURE_AVX1_0hbit(28) /* AVX 1.0 instructions */
174#define CPUID_FEATURE_F16Chbit(29) /* Float16 convert instructions */
175#define CPUID_FEATURE_RDRANDhbit(30) /* RDRAND instruction */
176#define CPUID_FEATURE_VMMhbit(31) /* VMM (Hypervisor) present */
177
178/*
179 * Leaf 7, subleaf 0 additional features.
180 * Bits returned in %ebx to a CPUID request with {%eax,%ecx} of (0x7,0x0}:
181 */
182#define CPUID_LEAF7_FEATURE_RDWRFSGSbit(0)/* FS/GS base read/write */
183#define CPUID_LEAF7_FEATURE_TSCOFFbit(1)/* TSC thread offset */
184#define CPUID_LEAF7_FEATURE_BMI1bit(3)/* Bit Manipulation Instrs, set 1 */
185#define CPUID_LEAF7_FEATURE_HLEbit(4)/* Hardware Lock Elision*/
186#define CPUID_LEAF7_FEATURE_AVX2bit(5)/* AVX2 Instructions */
187#define CPUID_LEAF7_FEATURE_SMEPbit(7)/* Supervisor Mode Execute Protect */
188#define CPUID_LEAF7_FEATURE_BMI2bit(8)/* Bit Manipulation Instrs, set 2 */
189#define CPUID_LEAF7_FEATURE_ENFSTRGbit(9)/* ENhanced Fast STRinG copy */
190#define CPUID_LEAF7_FEATURE_INVPCIDbit(10)/* INVPCID intruction, TDB */
191#define CPUID_LEAF7_FEATURE_RTMbit(11)/* TBD */
192
193/*
194 * The CPUID_EXTFEATURE_XXX values define 64-bit values
195 * returned in %ecx:%edx to a CPUID request with %eax of 0x80000001:
196 */
197#define CPUID_EXTFEATURE_SYSCALLbit(11)/* SYSCALL/sysret */
198#define CPUID_EXTFEATURE_XDbit(20)/* eXecute Disable */
199
200#define CPUID_EXTFEATURE_1GBPAGEbit(26)/* 1GB pages support */
201#define CPUID_EXTFEATURE_RDTSCPbit(27)/* RDTSCP */
202#define CPUID_EXTFEATURE_EM64Tbit(29)/* Extended Mem 64 Technology */
203
204
205#define CPUID_EXTFEATURE_LAHFhbit(0)/* LAFH/SAHF instructions */
206
207/*
208 * The CPUID_EXTFEATURE_XXX values define 64-bit values
209 * returned in %ecx:%edx to a CPUID request with %eax of 0x80000007:
210 */
211#define CPUID_EXTFEATURE_TSCIbit(8)/* TSC Invariant */
212
213#defineCPUID_CACHE_SIZE16/* Number of descriptor values */
214
215#define CPUID_MWAIT_EXTENSIONbit(0)/* enumeration of WMAIT extensions */
216#define CPUID_MWAIT_BREAKbit(1)/* interrupts are break events */
217
218//-- processor type -> p_type:
219#define PT_OEM0x00// Intel Original OEM Processor;
220#define PT_OD0x01 // Intel Over Drive Processor;
221#define PT_DUAL0x02// Intel Dual Processor;
222#define PT_RES0x03// Intel Reserved;
223
224/* Known MSR registers */
225#define MSR_IA32_PLATFORM_ID0x0017
226#define IA32_APIC_BASE0x001B /* used also for AMD */
227#define MSR_CORE_THREAD_COUNT0x0035/* limited use - not for Penryn or older */
228#define IA32_TSC_ADJUST0x003B
229#define MSR_IA32_BIOS_SIGN_ID0x008B/* microcode version */
230#define MSR_FSB_FREQ0x00CD/* limited use - not for i7 */
231#defineMSR_PLATFORM_INFO0x00CE/* limited use - MinRatio for i7 but Max for Yonah*/
232
233/* turbo for penryn */
234#define MSR_PKG_CST_CONFIG_CONTROL0x00E2// sandy and ivy
235#define MSR_PMG_IO_CAPTURE_BASE0x00E4
236#define IA32_MPERF0x00E7// TSC in C0 only
237#define IA32_APERF0x00E8// actual clocks in C0
238#define MSR_IA32_EXT_CONFIG0x00EE// limited use - not for i7
239#define MSR_FLEX_RATIO0x0194// limited use - not for Penryn or older
240//see no value on most CPUs
241#defineMSR_IA32_PERF_STATUS0x0198
242#define MSR_IA32_PERF_CONTROL0x0199
243#define MSR_IA32_CLOCK_MODULATION0x019A
244#define MSR_THERMAL_STATUS0x019C
245#define MSR_IA32_MISC_ENABLE0x01A0
246#define MSR_THERMAL_TARGET0x01A2// TjMax limited use - not for Penryn or older
247#define MSR_MISC_PWR_MGMT0x01AA
248#define MSR_TURBO_RATIO_LIMIT0x01AD// limited use - not for Penryn or older
249
250#define IA32_ENERGY_PERF_BIAS0x01B0
251#define MSR_PACKAGE_THERM_STATUS0x01B1
252#define IA32_PLATFORM_DCA_CAP0x01F8
253#define MSR_POWER_CTL0x01FC// MSR 000001FC 0000-0000-0004-005F
254
255// Nehalem (NHM) adds support for additional MSRs
256#define MSR_SMI_COUNT 0x034
257#define MSR_NHM_PLATFORM_INFO 0x0ce
258#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x0e2
259#define MSR_PKG_C3_RESIDENCY 0x3f8
260#define MSR_PKG_C6_RESIDENCY 0x3f9
261#define MSR_CORE_C3_RESIDENCY 0x3fc
262#define MSR_CORE_C6_RESIDENCY 0x3fd
263
264// Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's.
265#define MSR_RAPL_POWER_UNIT0x606// R/O
266//MSR 00000606 0000-0000-000A-1003
267#define MSR_PKGC3_IRTL0x60A// RW time limit to go C3
268// bit 15 = 1 -- the value valid for C-state PM
269#define MSR_PKGC6_IRTL0x60B// RW time limit to go C6
270//MSR 0000060B 0000-0000-0000-8854
271//Valid + 010=1024ns + 0x54=84mks
272#define MSR_PKGC7_IRTL0x60C// RW time limit to go C7
273//MSR 0000060C 0000-0000-0000-8854
274
275// Sandy Bridge (SNB) adds support for additional MSRs
276#define MSR_PKG_C7_RESIDENCY0x3FA
277#define MSR_CORE_C7_RESIDENCY0x3FE
278#define MSR_PKG_C2_RESIDENCY0x60D// same as TSC but in C2 only
279
280#define MSR_PKG_RAPL_POWER_LIMIT0x610//MSR 00000610 0000-A580-0000-8960
281#define MSR_PKG_ENERGY_STATUS0x611//MSR 00000611 0000-0000-3212-A857
282#define MSR_PKG_POWER_INFO0x614//MSR 00000614 0000-0000-01E0-02F8
283
284// Sandy Bridge IA (Core) domain MSR's.
285#define MSR_PP0_POWER_LIMIT0x638
286#define MSR_PP0_ENERGY_STATUS0x639
287#define MSR_PP0_POLICY0x63A
288#define MSR_PP0_PERF_STATUS0x63B
289
290// Sandy Bridge Uncore (IGPU) domain MSR's (Not on JakeTown).
291#define MSR_PP1_POWER_LIMIT0x640
292#define MSR_PP1_ENERGY_STATUS0x641
293#define MSR_PP1_POLICY0x642
294
295// JakeTown only Memory MSR's.
296#define MSR_PKG_PERF_STATUS0x613
297#define MSR_DRAM_POWER_LIMIT 0x618
298#define MSR_DRAM_ENERGY_STATUS0x619
299#define MSR_DRAM_PERF_STATUS0x61B
300#define MSR_DRAM_POWER_INFO0x61C
301
302// Ivy Bridge
303#define MSR_CONFIG_TDP_NOMINAL0x648
304#define MSR_CONFIG_TDP_LEVEL10x649
305#define MSR_CONFIG_TDP_LEVEL20x64A
306#define MSR_CONFIG_TDP_CONTROL0x64B// write once to lock
307#define MSR_TURBO_ACTIVATION_RATIO0x64C
308
309// Haswell (HSW) adds support for additional MSRs
310#define MSR_PKG_C8_RESIDENCY 0x630
311#define MSR_PKG_C9_RESIDENCY 0x631
312#define MSR_PKG_C10_RESIDENCY 0x632
313
314// Skylake (SKL) adds support for additional MSRs
315#define MSR_PKG_WEIGHTED_CORE_C0_RES 0x658
316#define MSR_PKG_ANY_CORE_C0_RES 0x659
317#define MSR_PKG_ANY_GFXE_C0_RES 0x65A
318#define MSR_PKG_BOTH_CORE_GFXE_C0_RES 0x65B
319
320/* AMD Defined MSRs */
321#define MSR_K6_EFER0xC0000080// extended feature register
322#define MSR_K6_STAR0xC0000081// legacy mode SYSCALL target
323#define MSR_K6_WHCR0xC0000082// long mode SYSCALL target
324#define MSR_K6_UWCCR0xC0000085
325#define MSR_K6_EPMR0xC0000086
326#define MSR_K6_PSOR0xC0000087
327#define MSR_K6_PFIR0xC0000088
328
329#define MSR_K7_EVNTSEL00xC0010000
330#define MSR_K7_PERFCTR00xC0010004
331#define MSR_K7_HWCR0xC0010015
332#define MSR_K7_CLK_CTL0xC001001b
333#define MSR_K7_FID_VID_CTL0xC0010041
334
335#define K8_FIDVID_STATUS0xC0010042
336#define K10_COFVID_LIMIT0xC0010061// max enabled p-state (msr >> 4) & 7
337#define K10_COFVID_CONTROL0xC0010062// switch to p-state
338#define K10_PSTATE_STATUS0xC0010064
339#define K10_COFVID_STATUS0xC0010071// current p-state (msr >> 16) & 7
340
341#define MSR_AMD_MPERF0x000000E7
342#define MSR_AMD_APERF0x000000E8
343
344#define DEFAULT_FSB100000 /* for now, hardcoding 100MHz for old CPUs */
345
346// DFE: This constant comes from older xnu:
347#define CLKNUM1193182/* formerly 1193167 */
348
349/* CPU Features */
350#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
351#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
352#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
353#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
354#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
355#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
356#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
357#define CPU_FEATURE_HTT0x00000080// HyperThreading
358#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
359#define CPU_FEATURE_MSR0x00000200// MSR Support
360
361/* SMBIOS Memory Types */
362#define SMB_MEM_TYPE_UNDEFINED0
363#define SMB_MEM_TYPE_OTHER1
364#define SMB_MEM_TYPE_UNKNOWN2
365#define SMB_MEM_TYPE_DRAM3
366#define SMB_MEM_TYPE_EDRAM4
367#define SMB_MEM_TYPE_VRAM5
368#define SMB_MEM_TYPE_SRAM6
369#define SMB_MEM_TYPE_RAM7
370#define SMB_MEM_TYPE_ROM8
371#define SMB_MEM_TYPE_FLASH9
372#define SMB_MEM_TYPE_EEPROM10
373#define SMB_MEM_TYPE_FEPROM11
374#define SMB_MEM_TYPE_EPROM12
375#define SMB_MEM_TYPE_CDRAM13
376#define SMB_MEM_TYPE_3DRAM14
377#define SMB_MEM_TYPE_SDRAM15
378#define SMB_MEM_TYPE_SGRAM16
379#define SMB_MEM_TYPE_RDRAM17
380#define SMB_MEM_TYPE_DDR18
381#define SMB_MEM_TYPE_DDR219
382#define SMB_MEM_TYPE_FBDIMM20
383#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
384#define SMB_MEM_TYPE_DDR426
385
386/* Memory Configuration Types */
387#define SMB_MEM_CHANNEL_UNKNOWN0
388#define SMB_MEM_CHANNEL_SINGLE1
389#define SMB_MEM_CHANNEL_DUAL2
390#define SMB_MEM_CHANNEL_TRIPLE3
391
392/* Maximum number of ram slots */
393#define MAX_RAM_SLOTS8
394
395#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
396
397/* Maximum number of SPD bytes */
398#define MAX_SPD_SIZE256
399
400/* Size of SMBIOS UUID in bytes */
401#define UUID_LEN16
402
403typedef struct _RamSlotInfo_t
404{
405uint32_tModuleSize;// Size of Module in MB
406uint32_tFrequency;// in Mhz
407const char*Vendor;
408const char*PartNo;
409const char*SerialNo;
410char*spd;// SPD Dump
411boolInUse;
412uint8_tType;
413uint8_tBankConnections;// table type 6, see (3.3.7)
414uint8_tBankConnCnt;
415} RamSlotInfo_t;
416
417//==============================================================================
418
419typedef struct _PlatformInfo_t
420{
421struct CPU {
422uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
423uint32_tVendor;// Vendor
424uint32_tCoresPerPackage;
425uint32_tLogicalPerPackage;
426uint32_tSignature;// Processor Signature
427uint32_tStepping;// Stepping
428uint32_tModel;// Model
429//uint32_tType;// Processor Type
430uint32_tExtModel;// Extended Model
431uint32_tFamily;// Family
432uint32_tExtFamily;// Extended Family
433uint32_tNoCores;// No Cores per Package
434uint32_tNoThreads;// Threads per Package
435uint8_tMaxCoef;// Max Multiplier
436uint8_tMaxDiv;// Min Multiplier
437uint8_tCurrCoef;// Current Multiplier
438uint8_tCurrDiv;
439uint64_tTSCFrequency;// TSC Frequency Hz
440uint64_tFSBFrequency;// FSB Frequency Hz
441uint64_tCPUFrequency;// CPU Frequency Hz
442uint32_tMaxRatio;// Max Bus Ratio
443uint32_tMinRatio;// Min Bus Ratio
444charBrandString[48];// 48 Byte Branding String
445uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
446
447} CPU;
448
449struct DMI
450{
451intMaxMemorySlots;// number of memory slots populated by SMBIOS
452intCntMemorySlots;// number of memory slots counted
453intMemoryModules;// number of memory modules installed
454intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
455} DMI;
456
457struct RAM
458{
459uint64_tFrequency;// Ram Frequency
460uint32_tDivider;// Memory divider
461uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
462uint8_tTRC;
463uint8_tTRP;
464uint8_tRAS;
465uint8_tChannels;// Channel Configuration Single,Dual, Triple or Quad
466uint8_tNoSlots;// Maximum no of slots available
467uint8_tType;// Standard SMBIOS v2.5 Memory Type
468RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
469} RAM;
470
471uint8_tType;// system-type: 1=Desktop, 2=Portable, 3=Workstation... according ACPI2.0 (FACP: PM_Profile)
472uint8_t*UUID;// system-id (SMBIOS Table 1: system uuid)
473uint32_tHWSignature;// machine-signature (FACS: Hardware Signature)
474} PlatformInfo_t;
475
476extern PlatformInfo_t Platform;
477
478#endif /* !__LIBSAIO_PLATFORM_H */
479

Archive Download this file

Revision: 2789