1 | /*␊ |
2 | * A very simple SMBIOS Table decoder, part of the Chameleon Boot Loader Project␊ |
3 | *␊ |
4 | * Copyright 2010 by Islam M. Ahmed Zaid. All rights reserved.␊ |
5 | *␊ |
6 | */␊ |
7 | ␊ |
8 | #include "libsaio.h"␊ |
9 | #include "smbios.h"␊ |
10 | // Bungo:␊ |
11 | #include "boot.h"␊ |
12 | #include "bootstruct.h"␊ |
13 | ␊ |
14 | #ifndef DEBUG_SMBIOS␊ |
15 | #define DEBUG_SMBIOS 0␊ |
16 | #endif␊ |
17 | ␊ |
18 | #if DEBUG_SMBIOS␊ |
19 | #define DBG(x...)␉printf(x)␊ |
20 | #else␊ |
21 | #define DBG(x...)␉msglog(x)␊ |
22 | #endif␊ |
23 | ␊ |
24 | extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field);␊ |
25 | ␊ |
26 | // Bungo:␊ |
27 | #define NotSpecifiedStr "Not Specified" // no string␊ |
28 | #define out_of_spec "<OUT OF SPEC>" // value out of smbios spec. range␊ |
29 | #define PrivateStr "** PRIVATE **" // masking private data␊ |
30 | #define neverMask false␊ |
31 | ␊ |
32 | static bool privateData = true;␊ |
33 | static SMBByte minorVersion; // SMBIOS rev. minor␊ |
34 | static SMBByte majorVersion; // SMBIOS rev. major␊ |
35 | static SMBByte bcdRevisionLo; // DMI rev. minor␊ |
36 | static SMBByte bcdRevisionHi; // DMI rev. major␊ |
37 | ␊ |
38 | /*====␊ |
39 | 7.2.2␊ |
40 | ===*/␊ |
41 | static const char *SMBWakeUpTypes[] = // Bungo: strings for wake-up type (Table Type 1 - System Information)␊ |
42 | {␊ |
43 | ␉"Reserved", /* 00h */␊ |
44 | ␉"Other", /* 01h */␊ |
45 | ␉"Unknown", /* 02h */␊ |
46 | ␉"APM Timer", /* 03h */␊ |
47 | ␉"Modem Ring", /* 04h */␊ |
48 | ␉"LAN Remote", /* 05h */␊ |
49 | ␉"Power Switch", /* 06h */␊ |
50 | ␉"PCI PME#", /* 07h */␊ |
51 | ␉"AC Power Restored" /* 08h */␊ |
52 | };␊ |
53 | ␊ |
54 | /*====␊ |
55 | 7.3.2␊ |
56 | ===*/␊ |
57 | static const char *SMBBaseBoardTypes[] = // Bungo: strings for base board type (Table Type 2 - Base Board Information)␊ |
58 | {␊ |
59 | ␉"Unknown", /* 01h */␊ |
60 | ␉"Other", /* 02h */␊ |
61 | ␉"Server Blade", /* 03h */␊ |
62 | ␉"Connectivity Switch", /* 04h */␊ |
63 | ␉"System Management Module", /* 05h */␊ |
64 | ␉"Processor Module", /* 06h */␊ |
65 | ␉"I/O Module", /* 07h */␊ |
66 | ␉"Memory Module", /* 08h */␊ |
67 | ␉"Daughter Board", /* 09h */␊ |
68 | ␉"Motherboard", /* 0Ah */␊ |
69 | ␉"Processor+Memory Module", /* 0Bh */␊ |
70 | ␉"Processor+I/O Module", /* 0Ch */␊ |
71 | ␉"Interconnect Board" /* 0Dh */␊ |
72 | };␊ |
73 | ␊ |
74 | /*===␊ |
75 | 7.4.1␊ |
76 | ===*/␊ |
77 | static const char *SMBChassisTypes[] = // Bungo: strings for chassis type (Table Type 3 - Chassis Information)␊ |
78 | {␊ |
79 | ␉"Other", /* 01h */␊ |
80 | ␉"Unknown", /* 02h */␊ |
81 | ␉"Desktop", /* 03h */␊ |
82 | ␉"Low Profile Desktop", /* 04h */␊ |
83 | ␉"Pizza Box", /* 05h */␊ |
84 | ␉"Mini Tower", /* 06h */␊ |
85 | ␉"Tower", /* 07h */␊ |
86 | ␉"Portable", /* 08h */␊ |
87 | ␉"Laptop", /* 09h */␊ |
88 | ␉"Notebook", /* 0Ah */␊ |
89 | ␉"Hand Held", /* 0Bh */␊ |
90 | ␉"Docking Station", /* 0Ch */␊ |
91 | ␉"All in One", /* 0Dh */␊ |
92 | ␉"Sub Notebook", /* 0Eh */␊ |
93 | ␉"Space-saving", /* 0Fh */␊ |
94 | ␉"Lunch Box",␉␉/* 10h */␊ |
95 | ␉"Main Server Chassis",␉/* 11h */␊ |
96 | ␉"Expansion Chassis",␉/* 12h */␊ |
97 | ␉"SubChassis",␉␉/* 13h */␊ |
98 | ␉"Bus Expansion Chassis",/* 14h */␊ |
99 | ␉"Peripheral Chassis",␉/* 15h */␊ |
100 | ␉"RAID Chassis",␉␉/* 16h */␊ |
101 | ␉"Rack Mount Chassis", /* 17h */␊ |
102 | ␉"Sealed-case PC",␉/* 18h */␊ |
103 | ␉"Multi-system Chassis", /* 19h */␊ |
104 | ␉"Compact PCI",␉␉/* 1Ah */␊ |
105 | ␉"Advanced TCA",␉␉/* 1Bh */␊ |
106 | ␉"Blade",␉␉/* 1Ch */ // An SMBIOS implementation for a Blade would contain a Type 3 Chassis structure␊ |
107 | ␉"Blade Enclosing"␉/* 1Dh */ // A Blade Enclosure is a specialized chassis that contains a set of Blades.␊ |
108 | };␊ |
109 | ␊ |
110 | /*====␊ |
111 | 7.5.1␊ |
112 | ===*/␊ |
113 | static const char *SMBProcessorTypes[] = // Bungo: strings for processor type (Table Type 4 - Processor Information)␊ |
114 | {␊ |
115 | ␉"Other", /* 01h */␊ |
116 | ␉"Unknown", /* 02h */␊ |
117 | ␉"Central Processor", /* 03h */␊ |
118 | ␉"Math Processor", /* 04h */␊ |
119 | ␉"DSP Processor", /* 05h */␊ |
120 | ␉"Video Processor" /* 06h */␊ |
121 | };␊ |
122 | ␊ |
123 | /*====␊ |
124 | 7.5.5␊ |
125 | ===*/␊ |
126 | static const char *SMBProcessorUpgrades[] = // ErmaC: strings for processor upgrade (Table Type 4 - Processor Information)␊ |
127 | {␊ |
128 | ␉"Other", // 01h␊ |
129 | ␉"Unknown",␊ |
130 | ␉"Daughter Board",␊ |
131 | ␉"ZIF Socket",␊ |
132 | ␉"Replaceable Piggy Back",␊ |
133 | ␉"None",␊ |
134 | ␉"LIF Socket",␊ |
135 | ␉"Slot 1",␊ |
136 | ␉"Slot 2",␊ |
137 | ␉"370-pin Socket",␊ |
138 | ␉"Slot A",␊ |
139 | ␉"Slot M",␊ |
140 | ␉"Socket 423",␊ |
141 | ␉"Socket A (Socket 462)",␊ |
142 | ␉"Socket 478",␊ |
143 | ␉"Socket 754",␊ |
144 | ␉"Socket 940",␊ |
145 | ␉"Socket 939",␊ |
146 | ␉"Socket mPGA604",␊ |
147 | ␉"Socket LGA771",␊ |
148 | ␉"Socket LGA775",␊ |
149 | ␉"Socket S1",␊ |
150 | ␉"Socket AM2",␊ |
151 | ␉"Socket F (1207)",␊ |
152 | ␉"Socket LGA1366",␊ |
153 | ␉"Socket G34",␊ |
154 | ␉"Socket AM3",␊ |
155 | ␉"Socket C32",␊ |
156 | ␉"Socket LGA1156",␊ |
157 | ␉"Socket LGA1567",␊ |
158 | ␉"Socket PGA988A",␊ |
159 | ␉"Socket BGA1288",␊ |
160 | ␉"Socket rPGA988B",␊ |
161 | ␉"Socket BGA1023",␊ |
162 | ␉"Socket BGA1224",␊ |
163 | ␉"Socket BGA1155",␊ |
164 | ␉"Socket LGA1356",␊ |
165 | ␉"Socket LGA2011",␊ |
166 | ␉"Socket FS1",␊ |
167 | ␉"Socket FS2",␊ |
168 | ␉"Socket FM1",␊ |
169 | ␉"Socket FM2",␊ |
170 | ␉"Socket LGA2011-3",␊ |
171 | ␉"Socket LGA1356-3"␉// 2Ch␊ |
172 | };␊ |
173 | ␊ |
174 | /*=====␊ |
175 | 7.18.2␊ |
176 | ====*/␊ |
177 | static const char *␊ |
178 | SMBMemoryDeviceTypes[] =␊ |
179 | {␊ |
180 | ␉"RAM", /* 00h Undefined */␊ |
181 | ␉"RAM", /* 01h Other */␊ |
182 | ␉"RAM", /* 02h Unknown */␊ |
183 | ␉"DRAM", /* 03h DRAM */␊ |
184 | ␉"EDRAM", /* 04h EDRAM */␊ |
185 | ␉"VRAM", /* 05h VRAM */␊ |
186 | ␉"SRAM", /* 06h SRAM */␊ |
187 | ␉"RAM", /* 07h RAM */␊ |
188 | ␉"ROM", /* 08h ROM */␊ |
189 | ␉"FLASH", /* 09h FLASH */␊ |
190 | ␉"EEPROM", /* 0Ah EEPROM */␊ |
191 | ␉"FEPROM", /* 0Bh FEPROM */␊ |
192 | ␉"EPROM", /* 0Ch EPROM */␊ |
193 | ␉"CDRAM", /* 0Dh CDRAM */␊ |
194 | ␉"3DRAM", /* 0Eh 3DRAM */␊ |
195 | ␉"SDRAM", /* 0Fh SDRAM */␊ |
196 | ␉"SGRAM", /* 10h SGRAM */␊ |
197 | ␉"RDRAM", /* 11h RDRAM */␊ |
198 | ␉"DDR SDRAM", /* 12h DDR */␊ |
199 | ␉"DDR2 SDRAM", /* 13h DDR2 */␊ |
200 | ␉"DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */␊ |
201 | ␉"RAM",␉␉/* 15h unused */␊ |
202 | ␉"RAM",␉␉/* 16h unused */␊ |
203 | ␉"RAM",␉␉/* 17h unused */␊ |
204 | ␉"DDR3",␉␉/* 18h DDR3, chosen in [5776134] */␊ |
205 | ␉"FBD2"␉␉/* 19h FBD2 */␊ |
206 | };␊ |
207 | ␊ |
208 | static const int kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) /␊ |
209 | sizeof(SMBMemoryDeviceTypes[0]);␊ |
210 | ␊ |
211 | // Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode displays␊ |
212 | char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask)␊ |
213 | {␊ |
214 | ␉char *str = NULL;␊ |
215 | ␉str = getSMBStringForField(structHeader, field);␊ |
216 | ␉if (!field) {␊ |
217 | ␉␉str = NotSpecifiedStr;␊ |
218 | ␉}␊ |
219 | ␉else if (mask) {␊ |
220 | ␉␉str = PrivateStr;␊ |
221 | ␉}␊ |
222 | ␊ |
223 | ␉return str;␊ |
224 | };␊ |
225 | ␊ |
226 | void printHeader(SMBStructHeader *structHeader)␊ |
227 | {␊ |
228 | DBG("Handle: 0x%04x, DMI type: %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length);␊ |
229 | }␊ |
230 | ␊ |
231 | //-------------------------------------------------------------------------------------------------------------------------␊ |
232 | // BIOS Information (Type 0)␊ |
233 | //-------------------------------------------------------------------------------------------------------------------------␊ |
234 | void decodeBIOSInformation(SMBStructHeader *structHeader)␊ |
235 | {␊ |
236 | ␉printHeader(structHeader);␊ |
237 | ␉DBG("BIOS Information\n");␊ |
238 | ␉DBG("\tVendor: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->vendor, neverMask));␊ |
239 | ␉DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->version, neverMask));␊ |
240 | ␉DBG("\tRelease Date: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->releaseDate, neverMask));␊ |
241 | // Address:␊ |
242 | // Runtime Size:␊ |
243 | // ROM Size:␊ |
244 | // DBG("\tSupported BIOS functions: (0x%llX) %s\n", ((SMBBIOSInformation *)structHeader)->characteristics, SMBBIOSInfoChar0[((SMBBIOSInformation *)structHeader)->characteristics]);␊ |
245 | ␉DBG("\tBIOS Revision: %d.%d\n", ((SMBBIOSInformation *)structHeader)->releaseMajor, ((SMBBIOSInformation *)structHeader)->releaseMinor);␊ |
246 | // Firmware Major Release␊ |
247 | // Firmware Minor Release␊ |
248 | // SMBByte characteristicsExt1;␊ |
249 | // SMBByte characteristicsExt2;␊ |
250 | ␉DBG("\n");␊ |
251 | }␊ |
252 | ␊ |
253 | //-------------------------------------------------------------------------------------------------------------------------␊ |
254 | // System Information (Type 1)␊ |
255 | //-------------------------------------------------------------------------------------------------------------------------␊ |
256 | void decodeSystemInformation(SMBStructHeader *structHeader)␊ |
257 | {␊ |
258 | ␉printHeader(structHeader);␊ |
259 | ␉DBG("System Information\n");␊ |
260 | ␉DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->manufacturer, neverMask));␊ |
261 | ␉DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->productName, neverMask));␊ |
262 | ␉DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->version, neverMask));␊ |
263 | ␉DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->serialNumber, privateData));␊ |
264 | ␉uint8_t *uuid = ((SMBSystemInformation *)structHeader)->uuid;␊ |
265 | ␉if (privateData) {␊ |
266 | ␉␉DBG("\tUUID: %s\n", PrivateStr);␊ |
267 | ␉} else {␊ |
268 | ␉␉DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n",␊ |
269 | ␉␉␉uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],␊ |
270 | ␉␉␉uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);␊ |
271 | ␉}␊ |
272 | ␉if (((SMBSystemInformation *)structHeader)->wakeupReason > 8) {␊ |
273 | ␉␉DBG("\tWake-up Type: %s\n", out_of_spec);␊ |
274 | ␉} else {␊ |
275 | ␉␉DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[((SMBSystemInformation *)structHeader)->wakeupReason]);␊ |
276 | ␉}␊ |
277 | ␉DBG("\tSKU Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->skuNumber, neverMask)); // System SKU#␊ |
278 | ␉DBG("\tFamily: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->family, neverMask));␊ |
279 | ␉DBG("\n");␊ |
280 | }␊ |
281 | ␊ |
282 | //-------------------------------------------------------------------------------------------------------------------------␊ |
283 | // Base Board (or Module) Information (Type 2)␊ |
284 | //-------------------------------------------------------------------------------------------------------------------------␊ |
285 | void decodeBaseBoard(SMBStructHeader *structHeader)␊ |
286 | {␊ |
287 | ␉printHeader(structHeader);␊ |
288 | ␉DBG("Base Board Information\n");␊ |
289 | ␉DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->manufacturer, neverMask));␊ |
290 | ␉DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->product, neverMask));␊ |
291 | ␉DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->version, neverMask));␊ |
292 | ␉DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->serialNumber, privateData));␊ |
293 | ␉DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->assetTag, neverMask));␊ |
294 | // Feature Flags (BYTE)␊ |
295 | ␉DBG("\tLocation In Chassis: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->locationInChassis, neverMask)); // Part Component␊ |
296 | // Chassis Handle (WORD)␊ |
297 | ␉if ((((SMBBaseBoard *)structHeader)->boardType < kSMBBaseBoardUnknown) || (((SMBBaseBoard *)structHeader)->boardType > kSMBBaseBoardInterconnect)) {␊ |
298 | ␉␉DBG("\tType: %s\n", out_of_spec);␊ |
299 | ␉} else {␊ |
300 | ␉␉DBG("\tType: %s\n", SMBBaseBoardTypes[(((SMBBaseBoard *)structHeader)->boardType - 1)]);␊ |
301 | ␉}␊ |
302 | // Number of Contained Object Handles (n) (BYTE)␊ |
303 | // Contained Object Handles n(WORDs)␊ |
304 | ␉DBG("\n");␊ |
305 | }␊ |
306 | ␊ |
307 | //-------------------------------------------------------------------------------------------------------------------------␊ |
308 | // System Enclosure or Chassis (Type 3)␊ |
309 | //-------------------------------------------------------------------------------------------------------------------------␊ |
310 | void decodeSystemEnclosure(SMBStructHeader *structHeader)␊ |
311 | {␊ |
312 | ␉printHeader(structHeader);␊ |
313 | ␉DBG("Chassis Information\n");␊ |
314 | ␉DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->manufacturer, neverMask));␊ |
315 | ␉if ((((SMBSystemEnclosure *)structHeader)->chassisType < kSMBchassisOther) || (((SMBSystemEnclosure *)structHeader)->chassisType > kSMBchassisBladeEnclosing)) {␊ |
316 | ␉␉DBG("\tType: %s\n", out_of_spec);␊ |
317 | ␉} else {␊ |
318 | ␉␉DBG("\tType: %s\n", SMBChassisTypes[(((SMBSystemEnclosure *)structHeader)->chassisType - 1)]);␊ |
319 | ␉}␊ |
320 | // Lock:␊ |
321 | ␉DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->version, neverMask));␊ |
322 | ␉DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->serialNumber, privateData));␊ |
323 | ␉DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->assetTag, neverMask));␊ |
324 | // Boot-up State:␊ |
325 | // Power Supply State␊ |
326 | // Thermal State␊ |
327 | // Security Status:␊ |
328 | // OEM Information:␊ |
329 | // Height;␊ |
330 | // Number Of Power Cords: Cords;␊ |
331 | // Contained Elements: ElementsCount;␊ |
332 | // SKU Number:␊ |
333 | // ElementLen;␊ |
334 | // Elements[1]; // open array of ElementsCount*ElementLen BYTEs␊ |
335 | ␉DBG("\n");␊ |
336 | }␊ |
337 | ␊ |
338 | //-------------------------------------------------------------------------------------------------------------------------␊ |
339 | // Processor Information (Type 4)␊ |
340 | //-------------------------------------------------------------------------------------------------------------------------␊ |
341 | void decodeProcessorInformation(SMBStructHeader *structHeader)␊ |
342 | {␊ |
343 | ␉printHeader(structHeader);␊ |
344 | ␉DBG("Processor Information\n");␊ |
345 | ␉DBG("\tSocket Designation: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->socketDesignation, neverMask));␊ |
346 | ␉if ((((SMBProcessorInformation *)structHeader)->processorType < kSMBprocessorTypeOther) || (((SMBProcessorInformation *)structHeader)->processorType > kSMBprocessorTypeGPU)) {␊ |
347 | ␉␉DBG("\tType: %s\n", out_of_spec);␊ |
348 | ␉} else {␊ |
349 | ␉␉DBG("\tType: %s\n", SMBProcessorTypes[((SMBProcessorInformation *)structHeader)->processorType - 1]);␊ |
350 | ␉}␊ |
351 | ␉DBG("\tFamily: 0x%X\n", ((SMBProcessorInformation *)structHeader)->processorFamily);␊ |
352 | ␉DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->manufacturer, neverMask));␊ |
353 | ␉DBG("\tID: 0x%llX\n", ((SMBProcessorInformation *)structHeader)->processorID);␊ |
354 | //␉DBG("\tSignature: Type %u, Family %u, Model %u, Stepping %u\n", (eax >> 12) & 0x3, ((eax >> 20) & 0xFF) + ((eax >> 8) & 0x0F), ((eax >> 12) & 0xF0) + ((eax >> 4) & 0x0F), eax & 0xF);␊ |
355 | // Flags:␊ |
356 | ␉DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->processorVersion, neverMask));␊ |
357 | //␉DBG("\tVoltage: 0.%xV\n", ((SMBProcessorInformation *)structHeader)->voltage);␊ |
358 | ␉DBG("\tExternal Clock: %d MHz\n", ((SMBProcessorInformation *)structHeader)->externalClock);␊ |
359 | ␉DBG("\tMax Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->maximumClock);␊ |
360 | ␉DBG("\tCurrent Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->currentClock);␊ |
361 | // Status: Populated/Unpopulated␊ |
362 | ␉if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) {␊ |
363 | ␉␉DBG("\tUpgrade: %s\n", out_of_spec);␊ |
364 | ␉} else {␊ |
365 | ␉␉DBG("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]);␊ |
366 | ␉}␊ |
367 | // L1 Cache Handle:␊ |
368 | // L2 Cache Handle:␊ |
369 | // L3 Cache Handle:␊ |
370 | ␉DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->serialNumber, privateData));␊ |
371 | ␉DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->assetTag, neverMask));␊ |
372 | ␉DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->partNumber, neverMask));␊ |
373 | ␉if(((SMBProcessorInformation *)structHeader)->coreCount != 0) {␊ |
374 | ␉␉DBG("\tCore Count: %d\n", ((SMBProcessorInformation *)structHeader)->coreCount);}␊ |
375 | ␉if(((SMBProcessorInformation *)structHeader)->coreEnabled != 0) {␊ |
376 | ␉␉DBG("\tCore Enabled: %d\n", ((SMBProcessorInformation *)structHeader)->coreEnabled);}␊ |
377 | ␉if(((SMBProcessorInformation *)structHeader)->threadCount != 0) {␊ |
378 | ␉␉DBG("\tThread Count: %d\n", ((SMBProcessorInformation *)structHeader)->threadCount);␊ |
379 | ␉}␊ |
380 | // Characteristics:␊ |
381 | //␉DBG("\tProcessor Family 2: %d\n", ((SMBProcessorInformation *)structHeader)->processorFamily2);␊ |
382 | ␉DBG("\n");␊ |
383 | }␊ |
384 | ␊ |
385 | //-------------------------------------------------------------------------------------------------------------------------␊ |
386 | // Memory Module Information (Type 6)␊ |
387 | //-------------------------------------------------------------------------------------------------------------------------␊ |
388 | //void decodeMemoryModule(SMBStructHeader *structHeader)␊ |
389 | //{␊ |
390 | //␉DBG("Memory Module Information\n");␊ |
391 | //␉DBG("\tSocket Designation: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation));␊ |
392 | //␉DBG("\tBank Connections: Type: %d\n", structHeader->bankConnections);␊ |
393 | //␉DBG("\tCurrent Speed: %X\n", structHeader->currentSpeed);␊ |
394 | //␉DBG("\tType: %llX\n", structHeader->currentMemoryType);␊ |
395 | //␉DBG("\tInstalled Size: %d\n", structHeader->installedSize);␊ |
396 | //␉DBG("\tEnabled Size: %d\n", structHeader->enabledSize);␊ |
397 | //␉DBG("\tError Status: %x\n", structHeader->errorStatus);␊ |
398 | //␉DBG("\n");␊ |
399 | //}␊ |
400 | ␊ |
401 | //-------------------------------------------------------------------------------------------------------------------------␊ |
402 | // OEM Strings (Type 11)␊ |
403 | //-------------------------------------------------------------------------------------------------------------------------␊ |
404 | void decodeSMBOEMStrings(SMBStructHeader *structHeader)␊ |
405 | {␊ |
406 | ␉char *stringPtr = (char *)structHeader + structHeader->length;␊ |
407 | ␉printHeader(structHeader);␊ |
408 | ␉DBG("OEM Strings\n");␊ |
409 | ␉SMBByte i;␊ |
410 | ␉for (i = 1; i <= ((SMBOEMStrings *)structHeader)->count; i++) {␊ |
411 | ␉␉DBG("\tString %d: %s\n", i, stringPtr);␊ |
412 | ␉␉stringPtr = stringPtr + strlen(stringPtr) + 1;␊ |
413 | ␉}␊ |
414 | ␉DBG("\n");␊ |
415 | }␊ |
416 | ␊ |
417 | //-------------------------------------------------------------------------------------------------------------------------␊ |
418 | // MemoryDevice (Type 17)␊ |
419 | //-------------------------------------------------------------------------------------------------------------------------␊ |
420 | void decodeMemoryDevice(SMBStructHeader *structHeader)␊ |
421 | {␊ |
422 | ␉printHeader(structHeader);␊ |
423 | ␉DBG("Memory Device\n");␊ |
424 | // Aray Handle␊ |
425 | ␉DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle);␊ |
426 | // Total Width:␊ |
427 | // Data Width:␊ |
428 | // Size:␊ |
429 | // Form Factor:␊ |
430 | // Set:␊ |
431 | ␉DBG("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask));␊ |
432 | ␉DBG("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask));␊ |
433 | ␉if (((SMBMemoryDevice *)structHeader)->memoryType > kSMBMemoryDeviceTypeCount) {␊ |
434 | ␉␉DBG("\tMemory Type: %s\n", out_of_spec);␊ |
435 | ␉} else {␊ |
436 | ␉␉DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[((SMBMemoryDevice *)structHeader)->memoryType]);␊ |
437 | ␉}␊ |
438 | // Type Detail:␊ |
439 | ␉DBG("\tSpeed: %d MHz\n", ((SMBMemoryDevice *)structHeader)->memorySpeed);␊ |
440 | ␉DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->manufacturer, neverMask));␊ |
441 | ␉DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->serialNumber, privateData));␊ |
442 | ␉DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->assetTag, neverMask));␊ |
443 | ␉DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->partNumber, neverMask));␊ |
444 | // Rank:␊ |
445 | // Configured Clock Speed:␊ |
446 | ␉DBG("\n");␊ |
447 | }␊ |
448 | ␊ |
449 | //-------------------------------------------------------------------------------------------------------------------------␊ |
450 | // Apple Specific (Type 131)␊ |
451 | //-------------------------------------------------------------------------------------------------------------------------␊ |
452 | void decodeOemProcessorType(SMBStructHeader *structHeader)␊ |
453 | {␊ |
454 | ␉printHeader(structHeader);␊ |
455 | ␉DBG("Apple specific Processor Type\n");␊ |
456 | ␉DBG("\tCpu-type: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType);␊ |
457 | ␉DBG("\n");␊ |
458 | }␊ |
459 | ␊ |
460 | //-------------------------------------------------------------------------------------------------------------------------␊ |
461 | // Apple Specific (Type 132)␊ |
462 | //-------------------------------------------------------------------------------------------------------------------------␊ |
463 | void decodeOemProcessorBusSpeed(SMBStructHeader *structHeader)␊ |
464 | {␊ |
465 | ␉printHeader(structHeader);␊ |
466 | ␉DBG("Apple specific Processor Interconnect Speed\n");␊ |
467 | ␉DBG("\tQPI = %d MT/s\n", ((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed);␊ |
468 | ␉DBG("\n");␊ |
469 | }␊ |
470 | ␊ |
471 | // Info for the Table Above: dmi 2.7+ https://wiki.debian.org/InstallingDebianOn/Thinkpad/T42/lenny?action=AttachFile&do=get&target=dmidecode.Lenny_Thinkpad_T42_2373.txt␊ |
472 | //-------------------------------------------------------------------------------------------------------------------------␊ |
473 | // Apple Specific (Type 133)␊ |
474 | //-------------------------------------------------------------------------------------------------------------------------␊ |
475 | //void decodeOemPlatformFeature(SMBStructHeader *structHeader)␊ |
476 | //{␊ |
477 | //␉printHeader(structHeader);␊ |
478 | //␉DBG("Apple specific Platform Feature\n");␊ |
479 | //␉DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->PlatformFeature);␊ |
480 | //␉DBG("\n");␊ |
481 | //}␊ |
482 | ␊ |
483 | //-------------------------------------------------------------------------------------------------------------------------␊ |
484 | // Specific (Type 134)␊ |
485 | //-------------------------------------------------------------------------------------------------------------------------␊ |
486 | //void decodeOem(SMBStructHeader *structHeader)␊ |
487 | //{␊ |
488 | //␉printHeader(structHeader);␊ |
489 | //␉DBG("Apple specific Feature\n");␊ |
490 | //␉DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->Feature);␊ |
491 | //␉DBG("\n");␊ |
492 | //}␊ |
493 | ␊ |
494 | //-------------------------------------------------------------------------------------------------------------------------␊ |
495 | ␊ |
496 | ␊ |
497 | void decodeSMBIOSTable(SMBEntryPoint *eps)␊ |
498 | {␊ |
499 | ␉uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;␊ |
500 | ␉SMBStructHeader *structHeader = (SMBStructHeader *)ptr;␊ |
501 | ␊ |
502 | ␉minorVersion = eps->minorVersion;␊ |
503 | ␉majorVersion = eps->majorVersion;␊ |
504 | ␉bcdRevisionHi = eps->dmi.bcdRevision >> 4;␊ |
505 | ␉bcdRevisionLo = eps->dmi.bcdRevision & 0x0F;␊ |
506 | ␊ |
507 | ␉getBoolForKey(kPrivateData, &privateData, &bootInfo->chameleonConfig); // Bungo: chek if mask some data␊ |
508 | ␊ |
509 | ␉DBG("\n");␊ |
510 | ␉DBG("SMBIOS rev.: %d.%d, DMI rev.: %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo);␊ |
511 | ␉DBG("\n");␊ |
512 | ␉for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)␊ |
513 | ␉{␊ |
514 | ␉␉switch (structHeader->type)␊ |
515 | ␉␉{␊ |
516 | ␉␉␉case kSMBTypeBIOSInformation: // Type 0␊ |
517 | ␉␉␉␉decodeBIOSInformation(structHeader);␊ |
518 | ␉␉␉␉break;␊ |
519 | ␊ |
520 | ␉␉␉case kSMBTypeSystemInformation: // Type 1␊ |
521 | ␉␉␉␉decodeSystemInformation(structHeader);␊ |
522 | ␉␉␉␉break;␊ |
523 | ␊ |
524 | ␉␉␉case kSMBTypeBaseBoard: // Type 2␊ |
525 | ␉␉␉␉decodeBaseBoard(structHeader);␊ |
526 | ␉␉␉␉break;␊ |
527 | ␊ |
528 | ␉␉␉case kSMBTypeSystemEnclosure: // Type 3␊ |
529 | ␉␉␉␉decodeSystemEnclosure(structHeader);␊ |
530 | ␉␉␉␉break;␊ |
531 | ␊ |
532 | ␉␉␉case kSMBTypeProcessorInformation: // Type 4␊ |
533 | ␉␉␉␉decodeProcessorInformation(structHeader);␊ |
534 | ␉␉␉␉break;␊ |
535 | ␊ |
536 | ␉␉␉//case kSMBTypeMemoryModule: // Type 6␊ |
537 | ␉␉␉//␉decodeMemoryModule(structHeader);␊ |
538 | ␉␉␉//␉break;␊ |
539 | ␊ |
540 | ␉␉␉//case kSMBTypeSystemSlot: // Type 9␊ |
541 | ␉␉␉//␉decodeSMBTypeSystemSlot(structHeader);␊ |
542 | ␉␉␉//␉break;␊ |
543 | ␊ |
544 | ␉␉␉case kSMBOEMStrings: // Type 11␊ |
545 | ␉␉␉␉decodeSMBOEMStrings(structHeader);␊ |
546 | ␉␉␉␉break;␊ |
547 | ␊ |
548 | ␉␉␉case kSMBTypeMemoryDevice: // Type 17␊ |
549 | ␉␉␉␉decodeMemoryDevice(structHeader);␊ |
550 | ␉␉␉␉break;␊ |
551 | ␊ |
552 | ␉␉␉//kSMBTypeMemoryArrayMappedAddress: // Type 19␊ |
553 | ␉␉␉//␉break;␊ |
554 | ␊ |
555 | ␉␉␉/* Skip all Apple Specific Structures */␊ |
556 | ␉␉␉// case kSMBTypeFirmwareVolume: // Type 128␊ |
557 | ␉␉␉// case kSMBTypeMemorySPD: // Type 130␊ |
558 | ␉␉␉//␉break;␊ |
559 | ␊ |
560 | ␉␉␉case kSMBTypeOemProcessorType: // Type 131␊ |
561 | ␉␉␉␉decodeOemProcessorType(structHeader);␊ |
562 | ␉␉␉␉break;␊ |
563 | ␊ |
564 | ␉␉␉case kSMBTypeOemProcessorBusSpeed: // Type 132␊ |
565 | ␉␉␉␉decodeOemProcessorBusSpeed(structHeader);␊ |
566 | ␉␉␉␉break;␊ |
567 | ␊ |
568 | ␉␉␉//kSMBTypeOemPlatformFeature: // Type 133␊ |
569 | ␉␉␉//␉decodeOemPlatformFeature(structHeader);␊ |
570 | ␉␉␉//␉break;␊ |
571 | ␊ |
572 | ␉␉␉case kSMBTypeEndOfTable: // Type 127␊ |
573 | ␉␉␉␉DBG("Handle 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length);␊ |
574 | ␉␉␉␉DBG("End of Table\n");␊ |
575 | ␉␉␉␉break;␊ |
576 | ␊ |
577 | ␉␉␉default:␊ |
578 | ␉␉␉␉break;␊ |
579 | ␉␉}␊ |
580 | ␊ |
581 | ␉␉ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);␊ |
582 | ␉␉for (; ((uint16_t *)ptr)[0] != 0; ptr++);␊ |
583 | ␊ |
584 | ␉␉if (((uint16_t *)ptr)[0] == 0) {␊ |
585 | ␉␉␉ptr += 2;␊ |
586 | ␉␉}␊ |
587 | ␊ |
588 | ␉␉structHeader = (SMBStructHeader *)ptr;␊ |
589 | ␉}␊ |
590 | ␉DBG("\n");␊ |
591 | }␊ |
592 | ␊ |
593 | |