Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2805