Root/
Source at commit HEAD created 5 years 6 days ago. By ifabio, Few update to kernelPatcher (Credits to CrazyBirdy) | |
---|---|
1 | /*␊ |
2 | * SMBIOS Table Patcher, part of the Chameleon Boot Loader Project␊ |
3 | *␊ |
4 | * Copyright 2010 by Islam M. Ahmed Zaid. All rights reserved.␊ |
5 | *␊ |
6 | */␊ |
7 | ␊ |
8 | #include "config.h"␊ |
9 | #include "boot.h"␊ |
10 | #include "bootstruct.h"␊ |
11 | #include "smbios_getters.h"␊ |
12 | // Bungo␊ |
13 | #include "convert.h"␊ |
14 | ␊ |
15 | #if DEBUG_SMBIOS␊ |
16 | #define DBG(x...)␉printf(x)␊ |
17 | #else␊ |
18 | #define DBG(x...)␉msglog(x)␊ |
19 | #endif␊ |
20 | ␊ |
21 | #define SMBPlist␉␉␉&bootInfo->smbiosConfig␊ |
22 | /* ASSUMPTION: 16KB should be enough for the whole thing */␊ |
23 | #define SMB_ALLOC_SIZE␉16384␊ |
24 | ␊ |
25 | ␊ |
26 | //-------------------------------------------------------------------------------------------------------------------------␊ |
27 | // SMBIOS Plist Keys␊ |
28 | //-------------------------------------------------------------------------------------------------------------------------␊ |
29 | ␊ |
30 | /* =======================␊ |
31 | BIOS Information (Type 0)␊ |
32 | ========================= */␊ |
33 | #define kSMBBIOSInformationVendorKey␉␉␉"SMbiosvendor"␉␉// Apple Inc.␊ |
34 | #define kSMBBIOSInformationVersionKey␉␉␉"SMbiosversion"␉␉// MP31.88Z.006C.B05.0802291410␊ |
35 | #define kSMBBIOSInformationReleaseDateKey␉␉"SMbiosdate"␉␉// 02/29/08␊ |
36 | // Bungo␊ |
37 | #define kSMBBIOSInformationReleaseKey␉␉␉"SMbiosrelease"␉␉// BIOS Revision␊ |
38 | // example: BIOS Revision: 1.23 --> 2 bytes: Major=0x01, Minor=0x17 --> after swap: 0x1701hex = 5889dec (SMBIOS_spec_DSP0134_2.7.1)␊ |
39 | ␊ |
40 | /* =========================␊ |
41 | System Information (Type 1)␊ |
42 | =========================== */␊ |
43 | #define kSMBSystemInformationManufacturerKey␉␉"SMmanufacturer"␉// Apple Inc.␊ |
44 | #define kSMBSystemInformationProductNameKey␉␉"SMproductname"␉␉// MacPro3,1␊ |
45 | #define kSMBSystemInformationVersionKey␉␉␉"SMsystemversion"␉// 1.0␊ |
46 | #define kSMBSystemInformationSerialNumberKey␉␉"SMserial"␉␉// Serial number␊ |
47 | //Bungo␊ |
48 | #define kSMBSystemInformationUUIDKey␉␉␉"SMsystemuuid"␉␉// ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }'␊ |
49 | #define kSMBSystemInformationSKUNumberKey␉␉"SMskunumber"␉␉// System SKU#␊ |
50 | ␊ |
51 | #define kSMBSystemInformationFamilyKey␉␉␉"SMfamily"␉␉// MacPro␊ |
52 | ␊ |
53 | /* =========================================␊ |
54 | Base Board (or Module) Information (Type 2)␊ |
55 | =========================================== */␊ |
56 | #define kSMBBaseBoardManufacturerKey␉␉␉"SMboardmanufacturer"␉// Apple Inc.␊ |
57 | #define kSMBBaseBoardProductKey␉␉␉␉"SMboardproduct"␉// Mac-F2268DC8␊ |
58 | // Bungo␊ |
59 | #define kSMBBaseBoardVersionKey␉␉␉␉"SMboardversion"␉// MacPro3,1␊ |
60 | #define kSMBBaseBoardSerialNumberKey␉␉␉"SMboardserial"␉␉// C02140302D5DMT31M␊ |
61 | #define kSMBBaseBoardAssetTagKey␉␉␉"SMboardassettag"␉// Base Board Asset Tag# Bungo: renamed folowing convention␊ |
62 | #define kSMBBaseBoardLocationInChassisKey␉␉"SMboardlocation"␉// Part Component␊ |
63 | ␊ |
64 | // ErmaC BoardType 0x0a(10) or 0x0b(11) MacPro Family␊ |
65 | #define kSMBBaseBoardTypeKey␉␉␉␉"SMboardtype"␉␉// 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro␊ |
66 | ␊ |
67 | // Bungo␊ |
68 | /* =======================␊ |
69 | System Enclosure (Type 3)␊ |
70 | ========================= */␊ |
71 | #define kSMBSystemEnclosureManufacturerKey␉␉"SMchassismanufacturer"␉// Apple Inc.␊ |
72 | #define kSMBSystemEnclosureTypeKey␉␉␉"SMchassistype"␉␉// 7 Desktop␊ |
73 | #define kSMBSystemEnclosureVersionKey␉␉␉"SMchassisversion"␉// Mac-F42C88C8␊ |
74 | #define kSMBSystemEnclosureSerialNumberKey␉␉"SMchassisserial"␉// Serial number␊ |
75 | #define kSMBSystemEnclosureAssetTagKey␉␉␉"SMchassisassettag"␉// Pro-Enclosure Bungo: renamed folowing convention␊ |
76 | ␊ |
77 | /* ============================␊ |
78 | Processor Information (Type 4)␊ |
79 | ============================== */␊ |
80 | // Bungo␊ |
81 | #define kSMBProcessorInformationSocketKey␉␉"SMcpusocket"␊ |
82 | #define kSMBProcessorInformationManufacturerKey␉␉"SMcpumanufacturer"␊ |
83 | #define kSMBProcessorInformationVersionKey␉␉"SMcpuversion"␊ |
84 | //␊ |
85 | #define kSMBProcessorInformationExternalClockKey␉"SMexternalclock"␊ |
86 | #define kSMBProcessorInformationMaximumClockKey␉␉"SMmaximalclock"␊ |
87 | // Bungo␊ |
88 | #define kSMBProcessorInformationCurrentClockKey␉␉"SMcurrentclock"␊ |
89 | #define kSMBProcessorInformationUpgradeKey␉␉"SMcpuupgrade"␊ |
90 | #define kSMBProcessorInformationSerialNumberKey␉␉"SMcpuserial"␊ |
91 | #define kSMBProcessorInformationAssetTagKey␉␉"SMcpuassettag"␉␉// Bungo: renamed folowing convention␊ |
92 | #define kSMBProcessorInformationPartNumberKey␉␉"SMcpupartnumber"␊ |
93 | ␊ |
94 | /* =====================␊ |
95 | Memory Device (Type 17)␊ |
96 | ======================= */␊ |
97 | #define kSMBMemoryDeviceDeviceLocatorKey␉␉"SMmemdevloc" //␊ |
98 | #define kSMBMemoryDeviceBankLocatorKey␉␉␉"SMmembankloc" //␊ |
99 | #define kSMBMemoryDeviceMemoryTypeKey␉␉␉"SMmemtype" //␊ |
100 | #define kSMBMemoryDeviceMemorySpeedKey␉␉␉"SMmemspeed" //␊ |
101 | #define kSMBMemoryDeviceManufacturerKey␉␉␉"SMmemmanufacturer" //␊ |
102 | #define kSMBMemoryDeviceSerialNumberKey␉␉␉"SMmemserial" //␊ |
103 | #define kSMBMemoryDevicePartNumberKey␉␉␉"SMmempart" //␊ |
104 | // Bungo:␊ |
105 | #define kSMBMemoryDeviceAssetTagKey␉␉␉"SMmemassettag" //␊ |
106 | ␊ |
107 | /* =====================================================␊ |
108 | Firmware Volume Description (Apple Specific - Type 128)␊ |
109 | ======================================================= */␊ |
110 | ␊ |
111 | /* =========================================␊ |
112 | Memory SPD Data (Apple Specific - Type 130)␊ |
113 | =========================================== */␊ |
114 | ␊ |
115 | /* ============================================␊ |
116 | OEM Processor Type (Apple Specific - Type 131)␊ |
117 | ============================================== */␊ |
118 | #define kSMBOemProcessorTypeKey␉␉␉␉"SMoemcputype"␉␉// Bungo: renamed from SMcputype␊ |
119 | ␊ |
120 | /* =================================================␊ |
121 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
122 | =================================================== */␊ |
123 | #define kSMBOemProcessorBusSpeedKey␉␉␉"SMoemcpubusspeed"␉// Bungo: renamed from SMbusspeed␊ |
124 | ␊ |
125 | /* ==============================================␊ |
126 | OEM Platform Feature (Apple Specific - Type 133)␊ |
127 | ================================================ */␊ |
128 | //#define kSMBOemPlatformFeatureKey␉␉␉"SMoemplatformfeature"␊ |
129 | ␊ |
130 | /* ==========================================␊ |
131 | OEM Platform SMC (Apple Specific - Type 134)␊ |
132 | ============================================ */␊ |
133 | //#define kSMBOemSMCKey "SMoemsmc"␊ |
134 | ␊ |
135 | ␊ |
136 | /* ==================================================*/␊ |
137 | #define getFieldOffset(struct, field)␉((uint8_t)(uint32_t)&(((struct *)0)->field))␊ |
138 | ␊ |
139 | typedef struct␊ |
140 | {␊ |
141 | ␉SMBStructHeader *orig;␊ |
142 | ␉SMBStructHeader *new;␊ |
143 | } SMBStructPtrs;␊ |
144 | ␊ |
145 | /* =======================␊ |
146 | BIOS Information (Type 0)␊ |
147 | ========================= */␊ |
148 | typedef struct␊ |
149 | {␊ |
150 | ␉char *vendor;␊ |
151 | ␉char *version;␊ |
152 | ␉char *releaseDate;␊ |
153 | ␉uint16_t release; // Bungo␊ |
154 | } defaultBIOSInfo_t;␊ |
155 | ␊ |
156 | defaultBIOSInfo_t defaultBIOSInfo;␊ |
157 | ␊ |
158 | /* =========================␊ |
159 | System Information (Type 1)␊ |
160 | =========================== */␊ |
161 | typedef struct␊ |
162 | {␊ |
163 | ␉char *manufacturer;␊ |
164 | ␉char *productName;␊ |
165 | ␉char *version;␊ |
166 | ␉char *serialNumber;␊ |
167 | ␉char *skuNumber;␉// ErmaC␊ |
168 | ␉char *family;␊ |
169 | } defaultSystemInfo_t;␊ |
170 | ␊ |
171 | defaultSystemInfo_t defaultSystemInfo;␊ |
172 | ␊ |
173 | /* =========================================␊ |
174 | Base Board (or Module) Information (Type 2)␊ |
175 | =========================================== */␊ |
176 | typedef struct␊ |
177 | {␊ |
178 | ␉char *manufacturer;␊ |
179 | ␉char *product;␊ |
180 | ␉char *version;␉␉␉// Bungo␊ |
181 | ␉char *serialNumber;␉␉// ErmaC␊ |
182 | ␉char *assetTag;␉␉␉// ErmaC Bungo: renamed folowing convention␊ |
183 | ␉char *locationInChassis;␉// ErmaC␊ |
184 | ␉uint8_t boardType;␉␉// ErmaC␊ |
185 | } defaultBaseBoard_t;␊ |
186 | ␊ |
187 | defaultBaseBoard_t defaultBaseBoard;␊ |
188 | ␊ |
189 | // Bungo␊ |
190 | typedef struct {␊ |
191 | ␉char␉␉*manufacturer;␊ |
192 | ␉uint8_t␉␉chassisType;␊ |
193 | ␉char␉␉*version;␊ |
194 | ␉char␉␉*serialNumber;␊ |
195 | ␉char␉␉*assetTag;␊ |
196 | ␉char␉␉*skuNumber;␊ |
197 | } defaultChassis_t;␊ |
198 | ␊ |
199 | defaultChassis_t defaultChassis;␊ |
200 | ␊ |
201 | typedef struct␊ |
202 | {␊ |
203 | ␉uint8_t␉␉␉type;␊ |
204 | ␉SMBValueType␉␉valueType;␊ |
205 | ␉uint8_t␉␉␉fieldOffset;␊ |
206 | ␉char␉␉␉*keyString;␊ |
207 | ␉bool␉␉␉(*getSMBValue)(returnType *);␊ |
208 | ␉char␉␉␉**defaultValue;␊ |
209 | } SMBValueSetter;␊ |
210 | ␊ |
211 | SMBValueSetter SMBSetters[] = ␊ |
212 | {␊ |
213 | ␉/* =======================␊ |
214 | ␉ BIOS Information (Type 0)␊ |
215 | ␉ ========================= */␊ |
216 | ␉{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, vendor),␊ |
217 | ␉␉kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor },␉␉␉␉// SMbiosvendor - Apple Inc.␊ |
218 | ␊ |
219 | ␉{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, version),␊ |
220 | ␉␉kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version },␉␉␉// SMbiosversion - MP31.88Z.006C.B05.0802291410␊ |
221 | ␊ |
222 | ␉{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, releaseDate),␊ |
223 | ␉␉kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate },␉␉// SMbiosdate - 02/29/08␊ |
224 | ␊ |
225 | ␉// Bungo␊ |
226 | ␉{ kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor),␊ |
227 | ␉␉kSMBBIOSInformationReleaseKey, NULL,␉(char **)&defaultBIOSInfo.release },␉␉// SMbiosrelease - 0.1 (256)␊ |
228 | ␊ |
229 | ␉/* =========================␊ |
230 | ␉ System Information (Type 1)␊ |
231 | ␉ =========================== */␊ |
232 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, manufacturer),␊ |
233 | ␉␉kSMBSystemInformationManufacturerKey, NULL,␉&defaultSystemInfo.manufacturer␉},␉// SMmanufacturer - Apple Inc.␊ |
234 | ␊ |
235 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, productName),␊ |
236 | ␉␉kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName },␉␉// SMproductname - MacPro3,1␊ |
237 | ␊ |
238 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, version),␊ |
239 | ␉␉kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version },␉␉␉// SMsystemversion - 1.0␊ |
240 | ␊ |
241 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, serialNumber),␊ |
242 | ␉␉kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber },␉␉// SMserial - Serial number␊ |
243 | ␉/* Bungo:␊ |
244 | ␉{kSMBTypeSystemInformation,␉kSMBByte,␉getFieldOffset(SMBSystemInformation, uuid),␊ |
245 | ␉␉kSMBSystemInformationUUIDKey, NULL, NULL},␉␉␉␉␉␉// SMsystemuuid␊ |
246 | ␊ |
247 | ␉{kSMBTypeSystemInformation,␉kSMBByte,␉getFieldOffset(SMBSystemInformation, wakeupReason),␊ |
248 | ␉␉NULL, NULL, NULL},␉␉␉␉␉␉␉␉␉// reason for system wakeup␊ |
249 | ␉*/␊ |
250 | ␊ |
251 | ␉// Bungo␊ |
252 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, skuNumber),␊ |
253 | ␉␉kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber},␉␉␉// SMskunumber - System SKU#␊ |
254 | ␊ |
255 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, family),␊ |
256 | ␉␉kSMBSystemInformationFamilyKey,␉NULL,␉&defaultSystemInfo.family},␉␉␉// SMfamily - MacPro␊ |
257 | ␊ |
258 | ␊ |
259 | ␉/* =========================================␊ |
260 | ␉ Base Board (or Module) Information (Type 2)␊ |
261 | ␉ =========================================== */␊ |
262 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, manufacturer),␊ |
263 | ␉␉kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer },␉␉␉// SMboardmanufacturer - Apple Inc.␊ |
264 | ␊ |
265 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, product),␊ |
266 | ␉␉kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product },␉␉␉␉// SMboardproduct - Mac-F2268DC8␊ |
267 | ␊ |
268 | ␉// Bungo␊ |
269 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, version),␊ |
270 | ␉␉kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version },␉␉␉␉// SMboardversion - MacPro3,1␊ |
271 | ␊ |
272 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, serialNumber),␊ |
273 | ␉␉kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber },␉␉␉// SMboardserial - C02140302D5DMT31M␊ |
274 | ␊ |
275 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, assetTag),␊ |
276 | ␉␉kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag },␉␉␉␉// SMboardassettag - Base Board Asset Tag#␊ |
277 | ␊ |
278 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, locationInChassis),␊ |
279 | ␉␉kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis },␉␉// SMboardlocation - Part Component␊ |
280 | ␊ |
281 | ␉{kSMBTypeBaseBoard,␉kSMBByte,␉getFieldOffset(SMBBaseBoard, boardType),␊ |
282 | ␉␉kSMBBaseBoardTypeKey,␉NULL, (char **)&defaultBaseBoard.boardType },␉␉␉// SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro␊ |
283 | ␊ |
284 | /*␉{kSMBTypeBaseBoard,␉kSMBByte, getFieldOffset(SMBBaseBoard, numberOfContainedHandles),␊ |
285 | ␉␉NULL , NULL, NULL },␉␉␉␉␉␉␉␉␉// numberOfContainedHandles = 0␊ |
286 | */␊ |
287 | ␉//␊ |
288 | ␊ |
289 | ␉// Bungo␊ |
290 | ␉/* =======================␊ |
291 | ␉ System Enclosure (Type 3)␊ |
292 | ␉ ========================= */␊ |
293 | ␉{kSMBTypeSystemEnclosure,␉kSMBString,␉getFieldOffset(SMBSystemEnclosure, manufacturer),␊ |
294 | ␉␉kSMBSystemEnclosureManufacturerKey, NULL,␉&defaultChassis.manufacturer },␉␉// SMchassismanufacturer - Apple Inc.␊ |
295 | ␊ |
296 | ␉{kSMBTypeSystemEnclosure, kSMBByte,␉getFieldOffset(SMBSystemEnclosure, chassisType),␊ |
297 | ␉␉kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType␉},␉␉// SMchassistype - 7␊ |
298 | ␊ |
299 | ␉{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, version),␊ |
300 | ␉␉kSMBSystemEnclosureVersionKey, NULL, &defaultChassis.version },␉␉␉␉// SMchassisversion - Mac-F42C88C8␊ |
301 | ␊ |
302 | ␉{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, serialNumber),␊ |
303 | ␉␉kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber },␉␉// SMchassisserial␊ |
304 | ␊ |
305 | ␉{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTag),␊ |
306 | ␉␉kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag },␉␉␉// SMchassisassettag - Pro Enclosure␊ |
307 | ␊ |
308 | ␉/*␊ |
309 | ␉{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, skuNumber),␊ |
310 | ␉␉NULL, NULL, &defaultChassis.skuNumber },␊ |
311 | ␉*/␊ |
312 | ␊ |
313 | ␉/* ============================␊ |
314 | ␉ Processor Information (Type 4)␊ |
315 | ␉ ============================== */␊ |
316 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, socketDesignation),␊ |
317 | ␉␉kSMBProcessorInformationSocketKey, NULL, NULL},␉␉␉␉␉␉// SMcpusocket -␊ |
318 | ␊ |
319 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, manufacturer),␊ |
320 | ␉␉kSMBProcessorInformationManufacturerKey, NULL, NULL},␉␉␉␉␉// SMcpumanufacturer - Intel(R) Corporation␊ |
321 | ␊ |
322 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, processorVersion),␊ |
323 | ␉␉kSMBProcessorInformationVersionKey, NULL, NULL},␉␉␉␉␉// SMcpuversion␊ |
324 | ␊ |
325 | ␉{kSMBTypeProcessorInformation,␉kSMBWord, getFieldOffset(SMBProcessorInformation, externalClock),␊ |
326 | ␉␉kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock,␉NULL},␉// SMcpuexternalclock␊ |
327 | ␊ |
328 | ␉{kSMBTypeProcessorInformation,␉kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock),␊ |
329 | ␉␉kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,␉NULL},␉// SMcpumaximumclock␊ |
330 | ␉// Bungo␊ |
331 | ␉{kSMBTypeProcessorInformation,␉kSMBWord,␉getFieldOffset(SMBProcessorInformation, currentClock),␊ |
332 | ␉␉kSMBProcessorInformationCurrentClockKey, NULL, NULL},␉␉␉␉␉// SMcpucurrentclock␊ |
333 | ␊ |
334 | ␉{kSMBTypeProcessorInformation,␉kSMBByte,␉getFieldOffset(SMBProcessorInformation, processorUpgrade),␊ |
335 | ␉␉kSMBProcessorInformationUpgradeKey, NULL, NULL},␉␉␉␉␉// SMcpuupgrade␊ |
336 | ␉//␊ |
337 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, serialNumber),␊ |
338 | ␉␉kSMBProcessorInformationSerialNumberKey, NULL, NULL},␊ |
339 | ␊ |
340 | ␉// Bungo␊ |
341 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, assetTag),␊ |
342 | ␉␉kSMBProcessorInformationAssetTagKey, NULL, NULL},␉␉␉␉␉// SMcpuassettag␊ |
343 | ␉//␊ |
344 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, partNumber),␊ |
345 | ␉␉kSMBProcessorInformationPartNumberKey, NULL, NULL},␊ |
346 | ␊ |
347 | ␉/* =====================␊ |
348 | ␉ Memory Device (Type 17)␊ |
349 | ␉ ======================= */␊ |
350 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, deviceLocator),␊ |
351 | ␉␉kSMBMemoryDeviceDeviceLocatorKey, NULL, NULL},␊ |
352 | ␊ |
353 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, bankLocator),␊ |
354 | ␉␉kSMBMemoryDeviceBankLocatorKey, NULL, NULL},␊ |
355 | ␊ |
356 | ␉{kSMBTypeMemoryDevice,␉kSMBByte,␉getFieldOffset(SMBMemoryDevice, memoryType),␊ |
357 | ␉␉kSMBMemoryDeviceMemoryTypeKey, getSMBMemoryDeviceMemoryType,␉NULL},␊ |
358 | ␊ |
359 | ␉{kSMBTypeMemoryDevice,␉kSMBWord,␉getFieldOffset(SMBMemoryDevice, memorySpeed),␊ |
360 | ␉␉kSMBMemoryDeviceMemorySpeedKey, getSMBMemoryDeviceMemorySpeed,␉NULL},␊ |
361 | ␊ |
362 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, manufacturer),␊ |
363 | ␉␉kSMBMemoryDeviceManufacturerKey, getSMBMemoryDeviceManufacturer, NULL},␊ |
364 | ␊ |
365 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, serialNumber),␊ |
366 | ␉␉kSMBMemoryDeviceSerialNumberKey, getSMBMemoryDeviceSerialNumber, NULL},␊ |
367 | ␊ |
368 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, assetTag),␊ |
369 | ␉␉kSMBMemoryDeviceAssetTagKey, NULL, NULL},␊ |
370 | ␊ |
371 | ␉{kSMBTypeMemoryDevice,␉kSMBWord,␉getFieldOffset(SMBMemoryDevice, errorHandle),␊ |
372 | ␉␉NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL},␊ |
373 | ␊ |
374 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, partNumber),␊ |
375 | ␉␉kSMBMemoryDevicePartNumberKey, getSMBMemoryDevicePartNumber, NULL},␊ |
376 | ␊ |
377 | ␉/* ============␊ |
378 | ␉ Apple Specific␊ |
379 | ␉ ============== */␊ |
380 | ␊ |
381 | ␉// Firmware Volume Description (Apple Specific - Type 128)␊ |
382 | ␉// kSMBTypeFirmwareVolume␊ |
383 | ␊ |
384 | ␉// Memory SPD Data (Apple Specific - Type 130)␊ |
385 | ␉// kSMBTypeMemorySPD␊ |
386 | ␊ |
387 | ␉// OEM Processor Type (Apple Specific - Type 131)␊ |
388 | ␉{kSMBTypeOemProcessorType,␉kSMBWord,␉getFieldOffset(SMBOemProcessorType, ProcessorType),␉kSMBOemProcessorTypeKey,␉␉␊ |
389 | ␉␉getSMBOemProcessorType,␉␉␉NULL},␊ |
390 | ␊ |
391 | ␉// OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
392 | ␉{kSMBTypeOemProcessorBusSpeed,␉kSMBWord,␉getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed),␉kSMBOemProcessorBusSpeedKey,␉␊ |
393 | ␉␉getSMBOemProcessorBusSpeed,␉NULL}␊ |
394 | ␊ |
395 | ␉// OEM Platform Feature (Apple Specific - Type 133)␊ |
396 | ␉/*␊ |
397 | ␉{kSMBTypeOemPlatformFeature,␉kSMBWord,␉getFieldOffset(SMBOemPlatformFeature, PlatformFeature),␉kSMBOemPlatformFeatureKey,␊ |
398 | ␉␉getSMBOemPlatformFeature,␉NULL}␊ |
399 | ␊ |
400 | ␉// OEM Platform Feature (Apple Specific - Type 134)␊ |
401 | ␊ |
402 | ␉{kSMBTypeOemSMCVersion,␉kSMBWord,␉getFieldOffset(SMBOemSMCVersion, SMCVersion),␉kSMBOemSMCVersionKey,␊ |
403 | ␉␉getSMBOemSMCVersion,␉NULL}␊ |
404 | ␉*/␊ |
405 | ␊ |
406 | };␊ |
407 | ␊ |
408 | int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter);␊ |
409 | ␊ |
410 | ␊ |
411 | SMBEntryPoint *origeps␉␉= 0;␊ |
412 | SMBEntryPoint *neweps␉␉= 0;␊ |
413 | ␊ |
414 | static uint8_t stringIndex;␉// increament when a string is added and set the field value accordingly␊ |
415 | static uint8_t stringsSize;␉// add string size␊ |
416 | ␊ |
417 | static SMBWord tableLength␉= 0;␊ |
418 | static SMBWord handle␉␉= 0;␊ |
419 | static SMBWord maxStructSize␉= 0;␊ |
420 | static SMBWord structureCount␉= 0;␊ |
421 | ␊ |
422 | //-------------------------------------------------------------------------------------------------------------------------␊ |
423 | // Default SMBIOS Data␊ |
424 | //-------------------------------------------------------------------------------------------------------------------------␊ |
425 | /* Rewrite: use a struct */␊ |
426 | ␊ |
427 | // Bungo: suggest to not mixing data from different Mac models, use real Mac SMBIOS dumps␊ |
428 | ␊ |
429 | #define kDefaultVendorManufacturer␉␉␉"Apple Inc."␊ |
430 | //#define kDefaultBIOSReleaseDate␉␉␉"11/06/2009"␊ |
431 | #define kDefaultSerialNumber␉␉␉␉"SOMESRLNMBR"␊ |
432 | //Bungo␊ |
433 | #define kDefaultSkuNumber␉␉␉␉"Default SKU#"␊ |
434 | #define kDefaultAssetTag␉␉␉␉"Default Asset Tag#"␊ |
435 | //#define kDefaultBoardType␉␉␉␉"10" // 0xA␊ |
436 | //#define kDefaultBoardProcessorType␉␉␉"11" // 0xB␊ |
437 | #define kDefaultSystemVersion␉␉␉␉"1.0"␊ |
438 | #define kDefaultBIOSRelease␉␉␉␉256 // 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0)␊ |
439 | ␊ |
440 | //=========== Mac mini ===========␊ |
441 | #define kDefaultMacMiniFamily␉␉␉␉"Napa Mac" // Macmini2,1 family = "Napa Mac" not "Mac mini"␊ |
442 | #define kDefaultMacMini␉␉␉␉␉"Macmini2,1"␊ |
443 | #define kDefaultMacMiniBIOSVersion␉␉␉" MM21.88Z.009A.B00.0706281359"␊ |
444 | #define kDefaultMacMiniBIOSReleaseDate␉␉␉"06/28/07"␊ |
445 | #define kDefaultMacMiniBoardProduct␉␉␉"Mac-F4208EAA"␊ |
446 | ␊ |
447 | //=========== MacBook ===========␊ |
448 | #define kDefaultMacBookFamily␉␉␉␉"MacBook"␊ |
449 | ␊ |
450 | #define kDefaultMacBook␉␉␉␉␉"MacBook4,1"␊ |
451 | #define kDefaultMacBookBIOSVersion␉␉␉" MB41.88Z.00C1.B00.0802091535"␊ |
452 | #define kDefaultMacBookBIOSReleaseDate␉␉␉"02/09/08"␊ |
453 | #define kDefaultMacBookBoardProduct␉␉␉"Mac-F22788A9"␊ |
454 | ␊ |
455 | //=========== MacBookAir ===========␊ |
456 | #define kDefaultMacBookAirFamily␉␉␉"MacBook Air"␊ |
457 | ␊ |
458 | // MacBookAir5,2␊ |
459 | #define kDefaultMacBookAir␉␉␉␉"MacBookAir5,2"␊ |
460 | #define kDefaultMacBookAirBIOSVersion␉␉␉" MBA51.88Z.00EF.B00.1205221442"␊ |
461 | #define kDefaultMacBookAirBIOSReleaseDate␉␉"05/10/12"␊ |
462 | #define kDefaultMacBookBoardAirProduct␉␉␉"Mac-2E6FAB96566FE58C"␊ |
463 | ␊ |
464 | //=========== MacBookPro ===========␊ |
465 | #define kDefaultMacBookProFamily␉␉␉"MacBook Pro"␊ |
466 | ␊ |
467 | #define kDefaultMacBookPro␉␉␉␉"MacBookPro4,1"␊ |
468 | #define kDefaultMacBookProBIOSVersion␉␉␉" MBP41.88Z.00C1.B03.0802271651"␊ |
469 | #define kDefaultMacBookProBIOSReleaseDate␉␉"02/27/08"␊ |
470 | #define kDefaultMacBookProBoardProduct␉␉␉"Mac-F42C89C8"␊ |
471 | ␊ |
472 | //=========== iMac ===========␊ |
473 | #define kDefaultiMacFamily␉␉␉␉"iMac"␊ |
474 | ␊ |
475 | #define kDefaultiMac␉␉␉␉␉"iMac8,1"␊ |
476 | #define kDefaultiMacBIOSVersion␉␉␉␉" IM81.88Z.00C1.B00.0903051113"␊ |
477 | #define kDefaultiMacBIOSReleaseDate␉␉␉"02/09/08"␊ |
478 | #define kDefaultiMacBoardProduct␉␉␉"Mac-F227BEC8"␊ |
479 | #define kDefaultMacFamily␉␉␉␉"Mac" // iMac8,1 family = "Mac" not "iMac"␊ |
480 | ␊ |
481 | // iMac10,1␊ |
482 | // iMac11,1 core i3/i5/i7␊ |
483 | #define kDefaultiMacNehalem␉␉␉␉"iMac11,1"␊ |
484 | #define kDefaultiMacNehalemBIOSVersion␉␉␉" IM111.88Z.0034.B02.1003171314"␊ |
485 | #define kDefaultiMacNehalemBIOSReleaseDate␉␉"03/17/10"␊ |
486 | #define kDefaultiMacNehalemBoardProduct␉␉␉"Mac-F2268DAE"␊ |
487 | ␊ |
488 | // iMac12,1␊ |
489 | #define kDefaultiMacSandy␉␉␉␉"iMac12,1"␊ |
490 | #define kDefaultiMacSandyBIOSVersion␉␉␉" IM121.88Z.0047.B00.1102091756"␊ |
491 | #define kDefaultiMacSandyBIOSReleaseDate␉␉"04/22/11"␊ |
492 | #define kDefaultiMacSandyBoardProduct␉␉␉"Mac-942B5BF58194151B"␊ |
493 | ␊ |
494 | //=========== MacPro ===========␊ |
495 | #define kDefaultMacProFamily␉␉␉␉"MacPro" // MacPro's family = "MacPro" not "Mac Pro"␊ |
496 | ␊ |
497 | #define kDefaultMacPro␉␉␉␉␉"MacPro3,1"␊ |
498 | #define kDefaultMacProBIOSVersion␉␉␉" MP31.88Z.006C.B05.0903051113"␊ |
499 | #define kDefaultMacProBIOSReleaseDate␉␉␉"08/03/2010"␊ |
500 | #define kDefaultMacProBoardProduct␉␉␉"Mac-F42C88C8"␊ |
501 | ␊ |
502 | // Mac Pro 4,1 core i7/Xeon␊ |
503 | #define kDefaultMacProNahWestSystemVersion␉␉"0.0"␊ |
504 | ␊ |
505 | #define kDefaultMacProNehalem␉␉␉␉"MacPro4,1"␊ |
506 | #define kDefaultMacProNehalemBIOSVersion␉␉" MP41.88Z.0081.B07.0910130729"␊ |
507 | #define kDefaultMacProNehalemBIOSReleaseDate␉␉"10/13/09"␊ |
508 | #define kDefaultMacProNehalemBoardProduct␉␉"Mac-F221BEC8"␊ |
509 | ␊ |
510 | // Mac Pro 5,1 core i7/Xeon␊ |
511 | #define kDefaultMacProWestmere␉␉␉␉"MacPro5,1"␊ |
512 | #define kDefaultMacProWestmereBIOSVersion␉␉" MP51.88Z.007F.B03.1010071432"␊ |
513 | #define kDefaultMacProWestmereBIOSReleaseDate␉␉"10/07/10"␊ |
514 | #define kDefaultMacProWestmereBoardProduct␉␉"Mac-F221BEC8"␊ |
515 | ␊ |
516 | // Mac Pro 6,1␊ |
517 | #define kDefaultMacProHaswell␉␉␉␉"MacPro6,1"␊ |
518 | #define kDefaultMacProHaswellBIOSVersion␉␉"MP61.88Z.0116.B04.1312061508"␊ |
519 | #define kDefaultMacProHaswellBIOSReleaseDate␉␉"12/06/2013"␊ |
520 | #define kDefaultMacProHaswellBoardProduct␉␉"Mac-F60DEB81FF30ACF6"␊ |
521 | ␊ |
522 | /* ============================================ */␊ |
523 | ␊ |
524 | bool useSMBIOSdefaults = true;␉// Bungo␊ |
525 | ␊ |
526 | SMBByte PlatformType␉␉= 1;␉// Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED.␊ |
527 | ␊ |
528 | /* Rewrite this function */␊ |
529 | void setDefaultSMBData(void) // Bungo: setting data from real Macs␊ |
530 | {␊ |
531 | ␉defaultBIOSInfo.vendor = kDefaultVendorManufacturer;␊ |
532 | ␉defaultBIOSInfo.release = kDefaultBIOSRelease; // Bungo␊ |
533 | ␊ |
534 | ␉defaultSystemInfo.manufacturer = kDefaultVendorManufacturer;␊ |
535 | ␉defaultSystemInfo.version = kDefaultSystemVersion;␊ |
536 | ␉defaultSystemInfo.serialNumber = kDefaultSerialNumber;␊ |
537 | ␉defaultSystemInfo.skuNumber = kDefaultSkuNumber; // Bungo␊ |
538 | ␊ |
539 | ␉defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;␊ |
540 | ␉defaultBaseBoard.serialNumber = kDefaultSerialNumber;␊ |
541 | ␉defaultBaseBoard.assetTag = kDefaultAssetTag;␊ |
542 | ␊ |
543 | ␉defaultChassis.manufacturer = kDefaultVendorManufacturer;␊ |
544 | ␉defaultChassis.serialNumber = kDefaultSerialNumber;␊ |
545 | ␉defaultChassis.assetTag = kDefaultAssetTag;␊ |
546 | ␉defaultChassis.skuNumber = kDefaultSkuNumber;␊ |
547 | ␊ |
548 | ␉// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing␊ |
549 | ␉if (PlatformType == 2) // this works but it's a substitute␊ |
550 | ␉{␊ |
551 | ␉␉if (Platform.CPU.NoCores > 1)␊ |
552 | ␉␉{␊ |
553 | ␉␉␉defaultSystemInfo.productName = kDefaultMacBookPro;␊ |
554 | ␉␉␉defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion;␊ |
555 | ␉␉␉defaultBIOSInfo.releaseDate = kDefaultMacBookProBIOSReleaseDate;␊ |
556 | ␉␉␉defaultSystemInfo.family = kDefaultMacBookProFamily;␊ |
557 | ␉␉␉defaultBaseBoard.product = kDefaultMacBookProBoardProduct;␊ |
558 | ␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
559 | ␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
560 | ␉␉}␊ |
561 | ␉␉else␊ |
562 | ␉␉{␊ |
563 | ␉␉␉defaultSystemInfo.productName = kDefaultMacBook;␊ |
564 | ␉␉␉defaultBIOSInfo.version = kDefaultMacBookBIOSVersion;␊ |
565 | ␉␉␉defaultBIOSInfo.releaseDate = kDefaultMacBookBIOSReleaseDate;␊ |
566 | ␉␉␉defaultSystemInfo.family = kDefaultMacBookFamily;␊ |
567 | ␉␉␉defaultBaseBoard.product = kDefaultMacBookBoardProduct;␊ |
568 | ␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
569 | ␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
570 | ␉␉}␊ |
571 | ␉}␊ |
572 | ␉else␊ |
573 | ␉{␊ |
574 | ␉␉switch (Platform.CPU.NoCores)␊ |
575 | ␉␉{␊ |
576 | ␉␉␉case 1:␊ |
577 | ␉␉␉␉defaultBIOSInfo.version = kDefaultMacMiniBIOSVersion;␊ |
578 | ␉␉␉␉defaultBIOSInfo.releaseDate = kDefaultMacMiniBIOSReleaseDate;␊ |
579 | ␉␉␉␉defaultSystemInfo.productName = kDefaultMacMini;␊ |
580 | ␉␉␉␉defaultSystemInfo.family = kDefaultMacMiniFamily;␊ |
581 | ␉␉␉␉defaultBaseBoard.product = kDefaultMacMiniBoardProduct;␊ |
582 | ␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardUnknown;␊ |
583 | ␉␉␉␉defaultChassis.chassisType = kSMBchassisLPDesktop;␊ |
584 | ␉␉␉␉break;␊ |
585 | ␊ |
586 | ␉␉␉case 2:␊ |
587 | ␉␉␉␉defaultBIOSInfo.version = kDefaultiMacBIOSVersion;␊ |
588 | ␉␉␉␉defaultBIOSInfo.releaseDate = kDefaultiMacBIOSReleaseDate;␊ |
589 | ␉␉␉␉defaultSystemInfo.productName = kDefaultiMac;␊ |
590 | ␉␉␉␉defaultSystemInfo.family = kDefaultMacFamily; // iMac8,1 family = Mac␊ |
591 | ␉␉␉␉defaultBaseBoard.product = kDefaultiMacBoardProduct;␊ |
592 | ␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
593 | ␉␉␉␉defaultChassis.chassisType = kSMBchassisAllInOne;␊ |
594 | ␉␉␉␉break;␊ |
595 | ␉␉␉default:␊ |
596 | ␉␉␉{␊ |
597 | ␉␉␉␉switch (Platform.CPU.Family)␊ |
598 | ␉␉␉␉{␊ |
599 | ␉␉␉␉␉case 0x06:␊ |
600 | ␉␉␉␉␉{␊ |
601 | ␉␉␉␉␉␉switch (Platform.CPU.Model)␊ |
602 | ␉␉␉␉␉␉{␊ |
603 | ␉␉␉␉␉␉␉case CPUID_MODEL_FIELDS:␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
604 | ␉␉␉␉␉␉␉case CPUID_MODEL_CLARKDALE:␊ |
605 | ␉␉␉␉␉␉␉case CPUID_MODEL_DALES:␉␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
606 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacNehalemBIOSVersion;␊ |
607 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultiMacNehalemBIOSReleaseDate;␊ |
608 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultiMacNehalem;␊ |
609 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
610 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultiMacNehalemBoardProduct;␊ |
611 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
612 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisAllInOne;␊ |
613 | ␉␉␉␉␉␉␉␉break;␊ |
614 | ␊ |
615 | ␉␉␉␉␉␉␉case CPUID_MODEL_SANDYBRIDGE:␉␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
616 | ␉␉␉␉␉␉␉case CPUID_MODEL_IVYBRIDGE:␉␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
617 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version = kDefaultiMacSandyBIOSVersion;␊ |
618 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate = kDefaultiMacSandyBIOSReleaseDate;␊ |
619 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultiMacSandy;␊ |
620 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family = kDefaultiMacFamily;␊ |
621 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultiMacSandyBoardProduct;␊ |
622 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
623 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisAllInOne;␊ |
624 | ␉␉␉␉␉␉␉␉break;␊ |
625 | ␊ |
626 | ␉␉␉␉␉␉␉case CPUID_MODEL_NEHALEM:␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
627 | ␉␉␉␉␉␉␉case CPUID_MODEL_NEHALEM_EX:␉␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
628 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProNehalemBIOSVersion;␊ |
629 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProNehalemBIOSReleaseDate;␊ |
630 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacProNehalem;␊ |
631 | ␉␉␉␉␉␉␉␉defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;␊ |
632 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
633 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct;␊ |
634 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;␊ |
635 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisTower;␊ |
636 | ␉␉␉␉␉␉␉␉break;␊ |
637 | ␊ |
638 | ␉␉␉␉␉␉␉case CPUID_MODEL_WESTMERE:␉␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
639 | ␉␉␉␉␉␉␉case CPUID_MODEL_WESTMERE_EX:␉␉// Intel Xeon E7␊ |
640 | ␉␉␉␉␉␉␉case CPUID_MODEL_JAKETOWN:␉␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
641 | ␉␉␉␉␉␉␉case CPUID_MODEL_IVYBRIDGE_XEON:␉// Intel Core i7, Xeon E5 v2 LGA2011 (22nm)␊ |
642 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProWestmereBIOSVersion;␊ |
643 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProWestmereBIOSReleaseDate;␊ |
644 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacProWestmere;␊ |
645 | ␉␉␉␉␉␉␉␉defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;␊ |
646 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
647 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct;␊ |
648 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;␊ |
649 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisTower;␊ |
650 | ␉␉␉␉␉␉␉␉break;␊ |
651 | ␊ |
652 | ␉␉␉␉␉␉␉default:␊ |
653 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProBIOSVersion;␊ |
654 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProBIOSReleaseDate;␊ |
655 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
656 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
657 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProBoardProduct;␊ |
658 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
659 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
660 | ␉␉␉␉␉␉␉␉break;␊ |
661 | ␉␉␉␉␉␉}␊ |
662 | ␉␉␉␉␉␉break;␊ |
663 | ␉␉␉␉␉}␊ |
664 | ␉␉␉␉␉default:␊ |
665 | ␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProBIOSVersion;␊ |
666 | ␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProBIOSReleaseDate;␊ |
667 | ␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
668 | ␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
669 | ␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProBoardProduct;␊ |
670 | ␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
671 | ␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
672 | ␉␉␉␉␉␉break;␊ |
673 | ␉␉␉␉}␊ |
674 | ␉␉␉␉break;␊ |
675 | ␉␉␉}␊ |
676 | ␉␉}␊ |
677 | ␉}␊ |
678 | }␊ |
679 | ␊ |
680 | /* Used for SM*n smbios.plist keys */␊ |
681 | bool getSMBValueForKey(SMBStructHeader *structHeader, const char *keyString, const char **string, returnType *value)␊ |
682 | {␊ |
683 | ␉static int idx = -1;␊ |
684 | ␉static int current = -1;␊ |
685 | ␉int len;␊ |
686 | ␉char key[24];␊ |
687 | ␊ |
688 | ␉if (current != structHeader->handle)␊ |
689 | ␉{␊ |
690 | ␉␉idx++;␊ |
691 | ␉␉current = structHeader->handle;␊ |
692 | ␉}␊ |
693 | ␊ |
694 | ␉sprintf(key, "%s%d", keyString, idx);␊ |
695 | ␊ |
696 | ␉if (value)␊ |
697 | ␉{␊ |
698 | ␉␉if (getIntForKey(key, (int *)&(value->dword), SMBPlist))␊ |
699 | ␉␉{␊ |
700 | ␉␉␉return true;␊ |
701 | ␉␉}␊ |
702 | ␉}␊ |
703 | ␉else␊ |
704 | ␉{␊ |
705 | ␉␉if (getValueForKey(key, string, &len, SMBPlist))␊ |
706 | ␉␉{␊ |
707 | ␉␉␉return true;␊ |
708 | ␉␉}␊ |
709 | ␉}␊ |
710 | ␉return false;␊ |
711 | }␊ |
712 | ␊ |
713 | char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field)␊ |
714 | {␊ |
715 | ␉if (!field || !structHeader)␊ |
716 | ␉{␊ |
717 | ␉␉return NULL;␊ |
718 | ␉}␊ |
719 | ␊ |
720 | ␉uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;␊ |
721 | ␊ |
722 | ␉for (field--; (field > 0) && (*stringPtr > 0) &&(*(uint16_t *)stringPtr != 0);␊ |
723 | ␉␉field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));␊ |
724 | ␊ |
725 | ␉return (char *)stringPtr;␊ |
726 | }␊ |
727 | ␊ |
728 | void setSMBStringForField(SMBStructHeader *structHeader, const char *string, uint8_t *field)␊ |
729 | {␊ |
730 | ␉int strSize;␊ |
731 | ␊ |
732 | ␉if (!field)␊ |
733 | ␉{␊ |
734 | ␉␉return;␊ |
735 | ␉}␊ |
736 | ␊ |
737 | ␉if (!string)␊ |
738 | ␉{␊ |
739 | ␉␉*field = 0;␊ |
740 | ␉␉return;␊ |
741 | ␉}␊ |
742 | ␊ |
743 | ␉strSize = strlen(string);␊ |
744 | ␊ |
745 | ␉// remove any spaces found at the end but only in MemoryDevice avoiding errors␊ |
746 | ␉if (structHeader->type == kSMBTypeMemoryDevice)␊ |
747 | ␉{␊ |
748 | ␉␉while ((strSize != 0) && (string[strSize - 1] == ' '))␊ |
749 | ␉␉{␊ |
750 | ␉␉␉strSize--;␊ |
751 | ␉␉}␊ |
752 | ␉}␊ |
753 | ␊ |
754 | ␉if (strSize == 0)␊ |
755 | ␉{␊ |
756 | ␉␉*field = 0;␊ |
757 | ␉␉return;␊ |
758 | ␉}␊ |
759 | ␊ |
760 | ␉memcpy((uint8_t *)structHeader + structHeader->length + stringsSize, string, strSize);␊ |
761 | ␉*field = stringIndex;␊ |
762 | ␊ |
763 | ␉stringIndex++;␊ |
764 | ␉stringsSize += strSize + 1;␊ |
765 | }␊ |
766 | ␊ |
767 | bool setSMBValue(SMBStructPtrs *structPtr, int idx, returnType *value)␊ |
768 | {␊ |
769 | ␉const char *string = 0;␊ |
770 | ␉int len;␊ |
771 | ␉bool parsed;␊ |
772 | ␉int val;␊ |
773 | ␊ |
774 | ␉if (numOfSetters <= idx)␊ |
775 | ␉{␊ |
776 | ␉␉return false;␊ |
777 | ␉}␊ |
778 | ␊ |
779 | ␉switch (SMBSetters[idx].valueType)␊ |
780 | ␉{␊ |
781 | ␉␉case kSMBString:␊ |
782 | ␉␉{␊ |
783 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
784 | ␉␉␉{␊ |
785 | ␉␉␉␉if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist))␊ |
786 | ␉␉␉␉{␊ |
787 | ␉␉␉␉␉break;␊ |
788 | ␉␉␉␉}␊ |
789 | ␉␉␉␉else␊ |
790 | ␉␉␉␉{␊ |
791 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␉// MemoryDevice only␊ |
792 | ␉␉␉␉␉{␊ |
793 | ␉␉␉␉␉␉if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL))␊ |
794 | ␉␉␉␉␉␉{␊ |
795 | ␉␉␉␉␉␉␉break;␊ |
796 | ␉␉␉␉␉␉}␊ |
797 | ␉␉␉␉␉}␊ |
798 | ␉␉␉␉}␊ |
799 | ␊ |
800 | ␉␉␉}␊ |
801 | ␉␉␉if (SMBSetters[idx].getSMBValue)␊ |
802 | ␉␉␉{␊ |
803 | ␉␉␉␉if (SMBSetters[idx].getSMBValue((returnType *)&string))␊ |
804 | ␉␉␉␉{␊ |
805 | ␉␉␉␉␉break;␊ |
806 | ␉␉␉␉}␊ |
807 | ␉␉␉}␊ |
808 | ␉␉␉// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo␊ |
809 | ␉␉␉if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue))␊ |
810 | ␉␉␉{␊ |
811 | ␉␉␉␉string = *(SMBSetters[idx].defaultValue);␊ |
812 | ␉␉␉␉break;␊ |
813 | ␉␉␉}␊ |
814 | ␉␉␉string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);␊ |
815 | ␉␉␉break;␊ |
816 | ␉␉}␊ |
817 | ␊ |
818 | ␉␉case kSMBByte:␊ |
819 | ␉␉case kSMBWord:␊ |
820 | ␉␉case kSMBDWord:␊ |
821 | ␉␉case kSMBQWord:␊ |
822 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
823 | ␉␉␉{␊ |
824 | ␉␉␉␉parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);␊ |
825 | ␉␉␉␉if (!parsed)␊ |
826 | ␉␉␉␉{␊ |
827 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice) // MemoryDevice only␊ |
828 | ␉␉␉␉␉{␊ |
829 | ␉␉␉␉␉␉parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val);␊ |
830 | ␉␉␉␉␉}␊ |
831 | ␉␉␉␉}␊ |
832 | ␊ |
833 | ␉␉␉␉if (parsed)␊ |
834 | ␉␉␉␉{␊ |
835 | ␉␉␉␉␉switch (SMBSetters[idx].valueType)␊ |
836 | ␉␉␉␉␉{␊ |
837 | ␉␉␉␉␉␉case kSMBByte:␊ |
838 | ␉␉␉␉␉␉␉value->byte = (uint8_t)val;␊ |
839 | ␉␉␉␉␉␉␉break;␊ |
840 | ␉␉␉␉␉␉case kSMBWord:␊ |
841 | ␉␉␉␉␉␉␉value->word = (uint16_t)val;␊ |
842 | ␉␉␉␉␉␉␉break;␊ |
843 | ␉␉␉␉␉␉case kSMBQWord:␊ |
844 | ␉␉␉␉␉␉␉value->qword = (uint64_t)val;␊ |
845 | ␉␉␉␉␉␉␉break;␊ |
846 | ␉␉␉␉␉␉case kSMBDWord:␊ |
847 | ␉␉␉␉␉␉default:␊ |
848 | ␉␉␉␉␉␉␉value->dword = (uint32_t)val;␊ |
849 | ␉␉␉␉␉␉␉break;␊ |
850 | ␉␉␉␉␉}␊ |
851 | ␉␉␉␉␉return true;␊ |
852 | ␉␉␉␉}␊ |
853 | ␉␉␉}␊ |
854 | ␊ |
855 | ␉␉␉if (SMBSetters[idx].getSMBValue)␊ |
856 | ␉␉␉{␊ |
857 | ␉␉␉␉if (SMBSetters[idx].getSMBValue(value))␊ |
858 | ␉␉␉␉{␊ |
859 | ␉␉␉␉␉return true;␊ |
860 | ␉␉␉␉}␊ |
861 | ␉␉␉}␊ |
862 | // #if 0 Bungo: enables code below␊ |
863 | ␉␉␉// if (*(SMBSetters[idx].defaultValue)) Bungo␊ |
864 | ␉␉␉if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue))␊ |
865 | ␉␉␉{␊ |
866 | ␉␉␉// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo␊ |
867 | ␉␉␉switch (SMBSetters[idx].valueType) {␊ |
868 | ␉␉␉␉case kSMBByte:␊ |
869 | ␉␉␉␉␉value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue);␊ |
870 | ␉␉␉␉␉break;␊ |
871 | ␉␉␉␉case kSMBWord:␊ |
872 | ␉␉␉␉␉value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);␊ |
873 | ␉␉␉␉␉break;␊ |
874 | ␉␉␉␉case kSMBQWord:␊ |
875 | ␉␉␉␉␉value->qword = *(uint64_t *)(SMBSetters[idx].defaultValue);␊ |
876 | ␉␉␉␉␉break;␊ |
877 | ␉␉␉␉case kSMBDWord:␊ |
878 | ␉␉␉␉default:␊ |
879 | ␉␉␉␉␉value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);␊ |
880 | ␉␉␉␉␉break;␊ |
881 | ␉␉␉}␊ |
882 | ␉␉␉return true;␊ |
883 | ␉␉}␊ |
884 | // #endif Bungo␊ |
885 | ␉␉break;␊ |
886 | ␉}␊ |
887 | ␊ |
888 | ␉// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"␊ |
889 | ␉if ((SMBSetters[idx].valueType == kSMBString) && string)␊ |
890 | ␉{␊ |
891 | ␉␉setSMBStringForField(structPtr->new, string, &value->byte);␊ |
892 | ␉}␊ |
893 | ␉return true;␊ |
894 | }␊ |
895 | ␊ |
896 | //-------------------------------------------------------------------------------------------------------------------------␊ |
897 | // Apple Specific␊ |
898 | //-------------------------------------------------------------------------------------------------------------------------␊ |
899 | ␊ |
900 | /* ===========================================␊ |
901 | Firmware Volume (Apple Specific - Type 128)␊ |
902 | ============================================= */␊ |
903 | void addSMBFirmwareVolume(SMBStructPtrs *structPtr)␊ |
904 | {␊ |
905 | ␉return;␊ |
906 | }␊ |
907 | ␊ |
908 | /* ===========================================␊ |
909 | Memory SPD Data (Apple Specific - Type 130)␊ |
910 | ============================================= */␊ |
911 | void addSMBMemorySPD(SMBStructPtrs *structPtr)␊ |
912 | {␊ |
913 | ␉/* SPD data from Platform.RAM.spd */␊ |
914 | ␉return;␊ |
915 | }␊ |
916 | ␊ |
917 | /* ============================================␊ |
918 | OEM Processor Type (Apple Specific - Type 131)␊ |
919 | ============================================== */␊ |
920 | void addSMBOemProcessorType(SMBStructPtrs *structPtr)␊ |
921 | {␊ |
922 | ␉SMBOemProcessorType *p = (SMBOemProcessorType *)structPtr->new;␊ |
923 | ␊ |
924 | ␉p->header.type␉␉= kSMBTypeOemProcessorType;␊ |
925 | ␉p->header.length␉= sizeof(SMBOemProcessorType);␊ |
926 | ␉p->header.handle␉= handle++;␊ |
927 | ␊ |
928 | ␉setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->ProcessorType));␊ |
929 | ␊ |
930 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorType) + 2);␊ |
931 | ␉tableLength += sizeof(SMBOemProcessorType) + 2;␊ |
932 | ␉structureCount++;␊ |
933 | }␊ |
934 | ␊ |
935 | /* =================================================␊ |
936 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
937 | =================================================== */␊ |
938 | void addSMBOemProcessorBusSpeed(SMBStructPtrs *structPtr)␊ |
939 | {␊ |
940 | ␉SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new;␊ |
941 | ␊ |
942 | ␉switch (Platform.CPU.Family) ␊ |
943 | ␉{␊ |
944 | ␉␉case 0x06:␊ |
945 | ␉␉{␊ |
946 | ␉␉␉switch (Platform.CPU.Model)␊ |
947 | ␉␉␉{␊ |
948 | ␉␉␉␉case 0x19:␉␉␉// Intel Core i5 650 @3.20 Ghz␊ |
949 | ␉␉␉␉case CPUID_MODEL_FIELDS:␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
950 | ␉␉␉␉case CPUID_MODEL_CLARKDALE:␊ |
951 | ␉␉␉␉case CPUID_MODEL_DALES:␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
952 | ␉␉␉␉case CPUID_MODEL_NEHALEM:␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
953 | ␉␉␉␉case CPUID_MODEL_NEHALEM_EX:␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
954 | ␉␉␉␉case CPUID_MODEL_WESTMERE:␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
955 | ␉␉␉␉case CPUID_MODEL_WESTMERE_EX:␉// Intel Xeon E7␊ |
956 | ␉␉␉␉case CPUID_MODEL_SANDYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
957 | ␉␉␉␉case CPUID_MODEL_IVYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
958 | ␉␉␉␉case CPUID_MODEL_IVYBRIDGE_XEON:␊ |
959 | ␉␉␉␉case CPUID_MODEL_JAKETOWN:␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
960 | ␉␉␉␉case CPUID_MODEL_HASWELL:␊ |
961 | ␉␉␉␉case CPUID_MODEL_HASWELL_SVR:␊ |
962 | ␉␉␉␉case CPUID_MODEL_HASWELL_ULT:␊ |
963 | ␉␉␉␉case CPUID_MODEL_HASWELL_ULX:␊ |
964 | ␊ |
965 | ␉␉␉␉␉break;␊ |
966 | ␊ |
967 | ␉␉␉␉default:␊ |
968 | ␉␉␉␉␉return;␊ |
969 | ␉␉␉}␊ |
970 | ␉␉}␊ |
971 | ␉}␊ |
972 | ␊ |
973 | ␉p->header.type␉␉= kSMBTypeOemProcessorBusSpeed;␊ |
974 | ␉p->header.length␉= sizeof(SMBOemProcessorBusSpeed);␊ |
975 | ␉p->header.handle␉= handle++;␊ |
976 | ␊ |
977 | ␉setSMBValue(structPtr, numOfSetters -1, (returnType *)&(p->ProcessorBusSpeed));␊ |
978 | ␊ |
979 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorBusSpeed) + 2);␊ |
980 | ␉tableLength += sizeof(SMBOemProcessorBusSpeed) + 2;␊ |
981 | ␉structureCount++;␊ |
982 | }␊ |
983 | ␊ |
984 | /* ==============================================␊ |
985 | OEM Platform Feature (Apple Specific - Type 133)␊ |
986 | ================================================ */␊ |
987 | /*␊ |
988 | void addSMBOemPlatformFeature(SMBStructPtrs *structPtr)␊ |
989 | {␊ |
990 | ␉SMBOemPlatformFeature *p = (SMBOemPlatformFeature *)structPtr->new;␊ |
991 | ␊ |
992 | ␉p->header.type␉␉= kSMBTypeOemPlatformFeature;␊ |
993 | ␉p->header.length␉= sizeof(SMBOemPlatformFeature);␊ |
994 | ␉p->header.handle␉= handle++;␊ |
995 | ␊ |
996 | ␉setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->PlatformFeature));␊ |
997 | ␊ |
998 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemPlatformFeature) + 2);␊ |
999 | ␉tableLength += sizeof(SMBOemPlatformFeature) + 2;␊ |
1000 | ␉structureCount++;␊ |
1001 | }␊ |
1002 | */␊ |
1003 | /* =========================================␊ |
1004 | OEM SMC Version (Apple Specific - Type 134)␊ |
1005 | =========================================== */␊ |
1006 | /*␊ |
1007 | void addSMBOemSMCVersion(SMBStructPtrs *structPtr)␊ |
1008 | {␊ |
1009 | SMBOemSMCVersion *p = (SMBOemSMCVersion *)structPtr->new;␊ |
1010 | ␊ |
1011 | p->header.type␉␉= kSMBTypeOemSMCVersion;␊ |
1012 | p->header.length␉= sizeof(SMBOemSMCVersion);␊ |
1013 | p->header.handle␉= handle++;␊ |
1014 | ␊ |
1015 | setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->SMCVersion));␊ |
1016 | ␊ |
1017 | structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemSMCVersion) + 2);␊ |
1018 | tableLength += sizeof(SMBOemSMCVersion) + 2;␊ |
1019 | structureCount++;␊ |
1020 | }␊ |
1021 | */␊ |
1022 | ␊ |
1023 | /* ==============================================␊ |
1024 | EndOfTable␊ |
1025 | ================================================ */␊ |
1026 | void addSMBEndOfTable(SMBStructPtrs *structPtr)␊ |
1027 | {␊ |
1028 | ␉structPtr->new->type␉= kSMBTypeEndOfTable;␊ |
1029 | ␉structPtr->new->length␉= sizeof(SMBStructHeader);␊ |
1030 | ␉structPtr->new->handle␉= handle++;␊ |
1031 | ␊ |
1032 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBStructHeader) + 2);␊ |
1033 | ␉tableLength += sizeof(SMBStructHeader) + 2;␊ |
1034 | ␉structureCount++;␊ |
1035 | }␊ |
1036 | ␊ |
1037 | void setSMBStruct(SMBStructPtrs *structPtr)␊ |
1038 | {␊ |
1039 | ␉bool setterFound = false;␊ |
1040 | ␊ |
1041 | ␉uint8_t *ptr;␊ |
1042 | ␉SMBWord structSize;␊ |
1043 | ␉int i;␊ |
1044 | ␊ |
1045 | ␉/* Bungo: not needed because of tables lengths fix in next lines␊ |
1046 | ␉// http://forge.voodooprojects.org/p/chameleon/issues/361/␊ |
1047 | ␉bool forceFullMemInfo = false;␊ |
1048 | ␊ |
1049 | ␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␊ |
1050 | ␉{␊ |
1051 | ␉␉getBoolForKey(kMemFullInfo, &forceFullMemInfo, &bootInfo->chameleonConfig);␊ |
1052 | ␉␉if (forceFullMemInfo)␊ |
1053 | ␉␉{␊ |
1054 | ␉␉␉structPtr->orig->length = 27;␊ |
1055 | ␉␉}␊ |
1056 | ␉}*/␊ |
1057 | ␊ |
1058 | ␉stringIndex = 1;␊ |
1059 | ␉stringsSize = 0;␊ |
1060 | ␊ |
1061 | ␉if (handle < structPtr->orig->handle)␊ |
1062 | ␉{␊ |
1063 | ␉␉handle = structPtr->orig->handle;␊ |
1064 | ␉}␊ |
1065 | ␉// Bungo: fix unsuported tables lengths from original smbios: extend shorter or truncate longer - we use SMBIOS rev. 2.4 like Apple uses␊ |
1066 | ␉switch (structPtr->orig->type)␊ |
1067 | ␉{␊ |
1068 | ␉␉case kSMBTypeBIOSInformation:␊ |
1069 | ␉␉␉structSize = sizeof(SMBBIOSInformation);␊ |
1070 | ␉␉␉break;␊ |
1071 | ␉␉case kSMBTypeSystemInformation:␊ |
1072 | ␉␉␉structSize = sizeof(SMBSystemInformation);␊ |
1073 | ␉␉␉break;␊ |
1074 | ␉␉case kSMBTypeBaseBoard:␊ |
1075 | ␉␉␉structSize = sizeof(SMBBaseBoard);␊ |
1076 | ␉␉␉break;␊ |
1077 | ␉␉case kSMBTypeSystemEnclosure:␊ |
1078 | ␉␉␉structSize = sizeof(SMBSystemEnclosure);␊ |
1079 | ␉␉␉break;␊ |
1080 | ␉␉case kSMBTypeProcessorInformation:␊ |
1081 | ␉␉␉structSize = sizeof(SMBProcessorInformation);␊ |
1082 | ␉␉␉break;␊ |
1083 | ␉␉case kSMBTypeMemoryDevice:␊ |
1084 | ␉␉␉structSize = sizeof(SMBMemoryDevice);␊ |
1085 | ␉␉␉break;␊ |
1086 | ␉␉default:␊ |
1087 | ␉␉␉structSize = structPtr->orig->length; // doesn't change a length for unpatched␊ |
1088 | ␉␉␉break;␊ |
1089 | ␉}␊ |
1090 | ␊ |
1091 | ␉// memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);␊ |
1092 | ␉if (structPtr->orig->length <= structSize)␊ |
1093 | ␉{␊ |
1094 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);␊ |
1095 | ␉}␊ |
1096 | ␉else␊ |
1097 | ␉{␊ |
1098 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structSize);␊ |
1099 | ␉}␊ |
1100 | ␊ |
1101 | ␉structPtr->new->length = structSize;␊ |
1102 | ␊ |
1103 | ␉for (i = 0; i < numOfSetters; i++)␊ |
1104 | ␉{␊ |
1105 | ␉␉// Bungo:␊ |
1106 | ␉␉//if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) {␊ |
1107 | ␉␉if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize))␊ |
1108 | ␉␉{␊ |
1109 | ␉␉␉setterFound = true;␊ |
1110 | ␉␉␉setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));␊ |
1111 | ␉␉}␊ |
1112 | ␉}␊ |
1113 | ␊ |
1114 | ␉if (setterFound)␊ |
1115 | ␉{␊ |
1116 | ␉␉// Bungo:␊ |
1117 | ␉␉// ptr = (uint8_t *)structPtr->new + structPtr->orig->length;␊ |
1118 | ␉␉ptr = (uint8_t *)structPtr->new + structPtr->new->length;␊ |
1119 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1120 | ␊ |
1121 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
1122 | ␉␉{␊ |
1123 | ␉␉␉ptr += 2;␊ |
1124 | ␉␉}␊ |
1125 | ␉␉structSize = ptr - (uint8_t *)structPtr->new;␊ |
1126 | ␉}␊ |
1127 | ␉else␊ |
1128 | ␉{␊ |
1129 | ␉␉ptr = (uint8_t *)structPtr->orig + structPtr->orig->length;␊ |
1130 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1131 | ␊ |
1132 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
1133 | ␉␉{␊ |
1134 | ␉␉␉ptr += 2;␊ |
1135 | ␉␉}␊ |
1136 | ␊ |
1137 | ␉␉structSize = ptr - (uint8_t *)structPtr->orig;␊ |
1138 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structSize);␊ |
1139 | ␉}␊ |
1140 | ␊ |
1141 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + structSize);␊ |
1142 | ␊ |
1143 | ␉tableLength += structSize;␊ |
1144 | ␊ |
1145 | ␉if (structSize > maxStructSize)␊ |
1146 | ␉{␊ |
1147 | ␉␉maxStructSize = structSize;␊ |
1148 | ␉}␊ |
1149 | ␊ |
1150 | ␉structureCount++;␊ |
1151 | }␊ |
1152 | ␊ |
1153 | void setupNewSMBIOSTable(SMBEntryPoint *eps, SMBStructPtrs *structPtr)␊ |
1154 | {␊ |
1155 | ␉uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;␊ |
1156 | ␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
1157 | ␊ |
1158 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structPtr->orig + sizeof(SMBStructHeader)));) {␊ |
1159 | ␉␉switch (structPtr->orig->type) {␊ |
1160 | ␉␉␉/* Skip all Apple Specific Structures */␊ |
1161 | ␉␉␉case kSMBTypeFirmwareVolume:␊ |
1162 | ␉␉␉case kSMBTypeMemorySPD:␊ |
1163 | ␉␉␉case kSMBTypeOemProcessorType:␊ |
1164 | ␉␉␉case kSMBTypeOemProcessorBusSpeed:␊ |
1165 | //␉␉␉case kSMBTypeOemPlatformFeature:␊ |
1166 | //␉␉␉case kSMBTypeOemSMCVersion:␊ |
1167 | ␉␉␉/* And this one too, to be added at the end */␊ |
1168 | ␉␉␉case kSMBTypeEndOfTable:␊ |
1169 | ␉␉␉␉break;␊ |
1170 | ␊ |
1171 | ␉␉␉default:␊ |
1172 | ␉␉␉{␊ |
1173 | ␉␉␉␉/* Add */␊ |
1174 | ␉␉␉␉setSMBStruct(structPtr);␊ |
1175 | ␉␉␉␉break;␊ |
1176 | ␉␉␉}␊ |
1177 | ␉␉}␊ |
1178 | ␊ |
1179 | ␉␉ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length);␊ |
1180 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1181 | ␊ |
1182 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
1183 | ␉␉{␊ |
1184 | ␉␉␉ptr += 2;␊ |
1185 | ␉␉}␊ |
1186 | ␊ |
1187 | ␉␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
1188 | ␉}␊ |
1189 | ␊ |
1190 | ␉addSMBFirmwareVolume(structPtr);␊ |
1191 | ␉addSMBMemorySPD(structPtr);␊ |
1192 | ␉addSMBOemProcessorType(structPtr);␊ |
1193 | ␉addSMBOemProcessorBusSpeed(structPtr);␊ |
1194 | //␉addSMBOemPlatformFeature(structPtr);␊ |
1195 | //␉addSMBOemSMCVersion(structPtr);␊ |
1196 | ␉addSMBEndOfTable(structPtr);␊ |
1197 | }␊ |
1198 | ␊ |
1199 | // Bungo: does fix system uuid in SMBIOS & EFI instead of in EFI (IODT/efi/platform/system-id) only␊ |
1200 | uint8_t *fixSystemUUID()␊ |
1201 | {␊ |
1202 | ␉uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress;␊ |
1203 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)ptr;␊ |
1204 | ␉uint8_t *ret = NULL;␊ |
1205 | ␉int i, isZero, isOnes;␊ |
1206 | ␉uint8_t fixedUUID[UUID_LEN] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};␊ |
1207 | ␉const char *sysId = getStringForKey(kSMBSystemInformationUUIDKey, SMBPlist); // try to get user's uuid from smbios.plist␊ |
1208 | ␉ret = (uint8_t *)getUUIDFromString(sysId); // convert user's uuid from string␊ |
1209 | ␊ |
1210 | ␉for (;(structHeader->type != kSMBTypeSystemInformation);) // find System Information Table (Type 1) in patched SMBIOS␊ |
1211 | ␉{␊ |
1212 | ␉␉ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
1213 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1214 | ␊ |
1215 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
1216 | ␉␉{␊ |
1217 | ␉␉␉ptr += 2;␊ |
1218 | ␉␉}␊ |
1219 | ␊ |
1220 | ␉␉structHeader = (SMBStructHeader *)ptr;␊ |
1221 | ␉}␊ |
1222 | ␊ |
1223 | ␉ptr = ((SMBSystemInformation *)structHeader)->uuid;␊ |
1224 | ␊ |
1225 | ␉if (!sysId || !ret) // no or bad custom uuid,...␊ |
1226 | ␉{␊ |
1227 | ␉␉sysId = 0;␊ |
1228 | ␉␉ret = Platform.UUID; // ...use original (factory) system uuid␊ |
1229 | ␉}␊ |
1230 | ␊ |
1231 | ␉for (i = 0, isZero = 1, isOnes = 1; i < UUID_LEN; i++) // check if empty (zeroed) or setable (FFed), means: no uuid present␊ |
1232 | ␉{␊ |
1233 | ␉␉if (ret[i] != 0x00)␊ |
1234 | ␉␉{␊ |
1235 | ␉␉␉isZero = 0;␊ |
1236 | ␉␉}␊ |
1237 | ␊ |
1238 | ␉␉if (ret[i] != 0xff)␊ |
1239 | ␉␉{␊ |
1240 | ␉␉␉isOnes = 0;␊ |
1241 | ␉␉}␊ |
1242 | ␉}␊ |
1243 | ␊ |
1244 | ␉if (isZero || isOnes) // if empty or setable...␊ |
1245 | ␉{␊ |
1246 | ␉␉verbose("System UUID: incorrect or not present. Fixing [00112233-4455-6677-8899-AABBCCDDEEFF]\n");␊ |
1247 | ␉␉ret = fixedUUID; // ...set a fixed value for system uuid: <00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF>␊ |
1248 | ␉}␊ |
1249 | ␊ |
1250 | ␉memcpy(ptr, ret, UUID_LEN); // save uuid into the patched SMBIOS Table 1␊ |
1251 | ␊ |
1252 | ␉return ptr;␊ |
1253 | } // Bungo: end fix␊ |
1254 | ␊ |
1255 | void setupSMBIOSTable(void)␊ |
1256 | {␊ |
1257 | ␉SMBStructPtrs *structPtr;␊ |
1258 | ␉uint8_t *buffer;␊ |
1259 | ␉// bool setSMB = true; Bungo: now we use useSMBIOSdefaults␊ |
1260 | ␊ |
1261 | ␉if (!origeps)␊ |
1262 | ␉{␊ |
1263 | ␉␉return;␊ |
1264 | ␉}␊ |
1265 | ␊ |
1266 | ␉neweps = origeps;␊ |
1267 | ␊ |
1268 | ␉structPtr = (SMBStructPtrs *)malloc(sizeof(SMBStructPtrs));␊ |
1269 | ␉if (!structPtr)␊ |
1270 | ␉{␊ |
1271 | ␉␉return;␊ |
1272 | ␉}␊ |
1273 | ␉␊ |
1274 | ␉buffer = (uint8_t *)malloc(SMB_ALLOC_SIZE);␊ |
1275 | ␉if (!buffer)␊ |
1276 | ␉{␊ |
1277 | ␉␉free(structPtr);␊ |
1278 | ␉␉return;␊ |
1279 | ␉}␊ |
1280 | ␊ |
1281 | ␉bzero(buffer, SMB_ALLOC_SIZE);␊ |
1282 | ␉structPtr->new = (SMBStructHeader *)buffer;␊ |
1283 | ␊ |
1284 | ␉// getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); Bungo␊ |
1285 | ␉getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig);␊ |
1286 | ␉// if (setSMB) Bungo␊ |
1287 | ␉setDefaultSMBData();␊ |
1288 | ␊ |
1289 | ␉setupNewSMBIOSTable(origeps, structPtr);␊ |
1290 | ␊ |
1291 | ␉neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));␊ |
1292 | ␉if (!neweps)␊ |
1293 | ␉{␊ |
1294 | ␉␉free(buffer);␊ |
1295 | ␉␉free(structPtr);␊ |
1296 | ␉␉return;␊ |
1297 | ␉}␊ |
1298 | ␉bzero(neweps, sizeof(SMBEntryPoint));␊ |
1299 | ␊ |
1300 | ␉neweps->anchor[0]␉␉␉= '_';␊ |
1301 | ␉neweps->anchor[1]␉␉␉= 'S';␊ |
1302 | ␉neweps->anchor[2]␉␉␉= 'M';␊ |
1303 | ␉neweps->anchor[3]␉␉␉= '_';␊ |
1304 | ␉neweps->entryPointLength␉= sizeof(SMBEntryPoint);␊ |
1305 | ␉neweps->majorVersion␉␉= 2; // Bungo:␊ |
1306 | ␉neweps->minorVersion␉␉= 4; // Here we're using 2.4 SMBIOS rev. as real Macs␊ |
1307 | ␉neweps->maxStructureSize␉= maxStructSize;␊ |
1308 | ␉neweps->entryPointRevision␉= 0;␊ |
1309 | ␊ |
1310 | ␉neweps->dmi.anchor[0]␉␉= '_';␊ |
1311 | ␉neweps->dmi.anchor[1]␉␉= 'D';␊ |
1312 | ␉neweps->dmi.anchor[2]␉␉= 'M';␊ |
1313 | ␉neweps->dmi.anchor[3]␉␉= 'I';␊ |
1314 | ␉neweps->dmi.anchor[4]␉␉= '_';␊ |
1315 | ␉neweps->dmi.tableLength␉␉= tableLength;␊ |
1316 | ␉neweps->dmi.tableAddress␉= AllocateKernelMemory(tableLength);␊ |
1317 | ␉neweps->dmi.structureCount␉= structureCount;␊ |
1318 | ␉neweps->dmi.bcdRevision␉␉= 0x24; // ... and 2.4 DMI rev. as real Macs␊ |
1319 | ␊ |
1320 | ␉if (!neweps->dmi.tableAddress)␊ |
1321 | ␉{␊ |
1322 | ␉␉free(buffer);␊ |
1323 | ␉␉free(structPtr);␊ |
1324 | ␉␉return;␊ |
1325 | ␉}␊ |
1326 | ␊ |
1327 | ␉memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);␊ |
1328 | ␊ |
1329 | ␉Platform.UUID = fixSystemUUID(); // Bungo: fix System UUID␊ |
1330 | ␊ |
1331 | ␉neweps->dmi.checksum␉␉= 0;␊ |
1332 | ␉neweps->dmi.checksum␉␉= 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint));␊ |
1333 | ␊ |
1334 | ␉neweps->checksum␉␉= 0;␊ |
1335 | ␉neweps->checksum␉␉= 0x100 - checksum8(neweps, sizeof(SMBEntryPoint));␊ |
1336 | ␊ |
1337 | ␉free(buffer);␊ |
1338 | ␉free(structPtr);␊ |
1339 | ␊ |
1340 | ␉DBG("SMBIOS orig was = %x\n", origeps);␊ |
1341 | ␉DBG("SMBIOS new is = %x\n", neweps);␊ |
1342 | ␊ |
1343 | ␉decodeSMBIOSTable(neweps);␊ |
1344 | ␊ |
1345 | }␊ |
1346 | ␊ |
1347 | void *getSmbios(int which)␊ |
1348 | {␊ |
1349 | ␉switch (which)␊ |
1350 | ␉{␊ |
1351 | ␉␉case SMBIOS_ORIGINAL:␊ |
1352 | ␉␉␉if (!origeps)␊ |
1353 | ␉␉␉{␊ |
1354 | ␉␉␉␉origeps = getAddressOfSmbiosTable();␊ |
1355 | ␉␉␉}␊ |
1356 | ␉␉␉return origeps;␊ |
1357 | ␉␉case SMBIOS_PATCHED:␊ |
1358 | ␉␉␉return neweps;␊ |
1359 | ␉}␊ |
1360 | ␊ |
1361 | ␉return 0;␊ |
1362 | }␊ |
1363 | ␊ |
1364 | /* Collect any information needed later */␊ |
1365 | void readSMBIOSInfo(SMBEntryPoint *eps)␊ |
1366 | {␊ |
1367 | ␉uint8_t *structPtr = (uint8_t *)eps->dmi.tableAddress;␊ |
1368 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;␊ |
1369 | ␊ |
1370 | ␉int dimmnbr = 0;␊ |
1371 | ␉Platform.DMI.MaxMemorySlots␉= 0;␉// number of memory slots polulated by SMBIOS␊ |
1372 | ␉Platform.DMI.CntMemorySlots␉= 0;␉// number of memory slots counted␊ |
1373 | ␉Platform.DMI.MemoryModules␉= 0;␊ |
1374 | ␊ |
1375 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)␊ |
1376 | ␉{␊ |
1377 | ␉␉switch (structHeader->type)␊ |
1378 | ␉␉{␊ |
1379 | ␉␉␉case kSMBTypeSystemInformation:␊ |
1380 | ␉␉␉␉Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid; // save factory system uuid␊ |
1381 | ␉␉␉␉break;␊ |
1382 | ␊ |
1383 | ␉␉␉case kSMBTypeSystemEnclosure: // Bungo: determine platform type␊ |
1384 | ␉␉␉␉switch (((SMBSystemEnclosure *)structHeader)->chassisType)␊ |
1385 | ␉␉␉␉{␊ |
1386 | ␉␉␉␉␉case kSMBchassisPortable:␊ |
1387 | ␉␉␉␉␉case kSMBchassisLaptop:␊ |
1388 | ␉␉␉␉␉case kSMBchassisNotebook:␊ |
1389 | ␉␉␉␉␉case kSMBchassisHandHeld:␊ |
1390 | ␉␉␉␉␉case kSMBchassisSubNotebook:␊ |
1391 | ␉␉␉␉␉␉PlatformType = 2; // notebook (MacBooks/Pros)␊ |
1392 | ␉␉␉␉␉␉break;␊ |
1393 | ␉␉␉␉␉case kSMBchassisMiniTower:␊ |
1394 | ␉␉␉␉␉case kSMBchassisTower:␊ |
1395 | ␉␉␉␉␉case kSMBchassisBlade:␊ |
1396 | ␉␉␉␉␉case kSMBchassisBladeEnclosing:␊ |
1397 | ␉␉␉␉␉␉PlatformType = 3; // workstation (Mac Pro, Xserve)␊ |
1398 | ␉␉␉␉␉␉break;␊ |
1399 | ␉␉␉␉␉default:␊ |
1400 | ␉␉␉␉␉␉PlatformType = 1; // defulting to 1 desktop (iMac, MacMini)␊ |
1401 | ␉␉␉␉␉␉break;␊ |
1402 | ␉␉␉␉}␊ |
1403 | ␉␉␉␉break;␊ |
1404 | ␊ |
1405 | ␉␉␉case kSMBTypePhysicalMemoryArray:␊ |
1406 | ␉␉␉␉Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices;␊ |
1407 | ␉␉␉␉break;␊ |
1408 | ␊ |
1409 | ␉␉␉case kSMBTypeMemoryDevice:␊ |
1410 | ␉␉␉␉Platform.DMI.CntMemorySlots++;␊ |
1411 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySize != 0)␊ |
1412 | ␉␉␉␉{␊ |
1413 | ␉␉␉␉␉Platform.DMI.MemoryModules++;␊ |
1414 | ␉␉␉␉}␊ |
1415 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)␊ |
1416 | ␉␉␉␉{␊ |
1417 | ␉␉␉␉␉Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed;␊ |
1418 | ␉␉␉␉}␊ |
1419 | ␉␉␉␉dimmnbr++;␊ |
1420 | ␉␉␉␉break;␊ |
1421 | ␉␉␉default:␊ |
1422 | ␉␉␉␉break;␊ |
1423 | ␉␉}␊ |
1424 | ␊ |
1425 | ␉␉structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
1426 | ␉␉for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);␊ |
1427 | ␊ |
1428 | ␉␉if (((uint16_t *)structPtr)[0] == 0)␊ |
1429 | ␉␉{␊ |
1430 | ␉␉␉structPtr += 2;␊ |
1431 | ␉␉}␊ |
1432 | ␊ |
1433 | ␉␉structHeader = (SMBStructHeader *)structPtr;␊ |
1434 | ␉}␊ |
1435 | }␊ |
1436 |