Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/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);
14
15#define bit(n)(1UL << (n))
16#define bitmask(h,l)((bit(h)|(bit(h)-1)) & ~(bit(l)-1))
17#define bitfield(x,h,l)(((x) & bitmask(h,l)) >> l)
18
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_805
27#define CPUID_816
28#define CPUID_MAX7
29
30#define CPU_MODEL_YONAH0x0E
31#define CPU_MODEL_MEROM0x0F
32#define CPU_MODEL_PENRYN0x17
33#define CPU_MODEL_NEHALEM0x1A
34#define CPU_MODEL_ATOM0x1C
35#define CPU_MODEL_FIELDS0x1E/* Lynnfield, Clarksfield, Jasper */
36#define CPU_MODEL_DALES0x1F/* Havendale, Auburndale */
37#define CPU_MODEL_DALES_32NM0x25/* Clarkdale, Arrandale */
38#define CPU_MODEL_WESTMERE0x2C/* Gulftown, Westmere-EP, Westmere-WS */
39#define CPU_MODEL_NEHALEM_EX0x2E
40#define CPU_MODEL_WESTMERE_EX0x2F
41
42/* CPU Features */
43// NOTE: Theses are currently mapped to the actual bit in the cpuid value
44#define CPU_FEATURE_MMXbit(23)// MMX Instruction Set
45#define CPU_FEATURE_SSEbit(25)// SSE Instruction Set
46#define CPU_FEATURE_SSE2bit(26)// SSE2 Instruction Set
47#define CPU_FEATURE_SSE3bit(0)// SSE3 Instruction Set
48#define CPU_FEATURE_SSE41bit(19)// SSE41 Instruction Set
49#define CPU_FEATURE_SSE42bit(20)// SSE42 Instruction Set
50#define CPU_FEATURE_EM64Tbit(29)// 64Bit Support
51#define CPU_FEATURE_HTTbit(28)// HyperThreading
52#define CPU_FEATURE_MSRbit(5)// MSR Support
53
54// NOTE: Determine correct bit for bellow (28 is already in use)
55#define CPU_FEATURE_MOBILEbit(1)// Mobile CPU
56
57
58/* SMBIOS Memory Types */
59#define SMB_MEM_TYPE_UNDEFINED0
60#define SMB_MEM_TYPE_OTHER1
61#define SMB_MEM_TYPE_UNKNOWN2
62#define SMB_MEM_TYPE_DRAM3
63#define SMB_MEM_TYPE_EDRAM4
64#define SMB_MEM_TYPE_VRAM5
65#define SMB_MEM_TYPE_SRAM6
66#define SMB_MEM_TYPE_RAM7
67#define SMB_MEM_TYPE_ROM8
68#define SMB_MEM_TYPE_FLASH9
69#define SMB_MEM_TYPE_EEPROM10
70#define SMB_MEM_TYPE_FEPROM11
71#define SMB_MEM_TYPE_EPROM12
72#define SMB_MEM_TYPE_CDRAM13
73#define SMB_MEM_TYPE_3DRAM14
74#define SMB_MEM_TYPE_SDRAM15
75#define SMB_MEM_TYPE_SGRAM16
76#define SMB_MEM_TYPE_RDRAM17
77#define SMB_MEM_TYPE_DDR18
78#define SMB_MEM_TYPE_DDR219
79#define SMB_MEM_TYPE_FBDIMM20
80#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
81
82/* Memory Configuration Types */
83#define SMB_MEM_CHANNEL_UNKNOWN0
84#define SMB_MEM_CHANNEL_SINGLE1
85#define SMB_MEM_CHANNEL_DUAL2
86#define SMB_MEM_CHANNEL_TRIPLE3
87
88/* Maximum number of ram slots */
89#define MAX_RAM_SLOTS8
90#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
91
92/* Maximum number of SPD bytes */
93#define MAX_SPD_SIZE256
94
95/* Size of SMBIOS UUID in bytes */
96#define UUID_LEN16
97
98typedef struct _RamSlotInfo_t {
99 uint32_tModuleSize;// Size of Module in MB
100 uint32_tFrequency; // in Mhz
101 const char*Vendor;
102 const char*PartNo;
103 const char*SerialNo;
104 char*spd;// SPD Dump
105 boolInUse;
106 uint8_tType;
107 uint8_tBankConnections; // table type 6, see (3.3.7)
108 uint8_tBankConnCnt;
109
110} RamSlotInfo_t;
111
112typedef struct _PlatformInfo_t {
113struct CPU {
114uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
115uint32_tVendor;// Vendor
116uint32_tSignature;// Signature
117uint32_tStepping;// Stepping
118uint32_tModel;// Model
119uint32_tExtModel;// Extended Model
120uint32_tFamily;// Family
121uint32_tExtFamily;// Extended Family
122uint32_tNoCores;// No Cores per Package
123uint32_tNoThreads;// Threads per Package
124uint8_tMaxCoef;// Max Multiplier
125uint8_tMaxDiv;
126uint8_tCurrCoef;// Current Multiplier
127uint8_tCurrDiv;
128uint64_tTSCFrequency;// TSC Frequency Hz
129uint64_tFSBFrequency;// FSB Frequency Hz
130uint64_tCPUFrequency;// CPU Frequency Hz
131charBrandString[48];// 48 Byte Branding String
132uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
133} CPU;
134
135struct RAM {
136uint64_tFrequency;// Ram Frequency
137uint32_tDivider;// Memory divider
138uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
139uint8_tTRC;
140uint8_tTRP;
141uint8_tRAS;
142uint8_tChannels;// Channel Configuration Single,Dual or Triple
143uint8_tNoSlots;// Maximum no of slots available
144uint8_tType;// Standard SMBIOS v2.5 Memory Type
145RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
146} RAM;
147
148struct DMI {
149intMaxMemorySlots;// number of memory slots polulated by SMBIOS
150intCntMemorySlots;// number of memory slots counted
151intMemoryModules;// number of memory modules installed
152intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
153} DMI;
154uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
155uint8_t*UUID; // SMBios UUID
156//char*Name;// the Platorm/Product name
157uint32_thardware_signature;
158} PlatformInfo_t;
159
160extern PlatformInfo_t *Platform;
161#endif /* !__LIBSAIO_PLATFORM_H */
162

Archive Download this file

Revision: 789