Chameleon

Chameleon Svn Source Tree

Root/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 index into cpuid_raw */
17#define CPUID_00
18#define CPUID_11
19#define CPUID_22
20#define CPUID_33
21#define CPUID_44
22#define CPUID_805
23#define CPUID_816
24#define CPUID_MAX7
25
26/* CPU Features */
27#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
28#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
29#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
30#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
31#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
32#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
33#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
34#define CPU_FEATURE_HTT0x00000080// HyperThreading
35#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
36#define CPU_FEATURE_MSR0x00000200// MSR Support
37
38/* SMBIOS Memory Types */
39#define SMB_MEM_TYPE_UNDEFINED0
40#define SMB_MEM_TYPE_OTHER1
41#define SMB_MEM_TYPE_UNKNOWN2
42#define SMB_MEM_TYPE_DRAM3
43#define SMB_MEM_TYPE_EDRAM4
44#define SMB_MEM_TYPE_VRAM5
45#define SMB_MEM_TYPE_SRAM6
46#define SMB_MEM_TYPE_RAM7
47#define SMB_MEM_TYPE_ROM8
48#define SMB_MEM_TYPE_FLASH9
49#define SMB_MEM_TYPE_EEPROM10
50#define SMB_MEM_TYPE_FEPROM11
51#define SMB_MEM_TYPE_EPROM12
52#define SMB_MEM_TYPE_CDRAM13
53#define SMB_MEM_TYPE_3DRAM14
54#define SMB_MEM_TYPE_SDRAM15
55#define SMB_MEM_TYPE_SGRAM16
56#define SMB_MEM_TYPE_RDRAM17
57#define SMB_MEM_TYPE_DDR18
58#define SMB_MEM_TYPE_DDR219
59#define SMB_MEM_TYPE_FBDIMM20
60#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
61
62/* Memory Configuration Types */
63#define SMB_MEM_CHANNEL_UNKNOWN0
64#define SMB_MEM_CHANNEL_SINGLE1
65#define SMB_MEM_CHANNEL_DUAL2
66#define SMB_MEM_CHANNEL_TRIPLE3
67
68/* Maximum number of ram slots */
69#define MAX_RAM_SLOTS8
70#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
71
72/* Maximum number of SPD bytes */
73#define MAX_SPD_SIZE256
74
75/* Size of SMBIOS UUID in bytes */
76#define UUID_LEN16
77
78typedef struct _RamSlotInfo_t {
79 uint32_tModuleSize;// Size of Module in MB
80 uint32_tFrequency; // in Mhz
81 const char*Vendor;
82 const char*PartNo;
83 const char*SerialNo;
84 char*spd;// SPD Dump
85 boolInUse;
86 uint8_tType;
87 uint8_tBankConnections; // table type 6, see (3.3.7)
88 uint8_tBankConnCnt;
89
90} RamSlotInfo_t;
91
92typedef struct _PlatformInfo_t {
93struct CPU {
94uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
95uint32_tVendor;// Vendor
96uint32_tModel;// Model
97uint32_tExtModel;// Extended Model
98uint32_tFamily;// Family
99uint32_tExtFamily;// Extended Family
100uint32_tNoCores;// No Cores per Package
101uint32_tNoThreads;// Threads per Package
102uint8_tMaxCoef;// Max Multiplier
103uint8_tMaxDiv;
104uint8_tCurrCoef;// Current Multiplier
105uint8_tCurrDiv;
106uint64_tTSCFrequency;// TSC Frequency Hz
107uint64_tFSBFrequency;// FSB Frequency Hz
108uint64_tCPUFrequency;// CPU Frequency Hz
109uint32_tBrandString[16];// 48 Byte Branding String
110uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
111} CPU;
112
113struct RAM {
114uint64_tFrequency;// Ram Frequency
115uint32_tDivider;// Memory divider
116uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
117uint8_tTRC;
118uint8_tTRP;
119uint8_tRAS;
120uint8_tChannels;// Channel Configuration Single,Dual or Triple
121uint8_tNoSlots;// Maximum no of slots available
122uint8_tType;// Standard SMBIOS v2.5 Memory Type
123RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
124} RAM;
125
126struct DMI {
127intMaxMemorySlots;// number of memory slots polulated by SMBIOS
128intCntMemorySlots;// number of memory slots counted
129intMemoryModules;// number of memory modules installed
130intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
131} DMI;
132uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
133} PlatformInfo_t;
134
135extern PlatformInfo_t Platform;
136
137#endif /* !__LIBSAIO_PLATFORM_H */
138

Archive Download this file

Revision: 226