Chameleon

Chameleon Svn Source Tree

Root/branches/Bungo/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 Vendor */
17#define CPUID_VENDOR_INTEL 0x756E6547 // "uneG"
18#define CPUID_VENDOR_AMD 0x68747541 // "htuA"
19
20/* CPUID index into cpuid_raw */
21#define CPUID_00
22#define CPUID_11
23#define CPUID_22
24#define CPUID_33
25#define CPUID_44
26#define CPUID_55
27#define CPUID_66
28#define CPUID_807
29#define CPUID_818
30#define CPUID_889
31#define CPUID_MAX10
32
33#define CPUID_MODEL_ANY 0xFF
34#define CPUID_MODEL_UNKNOWN 0x00
35//#define CPUID_MODEL_PRESCOTT 0x03// Celeron D, Pentium 4 (90nm)
36#define CPUID_MODEL_NOCONA 0x03// Celeron D, Pentium 4, Xeon (90nm)
37//#define CPUID_MODEL_NOCONA 0x04// Xeon Nocona/Paxville, Irwindale (90nm)
38#define CPUID_MODEL_IRWINDALE 0x04// Xeon Paxville, Irwindale (90nm)
39#define CPUID_MODEL_PRESLER 0x06// Pentium 4, Pentium D (65nm)
40#define CPUID_MODEL_PENTIUM_M0x09// Banias Pentium M (130nm)
41#define CPUID_MODEL_DOTHAN 0x0D// Dothan Pentium M, Celeron M (90nm)
42#define CPUID_MODEL_YONAH 0x0E// Sossaman, Yonah
43#define CPUID_MODEL_MEROM 0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
44//#define CPUID_MODEL_CONROE0x0F//
45#define CPUID_MODEL_CELERON 0x16// Merom, Conroe (65nm), Celeron (45nm)
46#define CPUID_MODEL_PENRYN 0x17// Wolfdale, Yorkfield, Harpertown, Penryn
47//#define CPUID_MODEL_WOLFDALE0x17// Xeon 31xx, 33xx, 52xx, 54xx, Core 2 Quad 8xxx and 9xxx
48#define CPUID_MODEL_NEHALEM 0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
49#define CPUID_MODEL_ATOM 0x1C// Pineview, Bonnell
50#define CPUID_MODEL_XEON_MP 0x1D// MP 7400
51#define CPUID_MODEL_FIELDS 0x1E// Lynnfield, Clarksfield, Jasper Forest
52#define CPUID_MODEL_DALES 0x1F// Havendale, Auburndale
53#define CPUID_MODEL_DALES_32NM0x25// Clarkdale, Arrandale
54#define CPUID_MODEL_ATOM_SAN0x26// Lincroft
55#define CPUID_MODEL_LINCROFT0x27// Bonnell
56#define CPUID_MODEL_SANDYBRIDGE0x2A// Sandy Bridge
57#define CPUID_MODEL_WESTMERE0x2C// Gulftown, Westmere-EP, Westmere-WS
58#define CPUID_MODEL_JAKETOWN0x2D// Sandy Bridge-E, Sandy Bridge-EP
59#define CPUID_MODEL_NEHALEM_EX0x2E// Beckton
60#define CPUID_MODEL_WESTMERE_EX0x2F// Westmere-EX
61//#define CPUID_MODEL_BONNELL_ATOM0x35// Atom Family Bonnell
62#define CPUID_MODEL_ATOM_20000x36// Cedarview / Saltwell
63#define CPUID_MODEL_SILVERMONT0x37// Atom E3000, Z3000 Atom Silvermont
64#define CPUID_MODEL_IVYBRIDGE0x3A// Ivy Bridge
65#define CPUID_MODEL_HASWELL 0x3C// Haswell DT
66#define CPUID_MODEL_BROADWELL0x3D// Core M, Broadwell / Core-AVX2
67//#define CPUID_MODEL_IVYBRIDGE_XEON0x3E// Ivy Bridge Xeon
68#define CPUID_MODEL_IVYBRIDGE_EP0x3E// Ivy Bridge Xeon
69#define CPUID_MODEL_HASWELL_SVR0x3F// Haswell Server, Xeon E5-2600/1600 v3 (Haswell-E)
70//#define CPUID_MODEL_HASWELL_H0x??// Haswell H
71#define CPUID_MODEL_HASWELL_ULT0x45// Haswell ULT, 4th gen Core, Xeon E3-12xx v3
72#define CPUID_MODEL_CRYSTALWELL0x46// Crystal Well, 4th gen Core, Xeon E3-12xx v3
73//#define CPUID_MODEL_0x4A// Future Atom E3000, Z3000 silvermont / atom
74#define CPUID_MODEL_AVOTON 0x4D// Silvermont/Avoton Atom C2000
75//#define CPUID_MODEL_0x4E// Future Core
76#define CPUID_MODEL_BRODWELL_SVR0x4F// Broadwell Server
77#define CPUID_MODEL_BRODWELL_MSVR0x56// Broadwell Micro Server, Future Xeon
78//#define CPUID_MODEL_0x5A// Silvermont, Future Atom E3000, Z3000
79//#define CPUID_MODEL_0x5D// Silvermont, Future Atom E3000, Z3000
80
81/* CPU Features */
82#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
83#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
84#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
85#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
86#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
87#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
88#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
89#define CPU_FEATURE_HTT0x00000080// HyperThreading
90#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
91#define CPU_FEATURE_MSR0x00000200// MSR Support
92
93/* SMBIOS Memory Types */
94#define SMB_MEM_TYPE_UNDEFINED0
95#define SMB_MEM_TYPE_OTHER1
96#define SMB_MEM_TYPE_UNKNOWN2
97#define SMB_MEM_TYPE_DRAM3
98#define SMB_MEM_TYPE_EDRAM4
99#define SMB_MEM_TYPE_VRAM5
100#define SMB_MEM_TYPE_SRAM6
101#define SMB_MEM_TYPE_RAM7
102#define SMB_MEM_TYPE_ROM8
103#define SMB_MEM_TYPE_FLASH9
104#define SMB_MEM_TYPE_EEPROM10
105#define SMB_MEM_TYPE_FEPROM11
106#define SMB_MEM_TYPE_EPROM12
107#define SMB_MEM_TYPE_CDRAM13
108#define SMB_MEM_TYPE_3DRAM14
109#define SMB_MEM_TYPE_SDRAM15
110#define SMB_MEM_TYPE_SGRAM16
111#define SMB_MEM_TYPE_RDRAM17
112#define SMB_MEM_TYPE_DDR18
113#define SMB_MEM_TYPE_DDR219
114#define SMB_MEM_TYPE_FBDIMM20
115#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
116#define SMB_MEM_TYPE_DDR426
117
118/* Memory Configuration Types */
119#define SMB_MEM_CHANNEL_UNKNOWN0
120#define SMB_MEM_CHANNEL_SINGLE1
121#define SMB_MEM_CHANNEL_DUAL2
122#define SMB_MEM_CHANNEL_TRIPLE3
123
124/* Maximum number of ram slots */
125#define MAX_RAM_SLOTS8
126#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
127
128/* Maximum number of SPD bytes */
129#define MAX_SPD_SIZE256
130
131/* Size of SMBIOS UUID in bytes */
132#define UUID_LEN16
133
134typedef struct _RamSlotInfo_t
135{
136uint32_tModuleSize;// Size of Module in MB
137uint32_tFrequency;// in Mhz
138const char*Vendor;
139const char*PartNo;
140const char*SerialNo;
141char*spd;// SPD Dump
142boolInUse;
143uint8_tType;
144uint8_tBankConnections;// table type 6, see (3.3.7)
145uint8_tBankConnCnt;
146} RamSlotInfo_t;
147
148//==============================================================================
149
150typedef struct _PlatformInfo_t
151{
152struct CPU {
153uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
154uint32_tVendor;// Vendor
155//uint32_tCoresPerPackage;
156//uint32_tLogicalPerPackage;
157uint32_tSignature;// Processor Signature
158uint32_tStepping;// Stepping
159//uint16_tType;// Type
160uint32_tModel;// Model
161uint32_tExtModel;// Extended Model
162uint32_tFamily;// Family
163uint32_tExtFamily;// Extended Family
164uint32_tNoCores;// No Cores per Package
165uint32_tNoThreads;// Threads per Package
166uint8_tMaxCoef;// Max Multiplier
167uint8_tMaxDiv;// Min Multiplier
168uint8_tCurrCoef;// Current Multiplier
169uint8_tCurrDiv;
170uint64_tTSCFrequency;// TSC Frequency Hz
171uint64_tFSBFrequency;// FSB Frequency Hz
172uint64_tCPUFrequency;// CPU Frequency Hz
173uint32_tMaxRatio;// Max Bus Ratio
174uint32_tMinRatio;// Min Bus Ratio
175charBrandString[48];// 48 Byte Branding String
176uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
177} CPU;
178
179struct RAM {
180uint64_tFrequency;// Ram Frequency
181uint32_tDivider;// Memory divider
182uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
183uint8_tTRC;
184uint8_tTRP;
185uint8_tRAS;
186uint8_tChannels;// Channel Configuration Single,Dual or Triple
187uint8_tNoSlots;// Maximum no of slots available
188uint8_tType;// Standard SMBIOS v2.5 Memory Type
189RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
190} RAM;
191
192struct DMI {
193intMaxMemorySlots; // number of memory slots populated by SMBIOS
194intCntMemorySlots; // number of memory slots counted
195intMemoryModules; // number of memory modules installed
196intDIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot
197} DMI;
198
199uint8_tType; // system-type: 1=Desktop, 2=Portable, 3=Workstation... according ACPI2.0 (FACP: PM_Profile)
200uint8_t*UUID; // system-id (SMBIOS Table 1: system uuid)
201 uint32_t HWSignature; // machine-signature (FACS: Hardware Signature)
202} PlatformInfo_t;
203
204extern PlatformInfo_t Platform;
205
206#endif /* !__LIBSAIO_PLATFORM_H */
207

Archive Download this file

Revision: 2537