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