Chameleon

Chameleon Commit Details

Date:2014-01-09 13:07:33 (5 years 11 months ago)
Author:ErmaC
Commit:2325
Parents: 2324
Message:Merge latest Bungo's improvements for SMBIOS
Changes:
M/trunk/i386/libsaio/smbios.h
M/trunk/i386/libsaio/fake_efi.c
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
118118
119119
120120
121
122
123
124
125121
126
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
122
206123
207124
208125
......
246163
247164
248165
249
166
250167
251168
252169
253
170
254171
255172
256173
257174
175
176
177
178
179
180
181
182
183
184
185
258186
259187
260188
......
262190
263191
264192
265
266
267
193
268194
269195
270196
......
283209
284210
285211
286
287
212
288213
289214
290215
......
301226
302227
303228
229
230
231
232
233
234
235
304236
305237
306238
307239
308
309
310240
311241
312242
......
318248
319249
320250
321
251
322252
323253
324254
325
255
326256
327257
328258
......
333263
334264
335265
336
337
266
267
268
269
270
271
338272
339273
340
274
341275
342276
343277
344278
345
279
346280
347
348
281
282
349283
350284
351285
352286
353287
354
288
355289
356290
357
291
358292
359
360293
361294
362295
......
386319
387320
388321
389
322
390323
391324
392325
......
441374
442375
443376
444
445
377
378
446379
447380
448381
......
452385
453386
454387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
455564
456565
566
567
457568
458
569
459570
460571
461
462
463572
464573
465574
466575
467576
468
577
469578
470579
471
472
473
474
475
580
581
476582
477
583
584
585
586
587
588
478589
479590
480591
481
482592
483
593
594
595
596
597
598
484599
485600
486601
487
488602
489
603
604
605
606
607
608
490609
491610
492611
......
494613
495614
496615
497
498
499
616
617
618
619
620
621
622
500623
501624
502625
503
504
505
626
627
628
629
630
631
632
506633
507634
508635
......
516643
517644
518645
646
519647
520648
649
650
651
521652
522653
523654
524655
656
525657
658
526659
527
660
661
662
663
528664
665
529666
530667
531
668
669
532670
533
671
672
673
674
534675
535676
536677
537678
538679
539
540
680
681
541682
542
683
684
685
686
543687
544688
545689
546
690
691
547692
548
693
694
695
696
549697
550698
551699
552700
553701
554702
703
555704
556705
706
707
708
557709
558710
559711
......
685837
686838
687839
688
689840
690841
691
842
843
692844
693
694
845
695846
696847
697848
......
762913
763914
764915
765
916
766917
767918
768919
......
9791130
9801131
9811132
982
1133
9831134
9841135
9851136
......
10841235
10851236
10861237
1087
1088
1238
1239
10891240
10901241
10911242
......
11091260
11101261
11111262
1112
1263
11131264
11141265
11151266
......
11551306
11561307
11571308
1158
1309
11591310
11601311
11611312
11621313
1163
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
11641335
11651336
11661337
=================================================== */
#define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed
//-------------------------------------------------------------------------------------------------------------------------
// Default SMBIOS Data
//-------------------------------------------------------------------------------------------------------------------------
/* Rewrite: use a struct */
#define kDefaultVendorManufacturer"Apple Inc."
#define kDefaultBIOSReleaseDate"11/06/2009"
#define kDefaultSerialNumber"SOMESRLNMBR"
#define kDefaultskuNumber"Default System SKU#"
#define kDefaultBoardProduct"Mac-F4208DC8"
#define kDefaultBoardType"10" // 0xA
#define kDefaultSystemVersion"1.0"
//Bungo
/* 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0) */
#define kDefaultBIOSRelease 256
#define KDefaultBoardSerialNumber"C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H
#define KDefaultBoardAssetTagNumber"Pro-Enclosure" // ErmaC
#define kDefaultLocatioInChassis"Part Component" // ErmaC
//=========== Mac mini ===========
#define kDefaultMacminiFamily"Macmini"
#define kDefaultMacmini"Macmini1,1"
#define kDefaultMacminiBIOSVersion" MM21.88Z.009A.B00.0903051113"
// MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309
// MacMini5,2 Mac-4BC72D62AD45599E
// MacMini5,3
// MacMini 6,1 - Mac-F65AE981FFA204ED
// MacMini 6,2
//#define kDefaultMacmini62"Macmini6,2"
//#define kDefaultMacmini62BIOSVersion" MM61.88Z.0106.B00.1208091121"
//#define kDefaultMacmini62BoardProduct"Mac-F65AE981FFA204ED"
//#define kDefaultMacmini62BIOSReleaseDate"10/14/2012"
//=========== MacBook ===========
#define kDefaultMacBookFamily"MacBook"
#define kDefaultMacBook"MacBook4,1"
#define kDefaultMacBookBIOSVersion" MB41.88Z.0073.B00.0903051113"
//=========== MacBookAir ===========
// MacBookAir4,1 - Mac-C08A6BB70A942AC2
// MacBookAir4,2 - Mac-742912EFDBEE19B3
// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229
// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442
//=========== MacBookPro ===========
#define kDefaultMacBookProFamily"MacBookPro"
#define kDefaultMacBookPro"MacBookPro4,1"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.0073.B00.0903051113"
// MacBookPro8,1 - Mac-94245B3640C91C81 - MBP81.88Z.0047.B24.1110141131
// MacBookPro8,2 - Mac_94245A3940C91C80
// MacBookPro8,3 - Mac-942459F5819B171B
// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B02.1310181745
// MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745
//=========== iMac ===========
#define kDefaultiMacFamily"iMac"
#define kDefaultiMac"iMac8,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
// iMac10,1
// iMac11,1 core i3/i5/i7
#define kDefaultiMacNehalem"iMac11,1"
#define kDefaultiMacNehalemBIOSVersion" IM111.88Z.0034.B00.0903051113"
// iMac11,2
// iMac11,3
// defaults for an iMac12,1
#define kDefaultiMacSandy"iMac12,1"
#define kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B00.1102091756"
//=========== MacPro ===========
#define kDefaultMacProFamily"MacPro"
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
// defaults for a Mac Pro 4,1 core i7/Xeon
#define kDefaultMacProNehalem"MacPro4,1"
#define kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B08.1001221313"
// defaults for a Mac Pro 5,1 core i7/Xeon
#define kDefaultMacProWestmere"MacPro5,1"
#define kDefaultMacProWestmereBIOSVersion" MP51.88Z.007F.B03.1010071432"
#define kDefaultMacProWestmereBIOSReleaseDate"10/07/2010"
// defaults for a Mac Pro 6,1
// MacPro6,1 - Mac-F60DEB81FF30ACF6 - MP61.88Z.0116.B00.1311020956
//-------------------------------------------------------------------------------------------------------------------------
/* ==================================================*/
#define getFieldOffset(struct, field)((uint8_t)(uint32_t)&(((struct *)0)->field))
typedef struct
{
char *manufacturer;
char *product;
char *productName;// ErmaC
char *version;// Bungo
char *serialNumber;// ErmaC
char *assetTagNumber;// ErmaC
char *locationInChassis;// ErmaC
char *boardType;// ErmaC
uint8_t boardType;// ErmaC
} defaultBaseBoard_t;
defaultBaseBoard_t defaultBaseBoard;
// Bungo
typedef struct {
char *manufacturer;
uint8_t chassisType;
char *version;
char *serialNumber;
char *assetTagNumber;
} defaultChassis_t;
defaultChassis_t defaultChassis;
typedef struct
{
uint8_ttype;
uint8_tfieldOffset;
char*keyString;
bool(*getSMBValue)(returnType *);
// Bungo
// char**defaultValue;
void*defaultValue;
char**defaultValue;
} SMBValueSetter;
SMBValueSetter SMBSetters[] =
// Bungo
{ kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor),
kSMBBIOSInformationReleaseKey, NULL,&defaultBIOSInfo.release }, // SMbiosrelease - 256
//
kSMBBIOSInformationReleaseKey, NULL,(char **)&defaultBIOSInfo.release }, // SMbiosrelease - 0.1 (256)
/* =========================
System Information (Type 1)
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, serialNumber),
kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number
/*{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),
kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU#
//
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, family),
kSMBSystemInformationFamilyKey,NULL,&defaultSystemInfo.family}, // SMfamily - MacPro
kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMboardmanufacturer - Apple Inc.
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, product),
kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product}, // SMboardproduct - Mac-F2268DC8
kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product }, // SMboardproduct - Mac-F2268DC8
// Bungo
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, version),
kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.productName}, // SMboardproductname - MacPro3,1
kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version }, // SMboardversion - MacPro3,1
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, serialNumber),
kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),
kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component
{kSMBTypeBaseBoard,kSMBByte, getFieldOffset(SMBBaseBoard, boardType),
kSMBBaseBoardTypeKey,NULL, &defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
{kSMBTypeBaseBoard,kSMBByte,getFieldOffset(SMBBaseBoard, boardType),
kSMBBaseBoardTypeKey,NULL, (char **)&defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
/*{kSMBTypeBaseBoard,kSMBByte, getFieldOffset(SMBBaseBoard, numberOfContainedHandles),
NULL , NULL, NULL }, // numberOfContainedHandles = 0
*/
//
// Bungo
// Bungo
/* =======================
System Enclosure (Type 3)
========================= */
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, manufacturer),
kSMBSystemEnclosureManufacturerKey, NULL,&defaultBaseBoard.manufacturer }, // SMchassismanufacturer - Apple Inc.
kSMBSystemEnclosureManufacturerKey, NULL,&defaultChassis.manufacturer }, // SMchassismanufacturer - Apple Inc.
{kSMBTypeSystemEnclosure, kSMBByte,getFieldOffset(SMBSystemEnclosure, type),
kSMBSystemEnclosureTypeKey, NULL, &defaultBaseBoard.boardType}, // SMchassistype - 7
{kSMBTypeSystemEnclosure, kSMBByte,getFieldOffset(SMBSystemEnclosure, chassisType),
kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType}, // SMchassistype - 7
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, version),
kSMBSystemEnclosureVersionKey, NULL, &defaultBaseBoard.product }, // SMchassisversion - Mac-F42C88C8
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, serialNumber),
kSMBSystemEnclosureSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMchassisserial
kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber }, // SMchassisserial
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTagNumber),
kSMBSystemEnclosureAssetTagNumberKey, NULL, &defaultBaseBoard.assetTagNumber }, // SMchassisassettag - Pro Enclosure
kSMBSystemEnclosureAssetTagNumberKey, NULL, &defaultChassis.assetTagNumber }, // SMchassisassettag - Pro Enclosure
/* ============================
Processor Information (Type 4)
============================== */
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, serialNumber),
NULL, NULL, NULL},
// Bungo
// Bungo
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),
kSMBProcessorInformationAssetTagNumberKey, NULL, NULL}, // SMcpuassettag
int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter);
SMBEntryPoint *origeps= 0;
SMBEntryPoint *neweps= 0;
SMBEntryPoint *origeps= 0;
SMBEntryPoint *neweps= 0;
static uint8_t stringIndex;// increament when a string is added and set the field value accordingly
static uint8_t stringsSize;// add string size
static SMBWord maxStructSize= 0;
static SMBWord structureCount= 0;
//-------------------------------------------------------------------------------------------------------------------------
// Default SMBIOS Data
//-------------------------------------------------------------------------------------------------------------------------
/* Rewrite: use a struct */
// Bungo: suggest to not mixing data from different Mac models, use real Mac SMBIOS dumps
#define kDefaultVendorManufacturer"Apple Inc."
//#define kDefaultBIOSReleaseDate"11/06/2009"
#define kDefaultSerialNumber"SOMESRLNMBR"
//Bungo
#define kDefaultSkuNumber"Default SKU#"
#define kDefaultAssetTagNumber"Default Asset Tag#"
//#define kDefaultBoardType"10" // 0xA
//#define kDefaultBoardProcessorType"11" // 0xB
#define kDefaultSystemVersion"1.0"
#define kDefaultBIOSRelease256 // 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0)
//#define kDefaultLocatioInChassis"Part Component"
//#define KDefaultBoardSerialNumber"C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H
//=========== Mac mini ===========
#define kDefaultMacMiniFamily"Mac mini"
//#define kDefaultMacMiniBoardAssetTagNumber"Mini-Aluminum"
#define kDefaultMacMini"Macmini2,1"
#define kDefaultMacMiniBIOSVersion" MM21.88Z.009A.B00.0706281359"
#define kDefaultMacMiniBIOSReleaseDate"06/28/07"
#define kDefaultMacMiniBoardProduct"Mac-F4208EAA"
// MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309
// MacMini5,2 Mac-4BC72D62AD45599E
// MacMini5,3
//#define kDefaultMacMini"Macmini5,3"
//#define kDefaultMacMiniBIOSVersion" MM51.88Z.0077.B10.1201241549"
//#define kDefaultMacMiniBoardProduct"Mac-F65AE981FFA204ED"
//#define kDefaultMacMiniBIOSReleaseDate"01/24/2012"
// MacMini 6,1 - Mac-F65AE981FFA204ED
// MacMini 6,2
//#define kDefaultMacMini62"Macmini6,2"
//#define kDefaultMacMini62BIOSVersion" MM61.88Z.0106.B00.1208091121"
//#define kDefaultMacMini62BoardProduct"Mac-F65AE981FFA204ED"
//#define kDefaultMacMini62BIOSReleaseDate"10/14/2012"
//=========== MacBook ===========
#define kDefaultMacBookFamily"MacBook"
//#define kDefaultMacBookBoardAssetTagNumber"MacBook-Black"
#define kDefaultMacBook"MacBook4,1"
#define kDefaultMacBookBIOSVersion" MB41.88Z.00C1.B00.0802091535"
#define kDefaultMacBookBIOSReleaseDate"02/09/08"
#define kDefaultMacBookBoardProduct"Mac-F22788A9"
//=========== MacBookAir ===========
#define kDefaultMacBookAirFamily"MacBook Air"
// MacBookAir4,1 - Mac-C08A6BB70A942AC2
// MacBookAir4,2 - Mac-742912EFDBEE19B3
#define kDefaultMacBookAir"MacBookAir5,2"
#define kDefaultMacBookAirBIOSVersion" MBA51.88Z.00EF.B00.1205221442"
#define kDefaultMacBookAirBIOSReleaseDate"05/10/12"
#define kDefaultMacBookBoardAirProduct"Mac-2E6FAB96566FE58C"
// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229
// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442
//=========== MacBookPro ===========
#define kDefaultMacBookProFamily"MacBook Pro"
//#define kDefaultMacBookProBoardAssetTagNumber"MacBook-Aluminum"
#define kDefaultMacBookPro"MacBookPro4,1"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.0073.B00.0903051113"
#define kDefaultMacBookProBIOSReleaseDate"02/27/08"
#define kDefaultMacBookProBoardProduct"Mac-F42C89C8"
//#define kDefaultMacBookPro"MacBookPro8,1"
//#define kDefaultMacBookProBIOSVersion" MBP81.88Z.0047.B24.1110141131"
//#define kDefaultMacBookProBoardProduct"Mac-94245B3640C91C81"
//#define kDefaultMacBookProBIOSReleaseDate"10/14/11"
// MacBookPro8,2 - Mac_94245A3940C91C80
// MacBookPro8,3 - Mac-942459F5819B171B
// MacBookPro10,2
//#define kDefaultMacBookProIvy"MacBookPro10,2"
//#define kDefaultMacBookProIvyBIOSVersion" MBP102.88Z.0106.B01.1208311637"
//#define kDefaultMacBookProIvyBoardProduct"Mac-AFD8A9D944EA4843"
//#define kDefaultMacBookProIvyBIOSReleaseDate"10/02/2012"
// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B02.1310181745
// MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745
//=========== iMac ===========
#define kDefaultiMacFamily"iMac"
//#define kDefaultiMacBoardAssetTagNumber"iMac-Aluminum"
#define kDefaultiMac"iMac8,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
#define kDefaultiMacBIOSReleaseDate"02/09/08"
#define kDefaultiMacBoardProduct"Mac-F227BEC8"
// iMac10,1
// iMac11,1 core i3/i5/i7
#define kDefaultiMacNehalem"iMac11,1"
#define kDefaultiMacNehalemBIOSVersion" IM111.88Z.0034.B02.1003171314"
#define kDefaultiMacNehalemBIOSReleaseDate"10/30/09"
#define kDefaultiMacNehalemBoardProduct"Mac-F2268DAE"
// iMac11,2
// iMac11,3
// iMac12,1
#define kDefaultiMacSandy"iMac12,1"
#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/2011"
//#define kDefaultiMacSandyBoardProduct"Mac-942B59F58194171B"
// iMac13,2
//#define kDefaultiMacIvy"iMac13,2"
//#define kDefaultiMacIvyBIOSVersion" IM131.88Z.00CE.B00.1203281326"
//#define kDefaultiMacIvyBIOSReleaseDate"03/28/2012"
//#define kDefaultiMacIvyBoardProduct"Mac-FC02E91DDD3FA6A4"
//=========== MacPro ===========
#define kDefaultMacProFamily"Mac Pro"
//#define KDefauktMacProBoardAssetTagNumber"Pro-Enclosure"
//#define kDefaultMacProBoardType"0xB" // 11
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
#define kDefaultMacProBIOSReleaseDate"08/03/2010"
//#define kDefaultMacProSystemVersion"1.3"
#define kDefaultMacProBoardProduct"Mac-F2268DC8"
//#define KDefaultMacProBoardSerialNumber"J593902RA4MFE"
// Mac Pro 4,1 core i7/Xeon
#define kDefaultMacProNehalem"MacPro4,1"
#define kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B04.0903051113"
#define kDefaultMacProNehalemBIOSReleaseDate"11/06/2009"
//#define kDefaultMacProNehalemSystemVersion"1.4"
#define kDefaultMacProNehalemBoardProduct"Mac-F4238CC8"
//#define KDefaultMacProNehalemBoardSerialNumber"J593004RB1LUE"
// Mac Pro 5,1 core i7/Xeon
#define kDefaultMacProWestmere"MacPro5,1"
#define kDefaultMacProWestmereBIOSVersion" MP51.88Z.007F.B03.1010071432"
#define kDefaultMacProWestmereBIOSReleaseDate"10/07/10"
//#define kDefaultMacProWestmereSystemVersion"1.2"
#define kDefaultMacProWestmereBoardProduct"Mac-F221BEC8"
//#define KDefaultMacProWestmereBoardSerialNumber"J522700H7BH8C"
// Mac Pro 6,1
#define kDefaultMacProHaswell"MacPro6,1"
#define kDefaultMacProHaswellBIOSVersion" MP61.88Z.0116.B00.1311020956"
#define kDefaultMacProHaswellBIOSReleaseDate"06/12/13"
//#define kDefaultMacProHaswellSystemVersion"1.?"
#define kDefaultMacProHaswellBoardProduct"Mac-F60DEB81FF30ACF6"
//#define KDefaultMacProHaswellBoardSerialNumber"?????????????"
//#define KDefaultBoardSerialNumber"C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H
// J593902RA4MFE 3,1
// J5031046RCZJA 5,1
// J521101A5CZJC 3,1
// J593004RB1LUE MacPro4,1
// J513401PZBH8C 5,1
// J590802LC4ACB 3,1
// J594900AH1LUE 4,1
// J512500HZBH8C 5,1
// J522700H7BH8C MacPro5,1
/* ============================================ */
bool useSMBIOSdefaults = true; // Bungo
SMBByte PlatformType= 3; // Bungo: same as Platfom.Type in platform.h
/* Rewrite this function */
void setDefaultSMBData(void)
void setDefaultSMBData(void) // Bungo: setting data from real Macs
{
defaultBIOSInfo.vendor = kDefaultVendorManufacturer;
defaultBIOSInfo.releaseDate = kDefaultBIOSReleaseDate;
defaultBIOSInfo.release = kDefaultBIOSRelease; // Bungo
defaultSystemInfo.manufacturer = kDefaultVendorManufacturer;
defaultSystemInfo.version = kDefaultSystemVersion;
defaultSystemInfo.serialNumber = kDefaultSerialNumber;
defaultSystemInfo.skuNumber = kDefaultskuNumber; // Bungo
defaultSystemInfo.skuNumber = kDefaultSkuNumber; // Bungo
defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;
defaultBaseBoard.product = kDefaultBoardProduct;
defaultBaseBoard.boardType = kDefaultBoardType;// ErmaC
defaultBaseBoard.serialNumber = KDefaultBoardSerialNumber;// ErmaC
defaultBaseBoard.assetTagNumber = KDefaultBoardAssetTagNumber;// ErmaC
defaultBaseBoard.locationInChassis = kDefaultLocatioInChassis;// ErmaC
defaultBaseBoard.serialNumber = kDefaultSerialNumber;
defaultBaseBoard.assetTagNumber = kDefaultAssetTagNumber;
if (platformCPUFeature(CPU_FEATURE_MOBILE))
defaultChassis.manufacturer = kDefaultVendorManufacturer;
defaultChassis.serialNumber = kDefaultSerialNumber;
defaultChassis.assetTagNumber = kDefaultAssetTagNumber;
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly
if (PlatformType == 2) // this method works
{
if (Platform.CPU.NoCores > 1)
{
defaultBIOSInfo.version= kDefaultMacBookProBIOSVersion;
defaultSystemInfo.productName= kDefaultMacBookPro;
defaultSystemInfo.family= kDefaultMacBookProFamily;
defaultBIOSInfo.version= kDefaultMacBookProBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacBookProBIOSReleaseDate;
defaultSystemInfo.family= kDefaultMacBookProFamily;
defaultBaseBoard.product = kDefaultMacBookProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
}
else
{
defaultBIOSInfo.version= kDefaultMacBookBIOSVersion;
defaultSystemInfo.productName= kDefaultMacBook;
defaultSystemInfo.family= kDefaultMacBookFamily;
defaultBIOSInfo.version= kDefaultMacBookBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacBookBIOSReleaseDate;
defaultSystemInfo.family= kDefaultMacBookFamily;
defaultBaseBoard.product = kDefaultMacBookBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
}
}
else
switch (Platform.CPU.NoCores)
{
case 1:
defaultBIOSInfo.version= kDefaultMacminiBIOSVersion;
defaultSystemInfo.productName= kDefaultMacmini;
defaultSystemInfo.family= kDefaultMacminiFamily;
defaultBIOSInfo.version= kDefaultMacMiniBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacMiniBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacMini;
defaultSystemInfo.family= kDefaultMacMiniFamily;
defaultBaseBoard.product = kDefaultMacMiniBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardUnknown;
defaultChassis.chassisType = kSMBchassisLPDesktop;
break;
case 2:
defaultBIOSInfo.version= kDefaultiMacBIOSVersion;
defaultSystemInfo.productName= kDefaultiMac;
defaultSystemInfo.family= kDefaultiMacFamily;
defaultBIOSInfo.version= kDefaultiMacBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultiMacBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultiMac;
defaultSystemInfo.family= kDefaultiMacFamily;
defaultBaseBoard.product = kDefaultiMacBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisAllInOne;
break;
default:
{
case CPU_MODEL_DALES:
case CPU_MODEL_DALES_32NM:// Intel Core i3, i5 LGA1156 (32nm)
defaultBIOSInfo.version= kDefaultiMacNehalemBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultiMacNehalemBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultiMacNehalem;
defaultSystemInfo.family= kDefaultiMacFamily;
defaultBaseBoard.product = kDefaultiMacNehalemBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisAllInOne;
break;
case CPU_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPU_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPU_MODEL_IVYBRIDGE_XEON:
defaultBIOSInfo.version= kDefaultiMacSandyBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultiMacSandyBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultiMacSandy;
defaultSystemInfo.family= kDefaultiMacFamily;
defaultSystemInfo.family= kDefaultiMacFamily;
defaultBaseBoard.product = kDefaultiMacSandyBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisAllInOne;
break;
case CPU_MODEL_NEHALEM:// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPU_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
defaultBIOSInfo.version= kDefaultMacProNehalemBIOSVersion;
defaultBIOSInfo.version= kDefaultMacProNehalemBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProNehalemBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProNehalem;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;
defaultChassis.chassisType = kSMBchassisTower;
break;
case CPU_MODEL_WESTMERE:// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPU_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
defaultBIOSInfo.version= kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProWestmereBIOSReleaseDate;
defaultBIOSInfo.version= kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProWestmereBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProWestmere;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;
defaultChassis.chassisType = kSMBchassisTower;
break;
default:
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacPro;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
break;
}
break;
}
default:
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacPro;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
break;
}
break;
if (SMBSetters[idx].getSMBValue((returnType *)&string))
{
break;
// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo
}
}
if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue) && *(char *)(SMBSetters[idx].defaultValue))
// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue))
{
// string = *(SMBSetters[idx].defaultValue); Bungo
string = (char *)(SMBSetters[idx].defaultValue);
string = *(SMBSetters[idx].defaultValue);
break;
}
string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);
}
// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"
if (SMBSetters[idx].valueType == kSMBString)
if ((SMBSetters[idx].valueType == kSMBString) && string)
{
setSMBStringForField(structPtr->new, string, &value->byte);
}
addSMBEndOfTable(structPtr);
}
// Bungo: does fix system uuid in SMBIOS istead of in EFI only
// Bungo: does fix system uuid in SMBIOS (and EFI) instead of in EFI only
uint8_t *FixSystemUUID()
{
uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress;
neweps->anchor[2]= 'M';
neweps->anchor[3]= '_';
neweps->entryPointLength= sizeof(SMBEntryPoint);
neweps->majorVersion= 2;
neweps->minorVersion= 4;
neweps->majorVersion= 2; // Bungo:
neweps->minorVersion= 4; // We're using 2.4 SMBIOS rev. as real Macs
neweps->maxStructureSize= maxStructSize;
neweps->entryPointRevision= 0;
memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);
// Bungo
Platform.UUID = FixSystemUUID(); // Fix System UUID
Platform.UUID = FixSystemUUID(); // Bungo: fix System UUID
neweps->dmi.checksum= 0;
neweps->dmi.checksum= 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint));
{
switch (structHeader->type)
{
/* Bungo
/* Bungo: fixed in smbios now
case kSMBTypeSystemInformation:
Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid;
break;
*/
case kSMBTypeSystemEnclosure: // Bungo: determine platform type
switch (((SMBSystemEnclosure *)structHeader)->chassisType) {
case kSMBchassisDesktop:
case kSMBchassisLPDesktop:
case kSMBchassisAllInOne:
case kSMBchassisLunchBox:
PlatformType = 1; // desktop (iMac, MacMini)
break;
case kSMBchassisPortable:
case kSMBchassisLaptop:
case kSMBchassisNotebook:
case kSMBchassisHandHeld:
case kSMBchassisSubNotebook:
PlatformType = 2; // notebook (Mac Books)
break;
default:
PlatformType = 3; // workstation (Mac Pro, Xserve)
break;
}
break;
//
case kSMBTypePhysicalMemoryArray:
Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices;
break;
trunk/i386/libsaio/smbios_decode.c
2222
2323
2424
25
26
27
28
29
30
31
32
33
34
35
36
37
2538
2639
2740
......
6275
6376
6477
65
66
78
79
6780
68
81
6982
7083
7184
......
8396
8497
8598
86
87
88
99
100
101
89102
90103
91104
......
100113
101114
102115
103
104
116
117
105118
106119
107120
......
111124
112125
113126
114
115
116
117
118
127
128
129
130
131
119132
120
133
121134
122135
123136
......
131144
132145
133146
134
135
136
137
138
147
148
149
150
151
139152
140153
141154
......
155168
156169
157170
158
171
159172
160173
161
174
162175
163
176
164177
165178
166179
......
168181
169182
170183
171
172
173
184
185
186
174187
175188
176189
......
178191
179192
180193
194
195
196
197
198
199
200
201
202
203
204
205
181206
182207
183208
184209
210
211
212
213
214
215
216
217
185218
186
187219
188220
189221
190222
191223
192224
193
194
225
226
195227
196228
197229
198230
199231
200232
201
202
203
204
233
234
235
236
205237
206238
207239
......
261293
262294
263295
296
297
298
299
300
301
302
303
264304
265305
266306
267307
268308
269
270
309
310
271311
272312
273
313
274314
275315
276316
277
317
278318
279319
280320
281
321
282322
283323
284324
extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field);
// Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode dispays
#define NotSpecifiedStr "Not Specified"
char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field)
{
char *str;
str = getSMBStringForField(structHeader, field);
if (str == 0)
str = NotSpecifiedStr;
return str;
};
//
static const char *
SMBMemoryDeviceTypes[] =
{
void decodeBIOSInformation(SMBBIOSInformation *structHeader)
{
DBG("BIOS Information:\n");
DBG("\tVendor: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor));
DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tVendor: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
// Address Segment
DBG("\tRelease Date: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->releaseDate));
DBG("\tRelease Date: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->releaseDate));
// ROM Size
//DBG("\tSupported BIOS functions: (0x%llX) %s\n", structHeader->characteristics, SMBBIOSInfoChar0[structHeader->characteristics]);
// Major Release
void decodeSystemInformation(SMBSystemInformation *structHeader)
{
DBG("System Information:\n");
DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tProduct Name: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->productName));
DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->productName));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
if (minorVersion < 1 || structHeader->header.length < 25)
if (minorVersion < 4 || structHeader->header.length < 27)
return;
DBG("\tSKU Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber)); // System SKU#
DBG("\tFamily: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->family));
DBG("\tSKU Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber)); // System SKU#
DBG("\tFamily: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->family));
DBG("\n");
}
void decodeBaseBoard(SMBBaseBoard *structHeader)
{
DBG("Base Board Information:\n");
DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tProduct Name: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->product));
DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber));
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->product));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber));
// Feature Flags (BYTE)
DBG("\tLocation In Chassis: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis)); // Part Component
DBG("\tLocation In Chassis: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis)); // Part Component
// Chassis Handle (WORD)
DBG("\tType: 0x%X\n", structHeader->boardType);
// Number of Contained Object Handles (n) (BYTE)
void decodeSystemEnclosure(SMBSystemEnclosure *structHeader)
{
DBG("Chassis Information:\n");
DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tType: %d\n", structHeader->type);
DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber));
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tType: 0x%X\n", structHeader->chassisType);
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber));
// Boot-up State:
// Power Supply State
// Thermal State
void decodeProcessorInformation(SMBProcessorInformation *structHeader)
{
DBG("Processor Information:\n");
DBG("\tSocket Designation: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation));
DBG("\tSocket Designation: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation));
DBG("\tType: %d\n", structHeader->processorType);
DBG("\tFamily: 0x%X\n", structHeader->processorFamily);
DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tID: 0x%llX\n", structHeader->processorID);
DBG("\tProcessor Version: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->processorVersion));
DBG("\tProcessor Version: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->processorVersion));
//DBG("\tVoltage: 0.%xV\n", structHeader->voltage);
DBG("\tExternal Clock: %dMHz\n", structHeader->externalClock);
DBG("\tMaximum Clock: %dMHz\n", structHeader->maximumClock);
if (minorVersion < 3 || structHeader->header.length < 35)
return;
DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag));
DBG("\tPart Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag));
DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber));
//DBG("\tProcessor Family 2: %d\n", structHeader->processorFamily2);
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// Memory Module Information (Type 6)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeMemoryModule(SMBMemoryModule *structHeader)
//{
//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("\tInstalled Size: %d\n", structHeader->installedSize);
//DBG("\tEnabled Size: %d\n", structHeader->enabledSize);
//DBG("\tError Status: %x\n", structHeader->errorStatus);
//DBG("\n");
//}
//-------------------------------------------------------------------------------------------------------------------------
// 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");
//}
//-------------------------------------------------------------------------------------------------------------------------
// MemoryDevice (Type 17)
//-------------------------------------------------------------------------------------------------------------------------
void decodeMemoryDevice(SMBMemoryDevice *structHeader)
{
DBG("Memory Device:\n");
DBG("\tDevice Locator: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator));
DBG("\tBank Locator: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator));
DBG("\tDevice Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator));
DBG("\tBank Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator));
DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[structHeader->memoryType]);
if (minorVersion < 3 || structHeader->header.length < 27)
return;
DBG("\tSpeed: %d MHz\n", structHeader->memorySpeed);
DBG("\tError Handle: %x\n", structHeader->errorHandle);
DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag));
DBG("\tPart Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber));
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag));
DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber));
DBG("\n");
}
decodeProcessorInformation((SMBProcessorInformation *)structHeader);
break;
//case 6: // kSMBTypeMemoryModule: // Type 6
//decodeMemoryModule((SMBMemoryModule *)structHeader);
//break;
//case 11: // kSMBOEMStrings: // Type 11
//decodeSMBOEMStrings((SMBOEMStrings *)structHeader);
//break;
case kSMBTypeMemoryDevice: // Type 17
decodeMemoryDevice((SMBMemoryDevice *)structHeader);
break;
/* Skip all Apple Specific Structures */
case kSMBTypeFirmwareVolume: // Type
case kSMBTypeMemorySPD: // Type
case kSMBTypeFirmwareVolume: // Type 128
case kSMBTypeMemorySPD: // Type 130
break;
case kSMBTypeOemProcessorType: // Type
case kSMBTypeOemProcessorType: // Type 131
decodeOemProcessorType((SMBOemProcessorType *)structHeader);
break;
case kSMBTypeOemProcessorBusSpeed: // Type
case kSMBTypeOemProcessorBusSpeed: // Type 132
decodeOemProcessorBusSpeed((SMBOemProcessorBusSpeed *)structHeader);
break;
case kSMBTypeEndOfTable: // Type
case kSMBTypeEndOfTable: // Type 127
/* Skip, to be added at the end */
break;
trunk/i386/libsaio/smbios.h
2323
2424
2525
26
27
28
2926
27
28
29
3030
3131
3232
......
8484
8585
8686
87
87
8888
8989
9090
......
134134
135135
136136
137
137
138138
139139
140140
......
231231
232232
233233
234
234
235
235236
236237
237238
......
248249
249250
250251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
251273
252274
253275
#ifndef __LIBSAIO_SMBIOS_H
#define __LIBSAIO_SMBIOS_H
//
// Based on System Management BIOS Reference Specification v2.5
//
/* Based on System Management BIOS Reference Specification v2.5 */
// http://dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf
typedef uint8_t SMBString;
typedef uint8_t SMBByte;
typedef uint16_t SMBWord;
/*
=======================
SMBIOS structure types.
=======================*/
======================= */
enum
{
kSMBTypeBIOSInformation= 0, // BIOS information (Type 0)
// Inactive (Type 126)
kSMBTypeEndOfTable= 127, // End-of-Table (Type 127)
/* Apple Specific Structures */
// Apple Specific Structures
kSMBTypeFirmwareVolume= 128, // FirmwareVolume (TYPE 128)
kSMBTypeMemorySPD= 130, // MemorySPD (TYPE 130)
kSMBTypeOemProcessorType= 131, // Processor Type (Type 131)
{
SMB_STRUCT_HEADER // Type 3
SMBString manufacturer;
SMBByte type;// System Enclosure Indicator
//SMBByte type;Bungo: renamed to chassisType - convention
SMBByte chassisType;// System Enclosure Indicator
SMBString version;// Board Number?
SMBString serialNumber;
SMBString assetTagNumber;
//SMBString skuNumber;// Number of null-terminated string describing the chassis or enclosure SKU number (2.7+)
} __attribute__((packed)) SMBSystemEnclosure;
// Bungo: values for SMBSystemEnclosure.chassisType
enum {
kSMBchassisOther = 0x01,
kSMBchassisUnknown = 0x02,
kSMBchassisDesktop = 0x03,
kSMBchassisLPDesktop = 0x04,
kSMBchassisPizzaBox = 0x05,
kSMBchassisMiniTower = 0x06,
kSMBchassisTower = 0x07,
kSMBchassisPortable = 0x08,
kSMBchassisLaptop = 0x09,
kSMBchassisNotebook = 0x0A,
kSMBchassisHandHeld = 0x0B,
kSMBchassisDockingStation = 0x0C,
kSMBchassisAllInOne = 0x0D,
kSMBchassisSubNotebook = 0x0E,
// ...
kSMBchassisLunchBox = 0x10
// fill up if needed ;-)
};
/* ============================
Processor Information (Type 4)
============================== */
trunk/i386/libsaio/fake_efi.c
550550
551551
552552
553
554
553
555554
556555
557556
......
635634
636635
637636
638
639
637
638
639
640640
641
641
642642
643643
644644
......
790790
791791
792792
793
793
794794
795795
796796
void setupEfiDeviceTree(void)
{
// Bungo
// EFI_CHAR8* ret = 0;
// EFI_CHAR8* ret = 0; Bungo: not used
EFI_CHAR16* ret16 = 0;
size_t len = 0;
Node*node;
}
*/
if (Platform.UUID)
{
// Bungo
//if (Platform.UUID)
//{
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, Platform.UUID);
}
//}
//
// Export SystemSerialNumber if present
}
memcpy(tableAddress, (void *)origeps->dmi.tableAddress, origeps->dmi.tableLength);
DT__AddProperty(node, "SMBIOS", origeps->dmi.tableLength, tableAddress);
DT__AddProperty(node, "SMBIOS-ORIG", origeps->dmi.tableLength, tableAddress); // Bungo: changed from SMBIOS to SMBIOS-ORIG to differentiate
}
/*
trunk/i386/libsaio/smbios_getters.c
6767
6868
6969
70
71
72
73
70
71
7472
7573
7674
......
113111
114112
115113
116
114
117115
118116
119117
......
143141
144142
145143
146
147
144
148145
149146
150
151
147
152148
153149
154150
......
157153
158154
159155
160
156
161157
162158
163159
......
168164
169165
170166
171
172
173
167
168
174169
175170
176171
177172
178
179
180
181
182
183
173
174
175
184176
185177
186
187
188
189
178
179
180
181
182
183
184
185
186
187
188
190189
191190
192
191
193192
193
194
195
196
197
198
199
200
201
202
203
194204
195205
196
206
197207
198208
199209
200
210
201211
202212
203
213
204214
215
216
217
218
205219
206220
207221
208222
223
224
225
226
227
228
229
230
231
232
233
209234
210235
211
236
212237
213
238
239
240
241
214242
215243
216
244
245
246
247
248
217249
218250
219
251
220252
221
253
222254
223
255
224256
257
258
259
260
261
262
263
264
225265
226266
227
228
229
230
231
232
233
234
267
268
235269
236270
237
271
238272
273
274
275
276
277
278
279
280
281
282
283
284
239285
240286
241
287
242288
243289
244290
245
291
246292
247293
248294
249
295
250296
297
298
299
300
251301
252302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
253321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
254353
255354
256355
......
259358
260359
261360
262
361
263362
264363
265364
......
403502
404503
405504
406
505
407506
408507
409508
410509
411510
412
511
413512
414513
415
416
514
417515
418516
419517
bool getSMBOemProcessorBusSpeed(returnType *value)
{
if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) // Intel
{
switch (Platform.CPU.Family)
{
if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) { // Intel
switch (Platform.CPU.Family) {
case 0x06:
{
switch (Platform.CPU.Model)
did &= 0xFF00;
if(vid == 0x8086 && did >= 0x2C00)
nhm_bus = possible_nhm_bus[i];
nhm_bus = possible_nhm_bus[i];
}
unsigned long qpimult, qpibusspeed;
uint16_t simpleGetSMBOemProcessorType(void)
{
if (Platform.CPU.NoCores >= 4)
{
if (Platform.CPU.NoCores >= 4) {
return 0x0501;// Quad-Core Xeon
}
else if (Platform.CPU.NoCores == 1)
{
else if (Platform.CPU.NoCores == 1) {
return 0x0201;// Core Solo
};
bool getSMBOemProcessorType(returnType *value)
{
static bool done = false;
static bool done = false;
value->word = simpleGetSMBOemProcessorType();
verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, (uint32_t)Platform.CPU.Family, (uint32_t)Platform.CPU.Model);
done = true;
}
switch (Platform.CPU.Family)
{
// Bungo: fixes Oem Processor Type - better matching IMHO
switch (Platform.CPU.Family) {
case 0x06:
{
switch (Platform.CPU.Model)
{
case CPU_MODEL_PENTIUM_M:
case CPU_MODEL_DOTHAN:// Intel Pentium M
case CPU_MODEL_YONAH:// Intel Mobile Core Solo, Duo
case CPU_MODEL_MEROM:// Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPU_MODEL_PENRYN:// Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
case CPU_MODEL_ATOM:// Intel Atom (45nm)
case CPU_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
value->word = 0x101;
return true;
case CPU_MODEL_NEHALEM:// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPU_MODEL_WESTMERE:// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPU_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5-xxxx LGA2011 (32nm)
case CPU_MODEL_YONAH:// 0x0E - Intel Mobile Core Solo, Duo
case CPU_MODEL_CELERON:
value->word = 0x201;
return true;
case CPU_MODEL_XEON_MP:// 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm
value->word = 0x401;
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 = 0x0501;// Xeon
value->word = 0x402;// Xeon
}
case CPU_MODEL_PENTIUM_M:// 0x09 - Banias
case CPU_MODEL_LINCROFT:// 0x27 - Intel Atom, "Lincroft", 45nm
case CPU_MODEL_ATOM:// 0x1C - Intel Atom (45nm)
return true;
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 = 0x0701;// Core i7
value->word = 0x701;// Core i7
}
return true;
case CPU_MODEL_FIELDS:// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPU_MODEL_FIELDS:// 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
if (strstr(Platform.CPU.BrandString, "Xeon(R)"))
{
value->word = 0x501;// Xeon
value->word = 0x501;// Lynnfiled Quad-Core Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x701;// Core i7
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x601;// Core i5
}
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 = 0x701;// Core i7
value->word = 0x702;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x602;// Core i5
}
return true;
case CPU_MODEL_DALES:
case CPU_MODEL_DALES_32NM:// 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale)
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x901;// Core i3
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x601;// Core i5
value->word = 0x601;// Core i5
}
else
if(strstr(Platform.CPU.BrandString, "Core(TM) i5 CPU M 540"))
{
value->word = 0x0701;// Core i7
value->word = 0x602;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x701;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x602;// Core i5
}
return true;
case CPU_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPU_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPU_MODEL_IVYBRIDGE_XEON:
case CPU_MODEL_DALES_32NM:// Intel Core i3, i5 LGA1156 (32nm)
case CPU_MODEL_HASWELL:
case CPU_MODEL_HASWELL_MB:
case CPU_MODEL_HASWELL_ULT:
case CPU_MODEL_CRYSTALWELL:
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 = 0x0501;// Xeon
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
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x901;// Core i3
value->word = 0x903;// Core i3
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x601;// Core i5
value->word = 0x603;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x0701;// Core i7
value->word = 0x703;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x603;// Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE:// 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm)
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x903;// Core i3 - Apple doesn't use it
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x604;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x704;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x604;// Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE_XEON:// 0x3E -
value->word = 0xA01;
return true;
case CPU_MODEL_HASWELL:// 0x3C -
case CPU_MODEL_HASWELL_MB:// 0x3F -
case CPU_MODEL_HASWELL_ULT:// 0x45 -
case CPU_MODEL_CRYSTALWELL:// 0x46
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x905;// Core i3 - Apple doesn't use it
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x605;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x705;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x605;// Core i5
}
return true;
case 0x15:// EP80579 integrated processor
value->word = 0x301;//
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
return true;
}
}
default:
break;
break;
}
}
SMBEntryPoint *getAddressOfSmbiosTable(void)
{
SMBEntryPoint*smbios;
/*
/*
* The logic is to start at 0xf0000 and end at 0xfffff iterating 16 bytes at a time looking
* for the SMBIOS entry-point structure anchor (literal ASCII "_SM_").
*/
smbios = (SMBEntryPoint*)SMBIOS_RANGE_START;
while (smbios <= (SMBEntryPoint *)SMBIOS_RANGE_END) {
if (COMPARE_DWORD(smbios->anchor, SMTAG) &&
if (COMPARE_DWORD(smbios->anchor, SMTAG) &&
COMPARE_DWORD(smbios->dmi.anchor, DMITAG) &&
smbios->dmi.anchor[4] == DMITAG[4] &&
checksum8(smbios, sizeof(SMBEntryPoint)) == 0)
{
checksum8(smbios, sizeof(SMBEntryPoint)) == 0) {
return smbios;
}
smbios = (SMBEntryPoint*)(((char*)smbios) + 16);

Archive Download the corresponding diff file

Revision: 2325