Chameleon

Chameleon Svn Source Tree

Root/branches/meklortOld/i386/libsaio/platform.h

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

Archive Download this file

Revision: 1146