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 | ␊ |
13 | #ifndef DEBUG_SMBIOS␊ |
14 | #define DEBUG_SMBIOS 0␊ |
15 | #endif␊ |
16 | ␊ |
17 | #if DEBUG_SMBIOS␊ |
18 | #define DBG(x...)␉printf(x)␊ |
19 | #else␊ |
20 | #define DBG(x...)␉msglog(x)␊ |
21 | #endif␊ |
22 | ␊ |
23 | #define SMBPlist␉␉␉&bootInfo->smbiosConfig␊ |
24 | /* ASSUMPTION: 16KB should be enough for the whole thing */␊ |
25 | #define SMB_ALLOC_SIZE␉16384␊ |
26 | ␊ |
27 | ␊ |
28 | //-------------------------------------------------------------------------------------------------------------------------␊ |
29 | // SMBIOS Plist Keys␊ |
30 | //-------------------------------------------------------------------------------------------------------------------------␊ |
31 | /* BIOS Information */␊ |
32 | #define kSMBBIOSInformationVendorKey␉␉␉"SMbiosvendor"␊ |
33 | #define kSMBBIOSInformationVersionKey␉␉␉"SMbiosversion"␊ |
34 | #define kSMBBIOSInformationReleaseDateKey␉␉"SMbiosdate"␊ |
35 | ␊ |
36 | /* System Information */␊ |
37 | #define kSMBSystemInformationManufacturerKey␉␉"SMmanufacturer"␊ |
38 | #define kSMBSystemInformationProductNameKey␉␉"SMproductname"␊ |
39 | #define kSMBSystemInformationVersionKey␉␉␉"SMsystemversion"␊ |
40 | #define kSMBSystemInformationSerialNumberKey␉␉"SMserial"␊ |
41 | #define kSMBSystemInformationFamilyKey␉␉␉"SMfamily"␊ |
42 | ␊ |
43 | /* Base Board */␊ |
44 | #define kSMBBaseBoardManufacturerKey␉␉␉"SMboardmanufacturer"␊ |
45 | #define kSMBBaseBoardProductKey␉␉␉␉"SMboardproduct"␊ |
46 | #define kSMBBaseBoardSerialNumber␉␉␉"SMboardserial"␊ |
47 | #define kSMBBaseBoardAssetTagNumber␉␉␉"SMboardassetag" // new␊ |
48 | #define kSMBBaseBoardLocationInChassis␉␉␉"SMboardlocation" // new␊ |
49 | #define kSMBBaseBoardType␉␉␉␉"SMboardtype" // new␊ |
50 | ␊ |
51 | /* Processor Information */␊ |
52 | #define kSMBProcessorInformationExternalClockKey␉"SMexternalclock"␊ |
53 | #define kSMBProcessorInformationMaximumClockKey␉␉"SMmaximalclock"␊ |
54 | ␊ |
55 | /* Memory Device */␊ |
56 | #define kSMBMemoryDeviceDeviceLocatorKey␉␉"SMmemdevloc"␊ |
57 | #define kSMBMemoryDeviceBankLocatorKey␉␉␉"SMmembankloc"␊ |
58 | #define kSMBMemoryDeviceMemoryTypeKey␉␉␉"SMmemtype"␊ |
59 | #define kSMBMemoryDeviceMemorySpeedKey␉␉␉"SMmemspeed"␊ |
60 | #define kSMBMemoryDeviceManufacturerKey␉␉␉"SMmemmanufacturer"␊ |
61 | #define kSMBMemoryDeviceSerialNumberKey␉␉␉"SMmemserial"␊ |
62 | #define kSMBMemoryDevicePartNumberKey␉␉␉"SMmempart"␊ |
63 | ␊ |
64 | /* Apple Specific */␊ |
65 | #define kSMBOemProcessorTypeKey␉␉␉␉"SMcputype"␊ |
66 | #define kSMBOemProcessorBusSpeedKey␉␉␉"SMbusspeed"␊ |
67 | ␊ |
68 | //-------------------------------------------------------------------------------------------------------------------------␊ |
69 | // Default SMBIOS Data␊ |
70 | //-------------------------------------------------------------------------------------------------------------------------␊ |
71 | /* Rewrite: use a struct */␊ |
72 | ␊ |
73 | #define kDefaultVendorManufacturer␉␉␉"Apple Inc."␊ |
74 | #define kDefaultBIOSReleaseDate␉␉␉␉"11/06/2009"␊ |
75 | #define kDefaultSerialNumber␉␉␉␉"SOMESRLNMBR"␊ |
76 | #define kDefaultBoardProduct␉␉␉␉"Mac-F4208DC8"␊ |
77 | #define kDefaultBoardType␉␉␉␉"10" // 0xA␊ |
78 | #define kDefaultSystemVersion␉␉␉␉"1.0"␊ |
79 | #define KDefaultBoardSerialNumber␉␉␉"C02140302D5DMT31M" // new C07019501PLDCVHAD␊ |
80 | // J593902RA4MFE 3,1␊ |
81 | // J5031046RCZJA 5,1␊ |
82 | // J521101A5CZJC 3,1␊ |
83 | // J593004RB1LUE MacPro4,1␊ |
84 | // J513401PZBH8C 5,1␊ |
85 | // J590802LC4ACB 3,1␊ |
86 | // J594900AH1LUE 4,1␊ |
87 | // J512500HZBH8C 5,1␊ |
88 | // J522700H7BH8C MacPro5,1␊ |
89 | #define KDefaultBoardAssetTagNumber␉␉␉"Pro-Enclosure" // new␊ |
90 | #define kDefaultLocatioInChassis␉␉␉"Part Component" // new␊ |
91 | ␊ |
92 | //=========== MacBook ===========␊ |
93 | // defaults for a MacBook␊ |
94 | #define kDefaultMacBookFamily␉␉␉␉"MacBook"␊ |
95 | #define kDefaultMacBook␉␉␉␉␉"MacBook4,1"␊ |
96 | #define kDefaultMacBookBIOSVersion␉␉␉" MB41.88Z.0073.B00.0809221748"␊ |
97 | #define kDefaultMacBookBIOSReleaseDate␉␉␉"09/22/08"␊ |
98 | #define kDefaultMacBookBoardAssetTagNumber␉␉"MacBook-Black"␊ |
99 | ␊ |
100 | //=========== Mac mini ===========␊ |
101 | // defaults for a Mac mini␊ |
102 | #define kDefaultMacminiFamily␉␉␉␉"Macmini"␊ |
103 | #define kDefaultMacmini␉␉␉␉␉"Macmini5,3"␊ |
104 | #define kDefaultMacminiBIOSVersion␉␉␉" MM51.88Z.0077.B10.1201241549"␊ |
105 | //#define kDefaultMacminiBoardProduct␉␉␉"Mac-F65AE981FFA204ED"␊ |
106 | #define kDefaultMacminiBIOSReleaseDate␉␉␉"01/24/2012"␊ |
107 | #define kDefaultMacminiBoardAssetTagNumber␉␉"Mini-Aluminum"␊ |
108 | // defaults for a Mac mini 6,2␊ |
109 | //#define kDefaultMacminiFamily␉␉␉␉"Macmini"␊ |
110 | //#define kDefaultMacmini␉␉␉␉"Macmini6,2"␊ |
111 | //#define kDefaultMacminiBIOSVersion␉␉␉" MM61.88Z.0106.B00.1208091121"␊ |
112 | //#define kDefaultMacminiBoardProduct␉␉␉"Mac-F65AE981FFA204ED"␊ |
113 | //#define kDefaultMacminiBIOSReleaseDate␉␉"10/14/2012"␊ |
114 | ␊ |
115 | //=========== MacBookPro ===========␊ |
116 | // defaults for a MacBook Pro␊ |
117 | #define kDefaultMacBookProFamily␉␉␉"MacBookPro"␊ |
118 | #define kDefaultMacBookPro␉␉␉␉"MacBookPro8,1"␊ |
119 | #define kDefaultMacBookProBIOSVersion␉␉␉" MBP81.88Z.0047.B24.1110141131"␊ |
120 | #define kDefaultMacBookProBoardProduct␉␉␉"Mac-94245B3640C91C81"␊ |
121 | #define kDefaultMacBookProBIOSReleaseDate␉␉"10/14/11"␊ |
122 | #define kDefaultMacBookProBoardAssetTagNumber␉␉"MacBook-Aluminum"␊ |
123 | // defaults for a MacBook Pro IVY␊ |
124 | #define kDefaultMacBookProIvy␉␉␉␉"MacBookPro10,2"␊ |
125 | #define kDefaultMacBookProIvyBIOSVersion␉␉" MBP102.88Z.0106.B01.1208311637"␊ |
126 | #define kDefaultMacBookProIvyBoardProduct␉␉"Mac-AFD8A9D944EA4843"␊ |
127 | #define kDefaultMacBookProIvyBIOSReleaseDate␉␉"10/02/2012"␊ |
128 | ␊ |
129 | //=========== iMac ===========␊ |
130 | #define kDefaultiMacFamily␉␉␉␉"iMac"␊ |
131 | #define kDefaultiMac␉␉␉␉␉"iMac8,1"␊ |
132 | #define kDefaultiMacBIOSVersion␉␉␉␉" IM81.88Z.00C1.B00.0903051113"␊ |
133 | #define kDefaultiMacBoardProduct␉␉␉"Mac-F227BEC8"␊ |
134 | #define kDefaultiMacBoardAssetTagNumber␉␉␉"iMac-Aluminum"␊ |
135 | // iMac10,1␊ |
136 | // iMac11,1 core i3/i5/i7␊ |
137 | #define kDefaultiMacNehalem␉␉␉␉"iMac11,1"␊ |
138 | #define kDefaultiMacNehalemBIOSVersion␉␉␉" IM111.88Z.0034.B00.0910301727"␊ |
139 | #define kDefaultiMacNehalemBIOSReleaseDate␉␉"10/30/09"␊ |
140 | #define kDefaultiMacNehalemBoardProduct␉␉␉"Mac-F2268DAE"␊ |
141 | // iMac11,2␊ |
142 | // iMac11,3␊ |
143 | // iMac12,1␊ |
144 | // iMac12,2␊ |
145 | #define kDefaultiMacSandy␉␉␉␉"iMac12,2"␊ |
146 | #define kDefaultiMacSandyBIOSVersion␉␉␉" IM121.88Z.0047.B1D.1110171110"␊ |
147 | #define kDefaultiMacSandyBIOSReleaseDate␉␉"10/17/2011"␊ |
148 | #define kDefaultiMacSandyBoardProduct␉␉␉"Mac-942B59F58194171B"␊ |
149 | // iMac13,2␊ |
150 | #define kDefaultiMacIvy␉␉␉␉␉"iMac13,2"␊ |
151 | #define kDefaultiMacIvyBIOSVersion␉␉␉" IM131.88Z.00CE.B00.1203281326"␊ |
152 | #define kDefaultiMacIvyBIOSReleaseDate␉␉␉"03/28/2012"␊ |
153 | #define kDefaultiMacIvyBoardProduct␉␉␉"Mac-FC02E91DDD3FA6A4"␊ |
154 | ␊ |
155 | //=========== MacPro ===========␊ |
156 | // defaults for a Mac Pro␊ |
157 | #define kDefaultMacProFamily␉␉␉␉"MacPro"␊ |
158 | #define kDefaultMacPro␉␉␉␉␉"MacPro3,1"␊ |
159 | #define kDefaultMacProBIOSVersion␉␉␉" MP31.88Z.006C.B05.0903051113"␊ |
160 | #define kDefaultMacProBIOSReleaseDate␉␉␉"08/03/2010"␊ |
161 | #define kDefaultMacProSystemVersion␉␉␉"1.3"␊ |
162 | #define kDefaultMacProBoardProduct␉␉␉"Mac-F2268DC8"␊ |
163 | #define KDefauktMacProBoardAssetTagNumber␉␉"Pro-Enclosure"␊ |
164 | //#define kDefaultMacProBoardType␉␉␉␉"0xB" // 11␊ |
165 | #define KDefaultMacProBoardSerialNumber␉␉␉"J593902RA4MFE"␊ |
166 | // defaults for a Mac Pro 4,1 core i7/Xeon␊ |
167 | #define kDefaultMacProNehalem␉␉␉␉"MacPro4,1"␊ |
168 | #define kDefaultMacProNehalemBIOSVersion␉␉" MP41.88Z.0081.B04.0903051113"␊ |
169 | #define kDefaultMacProNehalemBIOSReleaseDate␉␉"11/06/2009"␊ |
170 | #define kDefaultMacProNehalemSystemVersion␉␉"1.4"␊ |
171 | #define kDefaultMacProNehalemBoardProduct␉␉"Mac-F4238CC8"␊ |
172 | #define KDefaultMacProNehalemBoardSerialNumber␉␉"J593004RB1LUE"␊ |
173 | // defaults for a Mac Pro 5,1 core i7/Xeon␊ |
174 | #define kDefaultMacProWestmere␉␉␉␉"MacPro5,1"␊ |
175 | #define kDefaultMacProWestmereBIOSVersion␉␉" MP51.88Z.007F.B03.1010071432"␊ |
176 | #define kDefaultMacProWestmereBIOSReleaseDate␉␉"10/07/2010"␊ |
177 | #define kDefaultMacProWestmereSystemVersion␉␉"1.2"␊ |
178 | #define kDefaultMacProWestmereBoardProduct␉␉"Mac-F221BEC8"␊ |
179 | #define KDefaultMacProWestmereBoardSerialNumber␉␉"J522700H7BH8C"␊ |
180 | //-------------------------------------------------------------------------------------------------------------------------␊ |
181 | ␊ |
182 | ␊ |
183 | #define getFieldOffset(struct, field)␉((uint8_t)(uint32_t)&(((struct *)0)->field))␊ |
184 | ␊ |
185 | typedef struct␊ |
186 | {␊ |
187 | ␉SMBStructHeader *orig;␊ |
188 | ␉SMBStructHeader *new;␊ |
189 | } SMBStructPtrs;␊ |
190 | ␊ |
191 | struct␊ |
192 | {␊ |
193 | ␉char *vendor;␊ |
194 | ␉char *version;␊ |
195 | ␉char *releaseDate;␊ |
196 | } defaultBIOSInfo;␊ |
197 | ␊ |
198 | struct␊ |
199 | {␊ |
200 | ␉char *manufacturer;␊ |
201 | ␉char *productName;␊ |
202 | ␉char *version;␊ |
203 | ␉char *serialNumber;␊ |
204 | ␉char *family;␊ |
205 | } defaultSystemInfo;␊ |
206 | ␊ |
207 | struct␊ |
208 | {␊ |
209 | ␉char *manufacturer;␊ |
210 | ␉char *product;␊ |
211 | ␉char *serialNumber; //␊ |
212 | ␉char *boardType; //␊ |
213 | ␉char *assetTagNumber; //␊ |
214 | ␉char *locationInChassis; //␊ |
215 | } defaultBaseBoard;␊ |
216 | ␊ |
217 | ␊ |
218 | typedef struct␊ |
219 | {␊ |
220 | ␉uint8_t␉␉␉type;␊ |
221 | ␉SMBValueType␉valueType;␊ |
222 | ␉uint8_t␉␉␉fieldOffset;␊ |
223 | ␉char␉␉␉*keyString;␊ |
224 | ␉bool␉␉␉(*getSMBValue)(returnType *);␊ |
225 | ␉char␉␉␉**defaultValue;␊ |
226 | } SMBValueSetter;␊ |
227 | ␊ |
228 | SMBValueSetter SMBSetters[] = ␊ |
229 | {␊ |
230 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
231 | ␉// BIOSInformation␊ |
232 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
233 | ␉{kSMBTypeBIOSInformation,␉kSMBString,␉getFieldOffset(SMBBIOSInformation, vendor),␉␉␉kSMBBIOSInformationVendorKey,␉␉␊ |
234 | ␉␉NULL,␉&defaultBIOSInfo.vendor␉␉␉}, // AppleBiosVendor␊ |
235 | ␊ |
236 | ␉{kSMBTypeBIOSInformation,␉kSMBString,␉getFieldOffset(SMBBIOSInformation, version),␉␉kSMBBIOSInformationVersionKey,␉␉␊ |
237 | ␉␉NULL,␉&defaultBIOSInfo.version␉␉}, // AppleFirmwareVersion␊ |
238 | ␊ |
239 | ␉{kSMBTypeBIOSInformation,␉kSMBString,␉getFieldOffset(SMBBIOSInformation, releaseDate),␉kSMBBIOSInformationReleaseDateKey,␉␊ |
240 | ␉␉NULL,␉&defaultBIOSInfo.releaseDate␉}, // AppleReleaseDate␊ |
241 | ␊ |
242 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
243 | ␉// SystemInformation␊ |
244 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
245 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, manufacturer),␉kSMBSystemInformationManufacturerKey,␉␊ |
246 | ␉␉NULL,␉&defaultSystemInfo.manufacturer␉}, // AppleBiosVendor␊ |
247 | ␊ |
248 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, productName),␉kSMBSystemInformationProductNameKey,␉␊ |
249 | ␉␉NULL,␉&defaultSystemInfo.productName␉}, // AppleProductName␊ |
250 | ␊ |
251 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, version),␉␉kSMBSystemInformationVersionKey,␉␉␊ |
252 | ␉␉NULL,␉&defaultSystemInfo.version␉␉}, // AppleSystemVersion␊ |
253 | ␊ |
254 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, serialNumber),␉kSMBSystemInformationSerialNumberKey,␉␊ |
255 | ␉␉NULL,␉&defaultSystemInfo.serialNumber␉}, // AppleSerialNumber␊ |
256 | ␊ |
257 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, skuNumber),␉NULL,␉␉␉␉␉␉␉␉␉␊ |
258 | ␉␉NULL,␉NULL␉␉␉␉␉␉␉}, // AppleSkuNumber␊ |
259 | ␊ |
260 | ␉{kSMBTypeSystemInformation,␉kSMBString,␉getFieldOffset(SMBSystemInformation, family),␉␉kSMBSystemInformationFamilyKey,␊ |
261 | ␉␉NULL,␉&defaultSystemInfo.family␉␉}, // AppleFamily␊ |
262 | ␊ |
263 | ␊ |
264 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
265 | ␉// BaseBoard␊ |
266 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
267 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, manufacturer),␉␉kSMBBaseBoardManufacturerKey,␉␊ |
268 | ␉␉NULL,␉&defaultBaseBoard.manufacturer␉}, // AppleBiosVendor␊ |
269 | ␊ |
270 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, product),␉␉␉kSMBBaseBoardProductKey,␉␉␊ |
271 | ␉␉NULL,␉&defaultBaseBoard.product␉␉}, // AppleBoardID␊ |
272 | ␊ |
273 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, version),␉␉␉NULL,␊ |
274 | NULL,␉NULL␉␉␉␉␉␉␉}, // AppleSystemVersion␊ |
275 | ␊ |
276 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, serialNumber),␉␉kSMBBaseBoardSerialNumber,␊ |
277 | NULL,␉&defaultBaseBoard.serialNumber }, // AppleBoard␊ |
278 | ␊ |
279 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, assetTagNumber),␉␉kSMBBaseBoardAssetTagNumber,␊ |
280 | NULL,␉&defaultBaseBoard.assetTagNumber }, // AppleChassisAsset␊ |
281 | ␊ |
282 | ␉{kSMBTypeBaseBoard,␉kSMBString,␉getFieldOffset(SMBBaseBoard, locationInChassis),␉kSMBBaseBoardLocationInChassis,␊ |
283 | NULL,␉&defaultBaseBoard.locationInChassis }, // AppleBoardLocation␊ |
284 | ␊ |
285 | ␉{kSMBTypeBaseBoard,␉kSMBByte,␉getFieldOffset(SMBBaseBoard, boardType),␉kSMBBaseBoardType,␊ |
286 | NULL,␉&defaultBaseBoard.boardType }, // AppleBoardType␊ |
287 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
288 | ␉// SystemEnclosure␊ |
289 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
290 | ␉{kSMBTypeSystemEnclosure,␉kSMBString,␉getFieldOffset(SMBSystemEnclosure, manufacturer),␊ |
291 | ␉␉kSMBBaseBoardManufacturerKey,␉NULL,␉&defaultBaseBoard.manufacturer␉}, // AppleBiosVendor␊ |
292 | ␊ |
293 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
294 | ␉// ProcessorInformation␊ |
295 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
296 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, socketDesignation),␉NULL,␉NULL,␉NULL},␊ |
297 | ␊ |
298 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, manufacturer),␉␉NULL,␉NULL,␉NULL},␊ |
299 | ␊ |
300 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, processorVersion),␉NULL,␉NULL,␉NULL},␊ |
301 | ␊ |
302 | ␉{kSMBTypeProcessorInformation,␉kSMBWord,␉getFieldOffset(SMBProcessorInformation, externalClock),␉␉kSMBProcessorInformationExternalClockKey,␊ |
303 | ␉␉getProcessorInformationExternalClock,␉NULL},␊ |
304 | ␊ |
305 | ␉{kSMBTypeProcessorInformation,␉kSMBWord,␉getFieldOffset(SMBProcessorInformation, maximumClock),␉␉kSMBProcessorInformationMaximumClockKey,␉␊ |
306 | ␉␉getProcessorInformationMaximumClock,␉NULL},␊ |
307 | ␊ |
308 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, serialNumber),␉␉/*SMBProcessorInformationSerialNumberKey,␊ |
309 | getProcessorInformationSerialNumber, */NULL,␉NULL,␉NULL},␊ |
310 | ␊ |
311 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, assetTag),␉␉␉NULL,␉NULL,␉NULL},␊ |
312 | ␊ |
313 | ␉{kSMBTypeProcessorInformation,␉kSMBString,␉getFieldOffset(SMBProcessorInformation, partNumber),␉␉NULL,␉NULL,␉NULL},␊ |
314 | ␊ |
315 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
316 | ␉// Memory Device␊ |
317 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
318 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, deviceLocator),␉kSMBMemoryDeviceDeviceLocatorKey,␉␊ |
319 | ␉␉NULL,␉␉␉␉␉␉␉NULL},␊ |
320 | ␊ |
321 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, bankLocator),␉kSMBMemoryDeviceBankLocatorKey,␉␉␊ |
322 | ␉␉NULL,␉␉␉␉␉␉␉NULL},␊ |
323 | ␊ |
324 | ␉{kSMBTypeMemoryDevice,␉kSMBByte,␉getFieldOffset(SMBMemoryDevice, memoryType),␉kSMBMemoryDeviceMemoryTypeKey,␉␉␊ |
325 | ␉␉getSMBMemoryDeviceMemoryType,␉NULL},␊ |
326 | ␊ |
327 | ␉{kSMBTypeMemoryDevice,␉kSMBWord,␉getFieldOffset(SMBMemoryDevice, memorySpeed),␉kSMBMemoryDeviceMemorySpeedKey,␉␉␊ |
328 | ␉␉getSMBMemoryDeviceMemorySpeed,␉NULL},␊ |
329 | ␊ |
330 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, manufacturer),␉kSMBMemoryDeviceManufacturerKey,␉␊ |
331 | ␉␉getSMBMemoryDeviceManufacturer,␉NULL},␊ |
332 | ␊ |
333 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, serialNumber),␉kSMBMemoryDeviceSerialNumberKey,␉␊ |
334 | ␉␉getSMBMemoryDeviceSerialNumber,␉NULL},␊ |
335 | ␊ |
336 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, assetTag),␉␉NULL,␉NULL,␉NULL},␊ |
337 | ␊ |
338 | ␉{kSMBTypeMemoryDevice,␉kSMBWord,␉getFieldOffset(SMBMemoryDevice, errorHandle), NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL},␊ |
339 | ␊ |
340 | ␉{kSMBTypeMemoryDevice,␉kSMBString,␉getFieldOffset(SMBMemoryDevice, partNumber),␉kSMBMemoryDevicePartNumberKey,␉␉␊ |
341 | ␉␉getSMBMemoryDevicePartNumber,␉NULL},␊ |
342 | ␊ |
343 | ␊ |
344 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
345 | ␉// Apple Specific␊ |
346 | ␉//-------------------------------------------------------------------------------------------------------------------------␊ |
347 | ␉{kSMBTypeOemProcessorType,␉␉kSMBWord,␉getFieldOffset(SMBOemProcessorType, ProcessorType),␉␉␉kSMBOemProcessorTypeKey,␉␉␊ |
348 | ␉␉getSMBOemProcessorType,␉␉␉NULL},␊ |
349 | ␊ |
350 | ␉{kSMBTypeOemProcessorBusSpeed,␉kSMBWord,␉getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed),␉kSMBOemProcessorBusSpeedKey,␉␊ |
351 | ␉␉getSMBOemProcessorBusSpeed,␉␉NULL}␊ |
352 | };␊ |
353 | ␊ |
354 | int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter);␊ |
355 | ␊ |
356 | ␊ |
357 | SMBEntryPoint *origeps␉= 0;␊ |
358 | SMBEntryPoint *neweps␉= 0;␊ |
359 | ␊ |
360 | static uint8_t stringIndex;␉// increament when a string is added and set the field value accordingly␊ |
361 | static uint8_t stringsSize;␉// add string size␊ |
362 | ␊ |
363 | static SMBWord tableLength␉= 0;␊ |
364 | static SMBWord handle␉␉= 0;␊ |
365 | static SMBWord maxStructSize␉= 0;␊ |
366 | static SMBWord structureCount␉= 0;␊ |
367 | /*␊ |
368 | if (gSettings.RtMLB == NULL && SNLen > 0) {␊ |
369 | gSettings.RtMLB = AllocateCopyPool(SNLen + 1, gSettings.SerialNr);␊ |
370 | }␊ |
371 | ␊ |
372 | if (gSettings.RtROM == NULL) {␊ |
373 | // we can try to set it to MAC address from SMBIOS UUID - some boards have it there␊ |
374 | gSettings.RtROMLen = 6;␊ |
375 | gSettings.RtROM = AllocateCopyPool(gSettings.RtROMLen, ((UINT8*)&gSettings.SmUUID) + 10);␊ |
376 | }␊ |
377 | ␊ |
378 | ␊ |
379 | ----------------␊ |
380 | // RtVariables␊ |
381 | dictPointer = GetProperty(dict, "RtVariables");␊ |
382 | if (dictPointer) {␊ |
383 | ␊ |
384 | // ROM: <data>bin data</data> or <string>base 64 encoded bin data</string>␊ |
385 | prop = GetProperty(dictPointer, "ROM");␊ |
386 | if(prop) {␊ |
387 | gSettings.RtROM = GetDataSetting(dictPointer, "ROM", &gSettings.RtROMLen);␊ |
388 | if (gSettings.RtROM == NULL || gSettings.RtROMLen == 0) {␊ |
389 | gSettings.RtROM = NULL;␊ |
390 | gSettings.RtROMLen = 0;␊ |
391 | }␊ |
392 | }␊ |
393 | ␊ |
394 | // MLB: <string>some value</string>␊ |
395 | prop = GetProperty(dictPointer, "MLB");␊ |
396 | if(prop && AsciiStrLen(prop->string) > 0) {␊ |
397 | gSettings.RtMLB = AllocateCopyPool(AsciiStrSize(prop->string), prop->string);␊ |
398 | }␊ |
399 | ␊ |
400 | }␊ |
401 | ␊ |
402 | ␊ |
403 | ␊ |
404 | ␊ |
405 | */␊ |
406 | /* Rewrite this function */␊ |
407 | void setDefaultSMBData(void)␊ |
408 | {␊ |
409 | ␉defaultBIOSInfo.vendor = kDefaultVendorManufacturer;␊ |
410 | ␉defaultBIOSInfo.releaseDate = kDefaultBIOSReleaseDate;␊ |
411 | ␊ |
412 | ␉defaultSystemInfo.manufacturer = kDefaultVendorManufacturer;␊ |
413 | ␉defaultSystemInfo.version = kDefaultSystemVersion;␊ |
414 | ␉defaultSystemInfo.serialNumber = kDefaultSerialNumber;␊ |
415 | ␊ |
416 | ␉defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;␊ |
417 | ␉defaultBaseBoard.product = kDefaultBoardProduct;␊ |
418 | ␉defaultBaseBoard.boardType = kDefaultBoardType; // new␊ |
419 | ␉defaultBaseBoard.serialNumber = KDefaultBoardSerialNumber; //new␊ |
420 | ␉defaultBaseBoard.assetTagNumber = KDefaultBoardAssetTagNumber; //new␊ |
421 | ␉defaultBaseBoard.locationInChassis = kDefaultLocatioInChassis; //new␊ |
422 | ␊ |
423 | ␉if (platformCPUFeature(CPU_FEATURE_MOBILE))␊ |
424 | ␉{␊ |
425 | ␉␉if (Platform.CPU.NoCores > 1)␊ |
426 | ␉␉{␊ |
427 | ␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacBookProBIOSVersion;␊ |
428 | ␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacBookProBIOSReleaseDate;␊ |
429 | ␉␉␉defaultBaseBoard.product␉␉= kDefaultMacBookProBoardProduct;␊ |
430 | ␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacBookPro;␊ |
431 | ␉␉␉defaultSystemInfo.family␉␉= kDefaultMacBookProFamily;␊ |
432 | ␉␉␉defaultBaseBoard.assetTagNumber␉␉= kDefaultMacBookProBoardAssetTagNumber;␊ |
433 | ␉␉}␊ |
434 | ␉␉else␊ |
435 | ␉␉{␊ |
436 | ␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacBookBIOSVersion;␊ |
437 | ␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacBookBIOSReleaseDate;␊ |
438 | ␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacBook;␊ |
439 | ␉␉␉defaultSystemInfo.family␉␉= kDefaultMacBookFamily;␊ |
440 | ␉␉␉defaultBaseBoard.assetTagNumber␉␉= kDefaultMacBookBoardAssetTagNumber;␊ |
441 | ␉␉}␊ |
442 | ␉}␊ |
443 | ␉else␊ |
444 | ␉{␊ |
445 | ␉␉switch (Platform.CPU.NoCores) ␊ |
446 | ␉␉{␊ |
447 | ␉␉␉case 1: ␊ |
448 | ␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacminiBIOSVersion;␊ |
449 | ␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacminiBIOSReleaseDate;␊ |
450 | ␉␉␉␉//defaultBaseBoard.product␉␉= kDefaultMacminiBoardProduct;␊ |
451 | ␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacmini;␊ |
452 | ␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacminiFamily;␊ |
453 | ␉␉␉␉defaultBaseBoard.assetTagNumber␉␉= kDefaultMacminiBoardAssetTagNumber;␊ |
454 | ␉␉␉␉break;␊ |
455 | ␊ |
456 | ␉␉␉case 2:␊ |
457 | ␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacBIOSVersion;␊ |
458 | ␉␉␉␉defaultBaseBoard.product␉␉= kDefaultiMacBoardProduct;␊ |
459 | ␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultiMac;␊ |
460 | ␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
461 | ␉␉␉␉defaultBaseBoard.assetTagNumber = kDefaultiMacBoardAssetTagNumber;␊ |
462 | ␉␉␉␉break;␊ |
463 | ␉␉␉default:␊ |
464 | ␉␉␉{␊ |
465 | ␉␉␉␉switch (Platform.CPU.Family) ␊ |
466 | ␉␉␉␉{␊ |
467 | ␉␉␉␉␉case 0x06:␊ |
468 | ␉␉␉␉␉{␊ |
469 | ␉␉␉␉␉␉switch (Platform.CPU.Model)␊ |
470 | ␉␉␉␉␉␉{␊ |
471 | ␉␉␉␉␉␉␉case CPU_MODEL_FIELDS:␉␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
472 | ␉␉␉␉␉␉␉case CPU_MODEL_DALES:␊ |
473 | ␉␉␉␉␉␉␉case CPU_MODEL_CLARKDALE:␉␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
474 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacNehalemBIOSVersion;␊ |
475 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultiMacNehalemBIOSReleaseDate;␊ |
476 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product␉␉= kDefaultiMacNehalemBoardProduct;␊ |
477 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultiMacNehalem;␊ |
478 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
479 | ␉␉␉␉␉␉␉␉defaultBaseBoard.assetTagNumber␉␉= kDefaultiMacBoardAssetTagNumber;␊ |
480 | ␉␉␉␉␉␉␉␉break;␊ |
481 | ␊ |
482 | ␉␉␉␉␉␉␉case CPU_MODEL_SANDYBRIDGE:␉␉␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
483 | ␉␉␉␉␉␉␉case CPU_MODEL_JAKETOWN:␉␉␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
484 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacSandyBIOSVersion;␊ |
485 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultiMacSandyBIOSReleaseDate;␊ |
486 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product␉␉= kDefaultiMacSandyBoardProduct;␊ |
487 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultiMacSandy;␊ |
488 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
489 | ␉␉␉␉␉␉␉␉defaultBaseBoard.assetTagNumber = kDefaultiMacBoardAssetTagNumber;␊ |
490 | ␉␉␉␉␉␉␉␉break;␊ |
491 | ␊ |
492 | ␉␉␉␉␉␉␉case CPU_MODEL_IVYBRIDGE:␉␉␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
493 | ␉␉␉␉␉␉␉case CPU_MODEL_IVYBRIDGE_E5:␊ |
494 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultiMacIvyBIOSVersion;␊ |
495 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultiMacIvyBIOSReleaseDate;␊ |
496 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product␉␉= kDefaultiMacIvyBoardProduct;␊ |
497 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultiMacIvy;␊ |
498 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultiMacFamily;␊ |
499 | ␉␉␉␉␉␉␉␉defaultBaseBoard.assetTagNumber␉␉= kDefaultiMacBoardAssetTagNumber;␊ |
500 | ␉␉␉␉␉␉␉␉break;␊ |
501 | ␊ |
502 | ␉␉␉␉␉␉␉case CPU_MODEL_NEHALEM:␉␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
503 | ␉␉␉␉␉␉␉case CPU_MODEL_NEHALEM_EX:␉␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
504 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacProNehalemBIOSVersion;␊ |
505 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacProNehalemBIOSReleaseDate;␊ |
506 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product␉␉= kDefaultMacProNehalemBoardProduct;␊ |
507 | ␉␉␉␉␉␉␉␉//defaultBaseBoard.boardType␉␉= kDefaultMacProBoardType;␊ |
508 | ␉␉␉␉␉␉␉␉defaultBaseBoard.serialNumber␉␉= KDefaultMacProNehalemBoardSerialNumber;// BoardSerialNumber;␊ |
509 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacProNehalem;␊ |
510 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacProFamily;␊ |
511 | ␉␉␉␉␉␉␉␉defaultSystemInfo.version␉␉= kDefaultMacProNehalemSystemVersion;␊ |
512 | ␉␉␉␉␉␉␉␉break;␊ |
513 | ␊ |
514 | ␉␉␉␉␉␉␉case CPU_MODEL_WESTMERE:␉␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
515 | ␉␉␉␉␉␉␉case CPU_MODEL_WESTMERE_EX:␉␉// Intel Xeon E7␊ |
516 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacProWestmereBIOSVersion;␊ |
517 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacProWestmereBIOSReleaseDate;␊ |
518 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product␉␉= kDefaultMacProWestmereBoardProduct;␊ |
519 | ␉␉␉␉␉␉␉␉//defaultBaseBoard.boardType␉␉= kDefaultMacProBoardType;␊ |
520 | ␉␉␉␉␉␉␉␉defaultBaseBoard.serialNumber␉␉= KDefaultMacProWestmereBoardSerialNumber;// BoardSerialNumber;␊ |
521 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacProWestmere;␊ |
522 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacProFamily;␊ |
523 | ␉␉␉␉␉␉␉␉defaultSystemInfo.version␉␉= kDefaultMacProWestmereSystemVersion;␊ |
524 | ␉␉␉␉␉␉␉␉break;␊ |
525 | ␊ |
526 | ␉␉␉␉␉␉␉default:␊ |
527 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.version␉␉␉= kDefaultMacProBIOSVersion;␊ |
528 | ␉␉␉␉␉␉␉␉defaultBIOSInfo.releaseDate␉␉= kDefaultMacProBIOSReleaseDate;␊ |
529 | ␉␉␉␉␉␉␉␉defaultBaseBoard.product␉␉= kDefaultMacProBoardProduct;␊ |
530 | ␉␉␉␉␉␉␉␉//defaultBaseBoard.boardType␉␉= kDefaultMacProBoardType;␊ |
531 | ␉␉␉␉␉␉␉␉defaultSystemInfo.productName␉␉= kDefaultMacPro;␊ |
532 | ␉␉␉␉␉␉␉␉defaultSystemInfo.family␉␉= kDefaultMacProFamily;␊ |
533 | ␉␉␉␉␉␉␉␉break;␊ |
534 | ␉␉␉␉␉␉}␊ |
535 | ␉␉␉␉␉␉break;␊ |
536 | ␉␉␉␉␉}␊ |
537 | ␉␉␉␉␉default:␊ |
538 | ␉␉␉␉␉␉defaultBIOSInfo.version␉␉= kDefaultMacProBIOSVersion;␊ |
539 | ␉␉␉␉␉␉//defaultBaseBoard.boardType␉␉= kDefaultMacProBoardType;␊ |
540 | ␉␉␉␉␉␉defaultSystemInfo.productName␉= kDefaultMacPro;␊ |
541 | ␉␉␉␉␉␉defaultSystemInfo.family␉= kDefaultMacProFamily;␊ |
542 | ␉␉␉␉␉␉break;␊ |
543 | ␉␉␉␉}␊ |
544 | ␉␉␉␉break;␊ |
545 | ␉␉␉}␊ |
546 | ␉␉}␊ |
547 | ␉}␊ |
548 | }␊ |
549 | ␊ |
550 | /* Used for SM*n smbios.plist keys */␊ |
551 | bool getSMBValueForKey(SMBStructHeader *structHeader, const char *keyString, const char **string, returnType *value)␊ |
552 | {␊ |
553 | ␉static int idx = -1;␊ |
554 | ␉static int current = -1;␊ |
555 | ␉int len;␊ |
556 | ␉char key[24];␊ |
557 | ␊ |
558 | ␉if (current != structHeader->handle)␊ |
559 | ␉{␊ |
560 | ␉␉idx++;␊ |
561 | ␉␉current = structHeader->handle;␊ |
562 | ␉}␊ |
563 | ␊ |
564 | ␉sprintf(key, "%s%d", keyString, idx);␊ |
565 | ␊ |
566 | ␉if (value)␊ |
567 | ␉{␊ |
568 | ␉␉if (getIntForKey(key, (int *)&(value->dword), SMBPlist))␊ |
569 | ␉␉{␊ |
570 | ␉␉␉return true;␊ |
571 | ␉␉}␊ |
572 | ␉}␊ |
573 | ␉else␊ |
574 | ␉{␊ |
575 | ␉␉if (getValueForKey(key, string, &len, SMBPlist))␊ |
576 | ␉␉{␊ |
577 | ␉␉␉return true;␊ |
578 | ␉␉}␊ |
579 | ␉}␊ |
580 | ␉return false;␊ |
581 | }␊ |
582 | ␊ |
583 | char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field)␊ |
584 | {␊ |
585 | ␉uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;␊ |
586 | ␊ |
587 | ␉if (!field)␊ |
588 | ␉{␊ |
589 | ␉␉return NULL;␊ |
590 | ␉}␊ |
591 | ␊ |
592 | ␉for (field--; field != 0 && strlen((char *)stringPtr) > 0;␊ |
593 | ␉␉field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));␊ |
594 | ␊ |
595 | ␉return (char *)stringPtr;␊ |
596 | }␊ |
597 | ␊ |
598 | void setSMBStringForField(SMBStructHeader *structHeader, const char *string, uint8_t *field)␊ |
599 | {␊ |
600 | ␉int strSize;␊ |
601 | ␊ |
602 | ␉if (!field)␊ |
603 | ␉{␊ |
604 | ␉␉return;␊ |
605 | ␉}␊ |
606 | ␊ |
607 | ␉if (!string)␊ |
608 | ␉{␊ |
609 | ␉␉*field = 0;␊ |
610 | ␉␉return;␊ |
611 | ␉}␊ |
612 | ␊ |
613 | ␉strSize = strlen(string);␊ |
614 | ␊ |
615 | ␉// remove any spaces found at the end␊ |
616 | ␉while ((strSize != 0) && (string[strSize - 1] == ' '))␊ |
617 | ␉{␊ |
618 | ␉␉strSize--;␊ |
619 | ␉}␊ |
620 | ␊ |
621 | ␉if (strSize == 0)␊ |
622 | ␉{␊ |
623 | ␉␉*field = 0;␊ |
624 | ␉␉return;␊ |
625 | ␉}␊ |
626 | ␊ |
627 | ␉memcpy((uint8_t *)structHeader + structHeader->length + stringsSize, string, strSize);␊ |
628 | ␉*field = stringIndex;␊ |
629 | ␊ |
630 | ␉stringIndex++;␊ |
631 | ␉stringsSize += strSize + 1;␊ |
632 | }␊ |
633 | ␊ |
634 | bool setSMBValue(SMBStructPtrs *structPtr, int idx, returnType *value)␊ |
635 | {␊ |
636 | ␉const char *string = 0;␊ |
637 | ␉int len;␊ |
638 | ␉bool parsed;␊ |
639 | ␉int val;␊ |
640 | ␊ |
641 | ␉if (numOfSetters <= idx)␊ |
642 | ␉{␊ |
643 | ␉␉return false;␊ |
644 | ␉}␊ |
645 | ␊ |
646 | ␉switch (SMBSetters[idx].valueType)␊ |
647 | ␉{␊ |
648 | ␉␉case kSMBString:␊ |
649 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
650 | ␉␉␉{␊ |
651 | ␉␉␉␉if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist))␊ |
652 | ␉␉␉␉{␊ |
653 | ␉␉␉␉␉break;␊ |
654 | ␉␉␉␉}␊ |
655 | ␉␉␉␉else␊ |
656 | ␉␉␉␉{␊ |
657 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␉// MemoryDevice only␊ |
658 | ␉␉␉␉␉{␊ |
659 | ␉␉␉␉␉␉if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL))␊ |
660 | ␉␉␉␉␉␉{␊ |
661 | ␉␉␉␉␉␉␉break;␊ |
662 | ␉␉␉␉␉␉}␊ |
663 | ␉␉␉␉␉}␊ |
664 | ␉␉␉␉}␊ |
665 | ␊ |
666 | ␉␉␉}␊ |
667 | ␉␉␉if (SMBSetters[idx].getSMBValue)␊ |
668 | ␉␉␉{␊ |
669 | ␉␉␉␉if (SMBSetters[idx].getSMBValue((returnType *)&string))␊ |
670 | ␉␉␉␉{␊ |
671 | ␉␉␉␉␉break;␊ |
672 | ␉␉␉␉}␊ |
673 | ␉␉␉}␊ |
674 | ␉␉␉if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue))␊ |
675 | ␉␉␉{␊ |
676 | ␉␉␉␉string = *(SMBSetters[idx].defaultValue);␊ |
677 | ␉␉␉␉break;␊ |
678 | ␉␉␉}␊ |
679 | ␉␉␉string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);␊ |
680 | ␉␉␉break;␊ |
681 | ␊ |
682 | ␉␉case kSMBByte:␊ |
683 | ␉␉case kSMBWord:␊ |
684 | ␉␉case kSMBDWord:␊ |
685 | ␉␉//case kSMBQWord:␊ |
686 | ␉␉␉if (SMBSetters[idx].keyString)␊ |
687 | ␉␉␉{␊ |
688 | ␉␉␉␉parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);␊ |
689 | ␉␉␉␉if (!parsed)␊ |
690 | ␉␉␉␉{␊ |
691 | ␉␉␉␉␉if (structPtr->orig->type == kSMBTypeMemoryDevice)␉// MemoryDevice only␊ |
692 | ␉␉␉␉␉{␊ |
693 | ␉␉␉␉␉␉parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val);␊ |
694 | ␉␉␉␉␉}␊ |
695 | ␉␉␉␉}␊ |
696 | ␉␉␉␉if (parsed)␊ |
697 | ␉␉␉␉{␊ |
698 | ␉␉␉␉␉switch (SMBSetters[idx].valueType)␊ |
699 | ␉␉␉␉␉{␊ |
700 | ␉␉␉␉␉␉case kSMBByte:␊ |
701 | ␉␉␉␉␉␉␉value->byte = (uint8_t)val;␊ |
702 | ␉␉␉␉␉␉␉break;␊ |
703 | ␉␉␉␉␉␉case kSMBWord:␊ |
704 | ␉␉␉␉␉␉␉value->word = (uint16_t)val;␊ |
705 | ␉␉␉␉␉␉␉break;␊ |
706 | ␉␉␉␉␉␉case kSMBDWord:␊ |
707 | ␉␉␉␉␉␉default:␊ |
708 | ␉␉␉␉␉␉␉value->dword = (uint32_t)val;␊ |
709 | ␉␉␉␉␉␉␉break;␊ |
710 | ␉␉␉␉␉}␊ |
711 | ␉␉␉␉␉return true;␊ |
712 | ␉␉␉␉}␊ |
713 | ␉␉␉}␊ |
714 | ␊ |
715 | ␉␉␉if (SMBSetters[idx].getSMBValue)␊ |
716 | ␉␉␉{␊ |
717 | ␉␉␉␉if (SMBSetters[idx].getSMBValue(value))␊ |
718 | ␉␉␉␉{␊ |
719 | ␉␉␉␉␉return true;␊ |
720 | ␉␉␉␉}␊ |
721 | ␉␉␉}␊ |
722 | #if 0␊ |
723 | ␉␉␉if (*(SMBSetters[idx].defaultValue))␊ |
724 | ␉␉␉{␊ |
725 | ␉␉␉␉value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);␊ |
726 | ␉␉␉␉return true;␊ |
727 | ␉␉␉}␊ |
728 | #endif␊ |
729 | ␉␉␉break;␊ |
730 | ␉}␊ |
731 | ␊ |
732 | ␉if (SMBSetters[idx].valueType == kSMBString && string)␊ |
733 | ␉{␊ |
734 | ␉␉setSMBStringForField(structPtr->new, string, &value->byte);␊ |
735 | ␉}␊ |
736 | ␉return true;␊ |
737 | }␊ |
738 | ␊ |
739 | //-------------------------------------------------------------------------------------------------------------------------␊ |
740 | // Apple Specific␊ |
741 | //-------------------------------------------------------------------------------------------------------------------------␊ |
742 | void addSMBFirmwareVolume(SMBStructPtrs *structPtr)␊ |
743 | {␊ |
744 | ␉return;␊ |
745 | }␊ |
746 | ␊ |
747 | void addSMBMemorySPD(SMBStructPtrs *structPtr)␊ |
748 | {␊ |
749 | ␉/* SPD data from Platform.RAM.spd */␊ |
750 | ␉return;␊ |
751 | }␊ |
752 | ␊ |
753 | void addSMBOemProcessorType(SMBStructPtrs *structPtr)␊ |
754 | {␊ |
755 | ␉SMBOemProcessorType *p = (SMBOemProcessorType *)structPtr->new;␊ |
756 | ␊ |
757 | ␉p->header.type␉␉= kSMBTypeOemProcessorType;␊ |
758 | ␉p->header.length␉= sizeof(SMBOemProcessorType);␊ |
759 | ␉p->header.handle␉= handle++;␊ |
760 | ␊ |
761 | ␉setSMBValue(structPtr, numOfSetters - 2 , (returnType *)&(p->ProcessorType));␊ |
762 | ␊ |
763 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorType) + 2);␊ |
764 | ␉tableLength += sizeof(SMBOemProcessorType) + 2;␊ |
765 | ␉structureCount++;␊ |
766 | }␊ |
767 | ␊ |
768 | void addSMBOemProcessorBusSpeed(SMBStructPtrs *structPtr)␊ |
769 | {␊ |
770 | ␉SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new;␊ |
771 | ␊ |
772 | ␉switch (Platform.CPU.Family) ␊ |
773 | ␉{␊ |
774 | ␉␉case 0x06:␊ |
775 | ␉␉{␊ |
776 | ␉␉␉switch (Platform.CPU.Model)␊ |
777 | ␉␉␉{␊ |
778 | ␉␉␉␉case CPU_MODEL_FIELDS:␉␉// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)␊ |
779 | ␉␉␉␉case CPU_MODEL_DALES:␊ |
780 | ␉␉␉␉case CPU_MODEL_CLARKDALE:␉// Intel Core i3, i5 LGA1156 (32nm)␊ |
781 | ␉␉␉␉case CPU_MODEL_NEHALEM:␉␉// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)␊ |
782 | ␉␉␉␉case CPU_MODEL_NEHALEM_EX:␉// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x␊ |
783 | ␉␉␉␉case CPU_MODEL_WESTMERE:␉// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core␊ |
784 | ␉␉␉␉case CPU_MODEL_WESTMERE_EX:␉// Intel Xeon E7␊ |
785 | ␉␉␉␉case CPU_MODEL_SANDYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (32nm)␊ |
786 | ␉␉␉␉case CPU_MODEL_IVYBRIDGE:␉// Intel Core i3, i5, i7 LGA1155 (22nm)␊ |
787 | ␉␉␉␉case CPU_MODEL_IVYBRIDGE_E5:␊ |
788 | ␉␉␉␉case CPU_MODEL_JAKETOWN:␉// Intel Core i7, Xeon E5 LGA2011 (32nm)␊ |
789 | ␉␉␉␉␉break;␊ |
790 | ␊ |
791 | ␉␉␉␉default:␊ |
792 | ␉␉␉␉␉return;␊ |
793 | ␉␉␉}␊ |
794 | ␉␉}␊ |
795 | ␉}␊ |
796 | ␊ |
797 | ␉p->header.type␉␉= kSMBTypeOemProcessorBusSpeed;␊ |
798 | ␉p->header.length␉= sizeof(SMBOemProcessorBusSpeed);␊ |
799 | ␉p->header.handle␉= handle++;␊ |
800 | ␊ |
801 | ␉setSMBValue(structPtr, numOfSetters -1, (returnType *)&(p->ProcessorBusSpeed));␊ |
802 | ␊ |
803 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemProcessorBusSpeed) + 2);␊ |
804 | ␉tableLength += sizeof(SMBOemProcessorBusSpeed) + 2;␊ |
805 | ␉structureCount++;␊ |
806 | }␊ |
807 | ␊ |
808 | //-------------------------------------------------------------------------------------------------------------------------␊ |
809 | // EndOfTable␊ |
810 | //-------------------------------------------------------------------------------------------------------------------------␊ |
811 | void addSMBEndOfTable(SMBStructPtrs *structPtr)␊ |
812 | {␊ |
813 | ␉structPtr->new->type␉= kSMBTypeEndOfTable;␊ |
814 | ␉structPtr->new->length␉= sizeof(SMBStructHeader);␊ |
815 | ␉structPtr->new->handle␉= handle++;␊ |
816 | ␊ |
817 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBStructHeader) + 2);␊ |
818 | ␉tableLength += sizeof(SMBStructHeader) + 2;␊ |
819 | ␉structureCount++;␊ |
820 | }␊ |
821 | ␊ |
822 | void setSMBStruct(SMBStructPtrs *structPtr)␊ |
823 | {␊ |
824 | ␉bool setterFound = false;␊ |
825 | ␊ |
826 | ␉uint8_t *ptr;␊ |
827 | ␉SMBWord structSize;␊ |
828 | ␉int i;␊ |
829 | ␊ |
830 | ␉stringIndex = 1;␊ |
831 | ␉stringsSize = 0;␊ |
832 | ␊ |
833 | ␉if (handle < structPtr->orig->handle)␊ |
834 | ␉{␊ |
835 | ␉␉handle = structPtr->orig->handle;␊ |
836 | ␉}␊ |
837 | ␊ |
838 | ␉memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);␊ |
839 | ␊ |
840 | ␉for (i = 0; i < numOfSetters; i++)␊ |
841 | ␉{␊ |
842 | ␉␉if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length))␊ |
843 | ␉␉{␊ |
844 | ␉␉␉setterFound = true;␊ |
845 | ␉␉␉setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));␊ |
846 | ␉␉}␊ |
847 | ␉}␊ |
848 | ␊ |
849 | ␉if (setterFound)␊ |
850 | ␉{␊ |
851 | ␉␉ptr = (uint8_t *)structPtr->new + structPtr->orig->length;␊ |
852 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
853 | ␊ |
854 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
855 | ␉␉{␊ |
856 | ␉␉␉ptr += 2;␊ |
857 | ␉␉}␊ |
858 | ␉␉structSize = ptr - (uint8_t *)structPtr->new;␊ |
859 | ␉}␊ |
860 | ␉else␊ |
861 | ␉{␊ |
862 | ␉␉ptr = (uint8_t *)structPtr->orig + structPtr->orig->length;␊ |
863 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
864 | ␊ |
865 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
866 | ␉␉{␊ |
867 | ␉␉␉ptr += 2;␊ |
868 | ␉␉}␊ |
869 | ␊ |
870 | ␉␉structSize = ptr - (uint8_t *)structPtr->orig;␊ |
871 | ␉␉memcpy((void *)structPtr->new, structPtr->orig, structSize);␊ |
872 | ␉}␊ |
873 | ␊ |
874 | ␉structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + structSize);␊ |
875 | ␊ |
876 | ␉tableLength += structSize;␊ |
877 | ␊ |
878 | ␉if (structSize > maxStructSize)␊ |
879 | ␉{␊ |
880 | ␉␉maxStructSize = structSize;␊ |
881 | ␉}␊ |
882 | ␊ |
883 | ␉structureCount++;␊ |
884 | }␊ |
885 | ␊ |
886 | void setupNewSMBIOSTable(SMBEntryPoint *eps, SMBStructPtrs *structPtr)␊ |
887 | {␊ |
888 | ␉uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;␊ |
889 | ␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
890 | ␊ |
891 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structPtr->orig + sizeof(SMBStructHeader)));)␊ |
892 | ␉{␊ |
893 | ␉␉switch (structPtr->orig->type)␊ |
894 | ␉␉{␊ |
895 | ␉␉␉/* Skip all Apple Specific Structures */␊ |
896 | ␉␉␉case kSMBTypeFirmwareVolume:␊ |
897 | ␉␉␉case kSMBTypeMemorySPD:␊ |
898 | ␉␉␉case kSMBTypeOemProcessorType:␊ |
899 | ␉␉␉case kSMBTypeOemProcessorBusSpeed:␊ |
900 | ␉␉␉␉/* And this one too, to be added at the end */␊ |
901 | ␉␉␉case kSMBTypeEndOfTable:␊ |
902 | ␉␉␉␉break;␊ |
903 | ␊ |
904 | ␉␉␉default:␊ |
905 | ␉␉␉␉/* Add */␊ |
906 | ␉␉␉␉setSMBStruct(structPtr);␊ |
907 | ␉␉␉␉break;␊ |
908 | ␉␉}␊ |
909 | ␊ |
910 | ␉␉ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length);␊ |
911 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
912 | ␊ |
913 | ␉␉if (((uint16_t *)ptr)[0] == 0)␊ |
914 | ␉␉{␊ |
915 | ␉␉␉ptr += 2;␊ |
916 | ␉␉}␊ |
917 | ␊ |
918 | ␉␉structPtr->orig = (SMBStructHeader *)ptr;␊ |
919 | ␉}␊ |
920 | ␊ |
921 | ␉addSMBFirmwareVolume(structPtr);␊ |
922 | ␉addSMBMemorySPD(structPtr);␊ |
923 | ␉addSMBOemProcessorType(structPtr);␊ |
924 | ␉addSMBOemProcessorBusSpeed(structPtr);␊ |
925 | ␊ |
926 | ␉addSMBEndOfTable(structPtr);␊ |
927 | }␊ |
928 | ␊ |
929 | void setupSMBIOSTable(void)␊ |
930 | {␊ |
931 | ␉SMBStructPtrs *structPtr;␊ |
932 | ␉uint8_t *buffer;␊ |
933 | ␉bool setSMB = true;␊ |
934 | ␊ |
935 | ␉if (!origeps)␊ |
936 | ␉{␊ |
937 | ␉␉return;␊ |
938 | ␉}␊ |
939 | ␊ |
940 | ␉neweps = origeps;␊ |
941 | ␊ |
942 | ␉structPtr = (SMBStructPtrs *)malloc(sizeof(SMBStructPtrs));␊ |
943 | ␉if (!structPtr)␊ |
944 | ␉{␊ |
945 | ␉␉return;␊ |
946 | ␉}␊ |
947 | ␉␊ |
948 | ␉buffer = malloc(SMB_ALLOC_SIZE);␊ |
949 | ␉if (!buffer)␊ |
950 | ␉{␊ |
951 | ␉␉return;␊ |
952 | ␉}␊ |
953 | ␊ |
954 | ␉bzero(buffer, SMB_ALLOC_SIZE);␊ |
955 | ␉structPtr->new = (SMBStructHeader *)buffer;␊ |
956 | ␊ |
957 | ␉getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig);␊ |
958 | ␉if (setSMB)␊ |
959 | ␉{␊ |
960 | ␉␉setDefaultSMBData();␊ |
961 | ␉}␊ |
962 | ␊ |
963 | ␉setupNewSMBIOSTable(origeps, structPtr);␊ |
964 | ␊ |
965 | ␉neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));␊ |
966 | ␉if (!neweps)␊ |
967 | ␉{␊ |
968 | ␉␉return;␊ |
969 | ␉}␊ |
970 | ␉bzero(neweps, sizeof(SMBEntryPoint));␊ |
971 | ␊ |
972 | ␉neweps->anchor[0]␉␉␉= '_';␊ |
973 | ␉neweps->anchor[1]␉␉␉= 'S';␊ |
974 | ␉neweps->anchor[2]␉␉␉= 'M';␊ |
975 | ␉neweps->anchor[3]␉␉␉= '_';␊ |
976 | ␉neweps->entryPointLength␉= sizeof(SMBEntryPoint);␊ |
977 | ␉neweps->majorVersion␉␉= 2;␊ |
978 | ␉neweps->minorVersion␉␉= 4;␊ |
979 | ␉neweps->maxStructureSize␉= maxStructSize;␊ |
980 | ␉neweps->entryPointRevision␉= 0;␊ |
981 | ␊ |
982 | ␉neweps->dmi.anchor[0]␉␉= '_';␊ |
983 | ␉neweps->dmi.anchor[1]␉␉= 'D';␊ |
984 | ␉neweps->dmi.anchor[2]␉␉= 'M';␊ |
985 | ␉neweps->dmi.anchor[3]␉␉= 'I';␊ |
986 | ␉neweps->dmi.anchor[4]␉␉= '_';␊ |
987 | ␉neweps->dmi.tableLength␉␉= tableLength;␊ |
988 | ␉neweps->dmi.tableAddress␉= AllocateKernelMemory(tableLength);␊ |
989 | ␉neweps->dmi.structureCount␉= structureCount;␊ |
990 | ␉neweps->dmi.bcdRevision␉␉= 0x24;␊ |
991 | ␊ |
992 | ␉if (!neweps->dmi.tableAddress)␊ |
993 | ␉{␊ |
994 | ␉␉return;␊ |
995 | ␉}␊ |
996 | ␊ |
997 | ␉memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);␊ |
998 | ␊ |
999 | ␉neweps->dmi.checksum␉␉= 0;␊ |
1000 | ␉neweps->dmi.checksum␉␉= 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint));␊ |
1001 | ␊ |
1002 | ␉neweps->checksum␉␉␉= 0;␊ |
1003 | ␉neweps->checksum␉␉␉= 0x100 - checksum8(neweps, sizeof(SMBEntryPoint));␊ |
1004 | ␊ |
1005 | ␉free(buffer);␊ |
1006 | ␉decodeSMBIOSTable(neweps);␊ |
1007 | }␊ |
1008 | ␊ |
1009 | void *getSmbios(int which)␊ |
1010 | {␊ |
1011 | ␉switch (which)␊ |
1012 | ␉{␊ |
1013 | ␉␉case SMBIOS_ORIGINAL:␊ |
1014 | ␉␉␉if (!origeps)␊ |
1015 | ␉␉␉{␊ |
1016 | ␉␉␉␉origeps = getAddressOfSmbiosTable();␊ |
1017 | ␉␉␉}␊ |
1018 | ␉␉␉return origeps;␊ |
1019 | ␉␉case SMBIOS_PATCHED:␊ |
1020 | ␉␉␉return neweps;␊ |
1021 | ␉}␊ |
1022 | ␊ |
1023 | ␉return 0;␊ |
1024 | }␊ |
1025 | ␊ |
1026 | /* Collect any information needed later */␊ |
1027 | void readSMBIOSInfo(SMBEntryPoint *eps)␊ |
1028 | {␊ |
1029 | ␉uint8_t *structPtr = (uint8_t *)eps->dmi.tableAddress;␊ |
1030 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;␊ |
1031 | ␊ |
1032 | ␉int dimmnbr = 0;␊ |
1033 | ␉Platform.DMI.MaxMemorySlots␉= 0;␊ |
1034 | ␉Platform.DMI.CntMemorySlots␉= 0;␊ |
1035 | ␉Platform.DMI.MemoryModules␉= 0;␊ |
1036 | ␊ |
1037 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)␊ |
1038 | ␉{␊ |
1039 | ␉␉switch (structHeader->type)␊ |
1040 | ␉␉{␊ |
1041 | ␉␉␉case kSMBTypeSystemInformation:␊ |
1042 | ␉␉␉␉Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid;␊ |
1043 | ␉␉␉␉break;␊ |
1044 | ␊ |
1045 | ␉␉␉case kSMBTypePhysicalMemoryArray:␊ |
1046 | ␉␉␉␉Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices;␊ |
1047 | ␉␉␉␉break;␊ |
1048 | ␊ |
1049 | ␉␉␉case kSMBTypeMemoryDevice:␊ |
1050 | ␉␉␉␉Platform.DMI.CntMemorySlots++;␊ |
1051 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySize != 0)␊ |
1052 | ␉␉␉␉{␊ |
1053 | ␉␉␉␉␉Platform.DMI.MemoryModules++;␊ |
1054 | ␉␉␉␉}␊ |
1055 | ␉␉␉␉if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)␊ |
1056 | ␉␉␉␉{␊ |
1057 | ␉␉␉␉␉Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed;␊ |
1058 | ␉␉␉␉}␊ |
1059 | ␉␉␉␉dimmnbr++;␊ |
1060 | ␉␉␉␉break;␊ |
1061 | ␉␉}␊ |
1062 | ␊ |
1063 | ␉␉structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
1064 | ␉␉for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);␊ |
1065 | ␊ |
1066 | ␉␉if (((uint16_t *)structPtr)[0] == 0)␊ |
1067 | ␉␉{␊ |
1068 | ␉␉␉structPtr += 2;␊ |
1069 | ␉␉}␊ |
1070 | ␊ |
1071 | ␉␉structHeader = (SMBStructHeader *)structPtr;␊ |
1072 | ␉}␊ |
1073 | }␊ |
1074 | |