Chameleon

Chameleon Svn Source Tree

Root/branches/slice/trunkM/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);
15extern void scan_cpu();
16
17#define bit(n)(1ULL << (n))
18#define bitmask(h,l)((bit(h)|(bit(h)-1)) & ~(bit(l)-1))
19#define bitfield(x,h,l)(((x) & bitmask(h,l)) >> l)
20
21/* CPUID Vendor */
22#define CPUID_VENDOR_INTEL 0x756E6547
23#define CPUID_VENDOR_AMD 0x68747541
24
25/* CPUID index into cpuid_raw */
26#define CPUID_00
27#define CPUID_11
28#define CPUID_22
29#define CPUID_33
30#define CPUID_44
31#define CPUID_65
32#define CPUID_806
33#define CPUID_817
34#define CPUID_888
35#define CPUID_MAX9
36
37#define CPU_MODEL_PENTIUM_M0x0D
38#define CPU_MODEL_YONAH0x0E// Sossaman, Yonah
39#define CPU_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
40#define CPU_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
41#define CPU_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
42#define CPU_MODEL_ATOM0x1C// Atom
43#define CPU_MODEL_FIELDS0x1E// Lynnfield, Clarksfield, Jasper Forest
44#define CPU_MODEL_DALES0x1F// Havendale, Auburndale
45#define CPU_MODEL_DALES_32NM0x25// Clarkdale, Arrandale
46#define CPU_MODEL_SANDY0x2A// Sandy Bridge
47#define CPU_MODEL_WESTMERE0x2C// Gulftown, Westmere-EP, Westmere-WS
48#define CPU_MODEL_SANDY_XEON0x2D// Sandy Bridge Xeon
49#define CPU_MODEL_NEHALEM_EX0x2E// Beckton
50#define CPU_MODEL_WESTMERE_EX0x2F
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//Slice - just use Platform->CPU.Mobile
64#define MEGA 1000000LL
65
66/* SMBIOS Memory Types */
67#define SMB_MEM_TYPE_UNDEFINED0
68#define SMB_MEM_TYPE_OTHER1
69#define SMB_MEM_TYPE_UNKNOWN2
70#define SMB_MEM_TYPE_DRAM3
71#define SMB_MEM_TYPE_EDRAM4
72#define SMB_MEM_TYPE_VRAM5
73#define SMB_MEM_TYPE_SRAM6
74#define SMB_MEM_TYPE_RAM7
75#define SMB_MEM_TYPE_ROM8
76#define SMB_MEM_TYPE_FLASH9
77#define SMB_MEM_TYPE_EEPROM10
78#define SMB_MEM_TYPE_FEPROM11
79#define SMB_MEM_TYPE_EPROM12
80#define SMB_MEM_TYPE_CDRAM13
81#define SMB_MEM_TYPE_3DRAM14
82#define SMB_MEM_TYPE_SDRAM15
83#define SMB_MEM_TYPE_SGRAM16
84#define SMB_MEM_TYPE_RDRAM17
85#define SMB_MEM_TYPE_DDR18
86#define SMB_MEM_TYPE_DDR219
87#define SMB_MEM_TYPE_FBDIMM20
88#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
89
90/* Memory Configuration Types */
91#define SMB_MEM_CHANNEL_UNKNOWN0
92#define SMB_MEM_CHANNEL_SINGLE1
93#define SMB_MEM_CHANNEL_DUAL2
94#define SMB_MEM_CHANNEL_TRIPLE3
95
96/* Maximum number of ram slots */
97#define MAX_RAM_SLOTS8
98#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
99
100/* Maximum number of SPD bytes */
101#define MAX_SPD_SIZE256
102
103/* Size of SMBIOS UUID in bytes */
104#define UUID_LEN16
105
106typedef struct _RamSlotInfo_t {
107 uint32_tModuleSize;// Size of Module in MB
108 uint32_tFrequency;// in Mhz
109 const char*Vendor;
110 const char*PartNo;
111 const char*SerialNo;
112 char*spd;// SPD Dump
113 boolInUse;
114 uint8_tType;
115 uint8_tBankConnections;// table type 6, see (3.3.7)
116 uint8_tBankConnCnt;
117} RamSlotInfo_t;
118
119typedef struct _PlatformInfo_t {
120struct PCI {
121uint8_tNoDevices;// No of PCI devices
122} PCI;
123struct CPU {
124uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
125uint32_tVendor;// Vendor
126uint32_tSignature;// Signature
127uint32_tStepping;// Stepping
128uint32_tModel;// Model
129uint32_tExtModel;// Extended Model
130uint32_tFamily;// Family
131uint32_tExtFamily;// Extended Family
132uint32_tNoCores;// No Cores per Package
133uint32_tNoThreads;// Threads per Package
134uint8_tMaxCoef;// Max Multiplier
135uint8_tMaxDiv;// Possible 0,5
136uint8_tMinCoef;// Min Multiplier
137uint8_tCurrCoef;// Current Multiplier
138uint8_tCurrDiv;
139floatMaxRatio;// non-integer ratio
140floatMinRatio;
141floatCurrRatio;
142uint64_tTSCFrequency;// TSC Frequency Hz
143uint64_tFSBFrequency;// FSB Frequency Hz
144uint64_tCPUFrequency;// CPU Frequency Hz
145boolMobile;// Mobile CPU
146charBrandString[48];// 48 Byte Branding String
147uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
148} CPU;
149
150struct RAM {
151uint64_tFrequency;// Ram Frequency
152uint32_tDivider;// Memory divider
153uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
154uint8_tTRC;
155uint8_tTRP;
156uint8_tRAS;
157uint8_tChannels;// Channel Configuration Single,Dual or Triple
158uint8_tNoSlots;// Maximum no of slots available
159uint8_tType;// Standard SMBIOS v2.5 Memory Type
160charBrandString[48];// Branding String Memory Controller
161RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
162} RAM;
163
164struct DMI {
165intMaxMemorySlots;// number of memory slots populated by SMBIOS
166intCntMemorySlots;// number of memory slots counted
167intMemoryModules;// number of memory modules installed
168intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
169} DMI;
170
171uint8_tType; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
172uint8_t*UUID;
173} PlatformInfo_t;
174
175extern PlatformInfo_t* Platform;
176
177#endif /* !__LIBSAIO_PLATFORM_H */
178

Archive Download this file

Revision: 1199