Chameleon

Chameleon Commit Details

Date:2014-01-29 20:27:24 (5 years 6 months ago)
Author:ErmaC
Commit:2361
Parents: 2360
Message:Merge latest DMI improvements from Bungo's branch.
Changes:
M/trunk/i386/libsaio/smbios.h
M/trunk/i386/libsaio/smbios_getters.c
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/libsaio/smbios_decode.c

File differences

trunk/i386/libsaio/smbios.c
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
315
326
316327
317328
318329
319330
320
321331
322332
323333
324334
325335
326336
327
328337
329
330338
331339
332340
......
352360
353361
354362
355
363
356364
357365
358366
359367
360368
361369
362
363370
364371
365372
......
371378
372379
373380
381
382
383
384
385
386
374387
375388
376389
......
502515
503516
504517
518
505519
506520
507521
508522
509523
510524
525
526
527
528
529
511530
512531
513532
......
520539
521540
522541
523
524
542
543
525544
526545
527546
......
585604
586605
587606
607
588608
589
590
609
610
591611
592612
593613
......
767787
768788
769789
790
770791
771792
772793
773794
774
795
775796
776797
777798
......
847868
848869
849870
871
872
873
850874
851875
852876
......
862886
863887
864888
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
882906
907
908
883909
884
910
885911
886912
887913
......
894920
895921
896922
923
924
925
926
897927
898928
899929
900930
901931
932
933
934
902935
903936
904937
905938
906939
907940
941
942
943
908944
909945
910946
......
920956
921957
922958
959
960
961
923962
924963
925964
......
9661005
9671006
9681007
1008
1009
1010
1011
1012
9691013
9701014
9711015
......
9881032
9891033
9901034
991
1035
1036
9921037
9931038
9941039
......
9961041
9971042
9981043
999
1044
10001045
10011046
10021047
......
10041049
10051050
10061051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
10071076
1008
1077
1078
1079
1080
1081
1082
10091083
1084
1085
10101086
1011
1087
1088
1089
10121090
10131091
10141092
10151093
10161094
10171095
1018
1096
1097
1098
10191099
10201100
10211101
......
11401220
11411221
11421222
1143
1223
11441224
11451225
11461226
#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
kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,NULL}, // SMcpumaximumclock
// Bungo
{kSMBTypeProcessorInformation,kSMBWord,getFieldOffset(SMBProcessorInformation, currentClock),
kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentspeed
kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentclock
{kSMBTypeProcessorInformation,kSMBByte,getFieldOffset(SMBProcessorInformation, processorUpgrade),
kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, serialNumber),
kSMBProcessorInformationSerialNumberKey, NULL, NULL},
// Bungo
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),
kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, partNumber),
kSMBProcessorInformationPartNumberKey, NULL, NULL},
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 kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B00.1102091756"
#define kDefaultiMacSandyBIOSReleaseDate"01/02/08"
#define kDefaultiMacSandyBoardProduct"Mac-942B5BF58194151B"
// iMac12,2 Mac-942B59F58194171B
//#define kDefaultiMacSandy"iMac12,2"
//#define kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B1D.1110171110"
//#define kDefaultiMacSandyBIOSReleaseDate"10/17/11"
//#define kDefaultiMacSandyBoardProduct"Mac-942B59F58194171B"
// iMac13,1
// Bios: IM131.88Z.010A.B05.1211151146
// Data: 11/15/2012
// Board: Mac-00BE6ED71E35EB86
// iMac13,2
//#define kDefaultiMacIvy"iMac13,2"
//#define kDefaultiMacIvyBIOSVersion" IM131.88Z.00CE.B00.1203281326"
//#define kDefaultMacProBoardType"0xB" // 11
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B02.0801021250"
#define kDefaultMacProBIOSReleaseDate"01/02/08"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
#define kDefaultMacProBIOSReleaseDate"08/03/2010"
//#define kDefaultMacProSystemVersion"1.3"
#define kDefaultMacProBoardProduct"Mac-F42C88C8"
//#define KDefaultMacProBoardSerialNumber"J593902RA4MFE"
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
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing
if (PlatformType == 2) // this method works but it's a substitute
{
if (Platform.CPU.NoCores > 1) {
defaultSystemInfo.productName = kDefaultMacBookPro;
strSize = strlen(string);
/* Bungo: What was this for?
// remove any spaces found at the end
while ((strSize != 0) && (string[strSize - 1] == ' ')) {
strSize--;
}
*/
if (strSize == 0) {
*field = 0;
return;
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;
// 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 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;
structureCount++;
}
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
/*void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) { }*/
//-------------------------------------------------------------------------------------------------------------------------
// EndOfTable
//-------------------------------------------------------------------------------------------------------------------------
SMBWord structSize;
int i;
/* http://forge.voodooprojects.org/p/chameleon/issues/361/ */
/* Bungo: not needed because of tables lengths fix in next lines
// http://forge.voodooprojects.org/p/chameleon/issues/361/
bool forceFullMemInfo = false;
if (structPtr->orig->type == kSMBTypeMemoryDevice) {
if (forceFullMemInfo) {
structPtr->orig->length = 27;
}
}
}*/
stringIndex = 1;
stringsSize = 0;
if (handle < structPtr->orig->handle) {
handle = structPtr->orig->handle;
}
// Bungo: fix unsuported tables lengths from original smbios: extend smaller or truncate bigger - we use SMBIOS rev. 2.4 like Apple uses
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 < structPtr->orig->length)) {
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->orig->length;
ptr = (uint8_t *)structPtr->new + structPtr->new->length;
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0) {
{
SMBStructPtrs *structPtr;
uint8_t *buffer;
// bool setSMB = true; Bungo
// bool setSMB = true; Bungo: now we use useSMBIOSdefaults
if (!origeps) {
return;
trunk/i386/libsaio/smbios_decode.c
2121
2222
2323
24
25
26
27
28
29
3024
31
3225
3326
3427
3528
36
3729
30
3831
32
33
34
35
3936
40
41
42
43
44
45
46
47
48
49
50
51
52
5337
5438
5539
......
123107
124108
125109
110
111
112
113
114
115
116
117
118
119
120
121
122
126123
127124
128
125
129126
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
173
174
127
128
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
175172
176173
177174
......
210207
211208
212209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
213230
214231
215232
216
233
217234
218
219
220
221
222
223
224
225
226
227
228
229
230
231
235
236
237
238
239
240
241
242
243
244
245
246
247
248
232249
233250
234251
235252
236253
237254
238
255
239256
240
241
242
243
244
245
246
247
257
258
259
260
261
262
263
264
265
266
267
268
269
248270
249
250
251
252
253
254
255
256
257
258
259
260
261
271
262272
263273
264
274
265275
266
267
268
269
270
271
276
277
272278
273279
274280
275281
276282
277283
278
284
279285
280
281
282
283
284
285
286
287
288
289
286
287
288
289
290
291
292
293
294
295
296
290297
291298
292
299
293300
294
295
301
302
296303
297304
298305
299306
300307
301308
302
309
303310
304
305
306
307
311
312
313
314
308315
309316
310
317
311318
312
313
314
315
316
317
318
319
320
321
322
323
324
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
325334
326335
327336
328337
329338
330339
331
340
332341
333
334
335
336
337
338
339
340
341
342
343
344
345
346
342
343
344
345
346
347
348
347349
348
349
350
351
352
353
354
355
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
356381
357382
358383
359384
360385
361386
362
387
363388
364
389
365390
366391
367392
368
393
369394
370395
371396
......
375400
376401
377402
378
379
380
381
382
383
384
385
403
404
405
406
407
408
409
410
411
412
413
414
386415
387416
388417
389418
390
419
391420
392
393
394
395
421
422
423
424
425
426
427
428
429
430
431
432
396433
397434
398
435
399436
400
401
402
403
404
405
406
407
408
437
438
439
440
441
442
443
444
409445
410446
411447
412448
413
449
414450
415
451
416452
417
453
454
418455
419456
420457
421458
422
459
460
461
462
423463
424
425
426
427
464
465
466
428467
429468
469
470
430471
472
473
474
475
476
477
478
479
480
431481
482
483
484
485
486
487
488
489
490
491
432492
493
494
495
433496
434497
435498
......
443506
444507
445508
446
509
447510
448511
449512
450
451
452
453513
454514
455515
456
516
457517
458518
459519
460
520
461521
462522
463523
464
524
465525
466526
467527
468
528
469529
470530
471531
472
532
473533
474534
475535
476
536
477537
478538
479539
480
540
481541
482542
483
484
485
543
544
545
486546
487547
488
548
489549
490550
491551
492552
493553
494554
495
496
497
555
556
557
498558
499559
500
560
501561
502562
503563
504
564
505565
506566
507567
508
568
509569
510570
511571
512
572
573
513574
514575
515576
#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 OutOfSpecStr "<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
};*/
"Other", /* 01h */
"Unknown", /* 02h */
"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");
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;
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]);
}
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", OutOfSpecStr);
} 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");
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", OutOfSpecStr);
} 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");
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", OutOfSpecStr);
} 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");
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 < 3 || structHeader->header.length < 35) {
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", OutOfSpecStr);
} else {
DBG("\tType: %s\n", SMBProcessorTypes[((SMBProcessorInformation *)structHeader)->processorType - 1]);
}
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));
//DBG("\tCore Count: %d\n", structHeader->coreCount);
//DBG("\tCore Enabled: %d\n", structHeader->coreEnabled);
//DBG("\tThread Count: %d\n", structHeader->threadCount);
//DBG("\tProcessor Family 2: %d\n", structHeader->processorFamily2);
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", OutOfSpecStr);
} else {
DBG("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]);
}
// 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");
//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");
//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");
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", OutOfSpecStr);
} 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 kSMBTypeMemoryModule: // Type 6
//decodeMemoryModule((SMBMemoryModule *)structHeader);
//decodeMemoryModule(structHeader);
//break;
//case kSMBTypeSystemSlot: // Type 9
//decodeSMBTypeSystemSlot((SMBOEMStrings *)structHeader);
//decodeSMBTypeSystemSlot(structHeader);
//break;
//case kSMBOEMStrings: // Type 11
//decodeSMBOEMStrings((SMBOEMStrings *)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:
trunk/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
247
248
248249
249250
250251
......
298299
299300
300301
301
302
303
302
303
304
304305
305306
306307
......
308309
309310
310311
311
312
313
312
313
314
315
316
317
318
319
320
321
322
323
314324
315
316
317
318
319
320
321
322
323
324
325
326
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
327340
328
329
330
341
342
343
331344
332345
333346
......
387400
388401
389402
390
391
392
393
394
403
404
405
406
407
395408
396409
397410
......
577590
578591
579592
580
593
581594
582595
583596
// 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
//SMBByte containedElements;// 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+)
} __attribute__((packed)) SMBSystemEnclosure;
SMBString assetTag;
SMBString partNumber;
// 2.5+ spec (40 bytes)
//SMBByte coreCount;
//SMBByte coreEnabled;
//SMBByte threadCount;
SMBByte coreCount;
SMBByte coreEnabled;
SMBByte threadCount;
//SMBWord processorFuncSupport;
// 2.6+ spec (42 bytes)
//SMBWord processorFamily2;
#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
};
//typedef struct SMBMemoryControllerInfo {
//SMB_STRUCT_HEADER
//SMBByteerrorDetectingMethod;
//SMBByteerrorCorrectingCapability;
//SMBBytesupportedInterleave;
//SMBBytecurrentInterleave;
//SMBBytemaxMemoryModuleSize;
//SMBWordsupportedSpeeds;
//SMBWordsupportedMemoryTypes;
//SMBBytememoryModuleVoltage;
//SMBBytenumberOfMemorySlots;
//} __attribute__((packed)) SMBMemoryControllerInfo;
/* ======================================================================
Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1
======================================================================== */
typedef struct SMBMemoryControllerInfo {
SMB_STRUCT_HEADER
SMBByteerrorDetectingMethod;
SMBByteerrorCorrectingCapability;
SMBBytesupportedInterleave;
SMBBytecurrentInterleave;
SMBBytemaxMemoryModuleSize;
SMBWordsupportedSpeeds;
SMBWordsupportedMemoryTypes;
SMBBytememoryModuleVoltage;
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
/* ===================
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)
================================================ */
struct SMBOemPlatformFeature
{
SMB_STRUCT_HEADER
SMB_STRUCT_HEADER// Type 133
SMBWord PlatformFeature;
} __attribute__((packed)) SMBOemPlatformFeature;
trunk/i386/libsaio/smbios_getters.c
136136
137137
138138
139
139
140140
141
141
142142
143143
144
144
145145
146146
147147
......
162162
163163
164164
165
165
166166
167167
168168
169169
170
170
171171
172172
173173
174
174
175175
176176
177177
178178
179179
180
180
181181
182182
183183
......
186186
187187
188188
189
190
191
192
193
194
195
196
197189
190
198191
199
192
193
200194
201
202
195
196
197
203198
204199
205200
201
206202
207
208
209
210
211
212
213
214
215
216203
217
204
205
218206
219207
220
208
221209
222210
223211
224212
213
214
215
216
217
218
225219
226
220
221
227222
228223
229
224
225
230226
231
232
233
234227
235
228
229
236230
237231
238
232
239233
240234
241235
242
243
244
245
246
247
248
249
250
251
252236
253237
254238
255
239
240
256241
257242
258
243
244
259245
260246
261
247
248
262249
263250
264
251
252
265253
266254
267
255
268256
269257
270258
271259
260
261
262
263
272264
273
265
266
274267
275268
276
269
270
277271
278272
279
273
274
280275
281276
282
277
283278
284279
285280
286
287
281
282
288283
289284
290285
291286
292287
293288
289
290
291
292
294293
295
294
295
296296
297297
298
298
299
299300
300301
301
302
303
302304
303305
304
306
305307
306308
307309
308310
309
311
310312
311313
312314
313315
314
316
315317
316318
317319
uint16_t simpleGetSMBOemProcessorType(void)
{
if (Platform.CPU.NoCores >= 4) {
return 0x0501;// Quad-Core Xeon
return 0x501;// 1281 - Quad-Core Xeon
} else if (Platform.CPU.NoCores == 1) {
return 0x0201;// Core Solo
return 0x201;// 513 - Core Solo
};
return 0x0301;// Core 2 Duo
return 0x301;// 769 - Core 2 Duo
}
bool getSMBOemProcessorType(returnType *value)
switch (Platform.CPU.Model) {
case CPU_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
value->word = 0x101;
value->word = 0x101;// 257
return true;
case CPU_MODEL_YONAH:// 0x0E - Intel Mobile Core Solo, Duo
case CPU_MODEL_CELERON:
value->word = 0x201;
value->word = 0x201;// 513
return true;
case CPU_MODEL_XEON_MP:// 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm
value->word = 0x401;
value->word = 0x401;// 1025
return true;
case CPU_MODEL_MEROM:// 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPU_MODEL_PENRYN:// 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x402;// Xeon
value->word = 0x402;// 1026 - Xeon
}
case CPU_MODEL_PENTIUM_M:// 0x09 - Banias
case CPU_MODEL_LINCROFT:// 0x27 - Intel Atom, "Lincroft", 45nm
case CPU_MODEL_NEHALEM_EX:// 0x2E - Nehalem-ex, "Beckton", 45nm
case CPU_MODEL_NEHALEM:// 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x701;// Core i7
}
return true;
case CPU_MODEL_FIELDS:// 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPU_MODEL_DALES:// 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale)
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Lynnfiled Quad-Core Xeon
value->word = 0x501;// 1281 - Lynnfiled Quad-Core Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x701;// Core i7
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x901;// 2305 - Core i3
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x601;// Core i5
return true;
}
return true;
case CPU_MODEL_DALES:// 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale)
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x901;// Core i3
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x602;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x702;// Core i7
value->word = 0x701;// 1793 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x602;// Core i5
value->word = 0x601;// 1537 - Core i5
}
return true;
case CPU_MODEL_DALES_32NM:// 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale)
case CPU_MODEL_WESTMERE:// 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPU_MODEL_WESTMERE_EX:// 0x2F - Intel Xeon E7
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// 1281 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x901;// Core i3
value->word = 0x901;// 2305 - Core i3
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x601;// Core i5
value->word = 0x602;// 1538 - Core i5
return true;
}
if(strstr(Platform.CPU.BrandString, "Core(TM) i5 CPU M 540")) {
value->word = 0x602;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x701;// Core i7
value->word = 0x702;// 1794 -Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x602;// Core i5
value->word = 0x602;// 1538 - Core i5
}
return true;
case CPU_MODEL_WESTMERE:// 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPU_MODEL_WESTMERE_EX:// 0x2F - Intel Xeon E7
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x701;// Core i7
}
return true;
case CPU_MODEL_JAKETOWN:// 0x2D - Intel Core i7, Xeon E5-xxxx LGA2011 (32nm)
case CPU_MODEL_SANDYBRIDGE:// 0x2A - Intel Core i3, i5, i7 LGA1155 (32nm)
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Xeon
value->word = 0x501;// 1281 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x903;// Core i3
value->word = 0x902;// 2306 -Core i3
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x603;// Core i5
value->word = 0x603;// 1539 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x703;// Core i7
value->word = 0x703;// 1795 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x603;// Core i5
value->word = 0x603;// 1539 - Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE:// 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm)
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0xA01;// 2561 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x903;// Core i3 - Apple doesn't use it
value->word = 0x903;// 2307 - Core i3 - Apple doesn't use it
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x604;// Core i5
value->word = 0x604;// 1540 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x704;// Core i7
value->word = 0x704;// 1796 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x604;// Core i5
value->word = 0x604;// 1540 - Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE_XEON:// 0x3E - Mac Pro 6,1 - shouldn't be Sandy Bridge EP refering to intel spec.?
value->word = 0xA01;
case CPU_MODEL_IVYBRIDGE_XEON:// 0x3E - Mac Pro 6,1
value->word = 0xA01;// 2561
return true;
case CPU_MODEL_HASWELL:// 0x3C -
case CPU_MODEL_HASWELL_SVR:// 0x3F -
case CPU_MODEL_HASWELL_ULT:// 0x45 -
case CPU_MODEL_CRYSTALWELL:// 0x46
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0xA01;// 2561 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x905;// Core i3 - Apple doesn't use it
value->word = 0x904;// 2308 - Core i3 - Apple doesn't use it - but we yes:-)
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x605;// Core i5
value->word = 0x605;// 1541 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x705;// Core i7
value->word = 0x705;// 1797 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x605;// Core i5
value->word = 0x605;// 1541 - Core i5
}
return true;
case 0x15:// EP80579 integrated processor
value->word = 0x301;//
value->word = 0x301;// 769
return true;
case 0x13:// Core i5, Xeon MP, "Havendale", "Auburndale", 45nm
case 0x19:// Intel Core i5 650 @3.20 Ghz
value->word = 0x601;// Core i5
value->word = 0x601;// 1537 - Core i5
return true;
default:
break; //Unsupported CPU type

Archive Download the corresponding diff file

Revision: 2361