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