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
14#define bitmask(h,l)((_Bit(h)|(_Bit(h)-1)) & ~(_Bit(l)-1))
15#define bitfield(x,h,l)(((x) & bitmask(h,l)) >> l)
16
17#define quad(hi,lo) (((uint64_t)(hi)) << 32 | (lo))
18
19/* Only for 32bit values */
20#define bit32(n)(1U << (n))
21#define bitmask32(h,l)((bit32(h)|(bit32(h)-1)) & ~(bit32(l)-1))
22#define bitfield32(x,h,l)((((x) & bitmask32(h,l)) >> l))
23
24/* Additional models supported by Chameleon (NOT SUPPORTED BY THE APPLE'S ORIGINAL KERNEL) */
25#define CPUID_MODEL_BANIAS 0x09
26#define CPUID_MODEL_DOTHAN 0x0D
27#define CPUID_MODEL_ATOM0x1C
28
29/* CPUID Vendor */
30#define CPUID_VENDOR_INTEL 0x756E6547
31#define CPUID_VENDOR_AMD 0x68747541
32
33/* SMBIOS Memory Types */
34#define SMB_MEM_TYPE_UNDEFINED0
35#define SMB_MEM_TYPE_OTHER1
36#define SMB_MEM_TYPE_UNKNOWN2
37#define SMB_MEM_TYPE_DRAM3
38#define SMB_MEM_TYPE_EDRAM4
39#define SMB_MEM_TYPE_VRAM5
40#define SMB_MEM_TYPE_SRAM6
41#define SMB_MEM_TYPE_RAM7
42#define SMB_MEM_TYPE_ROM8
43#define SMB_MEM_TYPE_FLASH9
44#define SMB_MEM_TYPE_EEPROM10
45#define SMB_MEM_TYPE_FEPROM11
46#define SMB_MEM_TYPE_EPROM12
47#define SMB_MEM_TYPE_CDRAM13
48#define SMB_MEM_TYPE_3DRAM14
49#define SMB_MEM_TYPE_SDRAM15
50#define SMB_MEM_TYPE_SGRAM16
51#define SMB_MEM_TYPE_RDRAM17
52#define SMB_MEM_TYPE_DDR18
53#define SMB_MEM_TYPE_DDR219
54#define SMB_MEM_TYPE_FBDIMM20
55#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
56
57/* Memory Configuration Types */
58#define SMB_MEM_CHANNEL_UNKNOWN0
59#define SMB_MEM_CHANNEL_SINGLE1
60#define SMB_MEM_CHANNEL_DUAL2
61#define SMB_MEM_CHANNEL_TRIPLE3
62
63/* Maximum number of ram slots */
64#define MAX_RAM_SLOTS8
65#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
66
67/* Maximum number of SPD bytes */
68#define MAX_SPD_SIZE256
69
70typedef struct _RamSlotInfo_t {
71 uint32_tModuleSize;// Size of Module in MB
72 uint32_tFrequency; // in Mhz
73 const char*Vendor;
74 const char*PartNo;
75 const char*SerialNo;
76 char*spd;// SPD Dump
77 boolInUse;
78 uint8_tType;
79 uint8_tBankConnections; // table type 6, see (3.3.7)
80 uint8_tBankConnCnt;
81
82} RamSlotInfo_t;
83
84#define envVendor "boot.cpu.vendor"
85#define envFamily "boot.cpu.family"
86
87#define envCPUIDMaxBasic "boot.cpu.max_basic"
88#define envCPUIDMaxExt "boot.cpu.max_ext"
89#define envMicrocodeVersion "boot.cpu.microcode_version"
90#define envSignature "boot.cpu.signature"
91#define envStepping "boot.cpu.stepping"
92#define envModel "boot.cpu.model"
93#define envBrandString "boot.cpu.brand_string"
94#define envNoThreads "boot.cpu.logical_per_package"
95#define envNoCores "boot.cpu.cores_per_package"
96#define envExtModel "boot.cpu.extmodel"
97#define envExtFamily "boot.cpu.extfamily"
98#define envBrand "boot.cpu.brand"
99#define envFeatures "boot.cpu.feature_bits"
100#define envExtFeatures "boot.cpu.extfeature_bits"
101#define envCacheSize "boot.cpu.cache_size" //cache_size[LCACHE_MAX]
102#define envCacheLinesize "boot.cpu.cache_linesize"
103#define envLeaf7Features "boot.cpu.cpuid_leaf7_features"
104#define cpuid_features() ((uint32_t)get_env(envFeatures))
105#define cpuid_leaf7_features() ((uint32_t)get_env(envLeaf7Features))
106#define envTSC__ "boot.cpu.__tsc"
107
108#define envSubCstates "boot.cpu.mwait.sub_Cstates"
109#define envExtensions "boot.cpu.mwait.extensions"
110
111#define envDynamicAcceleration "boot.cpu.thermal.dynamic_acceleration"
112#define envInvariantAPICTimer "boot.cpu.thermal.invariant_APIC_timer"
113#define envFineGrainClockMod "boot.cpu.thermal.fine_grain_clock_mod"
114
115#define envIsMobile "boot.hw.is_mobile"
116#define envMaxCoef "boot.hw.maxcoef"
117#define envMaxDiv "boot.hw.maxdiv"
118#define envCurrCoef "boot.hw.currcoef"
119#define envCurrDiv "boot.hw.currdiv"
120#define envTSCFreq "boot.hw.tscfrequency"
121#define envFSBFreq "boot.hw.busfrequency"
122#define envCPUFreq "boot.hw.cpufrequency"
123#define envIsServer "boot.hw.is_server"
124#define envHardwareSignature "boot.hw.signature"
125#define envType "boot.hw.type"
126#define envUUID "boot.hw.uuid_ptr"
127#define envSysId "boot.hw.sysid"
128#define envgBIOSDev "boot.hw.bios_device"
129#define envgDeviceCount "boot.hw.device_count"
130#define envarchCpuType"boot.hw.cputype"
131
132#define envPCIRootDev "boot.hw.pci_root_dev"
133
134#define envgHaveKernelCache"boot.kern.HaveKernelCache"
135#define envAdler32"boot.kern.adler32"
136#define envkCacheFile "boot.kern.kernelcache"
137#define envMKextName "boot.kern.mkextcache"
138#define envArgCntRemaining "boot.kern.argCount_remaining"
139#define envgBootArgs"boot.kern.boot_args"
140
141#define envgBootMode "boot.options.boot_mode"
142#define envSysConfigValid "boot.options.sysconfing_valid"
143#define envgOverrideKernel "boot.options.kernel_overide"
144#define envgEnableCDROMRescan "boot.options.rescan_cdrom"
145#define envgScanSingleDrive "boot.options.single_drive"
146#define envShouldboot "boot.options.should_boot"
147#define envgVerboseMode "boot.options.boot_verbose"
148
149#define envDriverExtSpec "boot.drivers.extspec"
150#define envDriverSpec "boot.drivers.spec"
151#define envDriverFileSpec "boot.drivers.filespec"
152#define envDriverTempSpec "boot.drivers.tempspec"
153#define envDriverFileName "boot.drivers.filename"
154
155#define envBootBanner "boot.ui.banner"
156#define envBootPrompt "boot.ui.prompt"
157#define envBootRescanPrompt "boot.ui.promptrescan"
158
159#define envgMenuRow "boot.ui.menu_row"
160#define envgMenuHeight "boot.ui.menu_height"
161#define envgMenuItemCount "boot.ui.menu_itemcount"
162#define envgMenuTop "boot.ui.menu_top"
163#define envgMenuBottom "boot.ui.menu_bottom"
164#define envgMenuSelection "boot.ui.menu_selection"
165#define envgMenuStart "boot.ui.menu_start"
166#define envgMenuEnd "boot.ui.menu_end"
167
168#define envConsoleErr"boot.console.stderr"
169#define envErrno "boot.errno"
170
171#define envDeviceNumber "boot.dev.efi.devcount"
172#define envEFIString "boot.dev.efi.efistring"
173
174#define envgBootFileType"boot.disk.Bootfiletype"
175#define envHFSLoadVerbose"boot.disk.HFSLoadVerbose"
176#define envgFSLoadAddress"boot.disk.FSLoadAddress"
177#define envgBIOSBootVolume"boot.disk.BIOSBootVolume"
178#define envgBootVolume"boot.disk.BootVolume"
179
180#define envConvMem "boot.memmap.Conventional"
181#define envExtMem "boot.memmap.Extended"
182#define envMemoryMap "boot.memmap.Address"
183#define envMemoryMapCnt "boot.memmap.Count"
184#define envMemoryMapNode "boot.memmap.devNode"
185
186#define envRamFrequency "boot.ram.frequency"
187#define envRamCas "boot.ram.tCAS"
188#define envRamTrc "boot.ram.tRCD"
189#define envRamRas "boot.ram.tRAS"
190#define envRamTrp "boot.ram.tRP"
191#define envRamChannels "boot.ram.channels"
192#define envRamType "boot.ram.type"
193#define envRamDimm "boot.ram.dimm"
194
195#define envDMIMemModules "boot.dmi.memory_modules"
196#define envDMIMaxMemorySlots "boot.dmi.max_slots"
197#define envDMICntMemorySlots "boot.dmi.slots_count"
198#define envDmiDimm "boot.dmi.dimm"
199
200#define envVBEModeInfoBlock"boot.video.VBEModeInfoBlock"
201
202/* helpers ... */
203//#define set_errno(x) safe_set_env(envErrno,x)
204//#define get_errno() ((int)get_env(envErrno))
205
206#if UNUSED
207typedef struct _PlatformInfo_t {
208
209 struct CPU_t {
210 uint64_tFeatures;// CPU Features like MMX, SSE2, VT ...
211 uint64_tExtFeatures; // CPU Extended Features like SYSCALL, XD, EM64T, LAHF ...
212 uint32_tVendor;// Vendor
213 uint32_tSignature;// Signature
214 uint8_t Stepping;// Stepping
215 uint8_t Model;// Model
216 uint8_t ExtModel;// Extended Model
217 uint8_t Family;// Family
218 uint8_t ExtFamily;// Extended Family
219 uint32_tNoCores;// No Cores per Package
220 uint32_tNoThreads;// Threads per Package
221 uint8_tMaxCoef;// Max Multiplier
222 uint8_tMaxDiv;
223 uint8_tCurrCoef;// Current Multiplier
224 uint8_tCurrDiv;
225 uint64_tTSCFrequency;// TSC Frequency Hz
226 uint64_tFSBFrequency;// FSB Frequency Hz
227 uint64_tCPUFrequency;// CPU Frequency Hz
228 charBrandString[48];// 48 Byte Branding String
229 uint8_t Brand;
230 uint32_tMicrocodeVersion; // The microcode version number a.k.a. signature a.k.a. BIOS ID
231
232 bool isMobile;
233 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)
234
235 boolean_tdynamic_acceleration;
236 boolean_tinvariant_APIC_timer;
237 boolean_tfine_grain_clock_mod;
238
239 uint32_t cpuid_max_basic;
240uint32_t cpuid_max_ext;
241 uint32_tsub_Cstates;
242 uint32_t extensions;
243
244 } CPU;
245
246 struct RAM_t {
247 uint64_tFrequency;// Ram Frequency
248 uint32_tDivider;// Memory divider
249 uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
250 uint8_tTRC;
251 uint8_tTRP;
252 uint8_tRAS;
253 uint8_tChannels;// Channel Configuration Single,Dual or Triple
254 uint8_tNoSlots;// Maximum no of slots available
255 uint8_tType;// Standard SMBIOS v2.5 Memory Type
256 RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
257 } RAM;
258
259 struct DMI {
260 intMaxMemorySlots;// number of memory slots polulated by SMBIOS
261 intCntMemorySlots;// number of memory slots counted
262 intMemoryModules;// number of memory modules installed
263 intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
264 } DMI;
265
266uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PreferredProfile)
267uint8_t*UUID; // SMBios UUID
268uint32_thardware_signature;
269int8_tsysid[16];
270
271} PlatformInfo_t;
272#endif
273
274#endif /* !__LIBSAIO_PLATFORM_H */
275

Archive Download this file

Revision: 2182