Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/smbios_decode.c

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

Archive Download this file

Revision: 2858