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

Archive Download this file

Revision: 1972