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
18#define CPUID_VENDOR_AMD 0x68747541
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 CPU_MODEL_ANY0x00
34#define CPU_MODEL_UNKNOWN0x01
35#define CPU_MODEL_PRESCOTT0x03// Celeron D, Pentium 4 (90nm)
36#define CPU_MODEL_NOCONA0x04// Xeon Nocona/Paxville, Irwindale (90nm)
37#define CPU_MODEL_PRESLER0x06// Pentium 4, Pentium D (65nm)
38#define CPU_MODEL_PENTIUM_M0x09// Banias Pentium M (130nm)
39#define CPU_MODEL_DOTHAN0x0D// Dothan Pentium M, Celeron M (90nm)
40#define CPU_MODEL_YONAH0x0E// Sossaman, Yonah
41#define CPU_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
42#define CPU_MODEL_CONROE0x0F//
43#define CPU_MODEL_CELERON0x16// Merom, Conroe (65nm)
44#define CPU_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
45#define CPU_MODEL_WOLFDALE0x17//
46#define CPU_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
47#define CPU_MODEL_ATOM0x1C// Pineview, Bonnell
48#define CPU_MODEL_XEON_MP0x1D// MP 7400
49#define CPU_MODEL_FIELDS0x1E// Lynnfield, Clarksfield, Jasper Forest
50#define CPU_MODEL_DALES0x1F// Havendale, Auburndale
51#define CPU_MODEL_DALES_32NM0x25// Clarkdale, Arrandale
52#define CPU_MODEL_ATOM_SAN0x26// Lincroft
53#define CPU_MODEL_LINCROFT0x27// Bonnell
54#define CPU_MODEL_SANDYBRIDGE0x2A// Sandy Bridge
55#define CPU_MODEL_WESTMERE0x2C// Gulftown, Westmere-EP, Westmere-WS
56#define CPU_MODEL_JAKETOWN0x2D// Sandy Bridge-E, Sandy Bridge-EP
57#define CPU_MODEL_NEHALEM_EX0x2E// Beckton
58#define CPU_MODEL_WESTMERE_EX0x2F// Westmere-EX
59//#define CPU_MODEL_BONNELL_ATOM0x35// Bonnell
60#define CPU_MODEL_ATOM_20000x36// Cedarview / Saltwell
61#define CPU_MODEL_SILVERMONT0x37// Atom Silvermont
62#define CPU_MODEL_IVYBRIDGE0x3A// Ivy Bridge
63#define CPU_MODEL_HASWELL0x3C// Haswell DT
64#define CPU_MODEL_BROADWELL0x3D// Core M, Broadwell / Core-AVX2
65#define CPU_MODEL_IVYBRIDGE_XEON0x3E// Ivy Bridge Xeon
66#define CPU_MODEL_HASWELL_SVR0x3F// Haswell Server
67//#define CPU_MODEL_HASWELL_H0x??// Haswell H
68#define CPU_MODEL_HASWELL_ULT0x45// Haswell ULT
69#define CPU_MODEL_CRYSTALWELL0x46// Crystal Well
70// 4A silvermont / atom
71#define CPU_MODEL_AVOTON0x4D// Silvermont/Avoton Atom C2000
72// 4E Core???
73#define CPU_MODEL_BRODWELL_SVR0x4F// Broadwell Server
74#define CPU_MODEL_BRODWELL_MSVR0x56// Broadwell Micro Server
75// 5A silvermont / atom
76// 5D silvermont / atom
77
78/* CPU Features */
79#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
80#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
81#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
82#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
83#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
84#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
85#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
86#define CPU_FEATURE_HTT0x00000080// HyperThreading
87#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
88#define CPU_FEATURE_MSR0x00000200// MSR Support
89
90/* SMBIOS Memory Types */
91#define SMB_MEM_TYPE_UNDEFINED0
92#define SMB_MEM_TYPE_OTHER1
93#define SMB_MEM_TYPE_UNKNOWN2
94#define SMB_MEM_TYPE_DRAM3
95#define SMB_MEM_TYPE_EDRAM4
96#define SMB_MEM_TYPE_VRAM5
97#define SMB_MEM_TYPE_SRAM6
98#define SMB_MEM_TYPE_RAM7
99#define SMB_MEM_TYPE_ROM8
100#define SMB_MEM_TYPE_FLASH9
101#define SMB_MEM_TYPE_EEPROM10
102#define SMB_MEM_TYPE_FEPROM11
103#define SMB_MEM_TYPE_EPROM12
104#define SMB_MEM_TYPE_CDRAM13
105#define SMB_MEM_TYPE_3DRAM14
106#define SMB_MEM_TYPE_SDRAM15
107#define SMB_MEM_TYPE_SGRAM16
108#define SMB_MEM_TYPE_RDRAM17
109#define SMB_MEM_TYPE_DDR18
110#define SMB_MEM_TYPE_DDR219
111#define SMB_MEM_TYPE_FBDIMM20
112#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
113#define SMB_MEM_TYPE_DDR426
114
115/* Memory Configuration Types */
116#define SMB_MEM_CHANNEL_UNKNOWN0
117#define SMB_MEM_CHANNEL_SINGLE1
118#define SMB_MEM_CHANNEL_DUAL2
119#define SMB_MEM_CHANNEL_TRIPLE3
120
121/* Maximum number of ram slots */
122#define MAX_RAM_SLOTS8
123#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
124
125/* Maximum number of SPD bytes */
126#define MAX_SPD_SIZE256
127
128/* Size of SMBIOS UUID in bytes */
129#define UUID_LEN16
130
131typedef struct _RamSlotInfo_t
132{
133uint32_tModuleSize;// Size of Module in MB
134uint32_tFrequency;// in Mhz
135const char*Vendor;
136const char*PartNo;
137const char*SerialNo;
138char*spd;// SPD Dump
139boolInUse;
140uint8_tType;
141uint8_tBankConnections;// table type 6, see (3.3.7)
142uint8_tBankConnCnt;
143} RamSlotInfo_t;
144
145//==============================================================================
146
147typedef struct _PlatformInfo_t {
148struct CPU {
149uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
150uint32_tVendor;// Vendor
151uint32_tCoresPerPackage;
152uint32_tLogicalPerPackage;
153uint32_tSignature;// Processor Signature
154uint32_tStepping;// Stepping
155//uint16_tType;// Type
156uint32_tModel;// Model
157uint32_tExtModel;// Extended Model
158uint32_tFamily;// Family
159uint32_tExtFamily;// Extended Family
160uint32_tNoCores;// No Cores per Package
161uint32_tNoThreads;// Threads per Package
162uint8_tMaxCoef;// Max Multiplier
163uint8_tMaxDiv;// Min Multiplier
164uint8_tCurrCoef;// Current Multiplier
165uint8_tCurrDiv;
166uint64_tTSCFrequency;// TSC Frequency Hz
167uint64_tFSBFrequency;// FSB Frequency Hz
168uint64_tCPUFrequency;// CPU Frequency Hz
169uint32_tMaxRatio;// Max Bus Ratio
170uint32_tMinRatio;// Min Bus Ratio
171charBrandString[48];// 48 Byte Branding String
172uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
173} CPU;
174
175struct RAM {
176uint64_tFrequency;// Ram Frequency
177uint32_tDivider;// Memory divider
178uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
179uint8_tTRC;
180uint8_tTRP;
181uint8_tRAS;
182uint8_tChannels;// Channel Configuration Single,Dual or Triple
183uint8_tNoSlots;// Maximum no of slots available
184uint8_tType;// Standard SMBIOS v2.5 Memory Type
185RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
186} RAM;
187
188struct DMI {
189intMaxMemorySlots; // number of memory slots populated by SMBIOS
190intCntMemorySlots; // number of memory slots counted
191intMemoryModules; // number of memory modules installed
192intDIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot
193} DMI;
194
195uint8_tType; // system-type: 1=Desktop, 2=Portable, 3=Workstation... according ACPI2.0 (FACP: PM_Profile)
196uint8_t*UUID; // system-id (SMBIOS Table 1: system uuid)
197 uint32_t HWSignature; // machine-signature (FACS: Hardware Signature)
198} PlatformInfo_t;
199
200extern PlatformInfo_t Platform;
201
202#endif /* !__LIBSAIO_PLATFORM_H */
203

Archive Download this file

Revision: 2469