Chameleon

Chameleon Commit Details

Date:2014-01-29 01:48:10 (5 years 4 months ago)
Author:ErmaC
Commit:2355
Parents: 2354
Message:merge dmi improvements from Bungo's Branch enabled table 4 fields DMI outputs (bdmesg) like dmidecode
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/smbios.c
M/branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c
M/branches/ErmaC/Enoch/i386/libsaio/smbios.h
M/branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c

File differences

branches/ErmaC/Enoch/i386/libsaio/smbios.c
8181
8282
8383
84
84
8585
8686
8787
8888
8989
90
91
90
91
9292
9393
9494
......
105105
106106
107107
108
109
108110
109111
110112
......
120122
121123
122124
125
126
127
128
123129
124130
125131
......
181187
182188
183189
190
184191
185192
186193
......
227234
228235
229236
237
238
239
230240
231
232
233
234241
235242
236
243
237244
238245
239246
......
292299
293300
294301
302
303
304
305
306
295307
296308
297309
......
308320
309321
310322
311
312
323
313324
314325
315326
......
324335
325336
326337
327
328338
329339
330340
......
352362
353363
354364
355
365
356366
357367
358368
359369
360370
361371
362
363372
364373
365374
......
371380
372381
373382
383
384
385
386
387
388
374389
375390
376391
......
476491
477492
478493
479
494
480495
481496
482497
......
585600
586601
587602
603
588604
589605
590606
......
819835
820836
821837
822
838
823839
824840
825841
......
847863
848864
849865
866
867
868
850869
851870
852871
......
862881
863882
864883
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
882901
902
903
883904
884
905
885906
886907
887908
......
894915
895916
896917
918
919
920
921
897922
898923
899924
900925
901926
927
928
929
902930
903931
904932
905933
906934
907935
936
937
938
908939
909940
910941
......
920951
921952
922953
954
955
956
923957
924958
925959
......
943977
944978
945979
946
980
947981
948982
949983
......
9661000
9671001
9681002
1003
1004
1005
1006
1007
9691008
9701009
9711010
......
10041043
10051044
10061045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
10071070
1008
1071
1072
1073
1074
1075
1076
10091077
1078
1079
10101080
1011
1081
1082
10121083
10131084
10141085
10151086
10161087
10171088
1018
1089
1090
10191091
10201092
10211093
/* ============================
Processor Information (Type 4)
============================== */
// Bungo
// Bungo:
#define kSMBProcessorInformationSocketKey "SMcpusocket"
#define kSMBProcessorInformationManufacturerKey "SMcpumanufacturer"
#define kSMBProcessorInformationVersionKey "SMcpuversion"
//
#define kSMBProcessorInformationExternalClockKey"SMexternalclock"
#define kSMBProcessorInformationMaximumClockKey"SMmaximalclock"
// Bungo
#define kSMBProcessorInformationMaximalClockKey"SMmaximalclock"
// Bungo:
#define kSMBProcessorInformationCurrentClockKey "SMcurrentclock"
#define kSMBProcessorInformationUpgradeKey "SMcpuupgrade"
#define kSMBProcessorInformationSerialNumberKey "SMcpuserial"
#define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" //
#define kSMBMemoryDeviceSerialNumberKey "SMmemserial" //
#define kSMBMemoryDevicePartNumberKey "SMmempart" //
// Bungo:
#define kSMBMemoryDeviceAssetTagKey "SMmemassettag" //
/* ===========================================
Memory SPD Data (Apple Specific - Type 130)
=================================================== */
#define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
//#define kSMBOemPlatformFeatureKey
/* ==================================================*/
#define getFieldOffset(struct, field)((uint8_t)(uint32_t)&(((struct *)0)->field))
char*version;
char*serialNumber;
char*assetTag; // Bungo: renamed folowing convention
char*skuNumber;
} defaultChassis_t;
defaultChassis_t defaultChassis;
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, serialNumber),
kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number
/* Bungo:
{kSMBTypeSystemInformation,kSMBByte,getFieldOffset(SMBSystemInformation, uuid),
kSMBSystemInformationUUIDKey, NULL, NULL}, // SMsystemuuid
/*{kSMBTypeSystemInformation,kSMBByte,getFieldOffset(SMBSystemInformation, uuid[16]),
NULL, NULL, NULL}, // SmUUID/
{kSMBTypeSystemInformation,kSMBByte,getFieldOffset(SMBSystemInformation, wakeupReason),
NULL, NULL, NULL}, // reason for system wakeup
*/
*/
// Bungo
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, skuNumber),
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTag),
kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag }, // SMchassisassettag - Pro Enclosure
/*
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, skuNumber),
NULL, NULL, &defaultChassis.skuNumber },
*/
/* ============================
Processor Information (Type 4)
============================== */
kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock,NULL}, // SMcpuexternalclock
{kSMBTypeProcessorInformation,kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock),
kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,NULL}, // SMcpumaxspeed
kSMBProcessorInformationMaximalClockKey, getProcessorInformationMaximumClock,NULL}, // SMcpumaximumclock
// Bungo
{kSMBTypeProcessorInformation,kSMBWord,getFieldOffset(SMBProcessorInformation, currentClock),
kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentspeed
// Bungo
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),
kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, partNumber),
kSMBMemoryDeviceSerialNumberKey, getSMBMemoryDeviceSerialNumber, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, assetTag),
NULL, NULL, NULL},
kSMBMemoryDeviceAssetTagKey, NULL, NULL},
{kSMBTypeMemoryDevice,kSMBWord,getFieldOffset(SMBMemoryDevice, errorHandle),
NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, partNumber),
kSMBMemoryDevicePartNumberKey, getSMBMemoryDevicePartNumber, NULL},
//
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific
// OEM Processor Bus Speed (Apple Specific - Type 132)
{kSMBTypeOemProcessorBusSpeed,kSMBWord,getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed),kSMBOemProcessorBusSpeedKey,
getSMBOemProcessorBusSpeed,NULL}
// OEM Platform Feature (Apple Specific - Type 133)
/*
{kSMBTypeOemPlatformFeature,kSMBWord,getFieldOffset(SMBOemPlatformFeature, PlatformFeature),kSMBOemPlatformFeatureKey,
getSMBOemPlatformFeature,NULL}
*/
};
int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter);
//#define kDefaultMacBookProIvyBoardProduct"Mac-AFD8A9D944EA4843"
//#define kDefaultMacBookProIvyBIOSReleaseDate"10/02/2012"
// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B02.1310181745
// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B03.1310291227
// MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745
//=========== iMac ===========
defaultChassis.manufacturer = kDefaultVendorManufacturer;
defaultChassis.serialNumber = kDefaultSerialNumber;
defaultChassis.assetTag = kDefaultAssetTag;
defaultChassis.skuNumber = kDefaultSkuNumber;
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly
if (PlatformType == 2) // this method works
break;
}
}
// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo
// Bungo
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {
string = *(SMBSetters[idx].defaultValue);
break;
case kSMBWord:
value->word = (uint16_t)val;
break;
//case kSMBQWord:
//value->qword = (uint64_t)val;
//break;
case kSMBDWord:
default:
value->dword = (uint32_t)val;
}
}
// #if 0 Bungo: enables code below
// if (*(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue))
{
// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo
switch (SMBSetters[idx].valueType) {
case kSMBByte:
value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue);
break;
case kSMBWord:
value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);
break;
case kSMBDWord:
default:
value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);
break;
}
return true;
// Bungo
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {
// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo
switch (SMBSetters[idx].valueType) {
case kSMBByte:
value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue);
break;
case kSMBWord:
value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);
break;
//case kSMBQWord:
//value->qword = *(uint32_t *)(SMBSetters[idx].defaultValue);
//break;
case kSMBDWord:
default:
value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);
break;
}
return true;
}
// #endif Bungo
break;
break;
}
// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific
//-------------------------------------------------------------------------------------------------------------------------
/* ===========================================
Firmware Volume (Apple Specific - Type 128)
============================================= */
void addSMBFirmwareVolume(SMBStructPtrs *structPtr)
{
return;
}
/* ===========================================
Memory SPD Data (Apple Specific - Type 130)
============================================= */
void addSMBMemorySPD(SMBStructPtrs *structPtr)
{
/* SPD data from Platform.RAM.spd */
return;
}
/* ============================================
OEM Processor Type (Apple Specific - Type 131)
============================================== */
void addSMBOemProcessorType(SMBStructPtrs *structPtr)
{
SMBOemProcessorType *p = (SMBOemProcessorType *)structPtr->new;
structureCount++;
}
/* =================================================
OEM Processor Bus Speed (Apple Specific - Type 132)
=================================================== */
void addSMBOemProcessorBusSpeed(SMBStructPtrs *structPtr)
{
SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new;
case CPU_MODEL_IVYBRIDGE_XEON:
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPU_MODEL_HASWELL:
case CPU_MODEL_HASWELL_MB:
case CPU_MODEL_HASWELL_SVR:
case CPU_MODEL_HASWELL_ULT:
case CPU_MODEL_CRYSTALWELL:
structureCount++;
}
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
/*void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) { }*/
//-------------------------------------------------------------------------------------------------------------------------
// EndOfTable
//-------------------------------------------------------------------------------------------------------------------------
if (handle < structPtr->orig->handle) {
handle = structPtr->orig->handle;
}
// Bungo: fix unsuported tables lengths from original smbios: extend smaller or truncate bigger
switch (structPtr->orig->type) {
case kSMBTypeBIOSInformation:
structSize = sizeof(SMBBIOSInformation);
break;
case kSMBTypeSystemInformation:
structSize = sizeof(SMBSystemInformation);
break;
case kSMBTypeBaseBoard:
structSize = sizeof(SMBBaseBoard);
break;
case kSMBTypeSystemEnclosure:
structSize = sizeof(SMBSystemEnclosure);
break;
case kSMBTypeProcessorInformation:
structSize = sizeof(SMBProcessorInformation);
break;
case kSMBTypeMemoryDevice:
structSize = sizeof(SMBMemoryDevice);
break;
default:
structSize = structPtr->orig->length; // don't change if not to patch
break;
}
memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);
// memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);
if (structPtr->orig->length <= structSize) {
memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);
} else {
memcpy((void *)structPtr->new, structPtr->orig, structSize);
}
structPtr->new->length = structSize;
for (i = 0; i < numOfSetters; i++) {
if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) {
// Bungo:
if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize)) {
setterFound = true;
setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));
}
}
if (setterFound) {
ptr = (uint8_t *)structPtr->new + structPtr->orig->length;
// Bungo:
ptr = (uint8_t *)structPtr->new + structPtr->new->length;
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c
2121
2222
2323
24
25
26
27
28
29
3024
3125
3226
3327
3428
3529
36
3730
31
3832
33
34
35
36
3937
40
41
42
43
44
45
46
47
48
49
50
51
52
5338
5439
5540
......
123108
124109
125110
111
112
113
114
115
116
117
118
119
120
121
122
123
126124
127125
128
126
129127
130128
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
175173
176174
177175
......
210208
211209
212210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
213231
214232
215233
216
234
217235
218
219
220
221
222
223
224
225
226
227
228
229
230
231
236
237
238
239
240
241
242
243
244
245
246
247
248
249
232250
233251
234252
235253
236254
237255
238
256
239257
240
241
242
258
259
260
261
262
263
264
265
266
267
268
269
270
243271
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
272
266273
267274
268
275
269276
270
271
272
273
274
275
277
278
276279
277280
278281
279282
280283
281284
282
285
283286
284
285
286
287
288
289
290
291
292
293
294
295
296
287
288
289
290
291
292
293
294
295
296
297
297298
298299
299
300
300301
301
302
302
303
303304
304305
305306
306307
307308
308309
309
310
310311
311
312
313
314
315
316
317
312
313
314
315
318316
319317
320
318
321319
322
323
324
325
326
327
328
329
330
331
332
333
334
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335335
336336
337337
338338
339339
340340
341
341
342342
343
344
345
343
344
345
346
347
348
349
346350
347
348
349
350
351
352
353
354
355
356
357
358
359
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
360366
361
362
363
364
365
366
367
368
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
369382
370383
371384
372385
373386
374387
375
388
376389
377
378
379
380
390
381391
382392
383393
384
394
385395
386396
387397
......
391401
392402
393403
394
395
396
397
398
399
400
401
402
403
404
404
405
406
407
408
409
410
411
412
413
414
415
405416
406417
407418
408419
409
420
410421
411
412
413
414
415
416
417
422
423
424
425
426
427
428
429
430
431
432
433
418434
419435
420
436
421437
422
423
424
425
426
427
428
429
430
438
439
440
441
442
443
444
445
431446
432447
433448
434449
435
450
436451
437
452
438453
439
454
455
440456
441457
442458
443459
444
460
461
462
463
445464
446
447
448
449
465
466
467
450468
451469
470
471
452472
473
474
475
476
477
478
479
480
481
453482
483
484
485
486
487
488
489
490
491
492
454493
494
495
496
455497
456498
457499
......
465507
466508
467509
468
510
469511
470512
471513
472
473
474
475514
476515
477516
478
517
479518
480519
481520
482
521
483522
484523
485524
486
525
487526
488527
489528
490
529
491530
492531
493532
494
533
495534
496535
497
498
536
537
499538
500539
501
502
540
541
503542
504543
544
545
546
547
505548
506
549
507550
508551
509552
553
510554
511555
512
513
514
556
557
558
515559
516560
517
561
518562
519563
520564
521
565
522566
523567
524568
569
570
525571
526572
527
573
574
528575
529576
530577
#define DBG(x...)msglog(x)
#endif
static SMBByte minorVersion; // SMBIOS rev. minor
// Bungo:
static SMBByte majorVersion; // SMBIOS rev. major
static SMBByte bcdRevisionLo; // DMI rev. minor
static SMBByte bcdRevisionHi; // DMI rev. major
extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field);
// Bungo:
#define NotSpecifiedStr "Not Specified" // no string
#define out_of_spec "<OUT OF SPEC>" // value out of smbios spec. range
#define PrivateStr "** PRIVATE **" // masking private data
#define alwaysMask true
#define neverMask false
static bool privateData = true;
static SMBByte minorVersion; // SMBIOS rev. minor
static SMBByte majorVersion; // SMBIOS rev. major
static SMBByte bcdRevisionLo; // DMI rev. minor
static SMBByte bcdRevisionHi; // DMI rev. major
char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask) // Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode displays
{
char *str = NULL;
str = getSMBStringForField(structHeader, field);
if (!field) {
str = NotSpecifiedStr;
} else if (mask) {
str = PrivateStr;
}
return str;
};
/*====
7.2.2
===*/
};
/*====
7.5.1
===*/
static const char *SMBProcessorTypes[] = // Bungo: strings for processor type (Table Type 4 - Processor Information)
{
"Other", /* 01h */
"Unknown", /* 02h */
"Central Processor", /* 03h */
"Math Processor", /* 04h */
"DSP Processor", /* 05h */
"Video Processor" /* 06h */
};
/*====
7.5.5
===*/
/*static const char *SMBCpuSocket[] = // ErmaC: strings for (Table Type 4 - Processor Information )
static const char *SMBProcessorUpgrades[] = // ErmaC: strings for processor upgrade (Table Type 4 - Processor Information)
{
"Other", // 01h
"Unknown",
"Daughter Board",
"ZIF Socket",
"Replaceable Piggy Back",
"None",
"LIF Socket",
"Slot 1",
"Slot 2",
"370-pin Socket",
"Slot A",
"Slot M",
"Socket 423",
"Socket A (Socket 462)",
"Socket 478",
"Socket 754",
"Socket 940",
"Socket 939",
"Socket mPGA604",
"Socket LGA771",
"Socket LGA775",
"Socket S1",
"Socket AM2",
"Socket F (1207)",
"Socket LGA1366",
"Socket G34",
"Socket AM3",
"Socket C32",
"Socket LGA1156",
"Socket LGA1567",
"Socket PGA988A",
"Socket BGA1288",
"Socket rPGA988B",
"Socket BGA1023",
"Socket BGA1224",
"Socket BGA1155",
"Socket LGA1356",
"Socket LGA2011",
"Socket FS1",
"Socket FS2",
"Socket FM1",
"Socket FM2",
"Socket LGA2011-3",
"Socket LGA1356-3"// 2Ch
};*/
"Unknown",
"Daughter Board",
"ZIF Socket",
"Replaceable Piggy Back",
"None",
"LIF Socket",
"Slot 1",
"Slot 2",
"370-pin Socket",
"Slot A",
"Slot M",
"Socket 423",
"Socket A (Socket 462)",
"Socket 478",
"Socket 754",
"Socket 940",
"Socket 939",
"Socket mPGA604",
"Socket LGA771",
"Socket LGA775",
"Socket S1",
"Socket AM2",
"Socket F (1207)",
"Socket LGA1366",
"Socket G34",
"Socket AM3",
"Socket C32",
"Socket LGA1156",
"Socket LGA1567",
"Socket PGA988A",
"Socket BGA1288",
"Socket rPGA988B",
"Socket BGA1023",
"Socket BGA1224",
"Socket BGA1155",
"Socket LGA1356",
"Socket LGA2011",
"Socket FS1",
"Socket FS2",
"Socket FM1",
"Socket FM2",
"Socket LGA2011-3",
"Socket LGA1356-3"// 2Ch
};
/*=====
7.18.2
static const int kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) /
sizeof(SMBMemoryDeviceTypes[0]);
// Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode displays
char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask)
{
char *str = NULL;
str = getSMBStringForField(structHeader, field);
if (!field) {
str = NotSpecifiedStr;
}
else if (mask) {
str = PrivateStr;
}
return str;
};
void printHeader(SMBStructHeader *structHeader)
{
DBG("Handle: 0x%04x, DMI type: %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length);
}
//-------------------------------------------------------------------------------------------------------------------------
// BIOS Information (Type 0)
//-------------------------------------------------------------------------------------------------------------------------
void decodeBIOSInformation(SMBBIOSInformation *structHeader)
void decodeBIOSInformation(SMBStructHeader *structHeader)
{
DBG("BIOS Information:\n");
DBG("\tVendor: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor, neverMask));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask));
// Address Segment
DBG("\tRelease Date: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->releaseDate, neverMask));
DBG("\tBIOS Revision: %d.%d\n", structHeader->releaseMajor, structHeader->releaseMinor);
// ROM Size
//DBG("\tSupported BIOS functions: (0x%llX) %s\n", structHeader->characteristics, SMBBIOSInfoChar0[structHeader->characteristics]);
// Major Release
// Minor Release
// Firmware Major Release
// Firmware Minor Release
//SMBByte characteristicsExt1;
//SMBByte characteristicsExt2;
printHeader(structHeader);
DBG("BIOS Information\n");
DBG("\tVendor: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->vendor, neverMask));
DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->version, neverMask));
DBG("\tRelease Date: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->releaseDate, neverMask));
// Address:
// Runtime Size:
// ROM Size:
// DBG("\tSupported BIOS functions: (0x%llX) %s\n", ((SMBBIOSInformation *)structHeader)->characteristics, SMBBIOSInfoChar0[((SMBBIOSInformation *)structHeader)->characteristics]);
DBG("\tBIOS Revision: %d.%d\n", ((SMBBIOSInformation *)structHeader)->releaseMajor, ((SMBBIOSInformation *)structHeader)->releaseMinor);
// Firmware Major Release
// Firmware Minor Release
// SMBByte characteristicsExt1;
// SMBByte characteristicsExt2;
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// System Information (Type 1)
//-------------------------------------------------------------------------------------------------------------------------
void decodeSystemInformation(SMBSystemInformation *structHeader)
void decodeSystemInformation(SMBStructHeader *structHeader)
{
DBG("System Information:\n");
if (structHeader->header.length < 0x08) {
return;
printHeader(structHeader);
DBG("System Information\n");
DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->manufacturer, neverMask));
DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->productName, neverMask));
DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->version, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->serialNumber, privateData));
uint8_t *uuid = ((SMBSystemInformation *)structHeader)->uuid;
if (privateData) {
DBG("\tUUID: %s\n", PrivateStr);
} else {
DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
}
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask));
DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->productName, neverMask));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData));
if (minorVersion < 0x01 || structHeader->header.length < 0x19) {
return;
}
uint8_t *uuid = structHeader->uuid;
if (uuid) {
if (privateData) {
DBG("\tUUID: %s\n", PrivateStr);
} else {
DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
}
}
if (structHeader->wakeupReason > 8) {
if (((SMBSystemInformation *)structHeader)->wakeupReason > 8) {
DBG("\tWake-up Type: %s\n", out_of_spec);
} else {
DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[structHeader->wakeupReason]);
DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[((SMBSystemInformation *)structHeader)->wakeupReason]);
}
if (minorVersion < 0x04 || structHeader->header.length < 0x1B) {
return;
}
DBG("\tSKU Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber, neverMask)); // System SKU#
DBG("\tFamily: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->family, neverMask));
DBG("\tSKU Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->skuNumber, neverMask)); // System SKU#
DBG("\tFamily: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->family, neverMask));
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// Base Board (or Module) Information (Type 2)
//-------------------------------------------------------------------------------------------------------------------------
void decodeBaseBoard(SMBBaseBoard *structHeader)
void decodeBaseBoard(SMBStructHeader *structHeader)
{
DBG("Base Board Information:\n");
if (structHeader->header.length < 0x08) {
return;
}
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask));
DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->product, neverMask));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask));
// Feature Flags (BYTE)
DBG("\tLocation In Chassis: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis, neverMask)); // Part Component
// Chassis Handle (WORD)
if ((structHeader->boardType < kSMBBaseBoardUnknown) || (structHeader->boardType > kSMBBaseBoardInterconnect)) {
printHeader(structHeader);
DBG("Base Board Information\n");
DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->manufacturer, neverMask));
DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->product, neverMask));
DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->version, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->assetTag, neverMask));
// Feature Flags (BYTE)
DBG("\tLocation In Chassis: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->locationInChassis, neverMask)); // Part Component
// Chassis Handle (WORD)
if ((((SMBBaseBoard *)structHeader)->boardType < kSMBBaseBoardUnknown) || (((SMBBaseBoard *)structHeader)->boardType > kSMBBaseBoardInterconnect)) {
DBG("\tType: %s\n", out_of_spec);
} else {
DBG("\tType: %s\n", SMBBaseBoardTypes[(structHeader->boardType - 1)]);
DBG("\tType: %s\n", SMBBaseBoardTypes[(((SMBBaseBoard *)structHeader)->boardType - 1)]);
}
// Number of Contained Object Handles (n) (BYTE)
// Contained Object Handles n(WORDs)
// Number of Contained Object Handles (n) (BYTE)
// Contained Object Handles n(WORDs)
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// System Enclosure or Chassis (Type 3)
//-------------------------------------------------------------------------------------------------------------------------
void decodeSystemEnclosure(SMBSystemEnclosure *structHeader)
void decodeSystemEnclosure(SMBStructHeader *structHeader)
{
DBG("Chassis Information:\n");
if (structHeader->header.length < 0x09) {
return;
}
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask));
// DBG("\tType: 0x%X\n", structHeader->chassisType);
if ((structHeader->chassisType < kSMBchassisOther) || (structHeader->chassisType > kSMBchassisBladeEnclosing)) {
printHeader(structHeader);
DBG("Chassis Information\n");
DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->manufacturer, neverMask));
if ((((SMBSystemEnclosure *)structHeader)->chassisType < kSMBchassisOther) || (((SMBSystemEnclosure *)structHeader)->chassisType > kSMBchassisBladeEnclosing)) {
DBG("\tType: %s\n", out_of_spec);
} else {
DBG("\tType: %s\n", SMBChassisTypes[(structHeader->chassisType - 1)]);
DBG("\tType: %s\n", SMBChassisTypes[(((SMBSystemEnclosure *)structHeader)->chassisType - 1)]);
}
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask));
// Boot-up State:
// Power Supply State
// Thermal State
// Security Status:
// OEM Information:
// Height;
// Cords;
// ElementsCount;
// ElementLen;
// Elements[1]; // open array of ElementsCount*ElementLen BYTEs
// Lock:
DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->version, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->assetTag, neverMask));
// Boot-up State:
// Power Supply State
// Thermal State
// Security Status:
// OEM Information:
// Height;
// Number Of Power Cords: Cords;
// Contained Elements: ElementsCount;
// SKU Number:
// ElementLen;
// Elements[1]; // open array of ElementsCount*ElementLen BYTEs
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// Processor Information (Type 4)
//-------------------------------------------------------------------------------------------------------------------------
void decodeProcessorInformation(SMBProcessorInformation *structHeader)
void decodeProcessorInformation(SMBStructHeader *structHeader)
{
DBG("Processor Information:\n");
if (structHeader->header.length < 0x1A) {
return;
printHeader(structHeader);
DBG("Processor Information\n");
DBG("\tSocket Designation: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->socketDesignation, neverMask));
if ((((SMBProcessorInformation *)structHeader)->processorType < kSMBprocessorTypeOther) || (((SMBProcessorInformation *)structHeader)->processorType > kSMBprocessorTypeGPU)) {
DBG("\tType: %s\n", out_of_spec);
} else {
DBG("\tType: %s\n", SMBProcessorTypes[((SMBProcessorInformation *)structHeader)->processorType - 1]);
}
DBG("\tSocket Designation: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation, neverMask));
DBG("\tType: %d\n", structHeader->processorType);
DBG("\tFamily: 0x%X\n", structHeader->processorFamily);
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask));
DBG("\tID: 0x%llX\n", structHeader->processorID);
DBG("\tProcessor Version: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->processorVersion, neverMask));
//DBG("\tVoltage: 0.%xV\n", structHeader->voltage);
DBG("\tExternal Clock: %dMHz\n", structHeader->externalClock);
DBG("\tMaximum Clock: %dMHz\n", structHeader->maximumClock);
DBG("\tCurrent Clock: %dMHz\n", structHeader->currentClock);
if (minorVersion < 0x03 || structHeader->header.length < 0x23) {
return;
DBG("\tFamily: 0x%X\n", ((SMBProcessorInformation *)structHeader)->processorFamily);
DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->manufacturer, neverMask));
DBG("\tID: 0x%llX\n", ((SMBProcessorInformation *)structHeader)->processorID);
//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);
// Flags:
DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->processorVersion, neverMask));
//DBG("\tVoltage: 0.%xV\n", ((SMBProcessorInformation *)structHeader)->voltage);
DBG("\tExternal Clock: %d MHz\n", ((SMBProcessorInformation *)structHeader)->externalClock);
DBG("\tMax Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->maximumClock);
DBG("\tCurrent Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->currentClock);
// Status: Populated/Unpopulated
if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) {
DBG("\tUpgrade: %s\n", out_of_spec);
} else {
DBG("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]);
}
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData)); // 20
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask)); // 21
DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber, neverMask)); // 22
DBG("\tCore Count: %d\n", structHeader->coreCount); // 23
DBG("\tCore Enabled: %d\n", structHeader->coreEnabled); // 24
DBG("\tThread Count: %d\n", structHeader->threadCount); // 25
//DBG("\tProcessor Family 2: %d\n", structHeader->processorFamily2); //26
// L1 Cache Handle:
// L2 Cache Handle:
// L3 Cache Handle:
DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->assetTag, neverMask));
DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->partNumber, neverMask));
if(((SMBProcessorInformation *)structHeader)->coreCount != 0) {
DBG("\tCore Count: %d\n", ((SMBProcessorInformation *)structHeader)->coreCount);}
if(((SMBProcessorInformation *)structHeader)->coreEnabled != 0) {
DBG("\tCore Enabled: %d\n", ((SMBProcessorInformation *)structHeader)->coreEnabled);}
if(((SMBProcessorInformation *)structHeader)->threadCount != 0) {
DBG("\tThread Count: %d\n", ((SMBProcessorInformation *)structHeader)->threadCount);
}
// Characteristics:
//DBG("\tProcessor Family 2: %d\n", ((SMBProcessorInformation *)structHeader)->processorFamily2);
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// Memory Module Information (Type 6)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeMemoryModule(SMBMemoryModule *structHeader)
//void decodeMemoryModule(SMBStructHeader *structHeader)
//{
//DBG("Memory Module Information:\n");
//if (structHeader->header.length < 0x0C) {
// return;
//}
//DBG("Memory Module Information\n");
//DBG("\tSocket Designation: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation));
//DBG("\tBank Connections: Type: %d\n", structHeader->bankConnections);
//DBG("\tCurrent Speed: %X\n", structHeader->currentSpeed);
//DBG("\tCurrent Memory Type: %llX\n", structHeader->currentMemoryType);
//DBG("\tType: %llX\n", structHeader->currentMemoryType);
//DBG("\tInstalled Size: %d\n", structHeader->installedSize);
//DBG("\tEnabled Size: %d\n", structHeader->enabledSize);
//DBG("\tError Status: %x\n", structHeader->errorStatus);
//-------------------------------------------------------------------------------------------------------------------------
// OEM Strings (Type 11)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeSMBOEMStrings(SMBOEMStrings *structHeader)
//{
//DBG("OEM Strings:\n");
//if (structHeader->header.length < 0x05) {
//return;
//}
//DBG("\tString 1: %d\n"); //, structHeader->string1);
//DBG("\tString 2: %d\n"); //, structHeader->string1);
//DBG("\tString 3: %d\n"); //, structHeader->string1);
//DBG("\n");
//}
void decodeSMBOEMStrings(SMBStructHeader *structHeader)
{
char *stringPtr = (char *)structHeader + structHeader->length;
printHeader(structHeader);
DBG("OEM Strings\n");
SMBByte i;
for (i = 1; i <= ((SMBOEMStrings *)structHeader)->count; i++) {
DBG("\tString %d: %s\n", i, stringPtr);
stringPtr = stringPtr + strlen(stringPtr) + 1;
}
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// MemoryDevice (Type 17)
//-------------------------------------------------------------------------------------------------------------------------
void decodeMemoryDevice(SMBMemoryDevice *structHeader)
void decodeMemoryDevice(SMBStructHeader *structHeader)
{
DBG("Memory Device:\n");
if (structHeader->header.length < 0x15) {
return;
}
DBG("\tDevice Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator, neverMask));
DBG("\tBank Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator, neverMask));
if (structHeader->memoryType > kSMBMemoryDeviceTypeCount) {
printHeader(structHeader);
DBG("Memory Device\n");
// Aray Handle
DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle);
// Total Width:
// Data Width:
// Size:
// Form Factor:
// Set:
DBG("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask));
DBG("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask));
if (((SMBMemoryDevice *)structHeader)->memoryType > kSMBMemoryDeviceTypeCount) {
DBG("\tMemory Type: %s\n", out_of_spec);
} else {
DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[structHeader->memoryType]);
DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[((SMBMemoryDevice *)structHeader)->memoryType]);
}
if (minorVersion < 0x03 || structHeader->header.length < 0x1B) {
return;
}
DBG("\tSpeed: %d MHz\n", structHeader->memorySpeed);
DBG("\tError Handle: %x\n", structHeader->errorHandle);
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask));
DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber, neverMask));
// Type Detail:
DBG("\tSpeed: %d MHz\n", ((SMBMemoryDevice *)structHeader)->memorySpeed);
DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->manufacturer, neverMask));
DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->serialNumber, privateData));
DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->assetTag, neverMask));
DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->partNumber, neverMask));
// Rank:
// Configured Clock Speed:
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific
// Apple Specific (Type 131)
//-------------------------------------------------------------------------------------------------------------------------
void decodeOemProcessorType(SMBOemProcessorType *structHeader)
void decodeOemProcessorType(SMBStructHeader *structHeader)
{
DBG("Apple specific Processor Type:\n");
printHeader(structHeader);
DBG("Apple specific Processor Type\n");
DBG("\tCpu-type: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType);
DBG("\n");
}
void decodeOemProcessorBusSpeed(SMBOemProcessorBusSpeed *structHeader)
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific (Type 132)
//-------------------------------------------------------------------------------------------------------------------------
void decodeOemProcessorBusSpeed(SMBStructHeader *structHeader)
{
DBG("Apple specific Processor Interconnect Speed:\n");
DBG("\tQPI = %d.%dGT/s\n",
((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed / 1000,
(((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed / 100) % 10);
printHeader(structHeader);
DBG("Apple specific Processor Interconnect Speed\n");
DBG("\tQPI = %d MT/s\n", ((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed);
DBG("\n");
}
// 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
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific (Type 133)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeOemPlatformFeature(SMBStructHeader *structHeader)
//{
//printHeader(structHeader);
//DBG("Apple specific Platform Feature\n");
//DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->PlatformFeature);
//DBG("\n");
//}
//-------------------------------------------------------------------------------------------------------------------------
// Specific (Type 134)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeOem(SMBStructHeader *structHeader)
//{
//printHeader(structHeader);
//DBG("Apple specific Feature\n");
//DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->Feature);
//DBG("\n");
//}
//-------------------------------------------------------------------------------------------------------------------------
void decodeSMBIOSTable(SMBEntryPoint *eps)
{
uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress;
getBoolForKey(kPrivateData, &privateData, &bootInfo->chameleonConfig); // Bungo: chek if mask some data
DBG("\n");
DBG("SMBIOS rev. %d.%d, DMI rev. %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo);
DBG("SMBIOS rev.: %d.%d, DMI rev.: %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo);
DBG("\n");
for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
{
DBG("Type: %d, Length: %d, Handle: 0x%04x\n",
structHeader->type, structHeader->length, structHeader->handle);
switch (structHeader->type)
{
case kSMBTypeBIOSInformation: // Type 0
decodeBIOSInformation((SMBBIOSInformation *)structHeader);
decodeBIOSInformation(structHeader);
break;
case kSMBTypeSystemInformation: // Type 1
decodeSystemInformation((SMBSystemInformation *)structHeader);
decodeSystemInformation(structHeader);
break;
case kSMBTypeBaseBoard: // Type 2
decodeBaseBoard((SMBBaseBoard *)structHeader);
decodeBaseBoard(structHeader);
break;
case kSMBTypeSystemEnclosure: // Type 3
decodeSystemEnclosure((SMBSystemEnclosure *)structHeader);
decodeSystemEnclosure(structHeader);
break;
case kSMBTypeProcessorInformation: // Type 4
decodeProcessorInformation((SMBProcessorInformation *)structHeader);
decodeProcessorInformation(structHeader);
break;
//case 6: // kSMBTypeMemoryModule: // Type 6
//decodeMemoryModule((SMBMemoryModule *)structHeader);
//case kSMBTypeMemoryModule: // Type 6
//decodeMemoryModule(structHeader);
//break;
//case 11: // kSMBOEMStrings: // Type 11
//decodeSMBOEMStrings((SMBOEMStrings *)structHeader);
//case kSMBTypeSystemSlot: // Type 9
//decodeSMBTypeSystemSlot(structHeader);
//break;
case kSMBOEMStrings: // Type 11
decodeSMBOEMStrings(structHeader);
break;
case kSMBTypeMemoryDevice: // Type 17
decodeMemoryDevice((SMBMemoryDevice *)structHeader);
decodeMemoryDevice(structHeader);
break;
//kSMBTypeMemoryArrayMappedAddress: // Type 19
//break;
/* Skip all Apple Specific Structures */
case kSMBTypeFirmwareVolume: // Type 128
case kSMBTypeMemorySPD: // Type 130
break;
// case kSMBTypeFirmwareVolume: // Type 128
// case kSMBTypeMemorySPD: // Type 130
//break;
case kSMBTypeOemProcessorType: // Type 131
decodeOemProcessorType((SMBOemProcessorType *)structHeader);
decodeOemProcessorType(structHeader);
break;
case kSMBTypeOemProcessorBusSpeed: // Type 132
decodeOemProcessorBusSpeed((SMBOemProcessorBusSpeed *)structHeader);
decodeOemProcessorBusSpeed(structHeader);
break;
//kSMBTypeOemPlatformFeature: // Type 133
//decodeOemPlatformFeature(structHeader);
//break;
case kSMBTypeEndOfTable: // Type 127
/* Skip, to be added at the end */
DBG("Handle 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length);
DBG("End of Table\n");
break;
default:
branches/ErmaC/Enoch/i386/libsaio/smbios.h
9898
9999
100100
101
101
102102
103103
104104
......
138138
139139
140140
141
141
142
142143
143144
144145
......
240241
241242
242243
243
244
245
244
245
246
246247
247248
248249
......
301302
302303
303304
304
305
305
306
306307
307308
308309
309310
310311
311
312
313
312
313
314
315
316
317
318
319
320
321
322
323
314324
325
326
327
315328
316329
317330
......
325338
326339
327340
328
329
330
341
342
343
331344
332345
333346
......
378391
379392
380393
381
394
382395
383396
384
397
385398
386399
387400
388401
389402
390
391
392
393
394
403
404
405
406
407
395408
396409
397410
......
462475
463476
464477
465
466
478
479
467480
468481
469482
......
572585
573586
574587
588
589
590
591
592
593
594
595
596
575597
576598
577599
// Port Connector Information (Type 8)
kSMBTypeSystemSlot= 9, // System Slots (Type 9)
// On Board Devices Information (Type 10) Obsolete
// kSMBOEMStrings= 11 ,// OEM Strings (Type 11)
kSMBOEMStrings= 11 ,// OEM Strings (Type 11)
// System Configuration Options (Type 12)
// BIOS Language Information (Type 13)
// Group Associations (Type 14)
kSMBTypeFirmwareVolume= 128, // FirmwareVolume (TYPE 128)
kSMBTypeMemorySPD= 130, // MemorySPD (TYPE 130)
kSMBTypeOemProcessorType= 131, // Processor Type (Type 131)
kSMBTypeOemProcessorBusSpeed= 132 //Processor Bus Speed (Type 132)
kSMBTypeOemProcessorBusSpeed= 132 // Processor Bus Speed (Type 132)
//kSMBTypeOemPlatformFeature= 133 // Platform Feature (Type 133)
};
/* =======================
SMBByte thermalState;// Thermal state of the enclosure when last booted
SMBByte securityStatus;// Physical security status of the enclosure when last booted
SMBDWord oemDefined;// OEM- or BIOS vendor-specific information
//SMBByte height;// Height of the enclosure, in 'U's
//SMBByte numberOfPowerCords;// Number of power cords associated with the enclosure or chassis
//SMBByte containedElementCount;// Number of Contained Element record that follow, in the range 0 to 255
SMBByte height;// Height of the enclosure, in 'U's
SMBByte numberOfPowerCords;// Number of power cords associated with the enclosure or chassis
SMBByte containedElementCount;// Number of Contained Element record that follow, in the range 0 to 255
//SMBByte containedElementRecord;// Byte leght of each Contained Element record that follow, in the range 0 to 255
//SMBBytecontainedElements;// Elements, possibly defined by other SMBIOS structures present in chassis
//SMBString skuNumber;// Number of null-terminated string describing the chassis or enclosure SKU number (2.7+)
SMBByte coreCount;
SMBByte coreEnabled;
SMBByte threadCount;
//SMBWord processorCharacteristics;
// 2.6+ spec
//SMBWord processorFuncSupport;
// 2.6+ spec (42 bytes)
//SMBWord processorFamily2;
} __attribute__((packed)) SMBProcessorInformation;
#define kSMBProcessorInformationMinSize 26
/* =======================================================================
Memory Controller Information (Type 5) Obsoleted since SMBIOS version 2.1
========================================================================= */
/* ========================================
Values for processorType in Type 4 records
======================================== */
enum
{
kSMBprocessorTypeOther = 0x01,
kSMBprocessorTypeUnknown = 0x02,
kSMBprocessorTypeCPU = 0x03,
kSMBprocessorTypeMPU = 0x04,
kSMBprocessorTypeDSP = 0x05,
kSMBprocessorTypeGPU = 0x06
};
/* ======================================================================
Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1
======================================================================== */
typedef struct SMBMemoryControllerInfo {
SMB_STRUCT_HEADER
SMBByteerrorDetectingMethod;
SMBBytenumberOfMemorySlots;
} __attribute__((packed)) SMBMemoryControllerInfo;
/* ===================================================================
Memory Module Information (Type 6) Obsoleted since SMBIOS version 2.1
===================================================================== */
/* ==================================================================
Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1
==================================================================== */
typedef struct SMBMemoryModule
{
SMB_STRUCT_HEADER // Type 6
SMBByte slotCharacteristics1;
// 2.1+ spec (13 bytes)
SMBByte slotCharacteristics2;
// 2.6+ spec
// 2.6+ spec (17 bytes)
//SMBWordsegmentGroupNumber;
//SMBBytebusNumber;
//SMBBytedevFuncNumber;
//SMBBytedeviceFunctionNumber;
} __attribute__((packed)) SMBSystemSlot;
/* ===================
OEM Strings (Type 11)
===================== */
//typedef struct SMBOEMStrings
//{
//SMB_STRUCT_HEADER // Type 11
//SMBBytecount;// number of strings
//} __attribute__((packed)) SMBOEMStrings;
typedef struct SMBOEMStrings
{
SMB_STRUCT_HEADER // Type 11
SMBBytecount;// number of strings
} __attribute__((packed)) SMBOEMStrings;
/* =============================
Physical Memory Array (Type 16)
SMBString serialNumber;
SMBString assetTag;
SMBString partNumber;
// 2.6+ spec
//SMBByte memoryAtributes;
// 2.6+ spec (28 bytes)
//SMBByte attributes;
// 2.7+ spec
//SMBDWord memoryExtSize;
//SMBWord confMemClkSpeed;
SMBWord ProcessorBusSpeed; // MT/s unit
} __attribute__((packed)) SMBOemProcessorBusSpeed;
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
struct SMBOemPlatformFeature
{
SMB_STRUCT_HEADER// Type 133
SMBWord PlatformFeature;
} __attribute__((packed)) SMBOemPlatformFeature;
//----------------------------------------------------------------------------------------------------------
/* From Foundation/Efi/Guid/Smbios/SmBios.h */
branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c
3333
3434
3535
36
36
3737
3838
3939
......
288288
289289
290290
291
291
292292
293293
294294
case CPU_MODEL_IVYBRIDGE_XEON:
case CPU_MODEL_IVYBRIDGE:
case CPU_MODEL_HASWELL:
case CPU_MODEL_HASWELL_MB:
case CPU_MODEL_HASWELL_SVR:
case CPU_MODEL_HASWELL_ULT:
case CPU_MODEL_CRYSTALWELL:
return true;
case CPU_MODEL_HASWELL:// 0x3C -
case CPU_MODEL_HASWELL_MB:// 0x3F -
case CPU_MODEL_HASWELL_SVR:// 0x3F -
case CPU_MODEL_HASWELL_ULT:// 0x45 -
case CPU_MODEL_CRYSTALWELL:// 0x46
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {

Archive Download the corresponding diff file

Revision: 2355