Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/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_65
27#define CPUID_806
28#define CPUID_817
29#define CPUID_888
30#define CPUID_MAX9
31
32#define CPU_MODEL_DOTHAN0x0D// Dothan
33#define CPU_MODEL_YONAH0x0E// Sossaman, Yonah
34#define CPU_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
35#define CPU_MODEL_CONROE0x0F
36#define CPU_MODEL_CELERON0x16
37#define CPU_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
38#define CPU_MODEL_WOLFDALE0x17
39#define CPU_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
40#define CPU_MODEL_ATOM0x1C// Atom
41#define CPU_MODEL_XEON_MP0x1D
42#define CPU_MODEL_FIELDS0x1E// Lynnfield, Clarksfield, Jasper Forest
43#define CPU_MODEL_DALES0x1F// Havendale, Auburndale
44#define CPU_MODEL_DALES_32NM0x25// Clarkdale, Arrandale
45#define CPU_MODEL_SANDYBRIDGE0x2A// Sandy Bridge
46#define CPU_MODEL_WESTMERE0x2C// Gulftown, Westmere-EP, Westmere-WS
47#define CPU_MODEL_JAKETOWN0x2D// Sandy Bridge-E, Sandy Bridge-EP
48#define CPU_MODEL_NEHALEM_EX0x2E// Beckton
49#define CPU_MODEL_WESTMERE_EX0x2F// Westmere-EX
50#define CPU_MODEL_IVYBRIDGE0x3A// Ivy Bridge
51
52/* CPU Features */
53#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
54#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
55#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
56#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
57#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
58#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
59#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
60#define CPU_FEATURE_HTT0x00000080// HyperThreading
61#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
62#define CPU_FEATURE_MSR0x00000200// MSR Support
63
64/* SMBIOS Memory Types */
65#define SMB_MEM_TYPE_UNDEFINED0
66#define SMB_MEM_TYPE_OTHER1
67#define SMB_MEM_TYPE_UNKNOWN2
68#define SMB_MEM_TYPE_DRAM3
69#define SMB_MEM_TYPE_EDRAM4
70#define SMB_MEM_TYPE_VRAM5
71#define SMB_MEM_TYPE_SRAM6
72#define SMB_MEM_TYPE_RAM7
73#define SMB_MEM_TYPE_ROM8
74#define SMB_MEM_TYPE_FLASH9
75#define SMB_MEM_TYPE_EEPROM10
76#define SMB_MEM_TYPE_FEPROM11
77#define SMB_MEM_TYPE_EPROM12
78#define SMB_MEM_TYPE_CDRAM13
79#define SMB_MEM_TYPE_3DRAM14
80#define SMB_MEM_TYPE_SDRAM15
81#define SMB_MEM_TYPE_SGRAM16
82#define SMB_MEM_TYPE_RDRAM17
83#define SMB_MEM_TYPE_DDR18
84#define SMB_MEM_TYPE_DDR219
85#define SMB_MEM_TYPE_FBDIMM20
86#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
87
88/* Memory Configuration Types */
89#define SMB_MEM_CHANNEL_UNKNOWN0
90#define SMB_MEM_CHANNEL_SINGLE1
91#define SMB_MEM_CHANNEL_DUAL2
92#define SMB_MEM_CHANNEL_TRIPLE3
93
94/* Maximum number of ram slots */
95#define MAX_RAM_SLOTS8
96#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
97
98/* Maximum number of SPD bytes */
99#define MAX_SPD_SIZE256
100
101/* Size of SMBIOS UUID in bytes */
102#define UUID_LEN16
103
104typedef struct _RamSlotInfo_t {
105 uint32_tModuleSize;// Size of Module in MB
106 uint32_tFrequency;// in Mhz
107 const char*Vendor;
108 const char*PartNo;
109 const char*SerialNo;
110 char*spd;// SPD Dump
111 boolInUse;
112 uint8_tType;
113 uint8_tBankConnections;// table type 6, see (3.3.7)
114 uint8_tBankConnCnt;
115} RamSlotInfo_t;
116
117typedef struct _PlatformInfo_t {
118struct CPU {
119uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
120uint32_tVendor;// Vendor
121uint32_tSignature;// Signature
122uint32_tStepping;// Stepping
123uint32_tModel;// Model
124uint32_tExtModel;// Extended Model
125uint32_tFamily;// Family
126uint32_tExtFamily;// Extended Family
127uint32_tNoCores;// No Cores per Package
128uint32_tNoThreads;// Threads per Package
129uint8_tMaxCoef;// Max Multiplier
130uint8_tMaxDiv;
131uint8_tCurrCoef;// Current Multiplier
132uint8_tCurrDiv;
133uint64_tTSCFrequency;// TSC Frequency Hz
134uint64_tFSBFrequency;// FSB Frequency Hz
135uint64_tCPUFrequency;// CPU Frequency Hz
136uint32_tMaxRatio;// Max Bus Ratio
137uint32_tMinRatio;// Min Bus Ratio
138charBrandString[48];// 48 Byte Branding String
139uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
140} CPU;
141
142struct RAM {
143uint64_tFrequency;// Ram Frequency
144uint32_tDivider;// Memory divider
145uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
146uint8_tTRC;
147uint8_tTRP;
148uint8_tRAS;
149uint8_tChannels;// Channel Configuration Single,Dual or Triple
150uint8_tNoSlots;// Maximum no of slots available
151uint8_tType;// Standard SMBIOS v2.5 Memory Type
152RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
153} RAM;
154
155struct DMI {
156intMaxMemorySlots;// number of memory slots populated by SMBIOS
157intCntMemorySlots;// number of memory slots counted
158intMemoryModules;// number of memory modules installed
159intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
160} DMI;
161
162uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
163uint8_t*UUID;
164} PlatformInfo_t;
165
166extern PlatformInfo_t Platform;
167
168#endif /* !__LIBSAIO_PLATFORM_H */
169

Archive Download this file

Revision: 2004