Chameleon

Chameleon Commit Details

Date:2014-01-20 14:01:09 (5 years 9 months ago)
Author:ErmaC
Commit:2342
Parents: 2341
Message:Merge latest Bungo's SMBIOS improvements.
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_getters.h
M/trunk/i386/libsaio/smbios_decode.c

File differences

trunk/i386/libsaio/smbios_getters.h
1010
1111
1212
13
13
1414
1515
1616
#define SMBIOS_RANGE_START 0x000F0000
#define SMBIOS_RANGE_END 0x000FFFFF
#define NOT_AVAILABLE"N/A"
#define NOT_AVAILABLE"N/A"
typedef enum
{
trunk/i386/libsaio/smbios.c
6262
6363
6464
65
65
6666
67
68
6769
6870
6971
......
7476
7577
7678
77
79
7880
7981
8082
......
9092
9193
9294
93
95
9496
9597
9698
......
165167
166168
167169
168
170
169171
170172
171173
......
174176
175177
176178
177
178
179
180
181
179
180
181
182
183
182184
183185
184186
......
257259
258260
259261
260
261
262
263
262264
263265
264266
......
282284
283285
284286
285
287
286288
287289
288290
289291
290
291
292
293
292294
293295
294296
......
317319
318320
319321
320
322
321323
322324
323325
324
326
325327
326328
327329
328330
329
331
330332
331333
332334
......
393395
394396
395397
396
398
397399
398400
399401
400
402
401403
402404
403405
......
456458
457459
458460
459
461
460462
461463
462464
......
482484
483485
484486
485
487
486488
487489
488490
......
490492
491493
492494
493
495
494496
495497
496498
......
503505
504506
505507
506
508
507509
508510
509511
......
518520
519521
520522
521
522
523
524
523525
524
526
525527
526528
527529
528530
529
530
531
532
531533
532
534
533535
534536
535537
......
542544
543545
544546
545
546
547
548
547549
548550
549551
......
578580
579581
580582
581
583
582584
583585
584586
585
587
586588
587589
588590
589591
590592
591593
592
593
594
595
596
597
598
594
595
596
597
598
599
600
599601
600602
601603
602
603
604
605
606
607
608
604
605
606
607
608
609
610
609611
610612
611613
......
613615
614616
615617
616
617
618
619
618
619
620
621
620622
621623
622624
623625
624626
625627
626
627
628
629
628
629
630
631
630632
631633
632634
......
654656
655657
656658
657
658
659
660
659661
660
662
661663
662664
663665
......
825827
826828
827829
828
830
829831
830832
831833
......
868870
869871
870872
871
873
872874
873875
874876
......
10981100
10991101
11001102
1101
1103
11021104
11031105
11041106
......
11181120
11191121
11201122
1121
1123
11221124
11231125
11241126
......
11691171
11701172
11711173
1172
1173
1174
1175
1174
1175
1176
11761177
11771178
11781179
......
11891190
11901191
11911192
1192
1193
11931194
11941195
11951196
......
12011202
12021203
12031204
1204
1205
12051206
12061207
12071208
......
12111212
12121213
12131214
1214
12151215
12161216
12171217
......
12561256
12571257
12581258
1259
12601259
1261
1260
12621261
1263
1262
12641263
12651264
12661265
// Bungo
#define kSMBBaseBoardVersionKey "SMboardversion" // MacPro3,1
#define kSMBBaseBoardSerialNumberKey "SMboardserial" // C02140302D5DMT31M
#define kSMBBaseBoardAssetTagNumberKey "SMboardassettag" // Base Board Asset Tag#
#define kSMBBaseBoardAssetTagKey "SMboardassettag" // Base Board Asset Tag# Bungo: renamed folowing convention
#define kSMBBaseBoardLocationInChassisKey "SMboardlocation" // Part Component
// ErmaC BoardType 0x0a(10) or 0x0b(11) MacPro Family
#define kSMBBaseBoardTypeKey "SMboardtype" // 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
// Bungo
#define kSMBSystemEnclosureTypeKey "SMchassistype" // 7 Desktop
#define kSMBSystemEnclosureVersionKey "SMchassisversion" // Mac-F42C88C8
#define kSMBSystemEnclosureSerialNumberKey "SMchassisserial" // Serial number
#define kSMBSystemEnclosureAssetTagNumberKey "SMchassisassettag" // Pro-Enclosure
#define kSMBSystemEnclosureAssetTagKey "SMchassisassettag" // Pro-Enclosure Bungo: renamed folowing convention
/* ============================
Processor Information (Type 4)
#define kSMBProcessorInformationCurrentClockKey "SMcurrentclock"
#define kSMBProcessorInformationUpgradeKey "SMcpuupgrade"
#define kSMBProcessorInformationSerialNumberKey "SMcpuserial"
#define kSMBProcessorInformationAssetTagNumberKey "SMcpuassettag"
#define kSMBProcessorInformationAssetTagKey "SMcpuassettag" // Bungo: renamed folowing convention
#define kSMBProcessorInformationPartNumberKey "SMcpupartnumber"
/* =====================
char *product;
char *version;// Bungo
char *serialNumber;// ErmaC
char *assetTagNumber;// ErmaC
char *assetTag;// ErmaC Bungo: renamed folowing convention
char *locationInChassis;// ErmaC
uint8_t boardType;// ErmaC
} defaultBaseBoard_t;
// Bungo
typedef struct {
char *manufacturer;
uint8_t chassisType;
char *version;
char *serialNumber;
char *assetTagNumber;
char*manufacturer;
uint8_tchassisType;
char*version;
char*serialNumber;
char*assetTag; // Bungo: renamed folowing convention
} defaultChassis_t;
defaultChassis_t defaultChassis;
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, serialNumber),
kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTagNumber),
kSMBBaseBoardAssetTagNumberKey, NULL, &defaultBaseBoard.assetTagNumber }, // SMboardassetag - Base Board Asset Tag#
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTag),
kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassetag - Base Board Asset Tag#
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),
kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component
kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType}, // SMchassistype - 7
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, version),
kSMBSystemEnclosureVersionKey, NULL, &defaultBaseBoard.product }, // SMchassisversion - Mac-F42C88C8
kSMBSystemEnclosureVersionKey, NULL, &defaultChassis.version }, // SMchassisversion - Mac-F42C88C8
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, serialNumber),
kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber }, // SMchassisserial
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTagNumber),
kSMBSystemEnclosureAssetTagNumberKey, NULL, &defaultChassis.assetTagNumber }, // SMchassisassettag - Pro Enclosure
{kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTag),
kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag }, // SMchassisassettag - Pro Enclosure
/* ============================
Processor Information (Type 4)
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, serialNumber),
NULL, NULL, NULL},
kSMBProcessorInformationSerialNumberKey, NULL, NULL},
// Bungo
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),
kSMBProcessorInformationAssetTagNumberKey, NULL, NULL}, // SMcpuassettag
kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag
//
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, partNumber),
NULL, NULL, NULL},
kSMBProcessorInformationPartNumberKey, NULL, NULL},
/* =====================
Memory Device (Type 17)
// 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 kDefaultBIOSReleaseDate"11/06/2009"
#define kDefaultSerialNumber"SOMESRLNMBR"
//Bungo
#define kDefaultSkuNumber"Default SKU#"
#define kDefaultAssetTagNumber"Default Asset Tag#"
#define kDefaultAssetTag"Default Asset Tag#"
//#define kDefaultBoardType"10" // 0xA
//#define kDefaultBoardProcessorType"11" // 0xB
#define kDefaultSystemVersion"1.0"
//#define kDefaultMacBookProBoardAssetTagNumber"MacBook-Aluminum"
#define kDefaultMacBookPro"MacBookPro4,1"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.0073.B00.0903051113"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.00C1.B03.0802271651"
#define kDefaultMacBookProBIOSReleaseDate"02/27/08"
#define kDefaultMacBookProBoardProduct"Mac-F42C89C8"
//#define kDefaultiMacBoardAssetTagNumber"iMac-Aluminum"
#define kDefaultiMac"iMac8,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0802091538"
#define kDefaultiMacBIOSReleaseDate"02/09/08"
#define kDefaultiMacBoardProduct"Mac-F227BEC8"
// iMac11,1 core i3/i5/i7
#define kDefaultiMacNehalem"iMac11,1"
#define kDefaultiMacNehalemBIOSVersion" IM111.88Z.0034.B02.1003171314"
#define kDefaultiMacNehalemBIOSReleaseDate"10/30/09"
#define kDefaultiMacNehalemBIOSReleaseDate"03/30/10"
#define kDefaultiMacNehalemBoardProduct"Mac-F2268DAE"
// iMac11,2
// iMac11,3
// iMac12,2 Mac-942B59F58194171B
//#define kDefaultiMacSandy"iMac12,2"
//#define kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B1D.1110171110"
//#define kDefaultiMacSandyBIOSReleaseDate"10/17/2011"
//#define kDefaultiMacSandyBIOSReleaseDate"10/17/11"
//#define kDefaultiMacSandyBoardProduct"Mac-942B59F58194171B"
// iMac13,2
//#define kDefaultMacProBoardType"0xB" // 11
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
#define kDefaultMacProBIOSReleaseDate"08/03/2010"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B02.0801021250"
#define kDefaultMacProBIOSReleaseDate"01/02/08"
//#define kDefaultMacProSystemVersion"1.3"
#define kDefaultMacProBoardProduct"Mac-F2268DC8"
#define kDefaultMacProBoardProduct"Mac-F42C88C8"
//#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 kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B07.0910130729"
#define kDefaultMacProNehalemBIOSReleaseDate"10/13/09"
//#define kDefaultMacProNehalemSystemVersion"1.4"
#define kDefaultMacProNehalemBoardProduct"Mac-F4238CC8"
#define kDefaultMacProNehalemBoardProduct"Mac-F221BEC8"
//#define KDefaultMacProNehalemBoardSerialNumber"J593004RB1LUE"
// Mac Pro 5,1 core i7/Xeon
// Mac Pro 6,1
#define kDefaultMacProHaswell"MacPro6,1"
#define kDefaultMacProHaswellBIOSVersion" MP61.88Z.0116.B00.1311020956"
#define kDefaultMacProHaswellBIOSReleaseDate"06/12/13"
#define kDefaultMacProHaswellBIOSVersion" MP61.88Z.0116.B04.1312061508"
#define kDefaultMacProHaswellBIOSReleaseDate"12/06/2013"
//#define kDefaultMacProHaswellSystemVersion"1.?"
#define kDefaultMacProHaswellBoardProduct"Mac-F60DEB81FF30ACF6"
//#define KDefaultMacProHaswellBoardSerialNumber"?????????????"
defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;
defaultBaseBoard.serialNumber = kDefaultSerialNumber;
defaultBaseBoard.assetTagNumber = kDefaultAssetTagNumber;
defaultBaseBoard.assetTag = kDefaultAssetTag;
defaultChassis.manufacturer = kDefaultVendorManufacturer;
defaultChassis.serialNumber = kDefaultSerialNumber;
defaultChassis.assetTagNumber = kDefaultAssetTagNumber;
defaultChassis.assetTag = kDefaultAssetTag;
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly
if (PlatformType == 2) // this method works
{
if (Platform.CPU.NoCores > 1)
{
defaultSystemInfo.productName= kDefaultMacBookPro;
defaultBIOSInfo.version= kDefaultMacBookProBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacBookProBIOSReleaseDate;
defaultSystemInfo.family= kDefaultMacBookProFamily;
defaultBaseBoard.product = kDefaultMacBookProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
defaultSystemInfo.productName = kDefaultMacBookPro;
defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultMacBookProBIOSReleaseDate;
defaultSystemInfo.family = kDefaultMacBookProFamily;
defaultBaseBoard.product = kDefaultMacBookProBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
}
else
{
defaultSystemInfo.productName= kDefaultMacBook;
defaultBIOSInfo.version= kDefaultMacBookBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacBookBIOSReleaseDate;
defaultSystemInfo.family= kDefaultMacBookFamily;
defaultBaseBoard.product = kDefaultMacBookBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisUnknown;
defaultSystemInfo.productName = kDefaultMacBook;
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;
defaultBIOSInfo.releaseDate= kDefaultMacMiniBIOSReleaseDate;
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;
defaultBIOSInfo.releaseDate= kDefaultiMacBIOSReleaseDate;
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;
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;
defaultBIOSInfo.version = kDefaultiMacSandyBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultiMacSandyBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultiMacSandy;
defaultSystemInfo.family= kDefaultiMacFamily;
defaultSystemInfo.family = kDefaultiMacFamily;
defaultBaseBoard.product = kDefaultiMacSandyBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisAllInOne;
}
}
// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue)) {
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) {
string = *(SMBSetters[idx].defaultValue);
break;
}
}
// #if 0 Bungo: enables code below
// if (*(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue))
if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue))
{
// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo
switch (SMBSetters[idx].valueType) {
uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress;
SMBStructHeader *structHeader = (SMBStructHeader *)ptr;
int i, isZero, isOnes;
uint8_t FixedUUID[UUID_LEN] = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
uint8_t FixedUUID[UUID_LEN] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
const char *sysId = getStringForKey(kSMBSystemInformationUUIDKey, SMBPlist);
uint8_t *ret = (uint8_t *)getUUIDFromString(sysId);
if (!sysId || !ret) { // no or bad custom UUID,...
sysId = 0;
ret = ((SMBSystemInformation *)structHeader)->uuid; // ...try bios dmi info UUID extraction
ret = Platform.UUID; // ...try bios dmi system uuid extraction
}
for (i=0, isZero=1, isOnes=1; i<UUID_LEN; i++) // check if empty or setable, means: no uuid present
// getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); Bungo
getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig);
// if (setSMB)
setDefaultSMBData();
// Bungo
// if (setSMB) Bungo
setDefaultSMBData();
setupNewSMBIOSTable(origeps, structPtr);
neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));
neweps->anchor[3]= '_';
neweps->entryPointLength= sizeof(SMBEntryPoint);
neweps->majorVersion= 2; // Bungo:
neweps->minorVersion= 4; // We're using 2.4 SMBIOS rev. as real Macs
neweps->minorVersion= 4; // Here we're using 2.4 SMBIOS rev. as real Macs
neweps->maxStructureSize= maxStructSize;
neweps->entryPointRevision= 0;
neweps->dmi.tableLength= tableLength;
neweps->dmi.tableAddress= AllocateKernelMemory(tableLength);
neweps->dmi.structureCount= structureCount;
neweps->dmi.bcdRevision= 0x24;
neweps->dmi.bcdRevision= 0x24; // ... and 2.4 DMI rev. as real Macs
if (!neweps->dmi.tableAddress) {
free(buffer);
memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);
// Bungo
Platform.UUID = FixSystemUUID(); // Bungo: fix System UUID
neweps->dmi.checksum= 0;
{
switch (structHeader->type)
{
/* Bungo: fixed in smbios now
case kSMBTypeSystemInformation:
Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid;
Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid; // get factory system uuid
break;
*/
case kSMBTypeSystemEnclosure: // Bungo: determine platform type
switch (((SMBSystemEnclosure *)structHeader)->chassisType) {
case kSMBchassisDesktop:
trunk/i386/libsaio/smbios_decode.c
77
88
99
10
11
12
1013
1114
1215
......
1821
1922
2023
21
24
25
26
27
28
2229
2330
2431
25
26
32
33
34
35
36
37
38
2739
28
40
2941
30
31
32
33
42
43
44
45
46
47
48
3449
3550
3651
37
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
38179
39180
40181
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
67208
68209
69210
......
75216
76217
77218
78
79
219
220
80221
81
222
223
82224
83225
84226
......
96238
97239
98240
99
100
101
102
241
242
243
244
103245
104
246
105247
248
249
106250
107251
108
109
110
252
253
254
255
256
257
258
111259
112
113260
114
261
262
263
264
265
266
115267
116
117
268
269
270
271
118272
119273
120274
......
124278
125279
126280
127
128
129
130
131
281
282
283
284
285
132286
133
287
134288
135
289
290
291
292
293
136294
137295
138296
......
144302
145303
146304
147
148
149
150
151
305
306
307
308
309
310
311
312
313
314
152315
153316
154317
......
168331
169332
170333
171
334
172335
173336
174
337
175338
176
339
177340
178341
179342
180343
181344
182
345
183346
184
185
186
347
348
349
350
351
187352
188353
189354
......
222387
223388
224389
225
226
390
391
227392
228393
229
394
230395
396
231397
232398
233
234
235
236
399
400
401
402
237403
238404
239405
......
242408
243409
244410
245
246
411
412
247413
248414
249415
250416
251417
252
253
418
419
254420
255421
256422
......
264430
265431
266432
433
434
435
267436
437
438
268439
440
441
269442
270443
271
444
272445
273446
274447
......
305478
306479
307480
481
482
308483
309484
310485
......
318493
319494
320495
496
497
321498
322499
323500
#include "libsaio.h"
#include "smbios.h"
// Bungo:
#include "boot.h"
#include "bootstruct.h"
#ifndef DEBUG_SMBIOS
#define DEBUG_SMBIOS 0
#define DBG(x...)msglog(x)
#endif
static SMBWord minorVersion;
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: fixes random string readout if null in smbios to "Not Specified" as dmidecode dispays
#define NotSpecifiedStr "Not Specified"
// 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;
char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field)
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;
str = getSMBStringForField(structHeader, field);
if (str == 0)
str = NotSpecifiedStr;
char *str = NULL;
str = getSMBStringForField(structHeader, field);
if (!field) {
str = NotSpecifiedStr;
} else if (mask) {
str = PrivateStr;
}
return str;
};
//
/*====
7.2.2
===*/
static const char *SMBWakeUpTypes[] = // Bungo: strings for wake-up type (Table Type 1 - System Information)
{
"Reserved", /* 00h */
"Other", /* 01h */
"Unknown", /* 02h */
"APM Timer", /* 03h */
"Modem Ring", /* 04h */
"LAN Remote", /* 05h */
"Power Switch", /* 06h */
"PCI PME#", /* 07h */
"AC Power Restored" /* 08h */
};
/*====
7.3.2
===*/
static const char *SMBBaseBoardTypes[] = // Bungo: strings for base board type (Table Type 2 - Base Board Information)
{
"Unknown", /* 01h */
"Other", /* 02h */
"Server Blade", /* 03h */
"Connectivity Switch", /* 04h */
"System Management Module", /* 05h */
"Processor Module", /* 06h */
"I/O Module", /* 07h */
"Memory Module", /* 08h */
"Daughter Board", /* 09h */
"Motherboard", /* 0Ah */
"Processor+Memory Module", /* 0Bh */
"Processor+I/O Module", /* 0Ch */
"Interconnect Board" /* 0Dh */
};
/*===
7.4.1
===*/
static const char *SMBChassisTypes[] = // Bungo: strings for chassis type (Table Type 3 - Chassis Information)
{
"Other", /* 01h */
"Unknown", /* 02h */
"Desktop", /* 03h */
"Low Profile Desktop", /* 04h */
"Pizza Box", /* 05h */
"Mini Tower", /* 06h */
"Tower", /* 07h */
"Portable", /* 08h */
"Laptop", /* 09h */
"Notebook", /* 0Ah */
"Hand Held", /* 0Bh */
"Docking Station", /* 0Ch */
"All in One", /* 0Dh */
"Sub Notebook", /* 0Eh */
"Space-saving", /* 0Fh */
"Lunch Box",/* 10h */
"Main Server Chassis",/* 11h */
"Expansion Chassis",/* 12h */
"SubChassis",/* 13h */
"Bus Expansion Chassis",/* 14h */
"Peripheral Chassis",/* 15h */
"RAID Chassis",/* 16h */
"Rack Mount Chassis", /* 17h */
"Sealed-case PC",/* 18h */
"Multi-system Chassis", /* 19h */
"Compact PCI",/* 1Ah */
"Advanced TCA",/* 1Bh */
"Blade",/* 1Ch */ // An SMBIOS implementation for a Blade would contain a Type 3 Chassis structure
"Blade Enclosing"/* 1Dh */ // A Blade Enclosure is a specialized chassis that contains a set of Blades.
};
/*====
7.5.5
===*/
/*static const char *SMBCpuSocket[] = // ErmaC: strings for (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
};*/
/*=====
7.18.2
====*/
static const char *
SMBMemoryDeviceTypes[] =
{
"RAM", /* 00h Undefined */
"RAM", /* 01h Other */
"RAM", /* 02h Unknown */
"DRAM", /* 03h DRAM */
"EDRAM", /* 04h EDRAM */
"VRAM", /* 05h VRAM */
"SRAM", /* 06h SRAM */
"RAM", /* 07h RAM */
"ROM", /* 08h ROM */
"FLASH", /* 09h FLASH */
"EEPROM", /* 0Ah EEPROM */
"FEPROM", /* 0Bh FEPROM */
"EPROM", /* 0Ch EPROM */
"CDRAM", /* 0Dh CDRAM */
"3DRAM", /* 0Eh 3DRAM */
"SDRAM", /* 0Fh SDRAM */
"SGRAM", /* 10h SGRAM */
"RDRAM", /* 11h RDRAM */
"DDR SDRAM", /* 12h DDR */
"DDR2 SDRAM", /* 13h DDR2 */
"DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */
"RAM",/* 15h unused */
"RAM",/* 16h unused */
"RAM",/* 17h unused */
"DDR3",/* 18h DDR3, chosen in [5776134] */
"FBD2"/* 19h FBD2 */
"RAM", /* 00h Undefined */
"RAM", /* 01h Other */
"RAM", /* 02h Unknown */
"DRAM", /* 03h DRAM */
"EDRAM", /* 04h EDRAM */
"VRAM", /* 05h VRAM */
"SRAM", /* 06h SRAM */
"RAM", /* 07h RAM */
"ROM", /* 08h ROM */
"FLASH", /* 09h FLASH */
"EEPROM", /* 0Ah EEPROM */
"FEPROM", /* 0Bh FEPROM */
"EPROM", /* 0Ch EPROM */
"CDRAM", /* 0Dh CDRAM */
"3DRAM", /* 0Eh 3DRAM */
"SDRAM", /* 0Fh SDRAM */
"SGRAM", /* 10h SGRAM */
"RDRAM", /* 11h RDRAM */
"DDR SDRAM", /* 12h DDR */
"DDR2 SDRAM", /* 13h DDR2 */
"DDR2 FB-DIMM", /* 14h DDR2 FB-DIMM */
"RAM",/* 15h unused */
"RAM",/* 16h unused */
"RAM",/* 17h unused */
"DDR3",/* 18h DDR3, chosen in [5776134] */
"FBD2"/* 19h FBD2 */
};
static const int kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) /
void decodeBIOSInformation(SMBBIOSInformation *structHeader)
{
DBG("BIOS Information:\n");
DBG("\tVendor: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor));
DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
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));
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
void decodeSystemInformation(SMBSystemInformation *structHeader)
{
DBG("System Information:\n");
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));
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 < 1 || structHeader->header.length < 25)
if (minorVersion < 1 || structHeader->header.length < 25) {
return;
}
uint8_t *uuid = structHeader->uuid;
if (uuid) {
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 (privateData) {
DBG("\tUUID: %s\n", PrivateStr);
} else {
DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n",
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
}
}
DBG("\tWake-up Type: 0x%x\n", structHeader->wakeupReason);
if (minorVersion < 4 || structHeader->header.length < 27)
if (structHeader->wakeupReason > 8) {
DBG("\tWake-up Type: %s\n", OutOfSpecStr);
} else {
DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[structHeader->wakeupReason]);
}
if (minorVersion < 4 || structHeader->header.length < 27) {
return;
DBG("\tSKU Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber)); // System SKU#
DBG("\tFamily: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->family));
}
DBG("\tSKU Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber, neverMask)); // System SKU#
DBG("\tFamily: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->family, neverMask));
DBG("\n");
}
void decodeBaseBoard(SMBBaseBoard *structHeader)
{
DBG("Base Board Information:\n");
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));
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)); // Part Component
DBG("\tLocation In Chassis: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis, neverMask)); // Part Component
// Chassis Handle (WORD)
DBG("\tType: 0x%X\n", structHeader->boardType);
if ((structHeader->boardType < kSMBBaseBoardUnknown) || (structHeader->boardType > kSMBBaseBoardInterconnect)) {
DBG("\tType: %s\n", OutOfSpecStr);
} else {
DBG("\tType: %s\n", SMBBaseBoardTypes[(structHeader->boardType - 1)]);
}
// Number of Contained Object Handles (n) (BYTE)
// Contained Object Handles n(WORDs)
DBG("\n");
void decodeSystemEnclosure(SMBSystemEnclosure *structHeader)
{
DBG("Chassis Information:\n");
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));
DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask));
// DBG("\tType: 0x%X\n", structHeader->chassisType);
if ((structHeader->chassisType < kSMBchassisOther) || (structHeader->chassisType > kSMBchassisBladeEnclosing)) {
DBG("\tType: %s\n", OutOfSpecStr);
} else {
DBG("\tType: %s\n", SMBChassisTypes[(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
void decodeProcessorInformation(SMBProcessorInformation *structHeader)
{
DBG("Processor Information:\n");
DBG("\tSocket Designation: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation));
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));
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));
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)
if (minorVersion < 3 || structHeader->header.length < 35) {
return;
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("\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("\tProcessor Family 2: %d\n", structHeader->processorFamily2);
DBG("\n");
}
void decodeMemoryDevice(SMBMemoryDevice *structHeader)
{
DBG("Memory Device:\n");
DBG("\tDevice Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator));
DBG("\tBank Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator));
DBG("\tDevice Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator, neverMask));
DBG("\tBank Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator, neverMask));
DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[structHeader->memoryType]);
if (minorVersion < 3 || structHeader->header.length < 27)
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", 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("\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));
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
void decodeOemProcessorType(SMBOemProcessorType *structHeader)
{
DBG("AppleProcessorType:\n");
DBG("\tProcessorType: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType);
DBG("Apple specific Processor Type:\n");
DBG("\tCpu-type: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType);
DBG("\n");
}
void decodeOemProcessorBusSpeed(SMBOemProcessorBusSpeed *structHeader)
{
DBG("AppleProcessorBusSpeed:\n");
DBG("\tProcessorBusSpeed (QPI): %d.%dGT/s\n",
DBG("Apple specific Processor Interconnect Speed:\n");
DBG("\tQPI = %d.%dGT/s\n",
((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed / 1000,
(((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed / 100) % 10);
DBG("\n");
SMBStructHeader *structHeader = (SMBStructHeader *)ptr;
minorVersion = eps->minorVersion;
majorVersion = eps->majorVersion;
bcdRevisionHi = eps->dmi.bcdRevision >> 4;
bcdRevisionLo = eps->dmi.bcdRevision & 0x0F;
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("\n");
for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
{
DBG("Type: %d, Length: %d, Handle: 0x%x\n",
DBG("Type: %d, Length: %d, Handle: 0x%04x\n",
structHeader->type, structHeader->length, structHeader->handle);
switch (structHeader->type)
decodeMemoryDevice((SMBMemoryDevice *)structHeader);
break;
//kSMBTypeMemoryArrayMappedAddress: // Type 19
/* Skip all Apple Specific Structures */
case kSMBTypeFirmwareVolume: // Type 128
case kSMBTypeMemorySPD: // Type 130
decodeOemProcessorBusSpeed((SMBOemProcessorBusSpeed *)structHeader);
break;
//kSMBTypeOemPlatformFeature: // Type 133
case kSMBTypeEndOfTable: // Type 127
/* Skip, to be added at the end */
break;
trunk/i386/libsaio/smbios.h
191191
192192
193193
194
194
195195
196196
197197
......
231231
232232
233233
234
235234
236235
237236
238
237
239238
240239
241240
......
265264
266265
267266
268
269
270
267
268
269
270
271271
272272
273273
SMBStringproduct;
SMBStringversion;
SMBStringserialNumber;
SMBStringassetTagNumber;
SMBStringassetTag;// Bungo: renamed from assetTagNumber folowing convention
SMBByte featureFlags;// Collection of flag that identify features of this baseboard
SMBStringlocationInChassis;
SMBWord chassisHandle;
{
SMB_STRUCT_HEADER // Type 3
SMBString manufacturer;
//SMBByte type;Bungo: renamed to chassisType - convention
SMBByte chassisType;// System Enclosure Indicator
SMBString version;// Board Number?
SMBString serialNumber;
SMBString assetTagNumber;
SMBString assetTag;// Bungo: renamed from assetTagNumber folowing convention
SMBByte bootupState;// State of enclosure when when it was last booted
SMBByte powerSupplyState;// State of enclosure's power supply when last booted
SMBByte thermalState;// Thermal state of the enclosure when last booted
kSMBchassisDockingStation = 0x0C,
kSMBchassisAllInOne = 0x0D,
kSMBchassisSubNotebook = 0x0E,
// ...
kSMBchassisLunchBox = 0x10
// fill up if needed ;-)
// ... fill up if needed ;-)
kSMBchassisLunchBox = 0x10,
// ... fill up if needed ;-)
kSMBchassisBladeEnclosing = 0x1D
};
/* ============================
trunk/i386/libsaio/fake_efi.c
628628
629629
630630
631
632
631
633632
634633
635634
636635
637
638
639
640
641
642
636
643637
644638
645639
// Bungo
/* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
if ((ret=getSystemID()))
{
if ((ret=getSystemID())) {
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32*) ret);
}
*/
// Bungo
//if (Platform.UUID)
//{
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, Platform.UUID);
//}
//
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32 *)Platform.UUID);
// Export SystemSerialNumber if present
if ((ret16=getSmbiosChar16("SMserial", &len)))
trunk/i386/libsaio/smbios_getters.c
6767
6868
6969
70
71
70
7271
7372
7473
......
9998
10099
101100
102
103
101
104102
105103
106104
107105
108106
109
107
110108
109
111110
112111
113112
......
138137
139138
140139
141
142
140
143141
144142
145143
......
152150
153151
154152
155
156
157
158
153
154
159155
160156
161157
......
163159
164160
165161
166
167
162
168163
169164
170165
......
181176
182177
183178
184
185
179
186180
187181
188182
......
192186
193187
194188
195
196
189
197190
198191
199
200
192
201193
202194
203195
204196
205197
206
207
198
208199
209200
210
211
201
212202
213203
214
215
204
216205
217206
218207
219208
220209
221
222
210
223211
224212
225
226
213
227214
228215
229
230
216
231217
232218
233
234
219
235220
236221
237222
238223
239224
240
241
225
242226
243227
244
245
228
246229
247230
248
249
231
250232
251233
252
253
234
254235
255236
256
257
237
258238
259239
260240
261241
262242
263243
264
265
244
266245
267246
268
269
247
270248
271249
272250
273251
274252
275253
276
277
254
278255
279256
280
281
257
282258
283259
284
285
260
286261
287262
288
289
263
290264
291265
292
293
266
294267
295268
296269
297270
298271
299
300
272
301273
302274
303
304
275
305276
306277
307
308
278
309279
310280
311
312
281
313282
314283
315284
316285
317
286
318287
319288
320289
......
322291
323292
324293
325
326
294
327295
328296
329
330
297
331298
332299
333
334
300
335301
336302
337
338
303
339304
340305
341306
......
412377
413378
414379
415
416
380
417381
418
419
382
420383
421384
422385
switch (Platform.CPU.Family) {
case 0x06:
{
switch (Platform.CPU.Model)
{
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
// Nehalem supports Scrubbing
// First, locate the PCI bus where the MCH is located
for(i = 0; i < (sizeof(possible_nhm_bus)/sizeof(possible_nhm_bus[0])); i++)
{
for(i = 0; i < (sizeof(possible_nhm_bus)/sizeof(possible_nhm_bus[0])); i++) {
vid = pci_config_read16(PCIADDR(possible_nhm_bus[i], 3, 4), 0x00);
did = pci_config_read16(PCIADDR(possible_nhm_bus[i], 3, 4), 0x02);
vid &= 0xFFFF;
did &= 0xFF00;
if(vid == 0x8086 && did >= 0x2C00)
if(vid == 0x8086 && did >= 0x2C00) {
nhm_bus = possible_nhm_bus[i];
}
}
unsigned long qpimult, qpibusspeed;
{
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
};
value->word = simpleGetSMBOemProcessorType();
if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) // Intel
{
if (!done)
{
if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) { // Intel
if (!done) {
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) {
case 0x06:
{
switch (Platform.CPU.Model)
{
switch (Platform.CPU.Model) {
case CPU_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
value->word = 0x101;
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)"))
{
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x402;// Xeon
}
case CPU_MODEL_PENTIUM_M:// 0x09 - Banias
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)"))
{
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
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)
if (strstr(Platform.CPU.BrandString, "Xeon(R)"))
{
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Lynnfiled Quad-Core Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x701;// Core i7
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
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"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x901;// Core i3
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x602;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x702;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
if (Platform.CPU.NoCores <= 2) {
value->word = 0x602;// Core i5
}
return true;
case CPU_MODEL_DALES_32NM:// 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale)
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x901;// Core i3
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x601;// Core i5
}
if(strstr(Platform.CPU.BrandString, "Core(TM) i5 CPU M 540"))
{
if(strstr(Platform.CPU.BrandString, "Core(TM) i5 CPU M 540")) {
value->word = 0x602;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x701;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
if (Platform.CPU.NoCores <= 2) {
value->word = 0x602;// 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)"))
{
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
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)"))
{
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x501;// Xeon
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
value->word = 0x903;// Core i3
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x603;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x703;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
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"))
{
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"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x604;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x704;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
if (Platform.CPU.NoCores <= 2) {
value->word = 0x604;// Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE_XEON:// 0x3E -
case CPU_MODEL_IVYBRIDGE_XEON:// 0x3E - Mac Pro 6,1 - shouldn't be Sandy Bridge EP refering to intel spec.?
value->word = 0xA01;
return true;
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"))
{
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"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
value->word = 0x605;// Core i5
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
value->word = 0x705;// Core i7
}
if (Platform.CPU.NoCores <= 2)
{
if (Platform.CPU.NoCores <= 2) {
value->word = 0x605;// Core i5
}
return true;
intmap;
idx++;
if (idx < MAX_RAM_SLOTS)
{
if (idx < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[idx];
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].Vendor) > 0)
{
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].Vendor) > 0) {
DBG("RAM Detected Vendor[%d]='%s'\n", idx, Platform.RAM.DIMM[map].Vendor);
value->string = Platform.RAM.DIMM[map].Vendor;
return true;

Archive Download the corresponding diff file

Revision: 2342