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;␊ |
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 }, // SMboardassettag - 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 | ␊ |
434 | // MacMini5,2 Mac-4BC72D62AD45599E␊ |
435 | ␊ |
436 | // MacMini5,3␊ |
437 | // Bios: MM51.88Z.0077.B10.1201241549␊ |
438 | // Board: Mac-F65AE981FFA204ED␊ |
439 | // Data: 01/24/2012␊ |
440 | ␊ |
441 | // MacMini 6,1␊ |
442 | // Bios: MM61.88Z.0106.B03.1211161202␊ |
443 | // Board: Mac-F65AE981FFA204ED␊ |
444 | // Data: 10/14/2012␊ |
445 | ␊ |
446 | // MacMini 6,2␊ |
447 | // Bios: MM61.88Z.0106.B03.1211161202␊ |
448 | // Board: Mac-FC02E91DDD3FA6A4␊ |
449 | // Data: 10/14/2012␊ |
450 | ␊ |
451 | //=========== MacBook ===========␊ |
452 | #define kDefaultMacBookFamily␉␉␉␉"MacBook"␊ |
453 | //#define kDefaultMacBookBoardAssetTagNumber␉␉"MacBook-Black"␊ |
454 | ␊ |
455 | #define kDefaultMacBook␉␉␉␉␉"MacBook4,1"␊ |
456 | #define kDefaultMacBookBIOSVersion␉␉␉" MB41.88Z.00C1.B00.0802091535"␊ |
457 | #define kDefaultMacBookBIOSReleaseDate␉␉␉"02/09/08"␊ |
458 | #define kDefaultMacBookBoardProduct␉␉␉"Mac-F22788A9"␊ |
459 | ␊ |
460 | //=========== MacBookAir ===========␊ |
461 | #define kDefaultMacBookAirFamily␉␉␉"MacBook Air"␊ |
462 | ␊ |
463 | // MacBookAir4,1 - Mac-C08A6BB70A942AC2␊ |
464 | // MacBookAir4,2 - Mac-742912EFDBEE19B3␊ |
465 | ␊ |
466 | // MacBookAir5,2␊ |
467 | #define kDefaultMacBookAir␉␉␉␉"MacBookAir5,2"␊ |
468 | #define kDefaultMacBookAirBIOSVersion␉␉␉" MBA51.88Z.00EF.B00.1205221442"␊ |
469 | #define kDefaultMacBookAirBIOSReleaseDate␉␉"05/10/12"␊ |
470 | #define kDefaultMacBookBoardAirProduct␉␉␉"Mac-2E6FAB96566FE58C"␊ |
471 | ␊ |
472 | // MacBookAir6,1␊ |
473 | // Bios: MBA61.88Z.0099.B04.1309271229␊ |
474 | // Board: Mac-35C1E88140C3E6CF␊ |
475 | // Data: 24/06/13␊ |
476 | ␊ |
477 | // MacBookAir6,2␊ |
478 | // Bios: MBA62.88Z.00EF.B00.1205221442␊ |
479 | // Board: Mac-7DF21CB3ED6977E5␊ |
480 | // Data: 24/06/13␊ |
481 | ␊ |
482 | //=========== MacBookPro ===========␊ |
483 | #define kDefaultMacBookProFamily␉␉␉"MacBook Pro"␊ |
484 | //#define kDefaultMacBookProBoardAssetTagNumber␉␉"MacBook-Aluminum"␊ |
485 | ␊ |
486 | #define kDefaultMacBookPro␉␉␉␉"MacBookPro4,1"␊ |
487 | #define kDefaultMacBookProBIOSVersion␉␉␉" MBP41.88Z.00C1.B03.0802271651"␊ |
488 | #define kDefaultMacBookProBIOSReleaseDate␉␉"02/27/08"␊ |
489 | #define kDefaultMacBookProBoardProduct␉␉␉"Mac-F42C89C8"␊ |
490 | ␊ |
491 | // MacBookPro8,1␊ |
492 | // Bios: MBP81.88Z.0047.B24.1110141131␊ |
493 | // Board: Mac-94245B3640C91C81␊ |
494 | // Data: 10/14/11␊ |
495 | ␊ |
496 | // MacBookPro8,2␊ |
497 | // Bios:␊ |
498 | // Board: Mac_94245A3940C91C80␊ |
499 | // Data: 10/14/11␊ |
500 | ␊ |
501 | // MacBookPro8,3␊ |
502 | // Bios:␊ |
503 | // Board: Mac-942459F5819B171B␊ |
504 | // Data: 10/31/11␊ |
505 | ␊ |
506 | // MacBookPro10,2␊ |
507 | // Bios: MBP102.88Z.0106.B01.1208311637␊ |
508 | // Board: Mac-AFD8A9D944EA4843␊ |
509 | // Data: 10/02/2012␊ |
510 | ␊ |
511 | // MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B03.1310291227␊ |
512 | // MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745␊ |
513 | ␊ |
514 | //=========== iMac ===========␊ |
515 | #define kDefaultiMacFamily␉␉␉␉"iMac"␊ |
516 | //#define kDefaultiMacBoardAssetTagNumber␉␉"iMac-Aluminum"␊ |
517 | ␊ |
518 | #define kDefaultiMac␉␉␉␉␉"iMac8,1"␊ |
519 | #define kDefaultiMacBIOSVersion␉␉␉␉" IM81.88Z.00C1.B00.0903051113"␊ |
520 | #define kDefaultiMacBIOSReleaseDate␉␉␉"02/09/08"␊ |
521 | #define kDefaultiMacBoardProduct␉␉␉"Mac-F227BEC8"␊ |
522 | #define kDefaultMacFamily␉␉␉␉"Mac" // iMac8,1 family = "Mac" not "iMac"␊ |
523 | ␊ |
524 | // iMac10,1␊ |
525 | // iMac11,1 core i3/i5/i7␊ |
526 | #define kDefaultiMacNehalem␉␉␉␉"iMac11,1"␊ |
527 | #define kDefaultiMacNehalemBIOSVersion␉␉␉" IM111.88Z.0034.B02.1003171314"␊ |
528 | #define kDefaultiMacNehalemBIOSReleaseDate␉␉"03/17/10"␊ |
529 | #define kDefaultiMacNehalemBoardProduct␉␉␉"Mac-F2268DAE"␊ |
530 | // iMac11,2␊ |
531 | // iMac11,3␊ |
532 | ␊ |
533 | // iMac12,1␊ |
534 | #define kDefaultiMacSandy␉␉␉␉"iMac12,1"␊ |
535 | #define kDefaultiMacSandyBIOSVersion␉␉␉" IM121.88Z.0047.B00.1102091756"␊ |
536 | #define kDefaultiMacSandyBIOSReleaseDate␉␉"04/22/11"␊ |
537 | #define kDefaultiMacSandyBoardProduct␉␉␉"Mac-942B5BF58194151B"␊ |
538 | ␊ |
539 | // iMac12,2␊ |
540 | // Bios: IM121.88Z.0047.B1D.1110171110"␊ |
541 | // Data: 10/17/11␊ |
542 | // Board: Mac-942B59F58194171B"␊ |
543 | ␊ |
544 | // iMac13,1␊ |
545 | // Bios: IM131.88Z.010A.B05.1211151146␊ |
546 | // Data: 11/15/2012␊ |
547 | // Board: Mac-00BE6ED71E35EB86␊ |
548 | ␊ |
549 | // iMac13,2␊ |
550 | // Bios: IM131.88Z.00CE.B00.1203281326␊ |
551 | // Data: 03/28/2012␊ |
552 | // Board: Mac-FC02E91DDD3FA6A4␊ |
553 | ␊ |
554 | // iMac14,1␊ |
555 | // iMac14,2␊ |
556 | // iMac14,3␊ |
557 | // iMac14,4␊ |
558 | // Bios: IM144.88Z.0179.B03.1405241029␊ |
559 | // Data: 05/20/2014␊ |
560 | // Board: Mac-81E3E92DD6088272␊ |
561 | ␊ |
562 | //=========== MacPro ===========␊ |
563 | #define kDefaultMacProFamily␉␉␉␉"MacPro" // MacPro's family = "MacPro" not "Mac Pro"␊ |
564 | //#define KDefauktMacProBoardAssetTagNumber␉␉"Pro-Enclosure"␊ |
565 | //#define kDefaultMacProBoardType␉␉␉"0xB" // 11␊ |
566 | ␊ |
567 | #define kDefaultMacPro␉␉␉␉␉"MacPro3,1"␊ |
568 | #define kDefaultMacProBIOSVersion␉␉␉" MP31.88Z.006C.B05.0903051113"␊ |
569 | #define kDefaultMacProBIOSReleaseDate␉␉␉"08/03/2010"␊ |
570 | //#define kDefaultMacProSystemVersion␉␉␉"1.3"␊ |
571 | #define kDefaultMacProBoardProduct␉␉␉"Mac-F42C88C8"␊ |
572 | //#define KDefaultMacProBoardSerialNumber␉␉"J593902RA4MFE"␊ |
573 | ␊ |
574 | // Mac Pro 4,1 core i7/Xeon␊ |
575 | #define kDefaultMacProNahWestSystemVersion␉␉"0.0"␊ |
576 | ␊ |
577 | #define kDefaultMacProNehalem␉␉␉␉"MacPro4,1"␊ |
578 | #define kDefaultMacProNehalemBIOSVersion␉␉" MP41.88Z.0081.B07.0910130729"␊ |
579 | #define kDefaultMacProNehalemBIOSReleaseDate␉␉"10/13/09"␊ |
580 | //#define kDefaultMacProNehalemSystemVersion␉␉"1.4"␊ |
581 | #define kDefaultMacProNehalemBoardProduct␉␉"Mac-F221BEC8"␊ |
582 | //#define KDefaultMacProNehalemBoardSerialNumber␉"J593004RB1LUE"␊ |
583 | //␉␉␉␉␉␉␉"J591302R61LUC " // 2-cpu board␊ |
584 | //␉␉␉␉␉␉␉"J591002JV4MFB " // 1-cpu board␊ |
585 | ␊ |
586 | // Mac Pro 5,1 core i7/Xeon␊ |
587 | #define kDefaultMacProWestmere␉␉␉␉"MacPro5,1"␊ |
588 | #define kDefaultMacProWestmereBIOSVersion␉␉" MP51.88Z.007F.B03.1010071432"␊ |
589 | #define kDefaultMacProWestmereBIOSReleaseDate␉␉"10/07/10"␊ |
590 | //#define kDefaultMacProWestmereSystemVersion␉␉"1.2"␊ |
591 | #define kDefaultMacProWestmereBoardProduct␉␉"Mac-F221BEC8"␊ |
592 | //#define KDefaultMacProWestmereBoardSerialNumber␉"J522700H7BH8C"␊ |
593 | //␉␉␉␉␉␉␉"J503104H1BH8A " // 2-cpu board␊ |
594 | ␊ |
595 | // Mac Pro 6,1␊ |
596 | #define kDefaultMacProHaswell␉␉␉␉"MacPro6,1"␊ |
597 | #define kDefaultMacProHaswellBIOSVersion␉␉"MP61.88Z.0116.B04.1312061508"␊ |
598 | #define kDefaultMacProHaswellBIOSReleaseDate␉␉"12/06/2013"␊ |
599 | //#define kDefaultMacProHaswellSystemVersion␉␉"1.?"␊ |
600 | #define kDefaultMacProHaswellBoardProduct␉␉"Mac-F60DEB81FF30ACF6"␊ |
601 | //#define KDefaultMacProHaswellBoardSerialNumber␉"F5K3474008JFNN215"␊ |
602 | ␊ |
603 | //#define KDefaultBoardSerialNumber␉␉␉"C02140302D5DMT31M"␊ |
604 | // "C07019501PLDCVHAD"␊ |
605 | // "C02032101R5DC771H"␊ |
606 | ␊ |
607 | // J593902RA4MFE 3,1␊ |
608 | // J5031046RCZJA 5,1␊ |
609 | // J521101A5CZJC 3,1␊ |
610 | // J593004RB1LUE MacPro4,1␊ |
611 | // J513401PZBH8C 5,1␊ |
612 | // J590802LC4ACB 3,1␊ |
613 | // J594900AH1LUE 4,1␊ |
614 | // J512500HZBH8C 5,1␊ |
615 | // J522700H7BH8C MacPro5,1␊ |
616 | ␊ |
617 | /* ============================================ */␊ |
618 | ␊ |
619 | bool useSMBIOSdefaults = true; // Bungo␊ |
620 | ␊ |
621 | 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.␊ |
622 | ␊ |
623 | /* Rewrite this function */␊ |
624 | void setDefaultSMBData(void) // Bungo: setting data from real Macs␊ |
625 | {␊ |
626 | ␉defaultBIOSInfo.vendor = kDefaultVendorManufacturer;␊ |
627 | ␉defaultBIOSInfo.release = kDefaultBIOSRelease; // Bungo␊ |
628 | ␊ |
629 | ␉defaultSystemInfo.manufacturer = kDefaultVendorManufacturer;␊ |
630 | ␉defaultSystemInfo.version = kDefaultSystemVersion;␊ |
631 | ␉defaultSystemInfo.serialNumber = kDefaultSerialNumber;␊ |
632 | ␉defaultSystemInfo.skuNumber = kDefaultSkuNumber; // Bungo␊ |
633 | ␊ |
634 | ␉defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;␊ |
635 | ␉defaultBaseBoard.serialNumber = kDefaultSerialNumber;␊ |
636 | ␉defaultBaseBoard.assetTag = kDefaultAssetTag;␊ |
637 | ␊ |
638 | ␉defaultChassis.manufacturer = kDefaultVendorManufacturer;␊ |
639 | ␉defaultChassis.serialNumber = kDefaultSerialNumber;␊ |
640 | ␉defaultChassis.assetTag = kDefaultAssetTag;␊ |
641 | ␉defaultChassis.skuNumber = kDefaultSkuNumber;␊ |
642 | ␊ |
643 | ␉// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing␊ |
644 | ␉if (PlatformType == 2) // this works but it's a substitute␊ |
645 | ␉{␊ |
646 | ␉␉if (Platform.CPU.NoCores > 1)␊ |
647 | ␉␉{␊ |
648 | ␉␉␉defaultSystemInfo.productName = kDefaultMacBookPro;␊ |
649 | ␉␉␉defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion;␊ |
650 | ␉␉␉defaultBIOSInfo.releaseDate = kDefaultMacBookProBIOSReleaseDate;␊ |
651 | ␉␉␉defaultSystemInfo.family = kDefaultMacBookProFamily;␊ |
652 | ␉␉␉defaultBaseBoard.product = kDefaultMacBookProBoardProduct;␊ |
653 | ␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
654 | ␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
655 | ␉␉} else {␊ |
656 | ␉␉␉defaultSystemInfo.productName = kDefaultMacBook;␊ |
657 | ␉␉␉defaultBIOSInfo.version = kDefaultMacBookBIOSVersion;␊ |
658 | ␉␉␉defaultBIOSInfo.releaseDate = kDefaultMacBookBIOSReleaseDate;␊ |
659 | ␉␉␉defaultSystemInfo.family = kDefaultMacBookFamily;␊ |
660 | ␉␉␉defaultBaseBoard.product = kDefaultMacBookBoardProduct;␊ |
661 | ␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
662 | ␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
663 | ␉␉}␊ |
664 | ␉} else {␊ |
665 | ␉␉switch (Platform.CPU.NoCores)␊ |
666 | ␉␉{␊ |
667 | ␉␉␉case 1:␊ |
668 | ␉␉␉␉defaultBIOSInfo.version = kDefaultMacMiniBIOSVersion;␊ |
669 | ␉␉␉␉defaultBIOSInfo.releaseDate = kDefaultMacMiniBIOSReleaseDate;␊ |
670 | ␉␉␉␉defaultSystemInfo.productName = kDefaultMacMini;␊ |
671 | ␉␉␉␉defaultSystemInfo.family = kDefaultMacMiniFamily;␊ |
672 | ␉␉␉␉defaultBaseBoard.product = kDefaultMacMiniBoardProduct;␊ |
673 | ␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardUnknown;␊ |
674 | ␉␉␉␉defaultChassis.chassisType = kSMBchassisLPDesktop;␊ |
675 | ␉␉␉␉break;␊ |
676 | ␊ |
677 | ␉␉␉case 2:␊ |
678 | ␉␉␉␉defaultBIOSInfo.version = kDefaultiMacBIOSVersion;␊ |
679 | ␉␉␉␉defaultBIOSInfo.releaseDate = kDefaultiMacBIOSReleaseDate;␊ |
680 | ␉␉␉␉defaultSystemInfo.productName = kDefaultiMac;␊ |
681 | ␉␉␉␉defaultSystemInfo.family = kDefaultMacFamily; // iMac8,1 family = Mac␊ |
682 | ␉␉␉␉defaultBaseBoard.product = kDefaultiMacBoardProduct;␊ |
683 | ␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
684 | ␉␉␉␉defaultChassis.chassisType = kSMBchassisAllInOne;␊ |
685 | ␉␉␉␉break;␊ |
686 | ␉␉␉default:␊ |
687 | ␉␉␉{␊ |
688 | ␉␉␉␉switch (Platform.CPU.Family)␊ |
689 | ␉␉␉␉{␊ |
690 | ␉␉␉␉␉case 0x06:␊ |
691 | ␉␉␉␉␉{␊ |
692 | ␉␉␉␉␉␉switch (Platform.CPU.Model)␊ |
693 | ␉␉␉␉␉␉{␊ |
694 | ␉␉␉␉␉␉␉case CPU_MODEL_FIELDS:␉␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
695 | ␉␉␉␉␉␉␉case CPU_MODEL_DALES:␊ |
696 | ␉␉␉␉␉␉␉case CPU_MODEL_DALES_32NM:␉␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
697 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacNehalemBIOSVersion;␊ |
698 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultiMacNehalemBIOSReleaseDate;␊ |
699 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultiMacNehalem;␊ |
700 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
701 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultiMacNehalemBoardProduct;␊ |
702 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
703 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisAllInOne;␊ |
704 | ␉␉␉␉␉␉␉␉break;␊ |
705 | ␊ |
706 | ␉␉␉␉␉␉␉case CPU_MODEL_SANDYBRIDGE:␉␉␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
707 | ␉␉␉␉␉␉␉case CPU_MODEL_IVYBRIDGE:␉␉␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
708 | ␉␉␉␉␉␉␉case CPU_MODEL_IVYBRIDGE_XEON:␊ |
709 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version = kDefaultiMacSandyBIOSVersion;␊ |
710 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate = kDefaultiMacSandyBIOSReleaseDate;␊ |
711 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultiMacSandy;␊ |
712 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family = kDefaultiMacFamily;␊ |
713 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultiMacSandyBoardProduct;␊ |
714 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
715 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisAllInOne;␊ |
716 | ␉␉␉␉␉␉␉␉break;␊ |
717 | ␊ |
718 | ␉␉␉␉␉␉␉case CPU_MODEL_NEHALEM:␉␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
719 | ␉␉␉␉␉␉␉case CPU_MODEL_NEHALEM_EX:␉␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
720 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProNehalemBIOSVersion;␊ |
721 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProNehalemBIOSReleaseDate;␊ |
722 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacProNehalem;␊ |
723 | ␉␉␉␉␉␉␉␉defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;␊ |
724 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
725 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct;␊ |
726 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;␊ |
727 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisTower;␊ |
728 | ␉␉␉␉␉␉␉␉break;␊ |
729 | ␊ |
730 | ␉␉␉␉␉␉␉case CPU_MODEL_WESTMERE:␉␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
731 | ␉␉␉␉␉␉␉case CPU_MODEL_WESTMERE_EX:␉␉// Intel Xeon E7␊ |
732 | ␉␉␉␉␉␉␉case CPU_MODEL_JAKETOWN:␉␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
733 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProWestmereBIOSVersion;␊ |
734 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProWestmereBIOSReleaseDate;␊ |
735 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacProWestmere;␊ |
736 | ␉␉␉␉␉␉␉␉defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;␊ |
737 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
738 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct;␊ |
739 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;␊ |
740 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisTower;␊ |
741 | ␉␉␉␉␉␉␉␉break;␊ |
742 | ␊ |
743 | ␉␉␉␉␉␉␉default:␊ |
744 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProBIOSVersion;␊ |
745 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProBIOSReleaseDate;␊ |
746 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
747 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
748 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProBoardProduct;␊ |
749 | ␉␉␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
750 | ␉␉␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
751 | ␉␉␉␉␉␉␉␉break;␊ |
752 | ␉␉␉␉␉␉}␊ |
753 | ␉␉␉␉␉␉break;␊ |
754 | ␉␉␉␉␉}␊ |
755 | ␉␉␉␉␉default:␊ |
756 | ␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProBIOSVersion;␊ |
757 | ␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉= kDefaultMacProBIOSReleaseDate;␊ |
758 | ␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
759 | ␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
760 | ␉␉␉␉␉␉defaultBaseBoard.product = kDefaultMacProBoardProduct;␊ |
761 | ␉␉␉␉␉␉defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;␊ |
762 | ␉␉␉␉␉␉defaultChassis.chassisType = kSMBchassisUnknown;␊ |
763 | ␉␉␉␉␉␉break;␊ |
764 | ␉␉␉␉}␊ |
765 | ␉␉␉␉break;␊ |
766 | ␉␉␉}␊ |
767 | ␉␉}␊ |
768 | ␉}␊ |
769 | }␊ |
770 | ␊ |
771 | /* Used for SM*n smbios.plist keys */␊ |
772 | bool getSMBValueForKey(SMBStructHeader *structHeader, const char *keyString, const char **string, returnType *value)␊ |
773 | {␊ |
774 | ␉static int idx = -1;␊ |
775 | ␉static int current = -1;␊ |
776 | ␉int len;␊ |
777 | ␉char key[24];␊ |
778 | ␊ |
779 | ␉if (current != structHeader->handle) {␊ |
780 | ␉␉idx++;␊ |
781 | ␉␉current = structHeader->handle;␊ |
782 | ␉}␊ |
783 | ␊ |
784 | ␉sprintf(key, "%s%d", keyString, idx);␊ |
785 | ␊ |
786 | ␉if (value) {␊ |
787 | ␉␉if (getIntForKey(key, (int *)&(value->dword), SMBPlist)) {␊ |
788 | ␉␉␉return true;␊ |
789 | ␉␉}␊ |
790 | ␉} else {␊ |
791 | ␉␉if (getValueForKey(key, string, &len, SMBPlist)) {␊ |
792 | ␉␉␉return true;␊ |
793 | ␉␉}␊ |
794 | ␉}␊ |
795 | ␉return false;␊ |
796 | }␊ |
797 | ␊ |
798 | char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field)␊ |
799 | {␊ |
800 | ␉uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;␊ |
801 | ␊ |
802 | ␉if (!field) {␊ |
803 | ␉␉return NULL;␊ |
804 | ␉}␊ |
805 | ␊ |
806 | ␉for (field--; field != 0 && strlen((char *)stringPtr) > 0;␊ |
807 | ␉␉field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));␊ |
808 | ␊ |
809 | ␉return (char *)stringPtr;␊ |
810 | }␊ |
811 | ␊ |
812 | void setSMBStringForField(SMBStructHeader *structHeader, const char *string, uint8_t *field)␊ |
813 | {␊ |
814 | ␉int strSize;␊ |
815 | ␊ |
816 | ␉if (!field) {␊ |
817 | ␉␉return;␊ |
818 | ␉}␊ |
819 | ␊ |
820 | ␉if (!string) {␊ |
821 | ␉␉*field = 0;␊ |
822 | ␉␉return;␊ |
823 | ␉}␊ |
824 | ␊ |
825 | ␉strSize = strlen(string);␊ |
826 | ␊ |
827 | ␉// remove any spaces found at the end but only in MemoryDevice␊ |
828 | ␉if (structHeader->type == kSMBTypeMemoryDevice) {␊ |
829 | ␉␉while ((strSize != 0) && (string[strSize - 1] == ' ')) {␊ |
830 | ␉␉␉strSize--;␊ |
831 | ␉␉}␊ |
832 | ␉}␊ |
833 | ␊ |
834 | ␉if (strSize == 0) {␊ |
835 | ␉␉*field = 0;␊ |
836 | ␉␉return;␊ |
837 | ␉}␊ |
838 | ␊ |
839 | ␉memcpy((uint8_t *)structHeader + structHeader->length + stringsSize, string, strSize);␊ |
840 | ␉*field = stringIndex;␊ |
841 | ␊ |
842 | ␉stringIndex++;␊ |
843 | ␉stringsSize += strSize + 1;␊ |
844 | }␊ |
845 | ␊ |
846 | bool setSMBValue(SMBStructPtrs *structPtr, int idx, returnType *value)␊ |
847 | {␊ |
848 | ␉const char *string = 0;␊ |
849 | ␉int len;␊ |
850 | ␉bool parsed;␊ |
851 | ␉int val;␊ |
852 | ␊ |
853 | ␉if (numOfSetters <= idx) {␊ |
854 | ␉␉return false;␊ |
855 | ␉}␊ |
856 | ␊ |
857 | ␉switch (SMBSetters[idx].valueType) {␊ |
858 | ␉␉case kSMBString:␊ |
859 | ␉␉{␊ |
860 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
861 | ␉␉␉{␊ |
862 | ␉␉␉␉if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist))␊ |
863 | ␉␉␉␉{␊ |
864 | ␉␉␉␉␉break;␊ |
865 | ␉␉␉␉} else {␊ |
866 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␉// MemoryDevice only␊ |
867 | ␉␉␉␉␉{␊ |
868 | ␉␉␉␉␉␉if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL))␊ |
869 | ␉␉␉␉␉␉{␊ |
870 | ␉␉␉␉␉␉␉break;␊ |
871 | ␉␉␉␉␉␉}␊ |
872 | ␉␉␉␉␉}␊ |
873 | ␉␉␉␉}␊ |
874 | ␊ |
875 | ␉␉␉}␊ |
876 | ␉␉␉if (SMBSetters[idx].getSMBValue) {␊ |
877 | ␉␉␉␉if (SMBSetters[idx].getSMBValue((returnType *)&string)) {␊ |
878 | ␉␉␉␉␉break;␊ |
879 | ␉␉␉␉}␊ |
880 | ␉␉␉}␊ |
881 | ␉␉␉// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo␊ |
882 | ␉␉␉if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {␊ |
883 | ␉␉␉␉string = *(SMBSetters[idx].defaultValue);␊ |
884 | ␉␉␉␉break;␊ |
885 | ␉␉␉}␊ |
886 | ␉␉␉string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);␊ |
887 | ␉␉␉break;␊ |
888 | ␉␉}␊ |
889 | ␉␉case kSMBByte:␊ |
890 | ␉␉case kSMBWord:␊ |
891 | ␉␉case kSMBDWord:␊ |
892 | ␉␉case kSMBQWord:␊ |
893 | ␉␉␉if (SMBSetters[idx].keyString) ␉{␊ |
894 | ␉␉␉␉parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);␊ |
895 | ␉␉␉␉if (!parsed)␊ |
896 | ␉␉␉␉{␊ |
897 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice) { // MemoryDevice only␊ |
898 | ␉␉␉␉␉␉parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val);␊ |
899 | ␉␉␉␉␉}␊ |
900 | ␉␉␉␉}␊ |
901 | ␉␉␉␉if (parsed) {␊ |
902 | ␉␉␉␉␉switch (SMBSetters[idx].valueType) {␊ |
903 | ␉␉␉␉␉␉case kSMBByte:␊ |
904 | ␉␉␉␉␉␉␉value->byte = (uint8_t)val;␊ |
905 | ␉␉␉␉␉␉␉break;␊ |
906 | ␉␉␉␉␉␉case kSMBWord:␊ |
907 | ␉␉␉␉␉␉␉value->word = (uint16_t)val;␊ |
908 | ␉␉␉␉␉␉␉break;␊ |
909 | ␉␉␉␉␉␉case kSMBQWord:␊ |
910 | ␉␉␉␉␉␉␉value->qword = (uint64_t)val;␊ |
911 | ␉␉␉␉␉␉␉break;␊ |
912 | ␉␉␉␉␉␉case kSMBDWord:␊ |
913 | ␉␉␉␉␉␉default:␊ |
914 | ␉␉␉␉␉␉␉value->dword = (uint32_t)val;␊ |
915 | ␉␉␉␉␉␉␉break;␊ |
916 | ␉␉␉␉␉}␊ |
917 | ␉␉␉␉␉return true;␊ |
918 | ␉␉␉␉}␊ |
919 | ␉␉␉}␊ |
920 | ␊ |
921 | ␉␉␉if (SMBSetters[idx].getSMBValue) {␊ |
922 | ␉␉␉␉if (SMBSetters[idx].getSMBValue(value)) {␊ |
923 | ␉␉␉␉␉return true;␊ |
924 | ␉␉␉␉}␊ |
925 | ␉␉␉}␊ |
926 | // #if 0 Bungo: enables code below␊ |
927 | ␉␉␉// if (*(SMBSetters[idx].defaultValue)) Bungo␊ |
928 | ␉␉␉if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {␊ |
929 | ␉␉␉// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo␊ |
930 | ␉␉␉switch (SMBSetters[idx].valueType) {␊ |
931 | ␉␉␉␉case kSMBByte:␊ |
932 | ␉␉␉␉␉value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue);␊ |
933 | ␉␉␉␉␉break;␊ |
934 | ␉␉␉␉case kSMBWord:␊ |
935 | ␉␉␉␉␉value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);␊ |
936 | ␉␉␉␉␉break;␊ |
937 | ␉␉␉␉case kSMBQWord:␊ |
938 | ␉␉␉␉␉value->qword = *(uint64_t *)(SMBSetters[idx].defaultValue);␊ |
939 | ␉␉␉␉␉break;␊ |
940 | ␉␉␉␉case kSMBDWord:␊ |
941 | ␉␉␉␉default:␊ |
942 | ␉␉␉␉␉value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);␊ |
943 | ␉␉␉␉␉break;␊ |
944 | ␉␉␉}␊ |
945 | ␉␉␉return true;␊ |
946 | ␉␉}␊ |
947 | // #endif Bungo␊ |
948 | ␉␉break;␊ |
949 | ␉}␊ |
950 | ␊ |
951 | ␉// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"␊ |
952 | ␉if ((SMBSetters[idx].valueType == kSMBString) && string) {␊ |
953 | ␉␉setSMBStringForField(structPtr->new, string, &value->byte);␊ |
954 | ␉}␊ |
955 | ␉return true;␊ |
956 | }␊ |
957 | ␊ |
958 | //-------------------------------------------------------------------------------------------------------------------------␊ |
959 | // Apple Specific␊ |
960 | //-------------------------------------------------------------------------------------------------------------------------␊ |
961 | ␊ |
962 | /* ===========================================␊ |
963 | Firmware Volume (Apple Specific - Type 128)␊ |
964 | ============================================= */␊ |
965 | void addSMBFirmwareVolume(SMBStructPtrs *structPtr)␊ |
966 | {␊ |
967 | ␉return;␊ |
968 | }␊ |
969 | ␊ |
970 | /* ===========================================␊ |
971 | Memory SPD Data (Apple Specific - Type 130)␊ |
972 | ============================================= */␊ |
973 | void addSMBMemorySPD(SMBStructPtrs *structPtr)␊ |
974 | {␊ |
975 | ␉/* SPD data from Platform.RAM.spd */␊ |
976 | ␉return;␊ |
977 | }␊ |
978 | ␊ |
979 | /* ============================================␊ |
980 | OEM Processor Type (Apple Specific - Type 131)␊ |
981 | ============================================== */␊ |
982 | void addSMBOemProcessorType(SMBStructPtrs *structPtr)␊ |
983 | {␊ |
984 | ␉SMBOemProcessorType *p = (SMBOemProcessorType *)structPtr->new;␊ |
985 | ␊ |
986 | ␉p->header.type␉␉= kSMBTypeOemProcessorType;␊ |
987 | ␉p->header.length␉= sizeof(SMBOemProcessorType);␊ |
988 | ␉p->header.handle␉= handle++;␊ |
989 | ␊ |
990 | ␉setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->ProcessorType));␊ |
991 | ␊ |
992 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorType) + 2);␊ |
993 | ␉tableLength += sizeof(SMBOemProcessorType) + 2;␊ |
994 | ␉structureCount++;␊ |
995 | }␊ |
996 | ␊ |
997 | /* =================================================␊ |
998 | OEM Processor Bus Speed (Apple Specific - Type 132)␊ |
999 | =================================================== */␊ |
1000 | void addSMBOemProcessorBusSpeed(SMBStructPtrs *structPtr)␊ |
1001 | {␊ |
1002 | ␉SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new;␊ |
1003 | ␊ |
1004 | ␉switch (Platform.CPU.Family) ␊ |
1005 | ␉{␊ |
1006 | ␉␉case 0x06:␊ |
1007 | ␉␉{␊ |
1008 | ␉␉␉switch (Platform.CPU.Model)␊ |
1009 | ␉␉␉{␊ |
1010 | ␉␉␉␉case 0x19:␉␉␉// Intel Core i5 650 @3.20 Ghz␊ |
1011 | ␉␉␉␉case CPU_MODEL_FIELDS:␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
1012 | ␉␉␉␉case CPU_MODEL_DALES:␊ |
1013 | ␉␉␉␉case CPU_MODEL_DALES_32NM:␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
1014 | ␉␉␉␉case CPU_MODEL_NEHALEM:␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
1015 | ␉␉␉␉case CPU_MODEL_NEHALEM_EX:␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
1016 | ␉␉␉␉case CPU_MODEL_WESTMERE:␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
1017 | ␉␉␉␉case CPU_MODEL_WESTMERE_EX:␉// Intel Xeon E7␊ |
1018 | ␉␉␉␉case CPU_MODEL_SANDYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
1019 | ␉␉␉␉case CPU_MODEL_IVYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
1020 | ␉␉␉␉case CPU_MODEL_IVYBRIDGE_XEON:␊ |
1021 | ␉␉␉␉case CPU_MODEL_JAKETOWN:␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
1022 | ␉␉␉␉case CPU_MODEL_HASWELL:␊ |
1023 | ␉␉␉␉case CPU_MODEL_HASWELL_SVR:␊ |
1024 | ␉␉␉␉case CPU_MODEL_HASWELL_ULT:␊ |
1025 | ␉␉␉␉case CPU_MODEL_CRYSTALWELL:␊ |
1026 | ␊ |
1027 | ␉␉␉␉␉break;␊ |
1028 | ␊ |
1029 | ␉␉␉␉default:␊ |
1030 | ␉␉␉␉␉return;␊ |
1031 | ␉␉␉}␊ |
1032 | ␉␉}␊ |
1033 | ␉}␊ |
1034 | ␊ |
1035 | ␉p->header.type␉␉= kSMBTypeOemProcessorBusSpeed;␊ |
1036 | ␉p->header.length␉= sizeof(SMBOemProcessorBusSpeed);␊ |
1037 | ␉p->header.handle␉= handle++;␊ |
1038 | ␊ |
1039 | ␉setSMBValue(structPtr, numOfSetters -1, (returnType *)&(p->ProcessorBusSpeed));␊ |
1040 | ␊ |
1041 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorBusSpeed) + 2);␊ |
1042 | ␉tableLength += sizeof(SMBOemProcessorBusSpeed) + 2;␊ |
1043 | ␉structureCount++;␊ |
1044 | }␊ |
1045 | ␊ |
1046 | /* ==============================================␊ |
1047 | OEM Platform Feature (Apple Specific - Type 133)␊ |
1048 | ================================================ */␊ |
1049 | /*void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) {␊ |
1050 | ␉SMBOemPlatformFeature *p = (SMBOemPlatformFeature *)structPtr->new;␊ |
1051 | ␊ |
1052 | ␉p->header.type␉␉= kSMBTypeOemPlatformFeature;␊ |
1053 | ␉p->header.length␉= sizeof(SMBOemPlatformFeature);␊ |
1054 | ␉p->header.handle␉= handle++;␊ |
1055 | ␊ |
1056 | ␉setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->PlatformFeature));␊ |
1057 | ␊ |
1058 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemPPlatformFeature) + 2);␊ |
1059 | ␉tableLength += sizeof(SMBOemPlatformFeature) + 2;␊ |
1060 | ␉structureCount++;␊ |
1061 | }*/␊ |
1062 | ␊ |
1063 | //-------------------------------------------------------------------------------------------------------------------------␊ |
1064 | // EndOfTable␊ |
1065 | //-------------------------------------------------------------------------------------------------------------------------␊ |
1066 | void addSMBEndOfTable(SMBStructPtrs *structPtr)␊ |
1067 | {␊ |
1068 | ␉structPtr->new->type␉= kSMBTypeEndOfTable;␊ |
1069 | ␉structPtr->new->length␉= sizeof(SMBStructHeader);␊ |
1070 | ␉structPtr->new->handle␉= handle++;␊ |
1071 | ␊ |
1072 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBStructHeader) + 2);␊ |
1073 | ␉tableLength += sizeof(SMBStructHeader) + 2;␊ |
1074 | ␉structureCount++;␊ |
1075 | }␊ |
1076 | ␊ |
1077 | void setSMBStruct(SMBStructPtrs *structPtr)␊ |
1078 | {␊ |
1079 | ␉bool setterFound = false;␊ |
1080 | ␊ |
1081 | ␉uint8_t *ptr;␊ |
1082 | ␉SMBWord structSize;␊ |
1083 | ␉int i;␊ |
1084 | ␊ |
1085 | ␉/* Bungo: not needed because of tables lengths fix in next lines␊ |
1086 | ␉// http://forge.voodooprojects.org/p/chameleon/issues/361/␊ |
1087 | ␉bool forceFullMemInfo = false;␊ |
1088 | ␊ |
1089 | ␉if (structPtr->orig->type == kSMBTypeMemoryDevice) {␊ |
1090 | ␉␉getBoolForKey(kMemFullInfo, &forceFullMemInfo, &bootInfo->chameleonConfig);␊ |
1091 | ␉␉if (forceFullMemInfo) {␊ |
1092 | ␉␉␉structPtr->orig->length = 27;␊ |
1093 | ␉␉}␊ |
1094 | ␉}*/␊ |
1095 | ␊ |
1096 | ␉stringIndex = 1;␊ |
1097 | ␉stringsSize = 0;␊ |
1098 | ␊ |
1099 | ␉if (handle < structPtr->orig->handle) {␊ |
1100 | ␉␉handle = structPtr->orig->handle;␊ |
1101 | ␉}␊ |
1102 | ␉// Bungo: fix unsuported tables lengths from original smbios: extend smaller or truncate bigger - we use SMBIOS rev. 2.4 like Apple uses␊ |
1103 | ␉switch (structPtr->orig->type) {␊ |
1104 | ␉␉case kSMBTypeBIOSInformation:␊ |
1105 | ␉␉␉structSize = sizeof(SMBBIOSInformation);␊ |
1106 | ␉␉␉break;␊ |
1107 | ␉␉case kSMBTypeSystemInformation:␊ |
1108 | ␉␉␉structSize = sizeof(SMBSystemInformation);␊ |
1109 | ␉␉␉break;␊ |
1110 | ␉␉case kSMBTypeBaseBoard:␊ |
1111 | ␉␉␉structSize = sizeof(SMBBaseBoard);␊ |
1112 | ␉␉␉break;␊ |
1113 | ␉␉case kSMBTypeSystemEnclosure:␊ |
1114 | ␉␉␉structSize = sizeof(SMBSystemEnclosure);␊ |
1115 | ␉␉␉break;␊ |
1116 | ␉␉case kSMBTypeProcessorInformation:␊ |
1117 | ␉␉␉structSize = sizeof(SMBProcessorInformation);␊ |
1118 | ␉␉␉break;␊ |
1119 | ␉␉case kSMBTypeMemoryDevice:␊ |
1120 | ␉␉␉structSize = sizeof(SMBMemoryDevice);␊ |
1121 | ␉␉␉break;␊ |
1122 | ␉␉default:␊ |
1123 | ␉␉␉structSize = structPtr->orig->length; // doesn't change a length for unpatched␊ |
1124 | ␉␉␉break;␊ |
1125 | ␉}␊ |
1126 | ␊ |
1127 | ␉// memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);␊ |
1128 | ␉if (structPtr->orig->length <= structSize) {␊ |
1129 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);␊ |
1130 | ␉} else {␊ |
1131 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structSize);␊ |
1132 | ␉}␊ |
1133 | ␊ |
1134 | ␉structPtr->new->length = structSize;␊ |
1135 | ␊ |
1136 | ␉for (i = 0; i < numOfSetters; i++) {␊ |
1137 | ␉␉// Bungo:␊ |
1138 | ␉␉//if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) {␊ |
1139 | ␉␉if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize)) {␊ |
1140 | ␉␉␉setterFound = true;␊ |
1141 | ␉␉␉setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));␊ |
1142 | ␉␉}␊ |
1143 | ␉}␊ |
1144 | ␊ |
1145 | ␉if (setterFound) {␊ |
1146 | ␉␉// Bungo:␊ |
1147 | ␉␉// ptr = (uint8_t *)structPtr->new + structPtr->orig->length;␊ |
1148 | ␉␉ptr = (uint8_t *)structPtr->new + structPtr->new->length;␊ |
1149 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1150 | ␊ |
1151 | ␉␉if (((uint16_t *)ptr)[0] == 0) {␊ |
1152 | ␉␉␉ptr += 2;␊ |
1153 | ␉␉}␊ |
1154 | ␉␉structSize = ptr - (uint8_t *)structPtr->new;␊ |
1155 | ␉} else {␊ |
1156 | ␉␉ptr = (uint8_t *)structPtr->orig + structPtr->orig->length;␊ |
1157 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1158 | ␊ |
1159 | ␉␉if (((uint16_t *)ptr)[0] == 0) {␊ |
1160 | ␉␉␉ptr += 2;␊ |
1161 | ␉␉}␊ |
1162 | ␊ |
1163 | ␉␉structSize = ptr - (uint8_t *)structPtr->orig;␊ |
1164 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structSize);␊ |
1165 | ␉}␊ |
1166 | ␊ |
1167 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + structSize);␊ |
1168 | ␊ |
1169 | ␉tableLength += structSize;␊ |
1170 | ␊ |
1171 | ␉if (structSize > maxStructSize) {␊ |
1172 | ␉␉maxStructSize = structSize;␊ |
1173 | ␉}␊ |
1174 | ␊ |
1175 | ␉structureCount++;␊ |
1176 | }␊ |
1177 | ␊ |
1178 | void setupNewSMBIOSTable(SMBEntryPoint *eps, SMBStructPtrs *structPtr)␊ |
1179 | {␊ |
1180 | ␉uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;␊ |
1181 | ␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
1182 | ␊ |
1183 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structPtr->orig + sizeof(SMBStructHeader)));) {␊ |
1184 | ␉␉switch (structPtr->orig->type) {␊ |
1185 | ␉␉␉/* Skip all Apple Specific Structures */␊ |
1186 | ␉␉␉case kSMBTypeFirmwareVolume:␊ |
1187 | ␉␉␉case kSMBTypeMemorySPD:␊ |
1188 | ␉␉␉case kSMBTypeOemProcessorType:␊ |
1189 | ␉␉␉case kSMBTypeOemProcessorBusSpeed:␊ |
1190 | ␉␉␉␉/* And this one too, to be added at the end */␊ |
1191 | ␉␉␉case kSMBTypeEndOfTable:␊ |
1192 | ␉␉␉␉break;␊ |
1193 | ␊ |
1194 | ␉␉␉default:␊ |
1195 | ␉␉␉{␊ |
1196 | ␉␉␉␉/* Add */␊ |
1197 | ␉␉␉␉setSMBStruct(structPtr);␊ |
1198 | ␉␉␉␉break;␊ |
1199 | ␉␉␉}␊ |
1200 | ␉␉}␊ |
1201 | ␊ |
1202 | ␉␉ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length);␊ |
1203 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1204 | ␊ |
1205 | ␉␉if (((uint16_t *)ptr)[0] == 0) {␊ |
1206 | ␉␉␉ptr += 2;␊ |
1207 | ␉␉}␊ |
1208 | ␊ |
1209 | ␉␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
1210 | ␉}␊ |
1211 | ␊ |
1212 | ␉addSMBFirmwareVolume(structPtr);␊ |
1213 | ␉addSMBMemorySPD(structPtr);␊ |
1214 | ␉addSMBOemProcessorType(structPtr);␊ |
1215 | ␉addSMBOemProcessorBusSpeed(structPtr);␊ |
1216 | ␊ |
1217 | ␉addSMBEndOfTable(structPtr);␊ |
1218 | }␊ |
1219 | ␊ |
1220 | // Bungo: does fix system uuid in SMBIOS (and EFI) instead of in EFI only␊ |
1221 | uint8_t *FixSystemUUID()␊ |
1222 | {␊ |
1223 | ␉uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress;␊ |
1224 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)ptr;␊ |
1225 | ␉int i, isZero, isOnes;␊ |
1226 | ␉uint8_t FixedUUID[UUID_LEN] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};␊ |
1227 | ␉const char *sysId = getStringForKey(kSMBSystemInformationUUIDKey, SMBPlist);␊ |
1228 | ␉uint8_t *ret = (uint8_t *)getUUIDFromString(sysId);␊ |
1229 | ␊ |
1230 | ␉for (;(structHeader->type != kSMBTypeSystemInformation);) // find System Information Table (Type 1) in patched SMBIOS␊ |
1231 | ␉{␊ |
1232 | ␉␉ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
1233 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
1234 | ␊ |
1235 | ␉␉if (((uint16_t *)ptr)[0] == 0) {␊ |
1236 | ␉␉␉ptr += 2;␊ |
1237 | ␉␉}␊ |
1238 | ␊ |
1239 | ␉␉structHeader = (SMBStructHeader *)ptr;␊ |
1240 | ␉}␊ |
1241 | ␊ |
1242 | ␉ptr = ((SMBSystemInformation *)structHeader)->uuid;␊ |
1243 | ␊ |
1244 | ␉if (!sysId || !ret) { // no or bad custom UUID,...␊ |
1245 | ␉␉sysId = 0;␊ |
1246 | ␉␉ret = Platform.UUID; // ...try bios dmi system uuid extraction␊ |
1247 | ␉}␊ |
1248 | ␊ |
1249 | ␉for (i=0, isZero=1, isOnes=1; i<UUID_LEN; i++) // check if empty or setable, means: no uuid present␊ |
1250 | ␉{␊ |
1251 | ␉␉if (ret[i] != 0x00) {␊ |
1252 | ␉␉␉isZero = 0;␊ |
1253 | ␉␉}␊ |
1254 | ␊ |
1255 | ␉␉if (ret[i] != 0xff) {␊ |
1256 | ␉␉␉isOnes = 0;␊ |
1257 | ␉␉}␊ |
1258 | ␉}␊ |
1259 | ␊ |
1260 | ␉if (isZero || isOnes) { // if empty or setable...␊ |
1261 | ␉␉verbose("No UUID present in SMBIOS System Information Table\n");␊ |
1262 | ␉␉ret = FixedUUID; // ...set a fixed value for system-id = 000102030405060708090A0B0C0D0E0F␊ |
1263 | ␉}␊ |
1264 | ␊ |
1265 | ␉memcpy(ptr, ret, UUID_LEN); // fix uuid in the table␊ |
1266 | ␉return ptr;␊ |
1267 | } // Bungo: end fix␊ |
1268 | ␊ |
1269 | void setupSMBIOSTable(void)␊ |
1270 | {␊ |
1271 | ␉SMBStructPtrs *structPtr;␊ |
1272 | ␉uint8_t *buffer;␊ |
1273 | ␉// bool setSMB = true; Bungo: now we use useSMBIOSdefaults␊ |
1274 | ␊ |
1275 | ␉if (!origeps) {␊ |
1276 | ␉␉return;␊ |
1277 | ␉}␊ |
1278 | ␊ |
1279 | ␉neweps = origeps;␊ |
1280 | ␊ |
1281 | ␉structPtr = (SMBStructPtrs *)malloc(sizeof(SMBStructPtrs));␊ |
1282 | ␉if (!structPtr) {␊ |
1283 | ␉␉return;␊ |
1284 | ␉}␊ |
1285 | ␉␊ |
1286 | ␉buffer = (uint8_t *)malloc(SMB_ALLOC_SIZE);␊ |
1287 | ␉if (!buffer) {␊ |
1288 | ␉␉free(structPtr);␊ |
1289 | ␉␉return;␊ |
1290 | ␉}␊ |
1291 | ␊ |
1292 | ␉bzero(buffer, SMB_ALLOC_SIZE);␊ |
1293 | ␉structPtr->new = (SMBStructHeader *)buffer;␊ |
1294 | ␊ |
1295 | ␉// getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); Bungo␊ |
1296 | ␉getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig);␊ |
1297 | ␉// if (setSMB) Bungo␊ |
1298 | ␉setDefaultSMBData();␊ |
1299 | ␊ |
1300 | ␉setupNewSMBIOSTable(origeps, structPtr);␊ |
1301 | ␊ |
1302 | ␉neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));␊ |
1303 | ␉if (!neweps) {␊ |
1304 | ␉␉free(buffer);␊ |
1305 | ␉␉free(structPtr);␊ |
1306 | ␉␉return;␊ |
1307 | ␉}␊ |
1308 | ␉bzero(neweps, sizeof(SMBEntryPoint));␊ |
1309 | ␊ |
1310 | ␉neweps->anchor[0]␉␉␉= '_';␊ |
1311 | ␉neweps->anchor[1]␉␉␉= 'S';␊ |
1312 | ␉neweps->anchor[2]␉␉␉= 'M';␊ |
1313 | ␉neweps->anchor[3]␉␉␉= '_';␊ |
1314 | ␉neweps->entryPointLength␉= sizeof(SMBEntryPoint);␊ |
1315 | ␉neweps->majorVersion␉␉= 2; // Bungo:␊ |
1316 | ␉neweps->minorVersion␉␉= 4; // Here we're using 2.4 SMBIOS rev. as real Macs␊ |
1317 | ␉neweps->maxStructureSize␉= maxStructSize;␊ |
1318 | ␉neweps->entryPointRevision␉= 0;␊ |
1319 | ␊ |
1320 | ␉neweps->dmi.anchor[0]␉␉= '_';␊ |
1321 | ␉neweps->dmi.anchor[1]␉␉= 'D';␊ |
1322 | ␉neweps->dmi.anchor[2]␉␉= 'M';␊ |
1323 | ␉neweps->dmi.anchor[3]␉␉= 'I';␊ |
1324 | ␉neweps->dmi.anchor[4]␉␉= '_';␊ |
1325 | ␉neweps->dmi.tableLength␉␉= tableLength;␊ |
1326 | ␉neweps->dmi.tableAddress␉= AllocateKernelMemory(tableLength);␊ |
1327 | ␉neweps->dmi.structureCount␉= structureCount;␊ |
1328 | ␉neweps->dmi.bcdRevision␉␉= 0x24; // ... and 2.4 DMI rev. as real Macs␊ |
1329 | ␊ |
1330 | ␉if (!neweps->dmi.tableAddress) {␊ |
1331 | ␉␉free(buffer);␊ |
1332 | ␉␉free(structPtr);␊ |
1333 | ␉␉return;␊ |
1334 | ␉}␊ |
1335 | ␊ |
1336 | ␉memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);␊ |
1337 | ␊ |
1338 | ␉Platform.UUID = FixSystemUUID(); // Bungo: fix System UUID␊ |
1339 | ␊ |
1340 | ␉neweps->dmi.checksum␉␉= 0;␊ |
1341 | ␉neweps->dmi.checksum␉␉= 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint));␊ |
1342 | ␊ |
1343 | ␉neweps->checksum␉␉= 0;␊ |
1344 | ␉neweps->checksum␉␉= 0x100 - checksum8(neweps, sizeof(SMBEntryPoint));␊ |
1345 | ␊ |
1346 | ␉free(buffer);␊ |
1347 | ␉free(structPtr);␊ |
1348 | ␊ |
1349 | ␉decodeSMBIOSTable(neweps);␊ |
1350 | ␊ |
1351 | ␉DBG("SMBIOS orig was = %x\n", origeps);␊ |
1352 | ␉DBG("SMBIOS new is = %x\n", neweps);␊ |
1353 | }␊ |
1354 | ␊ |
1355 | void *getSmbios(int which)␊ |
1356 | {␊ |
1357 | ␉switch (which) {␊ |
1358 | ␉␉case SMBIOS_ORIGINAL:␊ |
1359 | ␉␉␉if (!origeps) {␊ |
1360 | ␉␉␉␉origeps = getAddressOfSmbiosTable();␊ |
1361 | ␉␉␉}␊ |
1362 | ␉␉␉return origeps;␊ |
1363 | ␉␉case SMBIOS_PATCHED:␊ |
1364 | ␉␉␉return neweps;␊ |
1365 | ␉}␊ |
1366 | ␊ |
1367 | ␉return 0;␊ |
1368 | }␊ |
1369 | ␊ |
1370 | /* Collect any information needed later */␊ |
1371 | void readSMBIOSInfo(SMBEntryPoint *eps)␊ |
1372 | {␊ |
1373 | ␉uint8_t *structPtr = (uint8_t *)eps->dmi.tableAddress;␊ |
1374 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;␊ |
1375 | ␊ |
1376 | ␉int dimmnbr = 0;␊ |
1377 | ␉Platform.DMI.MaxMemorySlots␉= 0;␉// number of memory slots polulated by SMBIOS␊ |
1378 | ␉Platform.DMI.CntMemorySlots␉= 0;␉// number of memory slots counted␊ |
1379 | ␉Platform.DMI.MemoryModules␉= 0;␊ |
1380 | ␊ |
1381 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)␊ |
1382 | ␉{␊ |
1383 | ␉␉switch (structHeader->type)␊ |
1384 | ␉␉{␊ |
1385 | ␉␉␉case kSMBTypeSystemInformation:␊ |
1386 | ␉␉␉␉Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid; // get factory system uuid␊ |
1387 | ␉␉␉␉break;␊ |
1388 | ␊ |
1389 | ␉␉␉case kSMBTypeSystemEnclosure: // Bungo: determine platform type␊ |
1390 | ␉␉␉␉switch (((SMBSystemEnclosure *)structHeader)->chassisType) {␊ |
1391 | ␉␉␉␉␉case kSMBchassisDesktop:␊ |
1392 | ␉␉␉␉␉case kSMBchassisLPDesktop:␊ |
1393 | ␉␉␉␉␉case kSMBchassisAllInOne:␊ |
1394 | ␉␉␉␉␉case kSMBchassisLunchBox:␊ |
1395 | ␉␉␉␉␉␉PlatformType = 1; // desktop (iMac, MacMini)␊ |
1396 | ␉␉␉␉␉␉break;␊ |
1397 | ␉␉␉␉␉case kSMBchassisPortable:␊ |
1398 | ␉␉␉␉␉case kSMBchassisLaptop:␊ |
1399 | ␉␉␉␉␉case kSMBchassisNotebook:␊ |
1400 | ␉␉␉␉␉case kSMBchassisHandHeld:␊ |
1401 | ␉␉␉␉␉case kSMBchassisSubNotebook:␊ |
1402 | ␉␉␉␉␉␉PlatformType = 2; // notebook (Mac Books)␊ |
1403 | ␉␉␉␉␉ break;␊ |
1404 | ␉␉␉␉␉default:␊ |
1405 | ␉␉␉␉␉␉PlatformType = 3; // workstation (Mac Pro, Xserve)␊ |
1406 | ␉␉␉␉␉␉break;␊ |
1407 | ␉␉␉␉}␊ |
1408 | ␉␉␉␉break;␊ |
1409 | ␉␉␉␉//␊ |
1410 | ␉␉␉case kSMBTypePhysicalMemoryArray:␊ |
1411 | ␉␉␉␉Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices;␊ |
1412 | ␉␉␉␉break;␊ |
1413 | ␊ |
1414 | ␉␉␉case kSMBTypeMemoryDevice:␊ |
1415 | ␉␉␉␉Platform.DMI.CntMemorySlots++;␊ |
1416 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySize != 0)␉{␊ |
1417 | ␉␉␉␉␉Platform.DMI.MemoryModules++;␊ |
1418 | ␉␉␉␉}␊ |
1419 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)␉{␊ |
1420 | ␉␉␉␉␉Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed;␊ |
1421 | ␉␉␉␉}␊ |
1422 | ␉␉␉␉dimmnbr++;␊ |
1423 | ␉␉␉␉break;␊ |
1424 | ␉␉␉default:␊ |
1425 | ␉␉␉␉break;␊ |
1426 | ␉␉}␊ |
1427 | ␊ |
1428 | ␉␉structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
1429 | ␉␉for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);␊ |
1430 | ␊ |
1431 | ␉␉if (((uint16_t *)structPtr)[0] == 0) {␊ |
1432 | ␉␉␉structPtr += 2;␊ |
1433 | ␉␉}␊ |
1434 | ␊ |
1435 | ␉␉structHeader = (SMBStructHeader *)structPtr;␊ |
1436 | ␉}␊ |
1437 | }␊ |
1438 | |