Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch/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 "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
24extern 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
32static bool privateData = true;
33static SMBByte minorVersion; // SMBIOS rev. minor
34static SMBByte majorVersion; // SMBIOS rev. major
35static SMBByte bcdRevisionLo; // DMI rev. minor
36static SMBByte bcdRevisionHi; // DMI rev. major
37
38/*====
39 7.2.2
40 ===*/
41static 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 ===*/
57static 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 ===*/
77static 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 ===*/
113static 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 ===*/
126static 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 ====*/
177static const char *
178SMBMemoryDeviceTypes[] =
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
208static 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
212char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask)
213{
214char *str = NULL;
215str = getSMBStringForField(structHeader, field);
216if (!field) {
217str = NotSpecifiedStr;
218}
219else if (mask) {
220str = PrivateStr;
221}
222
223return str;
224};
225
226void 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//-------------------------------------------------------------------------------------------------------------------------
234void decodeBIOSInformation(SMBStructHeader *structHeader)
235{
236printHeader(structHeader);
237DBG("BIOS Information\n");
238DBG("\tVendor: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->vendor, neverMask));
239DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->version, neverMask));
240DBG("\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]);
245DBG("\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;
250DBG("\n");
251}
252
253//-------------------------------------------------------------------------------------------------------------------------
254// System Information (Type 1)
255//-------------------------------------------------------------------------------------------------------------------------
256void decodeSystemInformation(SMBStructHeader *structHeader)
257{
258printHeader(structHeader);
259DBG("System Information\n");
260DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->manufacturer, neverMask));
261DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->productName, neverMask));
262DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->version, neverMask));
263DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->serialNumber, privateData));
264uint8_t *uuid = ((SMBSystemInformation *)structHeader)->uuid;
265if (privateData) {
266DBG("\tUUID: %s\n", PrivateStr);
267} else {
268DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n",
269uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
270uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
271}
272if (((SMBSystemInformation *)structHeader)->wakeupReason > 8) {
273DBG("\tWake-up Type: %s\n", out_of_spec);
274} else {
275DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[((SMBSystemInformation *)structHeader)->wakeupReason]);
276}
277DBG("\tSKU Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->skuNumber, neverMask)); // System SKU#
278DBG("\tFamily: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->family, neverMask));
279DBG("\n");
280}
281
282//-------------------------------------------------------------------------------------------------------------------------
283// Base Board (or Module) Information (Type 2)
284//-------------------------------------------------------------------------------------------------------------------------
285void decodeBaseBoard(SMBStructHeader *structHeader)
286{
287printHeader(structHeader);
288DBG("Base Board Information\n");
289DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->manufacturer, neverMask));
290DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->product, neverMask));
291DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->version, neverMask));
292DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->serialNumber, privateData));
293DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->assetTag, neverMask));
294// Feature Flags (BYTE)
295DBG("\tLocation In Chassis: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->locationInChassis, neverMask)); // Part Component
296// Chassis Handle (WORD)
297if ((((SMBBaseBoard *)structHeader)->boardType < kSMBBaseBoardUnknown) || (((SMBBaseBoard *)structHeader)->boardType > kSMBBaseBoardInterconnect)) {
298DBG("\tType: %s\n", out_of_spec);
299} else {
300DBG("\tType: %s\n", SMBBaseBoardTypes[(((SMBBaseBoard *)structHeader)->boardType - 1)]);
301}
302// Number of Contained Object Handles (n) (BYTE)
303// Contained Object Handles n(WORDs)
304DBG("\n");
305}
306
307//-------------------------------------------------------------------------------------------------------------------------
308// System Enclosure or Chassis (Type 3)
309//-------------------------------------------------------------------------------------------------------------------------
310void decodeSystemEnclosure(SMBStructHeader *structHeader)
311{
312printHeader(structHeader);
313DBG("Chassis Information\n");
314DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->manufacturer, neverMask));
315if ((((SMBSystemEnclosure *)structHeader)->chassisType < kSMBchassisOther) || (((SMBSystemEnclosure *)structHeader)->chassisType > kSMBchassisBladeEnclosing)) {
316DBG("\tType: %s\n", out_of_spec);
317} else {
318DBG("\tType: %s\n", SMBChassisTypes[(((SMBSystemEnclosure *)structHeader)->chassisType - 1)]);
319}
320// Lock:
321DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->version, neverMask));
322DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->serialNumber, privateData));
323DBG("\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
335DBG("\n");
336}
337
338//-------------------------------------------------------------------------------------------------------------------------
339// Processor Information (Type 4)
340//-------------------------------------------------------------------------------------------------------------------------
341void decodeProcessorInformation(SMBStructHeader *structHeader)
342{
343printHeader(structHeader);
344DBG("Processor Information\n");
345DBG("\tSocket Designation: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->socketDesignation, neverMask));
346if ((((SMBProcessorInformation *)structHeader)->processorType < kSMBprocessorTypeOther) || (((SMBProcessorInformation *)structHeader)->processorType > kSMBprocessorTypeGPU)) {
347DBG("\tType: %s\n", out_of_spec);
348} else {
349DBG("\tType: %s\n", SMBProcessorTypes[((SMBProcessorInformation *)structHeader)->processorType - 1]);
350}
351DBG("\tFamily: 0x%X\n", ((SMBProcessorInformation *)structHeader)->processorFamily);
352DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->manufacturer, neverMask));
353DBG("\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:
356DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->processorVersion, neverMask));
357//DBG("\tVoltage: 0.%xV\n", ((SMBProcessorInformation *)structHeader)->voltage);
358DBG("\tExternal Clock: %d MHz\n", ((SMBProcessorInformation *)structHeader)->externalClock);
359DBG("\tMax Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->maximumClock);
360DBG("\tCurrent Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->currentClock);
361// Status: Populated/Unpopulated
362if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) {
363DBG("\tUpgrade: %s\n", out_of_spec);
364} else {
365DBG("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]);
366}
367// L1 Cache Handle:
368// L2 Cache Handle:
369// L3 Cache Handle:
370DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->serialNumber, privateData));
371DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->assetTag, neverMask));
372DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->partNumber, neverMask));
373if(((SMBProcessorInformation *)structHeader)->coreCount != 0) {
374DBG("\tCore Count: %d\n", ((SMBProcessorInformation *)structHeader)->coreCount);}
375if(((SMBProcessorInformation *)structHeader)->coreEnabled != 0) {
376DBG("\tCore Enabled: %d\n", ((SMBProcessorInformation *)structHeader)->coreEnabled);}
377if(((SMBProcessorInformation *)structHeader)->threadCount != 0) {
378DBG("\tThread Count: %d\n", ((SMBProcessorInformation *)structHeader)->threadCount);
379}
380// Characteristics:
381//DBG("\tProcessor Family 2: %d\n", ((SMBProcessorInformation *)structHeader)->processorFamily2);
382DBG("\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//-------------------------------------------------------------------------------------------------------------------------
404void decodeSMBOEMStrings(SMBStructHeader *structHeader)
405{
406char *stringPtr = (char *)structHeader + structHeader->length;
407printHeader(structHeader);
408DBG("OEM Strings\n");
409SMBByte i;
410for (i = 1; i <= ((SMBOEMStrings *)structHeader)->count; i++) {
411DBG("\tString %d: %s\n", i, stringPtr);
412stringPtr = stringPtr + strlen(stringPtr) + 1;
413}
414DBG("\n");
415}
416
417//-------------------------------------------------------------------------------------------------------------------------
418// MemoryDevice (Type 17)
419//-------------------------------------------------------------------------------------------------------------------------
420void decodeMemoryDevice(SMBStructHeader *structHeader)
421{
422printHeader(structHeader);
423DBG("Memory Device\n");
424// Aray Handle
425DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle);
426// Total Width:
427// Data Width:
428// Size:
429// Form Factor:
430// Set:
431DBG("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask));
432DBG("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask));
433if (((SMBMemoryDevice *)structHeader)->memoryType > kSMBMemoryDeviceTypeCount) {
434DBG("\tMemory Type: %s\n", out_of_spec);
435} else {
436DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[((SMBMemoryDevice *)structHeader)->memoryType]);
437}
438// Type Detail:
439DBG("\tSpeed: %d MHz\n", ((SMBMemoryDevice *)structHeader)->memorySpeed);
440DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->manufacturer, neverMask));
441DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->serialNumber, privateData));
442DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->assetTag, neverMask));
443DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->partNumber, neverMask));
444// Rank:
445// Configured Clock Speed:
446DBG("\n");
447}
448
449//-------------------------------------------------------------------------------------------------------------------------
450// Apple Specific (Type 131)
451//-------------------------------------------------------------------------------------------------------------------------
452void decodeOemProcessorType(SMBStructHeader *structHeader)
453{
454printHeader(structHeader);
455DBG("Apple specific Processor Type\n");
456DBG("\tCpu-type: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType);
457DBG("\n");
458}
459
460//-------------------------------------------------------------------------------------------------------------------------
461// Apple Specific (Type 132)
462//-------------------------------------------------------------------------------------------------------------------------
463void decodeOemProcessorBusSpeed(SMBStructHeader *structHeader)
464{
465printHeader(structHeader);
466DBG("Apple specific Processor Interconnect Speed\n");
467DBG("\tQPI = %d MT/s\n", ((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed);
468DBG("\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
497void decodeSMBIOSTable(SMBEntryPoint *eps)
498{
499uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;
500SMBStructHeader *structHeader = (SMBStructHeader *)ptr;
501
502minorVersion = eps->minorVersion;
503majorVersion = eps->majorVersion;
504bcdRevisionHi = eps->dmi.bcdRevision >> 4;
505bcdRevisionLo = eps->dmi.bcdRevision & 0x0F;
506
507getBoolForKey(kPrivateData, &privateData, &bootInfo->chameleonConfig); // Bungo: chek if mask some data
508
509DBG("\n");
510DBG("SMBIOS rev.: %d.%d, DMI rev.: %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo);
511DBG("\n");
512for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
513{
514switch (structHeader->type)
515{
516case kSMBTypeBIOSInformation: // Type 0
517decodeBIOSInformation(structHeader);
518break;
519
520case kSMBTypeSystemInformation: // Type 1
521decodeSystemInformation(structHeader);
522break;
523
524case kSMBTypeBaseBoard: // Type 2
525decodeBaseBoard(structHeader);
526break;
527
528case kSMBTypeSystemEnclosure: // Type 3
529decodeSystemEnclosure(structHeader);
530break;
531
532case kSMBTypeProcessorInformation: // Type 4
533decodeProcessorInformation(structHeader);
534break;
535
536//case kSMBTypeMemoryModule: // Type 6
537//decodeMemoryModule(structHeader);
538//break;
539
540//case kSMBTypeSystemSlot: // Type 9
541//decodeSMBTypeSystemSlot(structHeader);
542//break;
543
544case kSMBOEMStrings: // Type 11
545decodeSMBOEMStrings(structHeader);
546break;
547
548case kSMBTypeMemoryDevice: // Type 17
549decodeMemoryDevice(structHeader);
550break;
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
560case kSMBTypeOemProcessorType: // Type 131
561decodeOemProcessorType(structHeader);
562break;
563
564case kSMBTypeOemProcessorBusSpeed: // Type 132
565decodeOemProcessorBusSpeed(structHeader);
566break;
567
568//kSMBTypeOemPlatformFeature: // Type 133
569//decodeOemPlatformFeature(structHeader);
570//break;
571
572case kSMBTypeEndOfTable: // Type 127
573DBG("Handle 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length);
574DBG("End of Table\n");
575break;
576
577default:
578break;
579}
580
581ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
582for (; ((uint16_t *)ptr)[0] != 0; ptr++);
583
584if (((uint16_t *)ptr)[0] == 0) {
585ptr += 2;
586}
587
588structHeader = (SMBStructHeader *)ptr;
589}
590DBG("\n");
591}
592
593

Archive Download this file

Revision: 2355