Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/smbios.c

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

Archive Download this file

Revision: 2288