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 | ␊ |
9 | #include "boot.h"␊ |
10 | #include "bootstruct.h"␊ |
11 | #include "smbios_getters.h"␊ |
12 | // Bungo␊ |
13 | #include "convert.h"␊ |
14 | ␊ |
15 | #ifndef DEBUG_SMBIOS␊ |
16 | #define DEBUG_SMBIOS 0␊ |
17 | #endif␊ |
18 | ␊ |
19 | #if DEBUG_SMBIOS␊ |
20 | #define DBG(x...)␉printf(x)␊ |
21 | #else␊ |
22 | #define DBG(x...)␉msglog(x)␊ |
23 | #endif␊ |
24 | ␊ |
25 | #define SMBPlist␉␉␉&bootInfo->smbiosConfig␊ |
26 | /* ASSUMPTION: 16KB should be enough for the whole thing */␊ |
27 | #define SMB_ALLOC_SIZE␉16384␊ |
28 | ␊ |
29 | ␊ |
30 | //-------------------------------------------------------------------------------------------------------------------------␊ |
31 | // SMBIOS Plist Keys␊ |
32 | //-------------------------------------------------------------------------------------------------------------------------␊ |
33 | ␊ |
34 | /* =======================␊ |
35 | BIOS Information (Type 0)␊ |
36 | ========================= */␊ |
37 | #define kSMBBIOSInformationVendorKey␉␉ "SMbiosvendor" // Apple Inc.␊ |
38 | #define kSMBBIOSInformationVersionKey␉␉ "SMbiosversion" // MP31.88Z.006C.B05.0802291410␊ |
39 | #define kSMBBIOSInformationReleaseDateKey␉ "SMbiosdate" // 02/29/08␊ |
40 | // Bungo␊ |
41 | #define kSMBBIOSInformationReleaseKey "SMbiosrelease" // BIOS Revision␊ |
42 | // example: BIOS Revision: 1.23 --> 2 bytes: Major=0x01, Minor=0x17 --> after swap: 0x1701hex = 5889dec (SMBIOS_spec_DSP0134_2.7.1)␊ |
43 | ␊ |
44 | /* =========================␊ |
45 | System Information (Type 1)␊ |
46 | =========================== */␊ |
47 | #define kSMBSystemInformationManufacturerKey "SMmanufacturer" // Apple Inc.␊ |
48 | #define kSMBSystemInformationProductNameKey "SMproductname" // MacPro3,1␊ |
49 | #define kSMBSystemInformationVersionKey "SMsystemversion" // 1.0␊ |
50 | #define kSMBSystemInformationSerialNumberKey "SMserial" // Serial number␊ |
51 | //Bungo␊ |
52 | #define kSMBSystemInformationUUIDKey "SMsystemuuid" // ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }'␊ |
53 | #define kSMBSystemInformationSKUNumberKey "SMskunumber" // System SKU#␊ |
54 | ␊ |
55 | #define kSMBSystemInformationFamilyKey "SMfamily" // MacPro␊ |
56 | ␊ |
57 | /* =========================================␊ |
58 | Base Board (or Module) Information (Type 2)␊ |
59 | =========================================== */␊ |
60 | #define kSMBBaseBoardManufacturerKey "SMboardmanufacturer" // Apple Inc.␊ |
61 | #define kSMBBaseBoardProductKey "SMboardproduct" // Mac-F2268DC8␊ |
62 | // Bungo␊ |
63 | #define kSMBBaseBoardVersionKey "SMboardversion" // MacPro3,1␊ |
64 | #define kSMBBaseBoardSerialNumberKey "SMboardserial" // C02140302D5DMT31M␊ |
65 | #define kSMBBaseBoardAssetTagNumberKey "SMboardassettag" // Base Board Asset Tag#␊ |
66 | #define kSMBBaseBoardLocationInChassisKey "SMboardlocation" // Part Component␊ |
67 | #define kSMBBaseBoardTypeKey "SMboardtype" // 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro␊ |
68 | ␊ |
69 | // Bungo␊ |
70 | /* =======================␊ |
71 | System Enclosure (Type 3)␊ |
72 | ========================= */␊ |
73 | #define kSMBSystemEnclosureManufacturerKey "SMchassismanufacturer" // Apple Inc.␊ |
74 | #define kSMBSystemEnclosureTypeKey "SMchassistype" // 7 Desktop␊ |
75 | #define kSMBSystemEnclosureVersionKey "SMchassisversion" // Mac-F42C88C8␊ |
76 | #define kSMBSystemEnclosureSerialNumberKey "SMchassisserial" // Serial number␊ |
77 | #define kSMBSystemEnclosureAssetTagNumberKey "SMchassisassettag" // Pro-Enclosure␊ |
78 | ␊ |
79 | /* ============================␊ |
80 | Processor Information (Type 4)␊ |
81 | ============================== */␊ |
82 | // Bungo␊ |
83 | #define kSMBProcessorInformationSocketKey "SMcpusocket"␊ |
84 | #define kSMBProcessorInformationManufacturerKey "SMcpumanufacturer"␊ |
85 | #define kSMBProcessorInformationVersionKey "SMcpuversion"␊ |
86 | //␊ |
87 | #define kSMBProcessorInformationExternalClockKey␉"SMexternalclock"␊ |
88 | #define kSMBProcessorInformationMaximumClockKey␉␉"SMmaximalclock"␊ |
89 | // Bungo␊ |
90 | #define kSMBProcessorInformationCurrentClockKey "SMcurrentclock"␊ |
91 | #define kSMBProcessorInformationUpgradeKey "SMcpuupgrade"␊ |
92 | #define kSMBProcessorInformationSerialNumberKey "SMcpuserial"␊ |
93 | #define kSMBProcessorInformationAssetTagNumberKey "SMcpuassettag"␊ |
94 | #define kSMBProcessorInformationPartNumberKey "SMcpupartnumber"␊ |
95 | ␊ |
96 | /* =====================␊ |
97 | Memory Device (Type 17)␊ |
98 | ======================= */␊ |
99 | #define kSMBMemoryDeviceDeviceLocatorKey "SMmemdevloc" //␊ |
100 | #define kSMBMemoryDeviceBankLocatorKey "SMmembankloc" //␊ |
101 | #define kSMBMemoryDeviceMemoryTypeKey "SMmemtype" //␊ |
102 | #define kSMBMemoryDeviceMemorySpeedKey "SMmemspeed" //␊ |
103 | #define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" //␊ |
104 | #define kSMBMemoryDeviceSerialNumberKey "SMmemserial" //␊ |
105 | #define kSMBMemoryDevicePartNumberKey "SMmempart" //␊ |
106 | ␊ |
107 | /* ===========================================␊ |
108 | Memory SPD Data (Apple Specific - Type 130)␊ |
109 | ============================================= */␊ |
110 | ␊ |
111 | /* ============================================␊ |
112 | OEM Processor Type (Apple Specific - Type 131)␊ |
113 | ============================================== */␊ |
114 | #define kSMBOemProcessorTypeKey "SMoemcputype" // Bungo: renamed from SMcputype␊ |
115 | ␊ |
116 | /* =================================================␊ |
117 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
118 | =================================================== */␊ |
119 | #define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed␊ |
120 | ␊ |
121 | //-------------------------------------------------------------------------------------------------------------------------␊ |
122 | // Default SMBIOS Data␊ |
123 | //-------------------------------------------------------------------------------------------------------------------------␊ |
124 | /* Rewrite: use a struct */␊ |
125 | ␊ |
126 | #define kDefaultVendorManufacturer␉␉␉"Apple Inc."␊ |
127 | #define kDefaultBIOSReleaseDate␉␉␉␉"11/06/2009"␊ |
128 | #define kDefaultSerialNumber␉␉␉␉"SOMESRLNMBR"␊ |
129 | #define kDefaultskuNumber␉␉␉␉"Default System SKU#"␊ |
130 | #define kDefaultBoardProduct␉␉␉␉"Mac-F4208DC8"␊ |
131 | #define kDefaultBoardType␉␉␉␉"10" // 0xA␊ |
132 | #define kDefaultSystemVersion␉␉␉␉"1.0"␊ |
133 | ␊ |
134 | //Bungo␊ |
135 | /* 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0) */␊ |
136 | #define kDefaultBIOSRelease 256␊ |
137 | ␊ |
138 | #define KDefaultBoardSerialNumber␉␉␉"C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H␊ |
139 | #define KDefaultBoardAssetTagNumber␉␉␉"Pro-Enclosure" // ErmaC␊ |
140 | #define kDefaultLocatioInChassis␉␉␉"Part Component" // ErmaC␊ |
141 | ␊ |
142 | // defaults for a Mac mini␊ |
143 | #define kDefaultMacminiFamily␉␉␉␉"Macmini"␊ |
144 | #define kDefaultMacmini␉␉␉␉␉"Macmini1,1"␊ |
145 | #define kDefaultMacminiBIOSVersion␉␉␉" MM21.88Z.009A.B00.0903051113"␊ |
146 | ␊ |
147 | // defaults for a MacBook␊ |
148 | #define kDefaultMacBookFamily␉␉␉␉"MacBook"␊ |
149 | #define kDefaultMacBook␉␉␉␉␉"MacBook4,1"␊ |
150 | #define kDefaultMacBookBIOSVersion␉␉␉" MB41.88Z.0073.B00.0903051113"␊ |
151 | ␊ |
152 | // defaults for a MacBook Pro␊ |
153 | #define kDefaultMacBookProFamily␉␉␉"MacBookPro"␊ |
154 | #define kDefaultMacBookPro␉␉␉␉"MacBookPro4,1"␊ |
155 | #define kDefaultMacBookProBIOSVersion␉␉␉" MBP41.88Z.0073.B00.0903051113"␊ |
156 | ␊ |
157 | // defaults for an iMac␊ |
158 | #define kDefaultiMacFamily␉␉␉␉"iMac"␊ |
159 | #define kDefaultiMac␉␉␉␉␉"iMac8,1"␊ |
160 | #define kDefaultiMacBIOSVersion␉␉␉␉" IM81.88Z.00C1.B00.0903051113"␊ |
161 | // defaults for an iMac11,1 core i3/i5/i7␊ |
162 | #define kDefaultiMacNehalem␉␉␉␉"iMac11,1"␊ |
163 | #define kDefaultiMacNehalemBIOSVersion␉␉␉" IM111.88Z.0034.B00.0903051113"␊ |
164 | // defaults for an iMac12,1␊ |
165 | #define kDefaultiMacSandy␉␉␉␉"iMac12,1"␊ |
166 | #define kDefaultiMacSandyBIOSVersion␉␉␉" IM121.88Z.0047.B00.1102091756"␊ |
167 | ␊ |
168 | // defaults for a Mac Pro␊ |
169 | #define kDefaultMacProFamily␉␉␉␉"MacPro"␊ |
170 | #define kDefaultMacPro␉␉␉␉␉"MacPro3,1"␊ |
171 | #define kDefaultMacProBIOSVersion␉␉␉" MP31.88Z.006C.B05.0903051113"␊ |
172 | // defaults for a Mac Pro 4,1 core i7/Xeon␊ |
173 | #define kDefaultMacProNehalem␉␉␉␉"MacPro4,1"␊ |
174 | #define kDefaultMacProNehalemBIOSVersion␉␉" MP41.88Z.0081.B04.0903051113"␊ |
175 | // defaults for a Mac Pro 5,1 core i7/Xeon␊ |
176 | #define kDefaultMacProWestmere␉␉␉␉"MacPro5,1"␊ |
177 | #define kDefaultMacProWestmereBIOSVersion␉␉" MP51.88Z.007F.B03.1010071432"␊ |
178 | #define kDefaultMacProWestmereBIOSReleaseDate␉␉"10/07/2010"␊ |
179 | //-------------------------------------------------------------------------------------------------------------------------␊ |
180 | ␊ |
181 | ␊ |
182 | #define getFieldOffset(struct, field)␉((uint8_t)(uint32_t)&(((struct *)0)->field))␊ |
183 | ␊ |
184 | typedef struct␊ |
185 | {␊ |
186 | ␉SMBStructHeader *orig;␊ |
187 | ␉SMBStructHeader *new;␊ |
188 | } SMBStructPtrs;␊ |
189 | ␊ |
190 | /* =======================␊ |
191 | BIOS Information (Type 0)␊ |
192 | ========================= */␊ |
193 | typedef struct␊ |
194 | {␊ |
195 | ␉char *vendor;␊ |
196 | ␉char *version;␊ |
197 | ␉char *releaseDate;␊ |
198 | ␉uint16_t release; // Bungo␊ |
199 | } defaultBIOSInfo_t;␊ |
200 | ␊ |
201 | defaultBIOSInfo_t defaultBIOSInfo;␊ |
202 | ␊ |
203 | /* =========================␊ |
204 | System Information (Type 1)␊ |
205 | =========================== */␊ |
206 | typedef struct␊ |
207 | {␊ |
208 | ␉char *manufacturer;␊ |
209 | ␉char *productName;␊ |
210 | ␉char *version;␊ |
211 | ␉char *serialNumber;␊ |
212 | ␉char *skuNumber;␊ |
213 | ␉char *family;␊ |
214 | } defaultSystemInfo_t;␊ |
215 | ␊ |
216 | defaultSystemInfo_t defaultSystemInfo;␊ |
217 | ␊ |
218 | /* =========================================␊ |
219 | Base Board (or Module) Information (Type 2)␊ |
220 | =========================================== */␊ |
221 | typedef struct␊ |
222 | {␊ |
223 | ␉char *manufacturer;␊ |
224 | ␉char *product;␊ |
225 | } defaultBaseBoard_t;␊ |
226 | ␊ |
227 | defaultBaseBoard_t defaultBaseBoard;␊ |
228 | ␊ |
229 | typedef struct␊ |
230 | {␊ |
231 | ␉uint8_t␉␉␉type;␊ |
232 | ␉SMBValueType␉␉valueType;␊ |
233 | ␉uint8_t␉␉␉fieldOffset;␊ |
234 | ␉char␉␉␉*keyString;␊ |
235 | ␉bool␉␉␉(*getSMBValue)(returnType *);␊ |
236 | ␉// Bungo␊ |
237 | ␉// char␉␉␉**defaultValue;␊ |
238 | ␉void␉␉␉*defaultValue;␊ |
239 | } SMBValueSetter;␊ |
240 | ␊ |
241 | SMBValueSetter SMBSetters[] = ␊ |
242 | {␊ |
243 | ␉/* =======================␊ |
244 | ␉ BIOS Information (Type 0)␊ |
245 | ␉ ========================= */␊ |
246 | ␉{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, vendor),␊ |
247 | ␉␉kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor }, // SMbiosvendor - Apple Inc.␊ |
248 | ␊ |
249 | ␉{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, version),␊ |
250 | ␉␉kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version }, // SMbiosversion - MP31.88Z.006C.B05.0802291410␊ |
251 | ␊ |
252 | ␉{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, releaseDate),␊ |
253 | ␉␉kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate }, // SMbiosdate - 02/29/08␊ |
254 | ␊ |
255 | ␉// Bungo␊ |
256 | ␉{ kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor),␊ |
257 | ␉␉kSMBBIOSInformationReleaseKey, NULL,␉&defaultBIOSInfo.release }, // SMbiosrelease - 256␊ |
258 | ␉//␊ |
259 | ␊ |
260 | ␉/* =========================␊ |
261 | ␉ System Information (Type 1)␊ |
262 | ␉ =========================== */␊ |
263 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, manufacturer),␊ |
264 | ␉␉kSMBSystemInformationManufacturerKey, NULL,␉&defaultSystemInfo.manufacturer␉}, // SMmanufacturer - Apple Inc.␊ |
265 | ␊ |
266 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, productName),␊ |
267 | ␉␉kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName }, // SMproductname - MacPro3,1␊ |
268 | ␊ |
269 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, version),␊ |
270 | ␉␉kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version }, // SMsystemversion - 1.0␊ |
271 | ␊ |
272 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, serialNumber),␊ |
273 | ␉␉kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number␊ |
274 | ␊ |
275 | ␉// Bungo␊ |
276 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, skuNumber),␊ |
277 | ␉␉kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU#␊ |
278 | ␊ |
279 | ␉//␊ |
280 | ␊ |
281 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, family),␊ |
282 | ␉␉kSMBSystemInformationFamilyKey,␉NULL,␉&defaultSystemInfo.family}, // SMfamily - MacPro␊ |
283 | ␊ |
284 | ␊ |
285 | ␉/* =========================================␊ |
286 | ␉ Base Board (or Module) Information (Type 2)␊ |
287 | ␉ =========================================== */␊ |
288 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, manufacturer),␊ |
289 | ␉␉kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMboardmanufacturer - Apple Inc.␊ |
290 | ␊ |
291 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, product),␊ |
292 | ␉␉kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product}, // SMboardproduct - Mac-F2268DC8␊ |
293 | ␊ |
294 | ␉// Bungo␊ |
295 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, version),␊ |
296 | ␉␉kSMBBaseBoardVersionKey, NULL, NULL}, // SMboardproductname - MacPro3,1␊ |
297 | ␊ |
298 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, serialNumber),␊ |
299 | ␉␉kSMBBaseBoardSerialNumberKey, NULL, NULL}, // SMboardserial - C02140302D5DMT31M␊ |
300 | ␊ |
301 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, assetTagNumber), kSMBBaseBoardAssetTagNumberKey,␊ |
302 | NULL, NULL␉␉},␊ |
303 | ␊ |
304 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, locationInChassis), kSMBBaseBoardLocationInChassisKey,␊ |
305 | NULL, NULL␉␉},␊ |
306 | ␉␊ |
307 | ␉{kSMBTypeBaseBoard,␉kSMBByte,␉getFieldOffset(SMBBaseBoard, boardType), kSMBBaseBoardTypeKey,␊ |
308 | NULL, NULL␉␉},␊ |
309 | ␊ |
310 | // Bungo␊ |
311 | ␉/* =======================␊ |
312 | ␉ System Enclosure (Type 3)␊ |
313 | ␉ ========================= */␊ |
314 | ␉{kSMBTypeSystemEnclosure,␉kSMBString,␉getFieldOffset(SMBSystemEnclosure, manufacturer),␉kSMBSystemEnclosureManufacturerKey,␊ |
315 | NULL,␉&defaultBaseBoard.manufacturer␉},␊ |
316 | ␊ |
317 | {kSMBTypeSystemEnclosure,␉kSMBByte,␉getFieldOffset(SMBSystemEnclosure, type),␉␉␉kSMBSystemEnclosureTypeKey,␊ |
318 | NULL, NULL␉␉},␊ |
319 | ␊ |
320 | {kSMBTypeSystemEnclosure,␉kSMBString,␉getFieldOffset(SMBSystemEnclosure, version), kSMBSystemEnclosureVersionKey,␊ |
321 | NULL,␉&defaultBaseBoard.product },␊ |
322 | ␊ |
323 | {kSMBTypeSystemEnclosure,␉kSMBString,␉getFieldOffset(SMBSystemEnclosure, serialNumber),␉kSMBSystemEnclosureSerialNumberKey,␊ |
324 | NULL, NULL␉␉},␊ |
325 | ␊ |
326 | {kSMBTypeSystemEnclosure,␉kSMBString,␉getFieldOffset(SMBSystemEnclosure, assetTagNumber), kSMBSystemEnclosureAssetTagNumberKey,␊ |
327 | NULL, NULL␉␉},␊ |
328 | ␊ |
329 | ␉/* ============================␊ |
330 | ␉ Processor Information (Type 4)␊ |
331 | ␉ ============================== */␊ |
332 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, socketDesignation),␊ |
333 | ␉␉kSMBProcessorInformationSocketKey, NULL, NULL}, // SMcpusocket -␊ |
334 | ␊ |
335 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, manufacturer),␊ |
336 | ␉␉kSMBProcessorInformationManufacturerKey, NULL, NULL}, // SMcpumanufacturer - Intel(R) Corporation␊ |
337 | ␊ |
338 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, processorVersion),␊ |
339 | ␉␉kSMBProcessorInformationVersionKey, NULL, NULL}, // SMcpuversion␊ |
340 | ␊ |
341 | ␉{kSMBTypeProcessorInformation,␉kSMBWord, getFieldOffset(SMBProcessorInformation, externalClock),␊ |
342 | ␉␉kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock,␉NULL}, // SMcpuexternalclock␊ |
343 | ␊ |
344 | ␉{kSMBTypeProcessorInformation,␉kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock),␊ |
345 | ␉␉kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,␉NULL}, // SMcpumaxspeed␊ |
346 | ␊ |
347 | ␉// Bungo␊ |
348 | ␉{kSMBTypeProcessorInformation,␉kSMBWord,␉getFieldOffset(SMBProcessorInformation, currentClock),␊ |
349 | ␉␉kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentspeed␊ |
350 | ␊ |
351 | ␉{kSMBTypeProcessorInformation,␉kSMBByte,␉getFieldOffset(SMBProcessorInformation, processorUpgrade),␊ |
352 | ␉␉kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade␊ |
353 | ␉//␊ |
354 | ␊ |
355 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, serialNumber),␊ |
356 | ␉␉NULL, NULL, NULL},␊ |
357 | ␊ |
358 | // Bungo␊ |
359 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, assetTag),␊ |
360 | ␉␉kSMBProcessorInformationAssetTagNumberKey, NULL, NULL}, // SMcpuassettag␊ |
361 | ␊ |
362 | ␉//␊ |
363 | ␊ |
364 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, partNumber),␊ |
365 | ␉␉NULL, NULL, NULL},␊ |
366 | ␊ |
367 | ␉/* =====================␊ |
368 | ␉ Memory Device (Type 17)␊ |
369 | ␉ ======================= */␊ |
370 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, deviceLocator),␊ |
371 | ␉␉kSMBMemoryDeviceDeviceLocatorKey, NULL, NULL},␊ |
372 | ␊ |
373 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, bankLocator),␊ |
374 | ␉␉kSMBMemoryDeviceBankLocatorKey, NULL, NULL},␊ |
375 | ␊ |
376 | ␉{kSMBTypeMemoryDevice,␉kSMBByte,␉getFieldOffset(SMBMemoryDevice, memoryType),␊ |
377 | ␉␉kSMBMemoryDeviceMemoryTypeKey, getSMBMemoryDeviceMemoryType,␉NULL},␊ |
378 | ␊ |
379 | ␉{kSMBTypeMemoryDevice,␉kSMBWord,␉getFieldOffset(SMBMemoryDevice, memorySpeed),␊ |
380 | ␉␉kSMBMemoryDeviceMemorySpeedKey, getSMBMemoryDeviceMemorySpeed,␉NULL},␊ |
381 | ␊ |
382 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, manufacturer),␊ |
383 | ␉␉kSMBMemoryDeviceManufacturerKey, getSMBMemoryDeviceManufacturer, NULL},␊ |
384 | ␊ |
385 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, serialNumber),␊ |
386 | ␉␉kSMBMemoryDeviceSerialNumberKey, getSMBMemoryDeviceSerialNumber, NULL},␊ |
387 | ␊ |
388 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, assetTag),␊ |
389 | ␉␉NULL, NULL, NULL},␊ |
390 | ␊ |
391 | ␉{kSMBTypeMemoryDevice,␉kSMBWord,␉getFieldOffset(SMBMemoryDevice, errorHandle),␊ |
392 | ␉␉NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL},␊ |
393 | ␊ |
394 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, partNumber),␊ |
395 | ␉␉kSMBMemoryDevicePartNumberKey, getSMBMemoryDevicePartNumber, NULL},␊ |
396 | ␉//␊ |
397 | ␊ |
398 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
399 | ␉// Apple Specific␊ |
400 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
401 | ␉// OEM Processor Type (Apple Specific - Type 131)␊ |
402 | ␉{kSMBTypeOemProcessorType,␉␉kSMBWord,␉getFieldOffset(SMBOemProcessorType, ProcessorType),␉␉␉kSMBOemProcessorTypeKey,␉␉␊ |
403 | ␉␉getSMBOemProcessorType,␉␉␉NULL},␊ |
404 | ␊ |
405 | ␉// OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
406 | ␉{kSMBTypeOemProcessorBusSpeed,␉kSMBWord,␉getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed),␉kSMBOemProcessorBusSpeedKey,␉␊ |
407 | ␉␉getSMBOemProcessorBusSpeed,␉␉NULL}␊ |
408 | };␊ |
409 | ␊ |
410 | int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter);␊ |
411 | ␊ |
412 | ␊ |
413 | SMBEntryPoint *origeps␉= 0;␊ |
414 | SMBEntryPoint *neweps␉= 0;␊ |
415 | ␊ |
416 | static uint8_t stringIndex;␉// increament when a string is added and set the field value accordingly␊ |
417 | static uint8_t stringsSize;␉// add string size␊ |
418 | ␊ |
419 | static SMBWord tableLength␉= 0;␊ |
420 | static SMBWord handle␉␉= 0;␊ |
421 | static SMBWord maxStructSize␉= 0;␊ |
422 | static SMBWord structureCount␉= 0;␊ |
423 | ␊ |
424 | bool useSMBIOSdefaults = true; // Bungo␊ |
425 | ␊ |
426 | /* Rewrite this function */␊ |
427 | void setDefaultSMBData(void)␊ |
428 | {␊ |
429 | ␉defaultBIOSInfo.vendor = kDefaultVendorManufacturer;␊ |
430 | ␉defaultBIOSInfo.releaseDate = kDefaultBIOSReleaseDate;␊ |
431 | ␊ |
432 | ␉defaultBIOSInfo.release = kDefaultBIOSRelease; // Bungo␊ |
433 | ␊ |
434 | ␉defaultSystemInfo.manufacturer = kDefaultVendorManufacturer;␊ |
435 | ␉defaultSystemInfo.version = kDefaultSystemVersion;␊ |
436 | ␉defaultSystemInfo.serialNumber = kDefaultSerialNumber;␊ |
437 | ␉defaultSystemInfo.skuNumber = kDefaultskuNumber; // Bungo␊ |
438 | ␊ |
439 | ␉defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;␊ |
440 | ␉defaultBaseBoard.product = kDefaultBoardProduct;␊ |
441 | ␊ |
442 | ␉if (platformCPUFeature(CPU_FEATURE_MOBILE))␊ |
443 | ␉{␊ |
444 | ␉␉if (Platform.CPU.NoCores > 1)␊ |
445 | ␉␉{␊ |
446 | ␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacBookProBIOSVersion;␊ |
447 | ␉␉␉defaultSystemInfo.productName␉= kDefaultMacBookPro;␊ |
448 | ␉␉␉defaultSystemInfo.family␉␉= kDefaultMacBookProFamily;␊ |
449 | ␉␉}␊ |
450 | ␉␉else␊ |
451 | ␉␉{␊ |
452 | ␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacBookBIOSVersion;␊ |
453 | ␉␉␉defaultSystemInfo.productName␉= kDefaultMacBook;␊ |
454 | ␉␉␉defaultSystemInfo.family␉␉= kDefaultMacBookFamily;␊ |
455 | ␉␉}␊ |
456 | ␉}␊ |
457 | ␉else␊ |
458 | ␉{␊ |
459 | ␉␉switch (Platform.CPU.NoCores)␊ |
460 | ␉␉{␊ |
461 | ␉␉␉case 1:␊ |
462 | ␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacminiBIOSVersion;␊ |
463 | ␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacmini;␊ |
464 | ␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacminiFamily;␊ |
465 | ␉␉␉␉break;␊ |
466 | ␊ |
467 | ␉␉␉case 2:␊ |
468 | ␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacBIOSVersion;␊ |
469 | ␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultiMac;␊ |
470 | ␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
471 | ␉␉␉␉break;␊ |
472 | ␉␉␉default:␊ |
473 | ␉␉␉{␊ |
474 | ␉␉␉␉switch (Platform.CPU.Family)␊ |
475 | ␉␉␉␉{␊ |
476 | ␉␉␉␉␉case 0x06:␊ |
477 | ␉␉␉␉␉{␊ |
478 | ␉␉␉␉␉␉switch (Platform.CPU.Model)␊ |
479 | ␉␉␉␉␉␉{␊ |
480 | ␉␉␉␉␉␉␉case CPU_MODEL_FIELDS:␉␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
481 | ␉␉␉␉␉␉␉case CPU_MODEL_DALES:␊ |
482 | ␉␉␉␉␉␉␉case CPU_MODEL_DALES_32NM:␉␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
483 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacNehalemBIOSVersion;␊ |
484 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultiMacNehalem;␊ |
485 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
486 | ␉␉␉␉␉␉␉␉break;␊ |
487 | ␊ |
488 | ␉␉␉␉␉␉␉case CPU_MODEL_SANDYBRIDGE:␉␉␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
489 | ␉␉␉␉␉␉␉case CPU_MODEL_IVYBRIDGE:␉␉␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
490 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacSandyBIOSVersion;␊ |
491 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultiMacSandy;␊ |
492 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
493 | ␉␉␉␉␉␉␉␉break;␊ |
494 | ␉␉␉␉␉␉␉case CPU_MODEL_NEHALEM:␉␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
495 | ␉␉␉␉␉␉␉case CPU_MODEL_NEHALEM_EX:␉␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
496 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacProNehalemBIOSVersion;␊ |
497 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacProNehalem;␊ |
498 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacProFamily;␊ |
499 | ␉␉␉␉␉␉␉␉break;␊ |
500 | ␊ |
501 | ␉␉␉␉␉␉␉case CPU_MODEL_WESTMERE:␉␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
502 | ␉␉␉␉␉␉␉case CPU_MODEL_WESTMERE_EX:␉␉// Intel Xeon E7␊ |
503 | ␉␉␉␉␉␉␉case CPU_MODEL_JAKETOWN:␉␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
504 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacProWestmereBIOSVersion;␊ |
505 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacProWestmereBIOSReleaseDate;␊ |
506 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacProWestmere;␊ |
507 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacProFamily;␊ |
508 | ␉␉␉␉␉␉␉␉break;␊ |
509 | ␊ |
510 | ␉␉␉␉␉␉␉default:␊ |
511 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacProBIOSVersion;␊ |
512 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
513 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacProFamily;␊ |
514 | ␉␉␉␉␉␉␉␉break;␊ |
515 | ␉␉␉␉␉␉}␊ |
516 | ␉␉␉␉␉␉break;␊ |
517 | ␉␉␉␉␉}␊ |
518 | ␉␉␉␉␉default:␊ |
519 | ␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProBIOSVersion;␊ |
520 | ␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
521 | ␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
522 | ␉␉␉␉␉␉break;␊ |
523 | ␉␉␉␉}␊ |
524 | ␉␉␉␉break;␊ |
525 | ␉␉␉}␊ |
526 | ␉␉}␊ |
527 | ␉}␊ |
528 | }␊ |
529 | ␊ |
530 | /* Used for SM*n smbios.plist keys */␊ |
531 | bool getSMBValueForKey(SMBStructHeader *structHeader, const char *keyString, const char **string, returnType *value)␊ |
532 | {␊ |
533 | ␉static int idx = -1;␊ |
534 | ␉static int current = -1;␊ |
535 | ␉int len;␊ |
536 | ␉char key[24];␊ |
537 | ␊ |
538 | ␉if (current != structHeader->handle)␊ |
539 | ␉{␊ |
540 | ␉␉idx++;␊ |
541 | ␉␉current = structHeader->handle;␊ |
542 | ␉}␊ |
543 | ␊ |
544 | ␉sprintf(key, "%s%d", keyString, idx);␊ |
545 | ␊ |
546 | ␉if (value)␊ |
547 | ␉{␊ |
548 | ␉␉if (getIntForKey(key, (int *)&(value->dword), SMBPlist))␊ |
549 | ␉␉{␊ |
550 | ␉␉␉return true;␊ |
551 | ␉␉}␊ |
552 | ␉}␊ |
553 | ␉else␊ |
554 | ␉{␊ |
555 | ␉␉if (getValueForKey(key, string, &len, SMBPlist))␊ |
556 | ␉␉{␊ |
557 | ␉␉␉return true;␊ |
558 | ␉␉}␊ |
559 | ␉}␊ |
560 | ␉return false;␊ |
561 | }␊ |
562 | ␊ |
563 | char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field)␊ |
564 | {␊ |
565 | ␉uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;␊ |
566 | ␊ |
567 | ␉if (!field)␊ |
568 | ␉{␊ |
569 | ␉␉return NULL;␊ |
570 | ␉}␊ |
571 | ␊ |
572 | ␉for (field--; field != 0 && strlen((char *)stringPtr) > 0;␊ |
573 | ␉␉field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));␊ |
574 | ␊ |
575 | ␉return (char *)stringPtr;␊ |
576 | }␊ |
577 | ␊ |
578 | void setSMBStringForField(SMBStructHeader *structHeader, const char *string, uint8_t *field)␊ |
579 | {␊ |
580 | ␉int strSize;␊ |
581 | ␊ |
582 | ␉if (!field)␊ |
583 | ␉{␊ |
584 | ␉␉return;␊ |
585 | ␉}␊ |
586 | ␊ |
587 | ␉if (!string)␊ |
588 | ␉{␊ |
589 | ␉␉*field = 0;␊ |
590 | ␉␉return;␊ |
591 | ␉}␊ |
592 | ␊ |
593 | ␉strSize = strlen(string);␊ |
594 | ␊ |
595 | ␉// remove any spaces found at the end␊ |
596 | ␉while ((strSize != 0) && (string[strSize - 1] == ' '))␊ |
597 | ␉{␊ |
598 | ␉␉strSize--;␊ |
599 | ␉}␊ |
600 | ␊ |
601 | ␉if (strSize == 0)␊ |
602 | ␉{␊ |
603 | ␉␉*field = 0;␊ |
604 | ␉␉return;␊ |
605 | ␉}␊ |
606 | ␊ |
607 | ␉memcpy((uint8_t *)structHeader + structHeader->length + stringsSize, string, strSize);␊ |
608 | ␉*field = stringIndex;␊ |
609 | ␊ |
610 | ␉stringIndex++;␊ |
611 | ␉stringsSize += strSize + 1;␊ |
612 | }␊ |
613 | ␊ |
614 | bool setSMBValue(SMBStructPtrs *structPtr, int idx, returnType *value)␊ |
615 | {␊ |
616 | ␉const char *string = 0;␊ |
617 | ␉int len;␊ |
618 | ␉bool parsed;␊ |
619 | ␉int val;␊ |
620 | ␊ |
621 | ␉if (numOfSetters <= idx)␊ |
622 | ␉{␊ |
623 | ␉␉return false;␊ |
624 | ␉}␊ |
625 | ␊ |
626 | ␉switch (SMBSetters[idx].valueType)␊ |
627 | ␉{␊ |
628 | ␉␉case kSMBString:␊ |
629 | ␉␉{␊ |
630 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
631 | ␉␉␉{␊ |
632 | ␉␉␉␉if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist))␊ |
633 | ␉␉␉␉{␊ |
634 | ␉␉␉␉␉break;␊ |
635 | ␉␉␉␉}␊ |
636 | ␉␉␉␉else␊ |
637 | ␉␉␉␉{␊ |
638 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␉// MemoryDevice only␊ |
639 | ␉␉␉␉␉{␊ |
640 | ␉␉␉␉␉␉if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL))␊ |
641 | ␉␉␉␉␉␉{␊ |
642 | ␉␉␉␉␉␉␉break;␊ |
643 | ␉␉␉␉␉␉}␊ |
644 | ␉␉␉␉␉}␊ |
645 | ␉␉␉␉}␊ |
646 | ␊ |
647 | ␉␉␉}␊ |
648 | ␉␉␉if (SMBSetters[idx].getSMBValue)␊ |
649 | ␉␉␉{␊ |
650 | ␉␉␉␉if (SMBSetters[idx].getSMBValue((returnType *)&string))␊ |
651 | ␉␉␉␉{␊ |
652 | ␉␉␉␉␉break;␊ |
653 | // if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo␊ |
654 | ␉␉␉␉}␊ |
655 | ␉␉␉}␊ |
656 | ␉␉␉if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue) && *(char *)(SMBSetters[idx].defaultValue))␊ |
657 | ␉␉␉{␊ |
658 | // string = *(SMBSetters[idx].defaultValue); Bungo␊ |
659 | ␉␉␉␉string = (char *)(SMBSetters[idx].defaultValue);␊ |
660 | ␉␉␉␉break;␊ |
661 | ␉␉␉}␊ |
662 | ␉␉␉string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);␊ |
663 | ␉␉␉break;␊ |
664 | ␉␉}␊ |
665 | ␉␉case kSMBByte:␊ |
666 | ␉␉case kSMBWord:␊ |
667 | ␉␉case kSMBDWord:␊ |
668 | ␉␉//case kSMBQWord:␊ |
669 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
670 | ␉␉␉{␊ |
671 | ␉␉␉␉parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);␊ |
672 | ␉␉␉␉if (!parsed)␊ |
673 | ␉␉␉␉{␊ |
674 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␉// MemoryDevice only␊ |
675 | ␉␉␉␉␉{␊ |
676 | ␉␉␉␉␉␉parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val);␊ |
677 | ␉␉␉␉␉}␊ |
678 | ␉␉␉␉}␊ |
679 | ␉␉␉␉if (parsed)␊ |
680 | ␉␉␉␉{␊ |
681 | ␉␉␉␉␉switch (SMBSetters[idx].valueType)␊ |
682 | ␉␉␉␉␉{␊ |
683 | ␉␉␉␉␉␉case kSMBByte:␊ |
684 | ␉␉␉␉␉␉␉value->byte = (uint8_t)val;␊ |
685 | ␉␉␉␉␉␉␉break;␊ |
686 | ␉␉␉␉␉␉case kSMBWord:␊ |
687 | ␉␉␉␉␉␉␉value->word = (uint16_t)val;␊ |
688 | ␉␉␉␉␉␉␉break;␊ |
689 | ␉␉␉␉␉␉case kSMBDWord:␊ |
690 | ␉␉␉␉␉␉default:␊ |
691 | ␉␉␉␉␉␉␉value->dword = (uint32_t)val;␊ |
692 | ␉␉␉␉␉␉␉break;␊ |
693 | ␉␉␉␉␉}␊ |
694 | ␉␉␉␉␉return true;␊ |
695 | ␉␉␉␉}␊ |
696 | ␉␉␉}␊ |
697 | ␊ |
698 | ␉␉␉if (SMBSetters[idx].getSMBValue)␊ |
699 | ␉␉␉{␊ |
700 | ␉␉␉␉if (SMBSetters[idx].getSMBValue(value))␊ |
701 | ␉␉␉␉{␊ |
702 | ␉␉␉␉␉return true;␊ |
703 | ␉␉␉␉}␊ |
704 | ␉␉␉}␊ |
705 | // #if 0 Bungo: enables code below␊ |
706 | // if (*(SMBSetters[idx].defaultValue)) Bungo␊ |
707 | ␉␉␉if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue))␊ |
708 | ␉␉␉{␊ |
709 | // value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo␊ |
710 | switch (SMBSetters[idx].valueType)␊ |
711 | {␊ |
712 | case kSMBByte:␊ |
713 | value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue);␊ |
714 | break;␊ |
715 | case kSMBWord:␊ |
716 | value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);␊ |
717 | break;␊ |
718 | case kSMBDWord:␊ |
719 | default:␊ |
720 | value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);␊ |
721 | break;␊ |
722 | }␊ |
723 | return true;␊ |
724 | ␉␉␉}␊ |
725 | // #endif Bungo␊ |
726 | ␉␉␉break;␊ |
727 | ␉}␊ |
728 | ␊ |
729 | ␉// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"␊ |
730 | ␉if (SMBSetters[idx].valueType == kSMBString)␊ |
731 | ␉{␊ |
732 | ␉␉setSMBStringForField(structPtr->new, string, &value->byte);␊ |
733 | ␉}␊ |
734 | ␉return true;␊ |
735 | }␊ |
736 | ␊ |
737 | //-------------------------------------------------------------------------------------------------------------------------␊ |
738 | // Apple Specific␊ |
739 | //-------------------------------------------------------------------------------------------------------------------------␊ |
740 | void addSMBFirmwareVolume(SMBStructPtrs *structPtr)␊ |
741 | {␊ |
742 | ␉return;␊ |
743 | }␊ |
744 | ␊ |
745 | void addSMBMemorySPD(SMBStructPtrs *structPtr)␊ |
746 | {␊ |
747 | ␉/* SPD data from Platform.RAM.spd */␊ |
748 | ␉return;␊ |
749 | }␊ |
750 | ␊ |
751 | void addSMBOemProcessorType(SMBStructPtrs *structPtr)␊ |
752 | {␊ |
753 | ␉SMBOemProcessorType *p = (SMBOemProcessorType *)structPtr->new;␊ |
754 | ␊ |
755 | ␉p->header.type␉␉= kSMBTypeOemProcessorType;␊ |
756 | ␉p->header.length␉= sizeof(SMBOemProcessorType);␊ |
757 | ␉p->header.handle␉= handle++;␊ |
758 | ␊ |
759 | ␉setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->ProcessorType));␊ |
760 | ␊ |
761 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorType) + 2);␊ |
762 | ␉tableLength += sizeof(SMBOemProcessorType) + 2;␊ |
763 | ␉structureCount++;␊ |
764 | }␊ |
765 | ␊ |
766 | void addSMBOemProcessorBusSpeed(SMBStructPtrs *structPtr)␊ |
767 | {␊ |
768 | ␉SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new;␊ |
769 | ␊ |
770 | ␉switch (Platform.CPU.Family) ␊ |
771 | ␉{␊ |
772 | ␉␉case 0x06:␊ |
773 | ␉␉{␊ |
774 | ␉␉␉switch (Platform.CPU.Model)␊ |
775 | ␉␉␉{␊ |
776 | ␉␉␉␉case 0x19:␉␉␉// Intel Core i5 650 @3.20 Ghz␊ |
777 | ␉␉␉␉case CPU_MODEL_FIELDS:␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
778 | ␉␉␉␉case CPU_MODEL_DALES:␊ |
779 | ␉␉␉␉case CPU_MODEL_DALES_32NM:␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
780 | ␉␉␉␉case CPU_MODEL_NEHALEM:␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
781 | ␉␉␉␉case CPU_MODEL_NEHALEM_EX:␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
782 | ␉␉␉␉case CPU_MODEL_WESTMERE:␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
783 | ␉␉␉␉case CPU_MODEL_WESTMERE_EX:␉// Intel Xeon E7␊ |
784 | ␉␉␉␉case CPU_MODEL_SANDYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
785 | ␉␉␉␉case CPU_MODEL_IVYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
786 | ␉␉␉␉case CPU_MODEL_IVYBRIDGE_XEON:␊ |
787 | ␉␉␉␉case CPU_MODEL_JAKETOWN:␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
788 | ␉␉␉␉case CPU_MODEL_HASWELL:␊ |
789 | ␉␉␉␉case CPU_MODEL_HASWELL_MB:␊ |
790 | ␉␉␉␉case CPU_MODEL_HASWELL_ULT:␊ |
791 | ␉␉␉␉case CPU_MODEL_CRYSTALWELL:␊ |
792 | ␊ |
793 | ␉␉␉␉␉break;␊ |
794 | ␊ |
795 | ␉␉␉␉default:␊ |
796 | ␉␉␉␉␉return;␊ |
797 | ␉␉␉}␊ |
798 | ␉␉}␊ |
799 | ␉}␊ |
800 | ␊ |
801 | ␉p->header.type␉␉= kSMBTypeOemProcessorBusSpeed;␊ |
802 | ␉p->header.length␉= sizeof(SMBOemProcessorBusSpeed);␊ |
803 | ␉p->header.handle␉= handle++;␊ |
804 | ␊ |
805 | ␉setSMBValue(structPtr, numOfSetters -1, (returnType *)&(p->ProcessorBusSpeed));␊ |
806 | ␊ |
807 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorBusSpeed) + 2);␊ |
808 | ␉tableLength += sizeof(SMBOemProcessorBusSpeed) + 2;␊ |
809 | ␉structureCount++;␊ |
810 | }␊ |
811 | ␊ |
812 | //-------------------------------------------------------------------------------------------------------------------------␊ |
813 | // EndOfTable␊ |
814 | //-------------------------------------------------------------------------------------------------------------------------␊ |
815 | void addSMBEndOfTable(SMBStructPtrs *structPtr)␊ |
816 | {␊ |
817 | ␉structPtr->new->type␉= kSMBTypeEndOfTable;␊ |
818 | ␉structPtr->new->length␉= sizeof(SMBStructHeader);␊ |
819 | ␉structPtr->new->handle␉= handle++;␊ |
820 | ␊ |
821 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBStructHeader) + 2);␊ |
822 | ␉tableLength += sizeof(SMBStructHeader) + 2;␊ |
823 | ␉structureCount++;␊ |
824 | }␊ |
825 | ␊ |
826 | void setSMBStruct(SMBStructPtrs *structPtr)␊ |
827 | {␊ |
828 | ␉bool setterFound = false;␊ |
829 | ␊ |
830 | ␉uint8_t *ptr;␊ |
831 | ␉SMBWord structSize;␊ |
832 | ␉int i;␊ |
833 | ␊ |
834 | ␉/* http://forge.voodooprojects.org/p/chameleon/issues/361/ */␊ |
835 | ␉bool forceFullMemInfo = false;␊ |
836 | ␊ |
837 | ␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␊ |
838 | ␉{␊ |
839 | ␉␉getBoolForKey(kMemFullInfo, &forceFullMemInfo, &bootInfo->chameleonConfig);␊ |
840 | ␉␉if (forceFullMemInfo)␊ |
841 | ␉␉{␊ |
842 | ␉␉␉structPtr->orig->length = 27;␊ |
843 | ␉␉}␊ |
844 | ␉}␊ |
845 | ␊ |
846 | ␉stringIndex = 1;␊ |
847 | ␉stringsSize = 0;␊ |
848 | ␊ |
849 | ␉if (handle < structPtr->orig->handle)␊ |
850 | ␉{␊ |
851 | ␉␉handle = structPtr->orig->handle;␊ |
852 | ␉}␊ |
853 | ␊ |
854 | ␉memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);␊ |
855 | ␊ |
856 | ␉for (i = 0; i < numOfSetters; i++)␊ |
857 | ␉{␊ |
858 | ␉␉if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length))␊ |
859 | ␉␉{␊ |
860 | ␉␉␉setterFound = true;␊ |
861 | ␉␉␉setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));␊ |
862 | ␉␉}␊ |
863 | ␉}␊ |
864 | ␊ |
865 | ␉if (setterFound)␊ |
866 | ␉{␊ |
867 | ␉␉ptr = (uint8_t *)structPtr->new + structPtr->orig->length;␊ |
868 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
869 | ␊ |
870 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
871 | ␉␉{␊ |
872 | ␉␉␉ptr += 2;␊ |
873 | ␉␉}␊ |
874 | ␉␉structSize = ptr - (uint8_t *)structPtr->new;␊ |
875 | ␉}␊ |
876 | ␉else␊ |
877 | ␉{␊ |
878 | ␉␉ptr = (uint8_t *)structPtr->orig + structPtr->orig->length;␊ |
879 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
880 | ␊ |
881 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
882 | ␉␉{␊ |
883 | ␉␉␉ptr += 2;␊ |
884 | ␉␉}␊ |
885 | ␊ |
886 | ␉␉structSize = ptr - (uint8_t *)structPtr->orig;␊ |
887 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structSize);␊ |
888 | ␉}␊ |
889 | ␊ |
890 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + structSize);␊ |
891 | ␊ |
892 | ␉tableLength += structSize;␊ |
893 | ␊ |
894 | ␉if (structSize > maxStructSize)␊ |
895 | ␉{␊ |
896 | ␉␉maxStructSize = structSize;␊ |
897 | ␉}␊ |
898 | ␊ |
899 | ␉structureCount++;␊ |
900 | }␊ |
901 | ␊ |
902 | void setupNewSMBIOSTable(SMBEntryPoint *eps, SMBStructPtrs *structPtr)␊ |
903 | {␊ |
904 | ␉uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;␊ |
905 | ␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
906 | ␊ |
907 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structPtr->orig + sizeof(SMBStructHeader)));)␊ |
908 | ␉{␊ |
909 | ␉␉switch (structPtr->orig->type)␊ |
910 | ␉␉{␊ |
911 | ␉␉␉/* Skip all Apple Specific Structures */␊ |
912 | ␉␉␉case kSMBTypeFirmwareVolume:␊ |
913 | ␉␉␉case kSMBTypeMemorySPD:␊ |
914 | ␉␉␉case kSMBTypeOemProcessorType:␊ |
915 | ␉␉␉case kSMBTypeOemProcessorBusSpeed:␊ |
916 | ␉␉␉␉/* And this one too, to be added at the end */␊ |
917 | ␉␉␉case kSMBTypeEndOfTable:␊ |
918 | ␉␉␉␉break;␊ |
919 | ␊ |
920 | ␉␉␉default:␊ |
921 | ␉␉␉{␊ |
922 | ␉␉␉␉/* Add */␊ |
923 | ␉␉␉␉setSMBStruct(structPtr);␊ |
924 | ␉␉␉␉break;␊ |
925 | ␉␉␉}␊ |
926 | ␉␉}␊ |
927 | ␊ |
928 | ␉␉ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length);␊ |
929 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
930 | ␊ |
931 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
932 | ␉␉{␊ |
933 | ␉␉␉ptr += 2;␊ |
934 | ␉␉}␊ |
935 | ␊ |
936 | ␉␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
937 | ␉}␊ |
938 | ␊ |
939 | ␉addSMBFirmwareVolume(structPtr);␊ |
940 | ␉addSMBMemorySPD(structPtr);␊ |
941 | ␉addSMBOemProcessorType(structPtr);␊ |
942 | ␉addSMBOemProcessorBusSpeed(structPtr);␊ |
943 | ␊ |
944 | ␉addSMBEndOfTable(structPtr);␊ |
945 | }␊ |
946 | ␊ |
947 | // Bungo: does fix system uuid in SMBIOS istead of in EFI only␊ |
948 | uint8_t *FixSystemUUID()␊ |
949 | {␊ |
950 | ␉uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress;␊ |
951 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)ptr;␊ |
952 | ␉int i, isZero, isOnes;␊ |
953 | ␉uint8_t FixedUUID[UUID_LEN] = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};␊ |
954 | ␉const char *sysId = getStringForKey(kSMBSystemInformationUUIDKey, SMBPlist);␊ |
955 | ␉uint8_t *ret = (uint8_t *)getUUIDFromString(sysId);␊ |
956 | ␊ |
957 | ␉for (;(structHeader->type != kSMBTypeSystemInformation);) // find System Information Table (Type 1) in patched SMBIOS␊ |
958 | ␉{␊ |
959 | ␉␉ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
960 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
961 | ␊ |
962 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
963 | ␉␉{␊ |
964 | ␉␉␉ptr += 2;␊ |
965 | ␉␉}␊ |
966 | ␊ |
967 | ␉␉structHeader = (SMBStructHeader *)ptr;␊ |
968 | ␉}␊ |
969 | ␊ |
970 | ␉ptr = ((SMBSystemInformation *)structHeader)->uuid;␊ |
971 | ␊ |
972 | ␉if (!sysId || !ret) // no or bad custom UUID,...␊ |
973 | ␉{␊ |
974 | ␉␉sysId = 0;␊ |
975 | ret = ((SMBSystemInformation *)structHeader)->uuid; // ...try bios dmi info UUID extraction␊ |
976 | ␉}␊ |
977 | ␊ |
978 | ␉for (i=0, isZero=1, isOnes=1; i<UUID_LEN; i++) // check if empty or setable, means: no uuid present␊ |
979 | ␉{␊ |
980 | ␉␉if (ret[i] != 0x00)␊ |
981 | ␉␉{␊ |
982 | ␉␉␉isZero = 0;␊ |
983 | ␉␉}␊ |
984 | ␊ |
985 | ␉␉if (ret[i] != 0xff)␊ |
986 | ␉␉{␊ |
987 | ␉␉␉isOnes = 0;␊ |
988 | ␉␉}␊ |
989 | ␉}␊ |
990 | ␊ |
991 | ␉if (isZero || isOnes) // if empty or setable...␊ |
992 | ␉{␊ |
993 | ␉␉verbose("No UUID present in SMBIOS System Information Table\n");␊ |
994 | ␉␉ret = FixedUUID; // ...set a fixed value for system-id = 000102030405060708090A0B0C0D0E0F␊ |
995 | ␉}␊ |
996 | ␊ |
997 | ␉memcpy(ptr, ret, UUID_LEN); // fix uuid in the table␊ |
998 | ␉return ptr;␊ |
999 | } // Bungo: end fix␊ |
1000 | ␊ |
1001 | void setupSMBIOSTable(void)␊ |
1002 | {␊ |
1003 | ␉SMBStructPtrs *structPtr;␊ |
1004 | ␉uint8_t *buffer;␊ |
1005 | ␉// bool setSMB = true; Bungo␊ |
1006 | ␊ |
1007 | ␉if (!origeps)␊ |
1008 | ␉{␊ |
1009 | ␉␉return;␊ |
1010 | ␉}␊ |
1011 | ␊ |
1012 | ␉neweps = origeps;␊ |
1013 | ␊ |
1014 | ␉structPtr = (SMBStructPtrs *)malloc(sizeof(SMBStructPtrs));␊ |
1015 | ␉if (!structPtr)␊ |
1016 | ␉{␊ |
1017 | ␉␉return;␊ |
1018 | ␉}␊ |
1019 | ␉␊ |
1020 | ␉buffer = (uint8_t *)malloc(SMB_ALLOC_SIZE);␊ |
1021 | ␉if (!buffer)␊ |
1022 | ␉{␊ |
1023 | ␉␉free(structPtr);␊ |
1024 | ␉␉return;␊ |
1025 | ␉}␊ |
1026 | ␊ |
1027 | ␉bzero(buffer, SMB_ALLOC_SIZE);␊ |
1028 | ␉structPtr->new = (SMBStructHeader *)buffer;␊ |
1029 | ␊ |
1030 | ␉// getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); Bungo␊ |
1031 | ␉getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig);␊ |
1032 | ␉// if (setSMB)␊ |
1033 | setDefaultSMBData();␊ |
1034 | ␉// Bungo␊ |
1035 | ␉␊ |
1036 | ␉setupNewSMBIOSTable(origeps, structPtr);␊ |
1037 | ␊ |
1038 | ␉neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));␊ |
1039 | ␉if (!neweps)␊ |
1040 | ␉{␊ |
1041 | ␉␉free(buffer);␊ |
1042 | ␉␉free(structPtr);␊ |
1043 | ␉␉return;␊ |
1044 | ␉}␊ |
1045 | ␉bzero(neweps, sizeof(SMBEntryPoint));␊ |
1046 | ␊ |
1047 | ␉neweps->anchor[0]␉␉␉= '_';␊ |
1048 | ␉neweps->anchor[1]␉␉␉= 'S';␊ |
1049 | ␉neweps->anchor[2]␉␉␉= 'M';␊ |
1050 | ␉neweps->anchor[3]␉␉␉= '_';␊ |
1051 | ␉neweps->entryPointLength␉= sizeof(SMBEntryPoint);␊ |
1052 | ␉neweps->majorVersion␉␉= 2;␊ |
1053 | ␉neweps->minorVersion␉␉= 4;␊ |
1054 | ␉neweps->maxStructureSize␉= maxStructSize;␊ |
1055 | ␉neweps->entryPointRevision␉= 0;␊ |
1056 | ␊ |
1057 | ␉neweps->dmi.anchor[0]␉␉= '_';␊ |
1058 | ␉neweps->dmi.anchor[1]␉␉= 'D';␊ |
1059 | ␉neweps->dmi.anchor[2]␉␉= 'M';␊ |
1060 | ␉neweps->dmi.anchor[3]␉␉= 'I';␊ |
1061 | ␉neweps->dmi.anchor[4]␉␉= '_';␊ |
1062 | ␉neweps->dmi.tableLength␉␉= tableLength;␊ |
1063 | ␉neweps->dmi.tableAddress␉= AllocateKernelMemory(tableLength);␊ |
1064 | ␉neweps->dmi.structureCount␉= structureCount;␊ |
1065 | ␉neweps->dmi.bcdRevision␉␉= 0x24;␊ |
1066 | ␊ |
1067 | ␉if (!neweps->dmi.tableAddress)␊ |
1068 | ␉{␊ |
1069 | ␉␉free(buffer);␊ |
1070 | ␉␉free(structPtr);␊ |
1071 | ␉␉return;␊ |
1072 | ␉}␊ |
1073 | ␊ |
1074 | ␉memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);␊ |
1075 | ␊ |
1076 | ␉// Bungo␊ |
1077 | ␉Platform.UUID = FixSystemUUID(); // Fix System UUID␊ |
1078 | ␊ |
1079 | ␉neweps->dmi.checksum␉␉= 0;␊ |
1080 | ␉neweps->dmi.checksum␉␉= 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint));␊ |
1081 | ␊ |
1082 | ␉neweps->checksum␉␉= 0;␊ |
1083 | ␉neweps->checksum␉␉= 0x100 - checksum8(neweps, sizeof(SMBEntryPoint));␊ |
1084 | ␊ |
1085 | ␉free(buffer);␊ |
1086 | ␉free(structPtr);␊ |
1087 | ␊ |
1088 | ␉decodeSMBIOSTable(neweps);␊ |
1089 | }␊ |
1090 | ␊ |
1091 | void *getSmbios(int which)␊ |
1092 | {␊ |
1093 | ␉switch (which)␊ |
1094 | ␉{␊ |
1095 | ␉␉case SMBIOS_ORIGINAL:␊ |
1096 | ␉␉␉if (!origeps)␊ |
1097 | ␉␉␉{␊ |
1098 | ␉␉␉␉origeps = getAddressOfSmbiosTable();␊ |
1099 | ␉␉␉}␊ |
1100 | ␉␉␉return origeps;␊ |
1101 | ␉␉case SMBIOS_PATCHED:␊ |
1102 | ␉␉␉return neweps;␊ |
1103 | ␉}␊ |
1104 | ␊ |
1105 | ␉return 0;␊ |
1106 | }␊ |
1107 | ␊ |
1108 | /* Collect any information needed later */␊ |
1109 | void readSMBIOSInfo(SMBEntryPoint *eps)␊ |
1110 | {␊ |
1111 | ␉uint8_t *structPtr = (uint8_t *)eps->dmi.tableAddress;␊ |
1112 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;␊ |
1113 | ␊ |
1114 | ␉int dimmnbr = 0;␊ |
1115 | ␉Platform.DMI.MaxMemorySlots␉= 0;␉// number of memory slots polulated by SMBIOS␊ |
1116 | ␉Platform.DMI.CntMemorySlots␉= 0;␉// number of memory slots counted␊ |
1117 | ␉Platform.DMI.MemoryModules␉= 0;␊ |
1118 | ␊ |
1119 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)␊ |
1120 | ␉{␊ |
1121 | ␉␉switch (structHeader->type)␊ |
1122 | ␉␉{␊ |
1123 | ␉␉␉/* Bungo␊ |
1124 | ␉␉␉case kSMBTypeSystemInformation:␊ |
1125 | ␉␉␉␉Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid;␊ |
1126 | ␉␉␉␉break;␊ |
1127 | ␉␉␉*/␊ |
1128 | ␊ |
1129 | ␉␉␉case kSMBTypePhysicalMemoryArray:␊ |
1130 | ␉␉␉␉Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices;␊ |
1131 | ␉␉␉␉break;␊ |
1132 | ␊ |
1133 | ␉␉␉case kSMBTypeMemoryDevice:␊ |
1134 | ␉␉␉␉Platform.DMI.CntMemorySlots++;␊ |
1135 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySize != 0)␊ |
1136 | ␉␉␉␉{␊ |
1137 | ␉␉␉␉␉Platform.DMI.MemoryModules++;␊ |
1138 | ␉␉␉␉}␊ |
1139 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)␊ |
1140 | ␉␉␉␉{␊ |
1141 | ␉␉␉␉␉Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed;␊ |
1142 | ␉␉␉␉}␊ |
1143 | ␉␉␉␉dimmnbr++;␊ |
1144 | ␉␉␉␉break;␊ |
1145 | ␉␉␉default:␊ |
1146 | ␉␉␉␉break;␊ |
1147 | ␉␉}␊ |
1148 | ␊ |
1149 | ␉␉structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
1150 | ␉␉for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);␊ |
1151 | ␊ |
1152 | ␉␉if (((uint16_t *)structPtr)[0] == 0)␊ |
1153 | ␉␉{␊ |
1154 | ␉␉␉structPtr += 2;␊ |
1155 | ␉␉}␊ |
1156 | ␊ |
1157 | ␉␉structHeader = (SMBStructHeader *)structPtr;␊ |
1158 | ␉}␊ |
1159 | }␊ |
1160 | |