Chameleon

Chameleon Svn Source Tree

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

  • Property svn:executable set to
1/*
2 * platform.h
3 * AsereBLN: reworked and extended
4 *valv: further additions
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/* CPU Features */
32// NOTE: These are currently mapped to the actual bit in the cpuid value
33#define CPU_FEATURE_MMXbit(23)// MMX Instruction Set
34#define CPU_FEATURE_SSEbit(25)// SSE Instruction Set
35#define CPU_FEATURE_SSE2bit(26)// SSE2 Instruction Set
36#define CPU_FEATURE_SSE3bit(0)// SSE3 Instruction Set
37#define CPU_FEATURE_SSE41bit(19)// SSE41 Instruction Set
38#define CPU_FEATURE_SSE42bit(20)// SSE42 Instruction Set
39#define CPU_FEATURE_EM64Tbit(29)// 64Bit Support
40#define CPU_FEATURE_HTTbit(28)// HyperThreading
41#define CPU_FEATURE_MSRbit(5)// MSR Support
42#define CPU_FEATURE_APICbit(9)// On-chip APIC Hardware
43#define CPU_FEATURE_ESTbit(7)// Enhanced Intel SpeedStep
44#define CPU_FEATURE_TM2bit(8)// Thermal Monitor 2
45#define CPU_FEATURE_TM1bit(29)// Thermal Monitor 1
46#define CPU_FEATURE_SSSE3bit(9)// Supplemental SSE3 Instruction Set
47#define CPU_FEATURE_xAPICbit(21)// Extended APIC Mode
48#define CPU_FEATURE_ACPIbit(22)// Thermal Monitor and Software Controlled Clock
49#define CPU_FEATURE_LAHFbit(20)// LAHF/SAHF Instructions
50#define CPU_FEATURE_XDbit(20)// Execute Disable
51
52// NOTE: Determine correct bit for below (28 is already in use)
53#define CPU_FEATURE_MOBILEbit(1)// Mobile CPU
54
55
56/* SMBIOS Memory Types */
57#define SMB_MEM_TYPE_UNDEFINED0
58#define SMB_MEM_TYPE_OTHER1
59#define SMB_MEM_TYPE_UNKNOWN2
60#define SMB_MEM_TYPE_DRAM3
61#define SMB_MEM_TYPE_EDRAM4
62#define SMB_MEM_TYPE_VRAM5
63#define SMB_MEM_TYPE_SRAM6
64#define SMB_MEM_TYPE_RAM7
65#define SMB_MEM_TYPE_ROM8
66#define SMB_MEM_TYPE_FLASH9
67#define SMB_MEM_TYPE_EEPROM10
68#define SMB_MEM_TYPE_FEPROM11
69#define SMB_MEM_TYPE_EPROM12
70#define SMB_MEM_TYPE_CDRAM13
71#define SMB_MEM_TYPE_3DRAM14
72#define SMB_MEM_TYPE_SDRAM15
73#define SMB_MEM_TYPE_SGRAM16
74#define SMB_MEM_TYPE_RDRAM17
75#define SMB_MEM_TYPE_DDR18
76#define SMB_MEM_TYPE_DDR219
77#define SMB_MEM_TYPE_FBDIMM20
78#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
79
80/* Memory Configuration Types */
81#define SMB_MEM_CHANNEL_UNKNOWN0
82#define SMB_MEM_CHANNEL_SINGLE1
83#define SMB_MEM_CHANNEL_DUAL2
84#define SMB_MEM_CHANNEL_TRIPLE3
85
86/* Maximum number of ram slots */
87#define MAX_RAM_SLOTS8
88#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
89
90/* Maximum number of SPD bytes */
91#define MAX_SPD_SIZE256
92
93/* Size of SMBIOS UUID in bytes */
94#define UUID_LEN16
95
96typedef struct _RamSlotInfo_t {
97 uint32_tModuleSize;// Size of Module in MB
98 uint32_tFrequency; // in Mhz
99 const char*Vendor;
100 const char*PartNo;
101 const char*SerialNo;
102 char*spd;// SPD Dump
103 boolInUse;
104 uint8_tType;
105 uint8_tBankConnections; // table type 6, see (3.3.7)
106 uint8_tBankConnCnt;
107
108} RamSlotInfo_t;
109
110typedef struct _PlatformInfo_t {
111struct CPU {
112uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
113uint32_tVendor;// Vendor
114uint32_tSignature;// Signature
115uint32_tStepping;// Stepping
116uint32_tModel;// Model
117uint32_tType;// Processor Type
118uint32_tExtModel;// Extended Model
119uint32_tFamily;// Family
120uint32_tExtFamily;// Extended Family
121uint32_tNoCores;// No Cores per Package
122uint32_tNoThreads;// Threads per Package
123uint8_tMaxDiv;// Max Halving ID
124uint8_tCurrDiv;// Current Halving ID
125uint64_tTSCFrequency;// TSC Frequency Hz
126uint64_tFSBFrequency;// FSB Frequency Hz
127uint64_tCPUFrequency;// CPU Frequency Hz
128uint32_tMaxRatio;// Max Bus Ratio
129uint32_tMinRatio;// Min Bus Ratio
130uint8_tTone;// Turbo Ratio limit (1 core)
131uint8_tTtwo;// Turbo Ratio limit (2 cores)
132uint8_tTthr;// Turbo Ratio limit (3 cores)
133uint8_tTfor;// Turbo Ratio limit (4 cores)
134boolISerie;// Intel's Core-i model
135boolTurbo;// Intel's Turbo Boost support
136uint8_tSLFM;// Dynamic FSB
137uint8_tEST;// Enhanced SpeedStep
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 polulated 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)
163
164} PlatformInfo_t;
165
166extern PlatformInfo_t Platform;
167
168#endif /* !__LIBSAIO_PLATFORM_H */
169

Archive Download this file

Revision: 665