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#include "cpuid.h"
12#include "cpu_data.h"
13
14extern bool platformCPUExtFeature(uint32_t);
15extern bool platformCPUFeature(uint32_t);
16extern void scan_platform(void);
17
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#define quad(hi,lo) (((uint64_t)(hi)) << 32 | (lo))
22
23
24/* CPUID index into cpuid_raw */
25/*
26#define CPUID_00
27#define CPUID_11
28#define CPUID_22
29#define CPUID_33
30#define CPUID_44
31#define CPUID_55
32#define CPUID_66
33#define CPUID_807
34#define CPUID_818
35#define CPUID_B09
36#define CPUID_B110
37#define CPUID_MAX11
38*/
39
40/* Additional models supported by Chameleon (NOT SUPPORTED BY THE APPLE'S ORIGINAL KERNEL) */
41#define CPUID_MODEL_BANIAS 0x09
42#define CPUID_MODEL_DOTHAN 0x0D
43#define CPUID_MODEL_ATOM0x1C
44
45/* SMBIOS Memory Types */
46#define SMB_MEM_TYPE_UNDEFINED0
47#define SMB_MEM_TYPE_OTHER1
48#define SMB_MEM_TYPE_UNKNOWN2
49#define SMB_MEM_TYPE_DRAM3
50#define SMB_MEM_TYPE_EDRAM4
51#define SMB_MEM_TYPE_VRAM5
52#define SMB_MEM_TYPE_SRAM6
53#define SMB_MEM_TYPE_RAM7
54#define SMB_MEM_TYPE_ROM8
55#define SMB_MEM_TYPE_FLASH9
56#define SMB_MEM_TYPE_EEPROM10
57#define SMB_MEM_TYPE_FEPROM11
58#define SMB_MEM_TYPE_EPROM12
59#define SMB_MEM_TYPE_CDRAM13
60#define SMB_MEM_TYPE_3DRAM14
61#define SMB_MEM_TYPE_SDRAM15
62#define SMB_MEM_TYPE_SGRAM16
63#define SMB_MEM_TYPE_RDRAM17
64#define SMB_MEM_TYPE_DDR18
65#define SMB_MEM_TYPE_DDR219
66#define SMB_MEM_TYPE_FBDIMM20
67#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
68
69/* Memory Configuration Types */
70#define SMB_MEM_CHANNEL_UNKNOWN0
71#define SMB_MEM_CHANNEL_SINGLE1
72#define SMB_MEM_CHANNEL_DUAL2
73#define SMB_MEM_CHANNEL_TRIPLE3
74
75/* Maximum number of ram slots */
76#define MAX_RAM_SLOTS8
77#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
78
79/* Maximum number of SPD bytes */
80#define MAX_SPD_SIZE256
81
82/* Size of SMBIOS UUID in bytes */
83#define UUID_LEN16
84
85typedef struct _RamSlotInfo_t {
86 uint32_tModuleSize;// Size of Module in MB
87 uint32_tFrequency; // in Mhz
88 const char*Vendor;
89 const char*PartNo;
90 const char*SerialNo;
91 char*spd;// SPD Dump
92 boolInUse;
93 uint8_tType;
94 uint8_tBankConnections; // table type 6, see (3.3.7)
95 uint8_tBankConnCnt;
96
97} RamSlotInfo_t;
98
99
100
101typedef struct _PlatformInfo_t {
102
103 struct CPU_t {
104 uint64_tFeatures;// CPU Features like MMX, SSE2, VT ...
105 uint64_tExtFeatures; // CPU Extended Features like SYSCALL, XD, EM64T, LAHF ...
106 uint32_tVendor;// Vendor
107 uint32_tSignature;// Signature
108 uint8_t Stepping;// Stepping
109 uint8_t Model;// Model
110 uint8_t ExtModel;// Extended Model
111 uint8_t Family;// Family
112 uint8_t ExtFamily;// Extended Family
113 uint32_tNoCores;// No Cores per Package
114 uint32_tNoThreads;// Threads per Package
115 uint8_tMaxCoef;// Max Multiplier
116 uint8_tMaxDiv;
117 uint8_tCurrCoef;// Current Multiplier
118 uint8_tCurrDiv;
119 uint64_tTSCFrequency;// TSC Frequency Hz
120 uint64_tFSBFrequency;// FSB Frequency Hz
121 uint64_tCPUFrequency;// CPU Frequency Hz
122 charBrandString[48];// 48 Byte Branding String
123 uint8_t Brand;
124 uint32_tMicrocodeVersion; // The microcode version number a.k.a. signature a.k.a. BIOS ID
125
126 bool isMobile;
127 bool isServer;// Unlike isMobile, if this value is set it will disable all kind of detection and enforce "Server" as platform (must be set by user)
128
129 boolean_tdynamic_acceleration;
130 boolean_tinvariant_APIC_timer;
131 boolean_tfine_grain_clock_mod;
132
133 uint32_t cpuid_max_basic;
134uint32_t cpuid_max_ext;
135 uint32_tsub_Cstates;
136 uint32_t extensions;
137
138 } CPU;
139
140 struct RAM_t {
141 uint64_tFrequency;// Ram Frequency
142 uint32_tDivider;// Memory divider
143 uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
144 uint8_tTRC;
145 uint8_tTRP;
146 uint8_tRAS;
147 uint8_tChannels;// Channel Configuration Single,Dual or Triple
148 uint8_tNoSlots;// Maximum no of slots available
149 uint8_tType;// Standard SMBIOS v2.5 Memory Type
150 RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
151 } RAM;
152
153 struct DMI {
154 intMaxMemorySlots;// number of memory slots polulated by SMBIOS
155 intCntMemorySlots;// number of memory slots counted
156 intMemoryModules;// number of memory modules installed
157 intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
158 } DMI;
159
160uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PreferredProfile)
161uint8_t*UUID; // SMBios UUID
162uint32_thardware_signature;
163int8_tsysid[16];
164
165} PlatformInfo_t;
166
167extern PlatformInfo_t *Platform;
168#endif /* !__LIBSAIO_PLATFORM_H */
169

Archive Download this file

Revision: 1525