Chameleon

Chameleon Svn Source Tree

Root/tags/2.1/i386/libsaio/platform.h

Source at commit 2381 created 10 years 21 days ago.
By ifabio, Apply patch: (Credits to Thomas Jansen aka tja) - Reading options from all devices during boot. The options for the boot menu are only read from the devices rd(0,0) or bt(0,0). Consequently, boot menu options (e.g. "Quiet Boot", "Timeout", etc.) in plists on other devices (like most users have) are ignored. This patch extends the list of paths to search for the options plist on all devices that can be found.
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 Vendor */
17#define CPUID_VENDOR_INTEL 0x756E6547
18#define CPUID_VENDOR_AMD 0x68747541
19
20/* CPUID index into cpuid_raw */
21#define CPUID_00
22#define CPUID_11
23#define CPUID_22
24#define CPUID_33
25#define CPUID_44
26#define CPUID_55
27#define CPUID_66
28#define CPUID_807
29#define CPUID_818
30#define CPUID_889
31#define CPUID_MAX10
32
33#define CPU_MODEL_DOTHAN0x0D// Dothan
34#define CPU_MODEL_YONAH0x0E// Sossaman, Yonah
35#define CPU_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
36#define CPU_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
37#define CPU_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
38#define CPU_MODEL_ATOM0x1C// Atom
39#define CPU_MODEL_FIELDS0x1E// Lynnfield, Clarksfield, Jasper Forest
40#define CPU_MODEL_DALES0x1F// Havendale, Auburndale
41#define CPU_MODEL_DALES_32NM0x25// Clarkdale, Arrandale
42#define CPU_MODEL_SANDYBRIDGE0x2A// Sandy Bridge
43#define CPU_MODEL_WESTMERE0x2C// Gulftown, Westmere-EP, Westmere-WS
44#define CPU_MODEL_JAKETOWN0x2D// Sandy Bridge-E, Sandy Bridge-EP
45#define CPU_MODEL_NEHALEM_EX0x2E// Beckton
46#define CPU_MODEL_WESTMERE_EX0x2F
47#define CPU_MODEL_IVYBRIDGE0x3A// Ivy Bridge
48
49/* CPU Features */
50#define CPU_FEATURE_MMX0x00000001// MMX Instruction Set
51#define CPU_FEATURE_SSE0x00000002// SSE Instruction Set
52#define CPU_FEATURE_SSE20x00000004// SSE2 Instruction Set
53#define CPU_FEATURE_SSE30x00000008// SSE3 Instruction Set
54#define CPU_FEATURE_SSE410x00000010// SSE41 Instruction Set
55#define CPU_FEATURE_SSE420x00000020// SSE42 Instruction Set
56#define CPU_FEATURE_EM64T0x00000040// 64Bit Support
57#define CPU_FEATURE_HTT0x00000080// HyperThreading
58#define CPU_FEATURE_MOBILE0x00000100// Mobile CPU
59#define CPU_FEATURE_MSR0x00000200// MSR Support
60
61/* SMBIOS Memory Types */
62#define SMB_MEM_TYPE_UNDEFINED0
63#define SMB_MEM_TYPE_OTHER1
64#define SMB_MEM_TYPE_UNKNOWN2
65#define SMB_MEM_TYPE_DRAM3
66#define SMB_MEM_TYPE_EDRAM4
67#define SMB_MEM_TYPE_VRAM5
68#define SMB_MEM_TYPE_SRAM6
69#define SMB_MEM_TYPE_RAM7
70#define SMB_MEM_TYPE_ROM8
71#define SMB_MEM_TYPE_FLASH9
72#define SMB_MEM_TYPE_EEPROM10
73#define SMB_MEM_TYPE_FEPROM11
74#define SMB_MEM_TYPE_EPROM12
75#define SMB_MEM_TYPE_CDRAM13
76#define SMB_MEM_TYPE_3DRAM14
77#define SMB_MEM_TYPE_SDRAM15
78#define SMB_MEM_TYPE_SGRAM16
79#define SMB_MEM_TYPE_RDRAM17
80#define SMB_MEM_TYPE_DDR18
81#define SMB_MEM_TYPE_DDR219
82#define SMB_MEM_TYPE_FBDIMM20
83#define SMB_MEM_TYPE_DDR324// Supported in 10.5.6+ AppleSMBIOS
84
85/* Memory Configuration Types */
86#define SMB_MEM_CHANNEL_UNKNOWN0
87#define SMB_MEM_CHANNEL_SINGLE1
88#define SMB_MEM_CHANNEL_DUAL2
89#define SMB_MEM_CHANNEL_TRIPLE3
90
91/* Maximum number of ram slots */
92#define MAX_RAM_SLOTS8
93#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
94
95/* Maximum number of SPD bytes */
96#define MAX_SPD_SIZE256
97
98/* Size of SMBIOS UUID in bytes */
99#define UUID_LEN16
100
101typedef struct _RamSlotInfo_t {
102 uint32_tModuleSize;// Size of Module in MB
103 uint32_tFrequency;// in Mhz
104 const char*Vendor;
105 const char*PartNo;
106 const char*SerialNo;
107 char*spd;// SPD Dump
108 boolInUse;
109 uint8_tType;
110 uint8_tBankConnections;// table type 6, see (3.3.7)
111 uint8_tBankConnCnt;
112} RamSlotInfo_t;
113
114typedef struct _PlatformInfo_t {
115struct CPU {
116uint32_tFeatures;// CPU Features like MMX, SSE2, VT, MobileCPU
117uint32_tVendor;// Vendor
118uint32_tSignature;// Signature
119uint32_tStepping;// Stepping
120uint32_tModel;// Model
121uint32_tExtModel;// Extended Model
122uint32_tFamily;// Family
123uint32_tExtFamily;// Extended Family
124uint32_tNoCores;// No Cores per Package
125uint32_tNoThreads;// Threads per Package
126uint8_tMaxCoef;// Max Multiplier
127uint8_tMaxDiv;
128uint8_tCurrCoef;// Current Multiplier
129uint8_tCurrDiv;
130uint64_tTSCFrequency;// TSC Frequency Hz
131uint64_tFSBFrequency;// FSB Frequency Hz
132uint64_tCPUFrequency;// CPU Frequency Hz
133uint32_tMaxRatio;// Max Bus Ratio
134uint32_tMinRatio;// Min Bus Ratio
135charBrandString[48];// 48 Byte Branding String
136uint32_tCPUID[CPUID_MAX][4];// CPUID 0..4, 80..81 Raw Values
137} CPU;
138
139struct RAM {
140uint64_tFrequency;// Ram Frequency
141uint32_tDivider;// Memory divider
142uint8_tCAS;// CAS 1/2/2.5/3/4/5/6/7
143uint8_tTRC;
144uint8_tTRP;
145uint8_tRAS;
146uint8_tChannels;// Channel Configuration Single,Dual or Triple
147uint8_tNoSlots;// Maximum no of slots available
148uint8_tType;// Standard SMBIOS v2.5 Memory Type
149RamSlotInfo_tDIMM[MAX_RAM_SLOTS];// Information about each slot
150} RAM;
151
152struct DMI {
153intMaxMemorySlots;// number of memory slots populated by SMBIOS
154intCntMemorySlots;// number of memory slots counted
155intMemoryModules;// number of memory modules installed
156intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
157} DMI;
158
159uint8_tType; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
160uint8_t*UUID;
161} PlatformInfo_t;
162
163extern PlatformInfo_t Platform;
164
165#endif /* !__LIBSAIO_PLATFORM_H */
166

Archive Download this file

Revision: 2381