Chameleon

Chameleon Commit Details

Date:2013-12-27 15:00:21 (10 years 3 months ago)
Author:ErmaC
Commit:2284
Parents: 2283
Message:Appling Bungo SMBIOS patch http://www.insanelymac.com/forum/topic/231075-chameleon-22svn-officia l-pkg-installer-binaries/page-94#entry1973614
Changes:
M/trunk/i386/libsaio/smbios.h
M/trunk/i386/libsaio/fake_efi.c
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/libsaio/fake_efi.h

File differences

trunk/i386/libsaio/fake_efi.h
11
2
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
326
427
528
......
932
1033
1134
12
35
1336
/*
* Copyright 2007 David F. Elliott. All rights reserved.
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* Copyright 2007 David F. Elliott.
* All rights reserved.
*
*/
#ifndef __LIBSAIO_FAKE_EFI_H
#define MAX_CONFIGURATION_TABLE_ENTRIES 10
extern void setupFakeEfi(void);
#endif /* !__LIBSAIO_FAKE_EFI_H */
trunk/i386/libsaio/smbios.c
99
1010
1111
12
13
1214
1315
1416
......
2830
2931
3032
31
32
33
34
3533
36
37
38
39
40
41
34
35
36
37
38
39
40
41
42
4243
43
44
45
44
45
46
47
48
49
50
51
52
53
4654
47
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
4887
4988
89
90
91
92
93
94
5095
51
52
53
54
55
56
57
58
96
97
98
99
100
101
102
103
104
105
59106
60
61
62
107
108
109
63110
111
112
113
114
115
116
117
118
119
120
64121
65122
66123
67124
68125
69
70
71
72
73
126
127
128
129
130
131
132
74133
75
76
77
78
134
135
136
79137
138
139
140
141
142
143
144
145
146
80147
81
82
83
148
149
150
84151
85152
86
87
88
153
154
155
89156
90157
91
92
93
158
159
160
94161
95
96
162
163
97164
98
99
165
166
100167
101168
102
103
104
169
170
171
105172
106
107
173
174
108175
109
110
111
176
177
178
112179
113180
114181
115182
116183
117
184
185
118186
119187
120188
121189
122
190
191
192
193
194
123195
124196
125197
126
198
199
127200
128
201
202
203
204
205
206
207
129208
130209
131210
132211
212
133213
134
214
135215
136
216
217
218
219
220
221
222
137223
138224
139
225
140226
227
141228
142
229
230
143231
144
232
145233
146234
147235
148
236
237
238
149239
150240
151241
152242
153
154
155
156
157
243
244
245
246
247
158248
159
160
249
250
161251
162
163
252
253
164254
165
166
167
168
169
255
256
257
258
170259
171
172
260
261
262
263
264
173265
174
175
266
267
176268
177
178
269
270
179271
180
181
272
273
182274
183
184
275
276
277
185278
279
186280
187
188
189
190
191
281
282
192283
193
194
195284
196
285
286
287
288
289
197290
198
291
292
199293
200
294
295
296
201297
202
298
299
300
301
302
303
304
305
306
307
308
203309
310
311
312
313
314
315
204316
205
206
207
208
317
318
209319
210
320
321
211322
212
323
324
213325
214
215
326
327
216328
217
218
329
330
331
332
333
219334
220
335
336
221337
222
338
339
223340
224
341
342
225343
226
227
228
229
230
344
345
231346
232
233
347
348
349
234350
235
236
351
352
353
237354
238
239
355
356
240357
241
242
358
359
360
243361
244
245
362
246363
247
364
365
248366
249
367
368
369
370
371
250372
251
252
373
374
253375
376
377
254378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
255398
256399
257400
401
258402
259403
260404
405
261406
262407
263408
......
271416
272417
273418
274
275
419
420
276421
277422
278423
424
425
279426
280427
281428
282
283
429
430
284431
285
286
287
432
288433
289
290
434
435
436
437
291438
439
440
441
292442
293443
294444
......
306456
307457
308458
309
459
310460
311
461
312462
313
463
314464
315465
316466
317467
318468
319
469
320470
321471
322472
323473
324
474
325475
326476
327477
......
352502
353503
354504
355
505
356506
357507
358508
......
366516
367517
368518
369
519
370520
371
521
372522
373523
374524
......
391541
392542
393543
394
395
396
397
398
399
400
401
402
403
404
405
406
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
407560
408561
409562
......
412565
413566
414567
568
415569
570
416571
417
572
418573
419574
420575
......
425580
426581
427582
583
428584
585
586
429587
430588
431589
......
436594
437595
438596
597
439598
599
440600
441601
442602
......
459619
460620
461621
622
462623
624
463625
464626
465627
466628
629
467630
468631
469632
633
470634
635
471636
637
472638
639
473640
641
474642
643
644
645
646
475647
476648
649
477650
651
478652
479
653
654
655
656
480657
481
658
659
482660
483661
484662
485663
486
664
487665
488666
489667
......
492670
493671
494672
673
495674
675
496676
677
678
497679
498680
499681
......
514696
515697
516698
699
517700
701
518702
519
520
703
704
705
706
707
521708
522
523
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
524724
525
725
526726
527727
528728
529
729
730
731
530732
531
733
532734
533735
534736
......
629831
630832
631833
632
834
633835
634836
635837
......
645847
646848
647849
850
648851
852
649853
650854
651855
652856
857
653858
654859
655860
656861
657862
863
658864
659865
660866
......
662868
663869
664870
871
665872
666
873
667874
668875
669876
......
672879
673880
674881
882
675883
884
676885
677886
678887
......
683892
684893
685894
895
686896
897
687898
688899
689900
......
707918
708919
709920
921
710922
711923
712924
925
713926
714927
715928
716929
717930
718931
932
719933
934
720935
721936
722937
......
729944
730945
731946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
7321001
7331002
7341003
7351004
736
1005
7371006
7381007
1008
7391009
1010
7401011
7411012
7421013
7431014
7441015
1016
7451017
1018
7461019
747
1020
7481021
1022
1023
7491024
1025
7501026
7511027
7521028
7531029
754
755
756
757
1030
1031
1032
1033
1034
1035
7581036
7591037
7601038
7611039
1040
1041
1042
7621043
1044
7631045
7641046
7651047
......
7831065
7841066
7851067
1068
1069
1070
7861071
1072
7871073
7881074
7891075
1076
1077
1078
7901079
7911080
7921081
793
794
1082
1083
7951084
7961085
1086
1087
7971088
7981089
7991090
......
8031094
8041095
8051096
1097
8061098
1099
8071100
8081101
8091102
......
8191112
8201113
8211114
822
823
1115
1116
8241117
8251118
8261119
8271120
8281121
8291122
1123
8301124
8311125
8321126
1127
8331128
8341129
8351130
......
8381133
8391134
8401135
1136
8411137
1138
8421139
1140
8431141
1142
8441143
8451144
1145
1146
8461147
8471148
8481149
8491150
8501151
8511152
1153
8521154
1155
8531156
8541157
8551158
8561159
857
#include "boot.h"
#include "bootstruct.h"
#include "smbios_getters.h"
// Bungo
#include "convert.h"
#ifndef DEBUG_SMBIOS
#define DEBUG_SMBIOS 0
//-------------------------------------------------------------------------------------------------------------------------
// SMBIOS Plist Keys
//-------------------------------------------------------------------------------------------------------------------------
/* BIOS Information */
#define kSMBBIOSInformationVendorKey"SMbiosvendor"
#define kSMBBIOSInformationVersionKey"SMbiosversion"
#define kSMBBIOSInformationReleaseDateKey"SMbiosdate"
/* System Information */
#define kSMBSystemInformationManufacturerKey"SMmanufacturer"
#define kSMBSystemInformationProductNameKey"SMproductname"
#define kSMBSystemInformationVersionKey"SMsystemversion"
#define kSMBSystemInformationSerialNumberKey"SMserial"
#define kSMBSystemInformationFamilyKey"SMfamily"
/* =======================
BIOS Information (Type 0)
========================= */
#define kSMBBIOSInformationVendorKey "SMbiosvendor" // Apple Inc.
#define kSMBBIOSInformationVersionKey "SMbiosversion" // MP31.88Z.006C.B05.0802291410
#define kSMBBIOSInformationReleaseDateKey "SMbiosdate" // 02/29/08
// Bungo
#define kSMBBIOSInformationReleaseKey "SMbiosrelease" // BIOS Revision
// example: BIOS Revision: 1.23 --> 2 bytes: Major=0x01, Minor=0x17 --> after swap: 0x1701hex = 5889dec (SMBIOS_spec_DSP0134_2.7.1)
/* Base Board */
#define kSMBBaseBoardManufacturerKey"SMboardmanufacturer"
#define kSMBBaseBoardProductKey"SMboardproduct"
/* =========================
System Information (Type 1)
=========================== */
#define kSMBSystemInformationManufacturerKey "SMmanufacturer" // Apple Inc.
#define kSMBSystemInformationProductNameKey "SMproductname" // MacPro3,1
#define kSMBSystemInformationVersionKey "SMsystemversion" // 1.0
#define kSMBSystemInformationSerialNumberKey "SMserial" // Serial number
//Bungo
#define kSMBSystemInformationUUIDKey "SMsystemuuid" // ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }'
#define kSMBSystemInformationSKUNumberKey "SMskunumber" // System SKU#
/* Processor Information */
#define kSMBSystemInformationFamilyKey "SMfamily" // MacPro
/* =========================================
Base Board (or Module) Information (Type 2)
=========================================== */
#define kSMBBaseBoardManufacturerKey "SMboardmanufacturer" // Apple Inc.
#define kSMBBaseBoardProductKey "SMboardproduct" // Mac-F2268DC8
// Bungo
#define kSMBBaseBoardVersionKey "SMboardversion" // MacPro3,1
#define kSMBBaseBoardSerialNumberKey "SMboardserial" // C02140302D5DMT31M
#define kSMBBaseBoardAssetTagNumberKey "SMboardassettag" // Base Board Asset Tag#
#define kSMBBaseBoardLocationInChassisKey "SMboardlocation" // Part Component
#define kSMBBaseBoardTypeKey "SMboardtype" // 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
// Bungo
/* =======================
System Enclosure (Type 3)
========================= */
#define kSMBSystemEnclosureManufacturerKey "SMchassismanufacturer" // Apple Inc.
#define kSMBSystemEnclosureTypeKey "SMchassistype" // 7 Desktop
#define kSMBSystemEnclosureVersionKey "SMchassisversion" // Mac-F42C88C8
#define kSMBSystemEnclosureSerialNumberKey "SMchassisserial" // Serial number
#define kSMBSystemEnclosureAssetTagNumberKey "SMchassisassettag" // Pro-Enclosure
/* ============================
Processor Information (Type 4)
============================== */
// Bungo
#define kSMBProcessorInformationSocketKey "SMcpusocket"
#define kSMBProcessorInformationManufacturerKey "SMcpumanufacturer"
#define kSMBProcessorInformationVersionKey "SMcpuversion"
//
#define kSMBProcessorInformationExternalClockKey"SMexternalclock"
#define kSMBProcessorInformationMaximumClockKey"SMmaximalclock"
// Bungo
#define kSMBProcessorInformationCurrentClockKey "SMcurrentclock"
#define kSMBProcessorInformationUpgradeKey "SMcpuupgrade"
#define kSMBProcessorInformationSerialNumberKey "SMcpuserial"
#define kSMBProcessorInformationAssetTagNumberKey "SMcpuassettag"
#define kSMBProcessorInformationPartNumberKey "SMcpupartnumber"
/* Memory Device */
#define kSMBMemoryDeviceDeviceLocatorKey"SMmemdevloc"
#define kSMBMemoryDeviceBankLocatorKey"SMmembankloc"
#define kSMBMemoryDeviceMemoryTypeKey"SMmemtype"
#define kSMBMemoryDeviceMemorySpeedKey"SMmemspeed"
#define kSMBMemoryDeviceManufacturerKey"SMmemmanufacturer"
#define kSMBMemoryDeviceSerialNumberKey"SMmemserial"
#define kSMBMemoryDevicePartNumberKey"SMmempart"
/* =====================
Memory Device (Type 17)
======================= */
#define kSMBMemoryDeviceDeviceLocatorKey "SMmemdevloc" //
#define kSMBMemoryDeviceBankLocatorKey "SMmembankloc" //
#define kSMBMemoryDeviceMemoryTypeKey "SMmemtype" //
#define kSMBMemoryDeviceMemorySpeedKey "SMmemspeed" //
#define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" //
#define kSMBMemoryDeviceSerialNumberKey "SMmemserial" //
#define kSMBMemoryDevicePartNumberKey "SMmempart" //
/* Apple Specific */
#define kSMBOemProcessorTypeKey"SMcputype"
#define kSMBOemProcessorBusSpeedKey"SMbusspeed"
/* ===========================================
Memory SPD Data (Apple Specific - Type 130)
============================================= */
/* ============================================
OEM Processor Type (Apple Specific - Type 131)
============================================== */
#define kSMBOemProcessorTypeKey "SMoemcputype" // Bungo: renamed from SMcputype
/* =================================================
OEM Processor Bus Speed (Apple Specific - Type 132)
=================================================== */
#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 kDefaultBoardProduct"Mac-F4208DC8"
#define kDefaultSystemVersion"1.0"
#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"
// defaults for a Mac mini
#define kDefaultMacminiFamily"Macmini"
#define kDefaultMacmini"Macmini1,1"
#define kDefaultMacminiBIOSVersion" MM21.88Z.009A.B00.0903051113"
//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
// defaults for a Mac mini
#define kDefaultMacminiFamily"Macmini"
#define kDefaultMacmini"Macmini1,1"
#define kDefaultMacminiBIOSVersion" MM21.88Z.009A.B00.0903051113"
// defaults for a MacBook
#define kDefaultMacBookFamily"MacBook"
#define kDefaultMacBook"MacBook4,1"
#define kDefaultMacBookBIOSVersion" MB41.88Z.0073.B00.0903051113"
#define kDefaultMacBookFamily"MacBook"
#define kDefaultMacBook"MacBook4,1"
#define kDefaultMacBookBIOSVersion" MB41.88Z.0073.B00.0903051113"
// defaults for a MacBook Pro
#define kDefaultMacBookProFamily"MacBookPro"
#define kDefaultMacBookPro"MacBookPro4,1"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.0073.B00.0903051113"
#define kDefaultMacBookProFamily"MacBookPro"
#define kDefaultMacBookPro"MacBookPro4,1"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.0073.B00.0903051113"
// defaults for an iMac
#define kDefaultiMacFamily"iMac"
#define kDefaultiMac"iMac8,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
#define kDefaultiMacFamily"iMac"
#define kDefaultiMac"iMac8,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
// defaults for an iMac11,1 core i3/i5/i7
#define kDefaultiMacNehalem"iMac11,1"
#define kDefaultiMacNehalemBIOSVersion" IM111.88Z.0034.B00.0903051113"
#define kDefaultiMacNehalem"iMac11,1"
#define kDefaultiMacNehalemBIOSVersion" IM111.88Z.0034.B00.0903051113"
// defaults for an iMac12,1
#define kDefaultiMacSandy"iMac12,1"
#define kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B00.1102091756"
#define kDefaultiMacSandy"iMac12,1"
#define kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B00.1102091756"
// defaults for a Mac Pro
#define kDefaultMacProFamily"MacPro"
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
#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.B04.0903051113"
#define kDefaultMacProNehalem"MacPro4,1"
#define kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B04.0903051113"
// defaults for a Mac Pro 5,1 core i7/Xeon
#define kDefaultMacProWestmere"MacPro5,1"
#define kDefaultMacProWestmereBIOSVersion" MP51.88Z.007F.B00.1008031144"
#define kDefaulMacProWestmereBIOSReleaseDate"08/03/10"
#define kDefaultMacProWestmere"MacPro5,1"
#define kDefaultMacProWestmereBIOSVersion" MP51.88Z.007F.B03.1010071432"
#define kDefaultMacProWestmereBIOSReleaseDate"10/07/2010"
//-------------------------------------------------------------------------------------------------------------------------
#define getFieldOffset(struct, field)((uint8_t)(uint32_t)&(((struct *)0)->field))
typedef struct {
typedef struct
{
SMBStructHeader *orig;
SMBStructHeader *new;
} SMBStructPtrs;
struct {
/* =======================
BIOS Information (Type 0)
========================= */
typedef struct
{
char *vendor;
char *version;
char *releaseDate;
} defaultBIOSInfo;
uint16_t release; // Bungo
} defaultBIOSInfo_t;
struct {
defaultBIOSInfo_t defaultBIOSInfo;
/* =========================
System Information (Type 1)
=========================== */
typedef struct
{
char *manufacturer;
char *productName;
char *version;
char *serialNumber;
char *skuNumber;
char *family;
} defaultSystemInfo;
} defaultSystemInfo_t;
struct {
defaultSystemInfo_t defaultSystemInfo;
/* =========================================
Base Board (or Module) Information (Type 2)
=========================================== */
typedef struct
{
char *manufacturer;
char *product;
} defaultBaseBoard;
} defaultBaseBoard_t;
defaultBaseBoard_t defaultBaseBoard;
typedef struct {
typedef struct
{
uint8_ttype;
SMBValueTypevalueType;
SMBValueTypevalueType;
uint8_tfieldOffset;
char*keyString;
bool(*getSMBValue)(returnType *);
char**defaultValue;
// Bungo
// char**defaultValue;
void*defaultValue;
} SMBValueSetter;
SMBValueSetter SMBSetters[] =
{
//-------------------------------------------------------------------------------------------------------------------------
// BIOSInformation
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeBIOSInformation,kSMBString,getFieldOffset(SMBBIOSInformation, vendor),kSMBBIOSInformationVendorKey,
NULL,&defaultBIOSInfo.vendor},
/* =======================
BIOS Information (Type 0)
========================= */
{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, vendor),
kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor }, // SMbiosvendor - Apple Inc.
{kSMBTypeBIOSInformation,kSMBString,getFieldOffset(SMBBIOSInformation, version),kSMBBIOSInformationVersionKey,
NULL,&defaultBIOSInfo.version},
{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, version),
kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version }, // SMbiosversion - MP31.88Z.006C.B05.0802291410
{kSMBTypeBIOSInformation,kSMBString,getFieldOffset(SMBBIOSInformation, releaseDate),kSMBBIOSInformationReleaseDateKey,
NULL,&defaultBIOSInfo.releaseDate},
{ kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, releaseDate),
kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate }, // SMbiosdate - 02/29/08
//-------------------------------------------------------------------------------------------------------------------------
// SystemInformation
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, manufacturer),kSMBSystemInformationManufacturerKey,
NULL,&defaultSystemInfo.manufacturer},
// Bungo
{ kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor),
kSMBBIOSInformationReleaseKey, NULL,&defaultBIOSInfo.release }, // SMbiosrelease - 256
//
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, productName),kSMBSystemInformationProductNameKey,
NULL,&defaultSystemInfo.productName},
/* =========================
System Information (Type 1)
=========================== */
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, manufacturer),
kSMBSystemInformationManufacturerKey, NULL,&defaultSystemInfo.manufacturer}, // SMmanufacturer - Apple Inc.
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, version),kSMBSystemInformationVersionKey,
NULL,&defaultSystemInfo.version},
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, productName),
kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName }, // SMproductname - MacPro3,1
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, serialNumber),kSMBSystemInformationSerialNumberKey,
NULL,&defaultSystemInfo.serialNumber},
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, version),
kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version }, // SMsystemversion - 1.0
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, skuNumber),NULL,
NULL,NULL},
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, serialNumber),
kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, family),kSMBSystemInformationFamilyKey,
NULL,&defaultSystemInfo.family},
// Bungo
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, skuNumber),
kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU#
//
//-------------------------------------------------------------------------------------------------------------------------
// BaseBoard
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, manufacturer),kSMBBaseBoardManufacturerKey,
NULL,&defaultBaseBoard.manufacturer},
{kSMBTypeSystemInformation,kSMBString,getFieldOffset(SMBSystemInformation, family),
kSMBSystemInformationFamilyKey,NULL,&defaultSystemInfo.family}, // SMfamily - MacPro
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, product),kSMBBaseBoardProductKey,
NULL,&defaultBaseBoard.product},
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, version),NULL,NULL,NULL},
/* =========================================
Base Board (or Module) Information (Type 2)
=========================================== */
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, manufacturer),
kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMboardmanufacturer - Apple Inc.
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, serialNumber),NULL,NULL,NULL},
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, product),
kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product}, // SMboardproduct - Mac-F2268DC8
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTagNumber),NULL,NULL,NULL},
// Bungo
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, version),
kSMBBaseBoardVersionKey, NULL, NULL}, // SMboardproductname - MacPro3,1
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),NULL,NULL,NULL},
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, serialNumber),
kSMBBaseBoardSerialNumberKey, NULL, NULL}, // SMboardserial - C02140302D5DMT31M
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTagNumber), kSMBBaseBoardAssetTagNumberKey,
NULL, NULL},
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis), kSMBBaseBoardLocationInChassisKey,
NULL, NULL},
{kSMBTypeBaseBoard,kSMBByte,getFieldOffset(SMBBaseBoard, boardType), kSMBBaseBoardTypeKey,
NULL, NULL},
// Bungo
/* =======================
System Enclosure (Type 3)
========================= */
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, manufacturer),kSMBSystemEnclosureManufacturerKey,
NULL,&defaultBaseBoard.manufacturer},
//-------------------------------------------------------------------------------------------------------------------------
// ProcessorInformation
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, socketDesignation),NULL,NULL,NULL},
{kSMBTypeSystemEnclosure,kSMBByte,getFieldOffset(SMBSystemEnclosure, type),kSMBSystemEnclosureTypeKey,
NULL, NULL},
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, manufacturer),NULL,NULL,NULL},
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, version), kSMBSystemEnclosureVersionKey,
NULL,&defaultBaseBoard.product },
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, processorVersion),NULL,NULL,NULL},
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, serialNumber),kSMBSystemEnclosureSerialNumberKey,
NULL, NULL},
{kSMBTypeProcessorInformation,kSMBWord,getFieldOffset(SMBProcessorInformation, externalClock),kSMBProcessorInformationExternalClockKey,
getProcessorInformationExternalClock,NULL},
{kSMBTypeSystemEnclosure,kSMBString,getFieldOffset(SMBSystemEnclosure, assetTagNumber), kSMBSystemEnclosureAssetTagNumberKey,
NULL, NULL},
{kSMBTypeProcessorInformation,kSMBWord,getFieldOffset(SMBProcessorInformation, maximumClock),kSMBProcessorInformationMaximumClockKey,
getProcessorInformationMaximumClock,NULL},
/* ============================
Processor Information (Type 4)
============================== */
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, socketDesignation),
kSMBProcessorInformationSocketKey, NULL, NULL}, // SMcpusocket -
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, serialNumber),NULL,NULL,NULL},
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, manufacturer),
kSMBProcessorInformationManufacturerKey, NULL, NULL}, // SMcpumanufacturer - Intel(R) Corporation
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),NULL,NULL,NULL},
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, processorVersion),
kSMBProcessorInformationVersionKey, NULL, NULL}, // SMcpuversion
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, partNumber),NULL,NULL,NULL},
{kSMBTypeProcessorInformation,kSMBWord, getFieldOffset(SMBProcessorInformation, externalClock),
kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock,NULL}, // SMcpuexternalclock
//-------------------------------------------------------------------------------------------------------------------------
// Memory Device
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, deviceLocator),kSMBMemoryDeviceDeviceLocatorKey,
NULL,NULL},
{kSMBTypeProcessorInformation,kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock),
kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock,NULL}, // SMcpumaxspeed
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, bankLocator),kSMBMemoryDeviceBankLocatorKey,
NULL,NULL},
// Bungo
{kSMBTypeProcessorInformation,kSMBWord,getFieldOffset(SMBProcessorInformation, currentClock),
kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentspeed
{kSMBTypeMemoryDevice,kSMBByte,getFieldOffset(SMBMemoryDevice, memoryType),kSMBMemoryDeviceMemoryTypeKey,
getSMBMemoryDeviceMemoryType,NULL},
{kSMBTypeProcessorInformation,kSMBByte,getFieldOffset(SMBProcessorInformation, processorUpgrade),
kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade
//
{kSMBTypeMemoryDevice,kSMBWord,getFieldOffset(SMBMemoryDevice, memorySpeed),kSMBMemoryDeviceMemorySpeedKey,
getSMBMemoryDeviceMemorySpeed,NULL},
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, serialNumber),
NULL, NULL, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, manufacturer),kSMBMemoryDeviceManufacturerKey,
getSMBMemoryDeviceManufacturer,NULL},
// Bungo
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, assetTag),
kSMBProcessorInformationAssetTagNumberKey, NULL, NULL}, // SMcpuassettag
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, serialNumber),kSMBMemoryDeviceSerialNumberKey,
getSMBMemoryDeviceSerialNumber,NULL},
//
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, assetTag),NULL,NULL,NULL},
{kSMBTypeProcessorInformation,kSMBString,getFieldOffset(SMBProcessorInformation, partNumber),
NULL, NULL, NULL},
{kSMBTypeMemoryDevice,kSMBWord,getFieldOffset(SMBMemoryDevice, errorHandle), NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL},
/* =====================
Memory Device (Type 17)
======================= */
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, deviceLocator),
kSMBMemoryDeviceDeviceLocatorKey, NULL, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, partNumber),kSMBMemoryDevicePartNumberKey,
getSMBMemoryDevicePartNumber,NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, bankLocator),
kSMBMemoryDeviceBankLocatorKey, NULL, NULL},
{kSMBTypeMemoryDevice,kSMBByte,getFieldOffset(SMBMemoryDevice, memoryType),
kSMBMemoryDeviceMemoryTypeKey, getSMBMemoryDeviceMemoryType,NULL},
{kSMBTypeMemoryDevice,kSMBWord,getFieldOffset(SMBMemoryDevice, memorySpeed),
kSMBMemoryDeviceMemorySpeedKey, getSMBMemoryDeviceMemorySpeed,NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, manufacturer),
kSMBMemoryDeviceManufacturerKey, getSMBMemoryDeviceManufacturer, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, serialNumber),
kSMBMemoryDeviceSerialNumberKey, getSMBMemoryDeviceSerialNumber, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, assetTag),
NULL, NULL, NULL},
{kSMBTypeMemoryDevice,kSMBWord,getFieldOffset(SMBMemoryDevice, errorHandle),
NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL},
{kSMBTypeMemoryDevice,kSMBString,getFieldOffset(SMBMemoryDevice, partNumber),
kSMBMemoryDevicePartNumberKey, getSMBMemoryDevicePartNumber, NULL},
//
//-------------------------------------------------------------------------------------------------------------------------
// Apple Specific
//-------------------------------------------------------------------------------------------------------------------------
// OEM Processor Type (Apple Specific - Type 131)
{kSMBTypeOemProcessorType,kSMBWord,getFieldOffset(SMBOemProcessorType, ProcessorType),kSMBOemProcessorTypeKey,
getSMBOemProcessorType,NULL},
// OEM Processor Bus Speed (Apple Specific - Type 132)
{kSMBTypeOemProcessorBusSpeed,kSMBWord,getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed),kSMBOemProcessorBusSpeedKey,
getSMBOemProcessorBusSpeed,NULL}
};
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 tableLength= 0;
static SMBWord handle= 0;
static SMBWord tableLength= 0;
static SMBWord handle= 0;
static SMBWord maxStructSize= 0;
static SMBWord structureCount= 0;
bool useSMBIOSdefaults = true; // Bungo
/* Rewrite this function */
void setDefaultSMBData(void)
{
defaultBIOSInfo.vendor= kDefaultVendorManufacturer;
defaultBIOSInfo.releaseDate= kDefaultBIOSReleaseDate;
defaultBIOSInfo.vendor = kDefaultVendorManufacturer;
defaultBIOSInfo.releaseDate = kDefaultBIOSReleaseDate;
defaultSystemInfo.manufacturer= kDefaultVendorManufacturer;
defaultSystemInfo.version= kDefaultSystemVersion;
defaultSystemInfo.serialNumber= kDefaultSerialNumber;
defaultBIOSInfo.release = kDefaultBIOSRelease; // Bungo
defaultBaseBoard.manufacturer= kDefaultVendorManufacturer;
defaultBaseBoard.product= kDefaultBoardProduct;
defaultSystemInfo.manufacturer = kDefaultVendorManufacturer;
defaultSystemInfo.version = kDefaultSystemVersion;
defaultSystemInfo.serialNumber = kDefaultSerialNumber;
defaultSystemInfo.skuNumber = kDefaultskuNumber; // Bungo
defaultBaseBoard.manufacturer = kDefaultVendorManufacturer;
defaultBaseBoard.product = kDefaultBoardProduct;
if (platformCPUFeature(CPU_FEATURE_MOBILE))
{
if (Platform.CPU.NoCores > 1)
}
else
{
switch (Platform.CPU.NoCores)
switch (Platform.CPU.NoCores)
{
case 1:
case 1:
defaultBIOSInfo.version= kDefaultMacminiBIOSVersion;
defaultSystemInfo.productName= kDefaultMacmini;
defaultSystemInfo.productName= kDefaultMacmini;
defaultSystemInfo.family= kDefaultMacminiFamily;
break;
case 2:
defaultBIOSInfo.version= kDefaultiMacBIOSVersion;
defaultSystemInfo.productName= kDefaultiMac;
defaultSystemInfo.productName= kDefaultiMac;
defaultSystemInfo.family= kDefaultiMacFamily;
break;
default:
{
switch (Platform.CPU.Family)
switch (Platform.CPU.Family)
{
case 0x06:
{
case CPU_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
defaultBIOSInfo.version= kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaulMacProWestmereBIOSReleaseDate;
defaultBIOSInfo.releaseDate= kDefaultMacProWestmereBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProWestmere;
defaultSystemInfo.family= kDefaultMacProFamily;
break;
break;
}
default:
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultBIOSInfo.version= kDefaultMacProBIOSVersion;
defaultSystemInfo.productName= kDefaultMacPro;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultSystemInfo.family= kDefaultMacProFamily;
break;
}
break;
current = structHeader->handle;
}
sprintf(key, "%s%d", keyString, idx);
if (value)
{
if (getIntForKey(key, (int *)&(value->dword), SMBPlist))
return true;
}
else
{
if (getValueForKey(key, string, &len, SMBPlist))
return true;
}
sprintf(key, "%s%d", keyString, idx);
if (value)
{
if (getIntForKey(key, (int *)&(value->dword), SMBPlist))
{
return true;
}
}
else
{
if (getValueForKey(key, string, &len, SMBPlist))
{
return true;
}
}
return false;
}
uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length;
if (!field)
{
return NULL;
}
for (field--; field != 0 && strlen((char *)stringPtr) > 0;
for (field--; field != 0 && strlen((char *)stringPtr) > 0;
field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1));
return (char *)stringPtr;
int strSize;
if (!field)
{
return;
}
if (!string)
{
*field = 0;
// remove any spaces found at the end
while ((strSize != 0) && (string[strSize - 1] == ' '))
{
strSize--;
}
if (strSize == 0)
{
int val;
if (numOfSetters <= idx)
{
return false;
}
switch (SMBSetters[idx].valueType)
{
case kSMBString:
{
if (SMBSetters[idx].keyString)
{
if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist))
{
break;
}
else
{
if (structPtr->orig->type == kSMBTypeMemoryDevice)// MemoryDevice only
{
if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL))
{
break;
}
}
}
}
if (SMBSetters[idx].getSMBValue)
{
if (SMBSetters[idx].getSMBValue((returnType *)&string))
{
break;
if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue))
// if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo
}
}
if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue) && *(char *)(SMBSetters[idx].defaultValue))
{
string = *(SMBSetters[idx].defaultValue);
// string = *(SMBSetters[idx].defaultValue); Bungo
string = (char *)(SMBSetters[idx].defaultValue);
break;
}
string = getSMBStringForField(structPtr->orig, *(uint8_t *)value);
break;
}
case kSMBByte:
case kSMBWord:
case kSMBDWord:
{
parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);
if (!parsed)
{
if (structPtr->orig->type == kSMBTypeMemoryDevice)// MemoryDevice only
{
parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val);
}
}
if (parsed)
{
switch (SMBSetters[idx].valueType)
}
if (SMBSetters[idx].getSMBValue)
{
if (SMBSetters[idx].getSMBValue(value))
{
return true;
#if 0
if (*(SMBSetters[idx].defaultValue))
}
}
// #if 0 Bungo: enables code below
// if (*(SMBSetters[idx].defaultValue)) Bungo
if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue))
{
value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);
return true;
// value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo
switch (SMBSetters[idx].valueType)
{
case kSMBByte:
value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue);
break;
case kSMBWord:
value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);
break;
case kSMBDWord:
default:
value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);
break;
}
return true;
}
#endif
// #endif Bungo
break;
}
if (SMBSetters[idx].valueType == kSMBString && string)
// if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified"
if (SMBSetters[idx].valueType == kSMBString)
{
setSMBStringForField(structPtr->new, string, &value->byte);
}
return true;
}
SMBWord structSize;
int i;
/* http://forge.voodooprojects.org/p/chameleon/issues/361/ */
/* http://forge.voodooprojects.org/p/chameleon/issues/361/ */
bool forceFullMemInfo = false;
if (structPtr->orig->type == kSMBTypeMemoryDevice)
stringsSize = 0;
if (handle < structPtr->orig->handle)
{
handle = structPtr->orig->handle;
}
memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length);
for (i = 0; i < numOfSetters; i++)
{
if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length))
{
setterFound = true;
setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset));
}
}
if (setterFound)
{
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
structSize = ptr - (uint8_t *)structPtr->new;
}
else
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
structSize = ptr - (uint8_t *)structPtr->orig;
memcpy((void *)structPtr->new, structPtr->orig, structSize);
tableLength += structSize;
if (structSize > maxStructSize)
{
maxStructSize = structSize;
}
structureCount++;
}
break;
default:
{
/* Add */
setSMBStruct(structPtr);
break;
}
}
ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length);
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
structPtr->orig = (SMBStructHeader *)ptr;
}
addSMBEndOfTable(structPtr);
}
// Bungo: does fix system uuid in SMBIOS istead of in EFI only
uint8_t *FixSystemUUID()
{
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};
const char *sysId = getStringForKey(kSMBSystemInformationUUIDKey, SMBPlist);
uint8_t *ret = (uint8_t *)getUUIDFromString(sysId);
for (;(structHeader->type != kSMBTypeSystemInformation);) // find System Information Table (Type 1) in patched SMBIOS
{
ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
for (; ((uint16_t *)ptr)[0] != 0; ptr++);
if (((uint16_t *)ptr)[0] == 0)
{
ptr += 2;
}
structHeader = (SMBStructHeader *)ptr;
}
ptr = ((SMBSystemInformation *)structHeader)->uuid;
if (!sysId || !ret) // no or bad custom UUID,...
{
sysId = 0;
ret = ((SMBSystemInformation *)structHeader)->uuid; // ...try bios dmi info UUID extraction
}
for (i=0, isZero=1, isOnes=1; i<UUID_LEN; i++) // check if empty or setable, means: no uuid present
{
if (ret[i] != 0x00)
{
isZero = 0;
}
if (ret[i] != 0xff)
{
isOnes = 0;
}
}
if (isZero || isOnes) // if empty or setable...
{
verbose("No UUID present in SMBIOS System Information Table\n");
ret = FixedUUID; // ...set a fixed value for system-id = 000102030405060708090A0B0C0D0E0F
}
memcpy(ptr, ret, UUID_LEN); // fix uuid in the table
return ptr;
} // Bungo: end fix
void setupSMBIOSTable(void)
{
SMBStructPtrs *structPtr;
uint8_t *buffer;
bool setSMB = true;
// bool setSMB = true; Bungo
if (!origeps)
{
return;
}
neweps = origeps;
structPtr = (SMBStructPtrs *)malloc(sizeof(SMBStructPtrs));
if (!structPtr)
{
return;
}
buffer = malloc(SMB_ALLOC_SIZE);
buffer = (uint8_t *)malloc(SMB_ALLOC_SIZE);
if (!buffer)
{
free(structPtr);
return;
}
bzero(buffer, SMB_ALLOC_SIZE);
structPtr->new = (SMBStructHeader *)buffer;
getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig);
if (setSMB)
setDefaultSMBData();
// getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig); Bungo
getBoolForKey(kSMBIOSdefaults, &useSMBIOSdefaults, &bootInfo->chameleonConfig);
// if (setSMB)
setDefaultSMBData();
// Bungo
setupNewSMBIOSTable(origeps, structPtr);
neweps = (SMBEntryPoint *)AllocateKernelMemory(sizeof(SMBEntryPoint));
if (!neweps)
{
free(buffer);
free(structPtr);
return;
}
bzero(neweps, sizeof(SMBEntryPoint));
neweps->anchor[0]= '_';
neweps->dmi.bcdRevision= 0x24;
if (!neweps->dmi.tableAddress)
{
free(buffer);
free(structPtr);
return;
}
memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength);
// Bungo
Platform.UUID = FixSystemUUID(); // Fix System UUID
neweps->dmi.checksum= 0;
neweps->dmi.checksum= 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint));
neweps->checksum= 0;
neweps->checksum= 0x100 - checksum8(neweps, sizeof(SMBEntryPoint));
neweps->checksum= 0;
neweps->checksum= 0x100 - checksum8(neweps, sizeof(SMBEntryPoint));
free(buffer);
free(structPtr);
decodeSMBIOSTable(neweps);
}
{
case SMBIOS_ORIGINAL:
if (!origeps)
{
origeps = getAddressOfSmbiosTable();
}
return origeps;
case SMBIOS_PATCHED:
return neweps;
SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;
int dimmnbr = 0;
Platform.DMI.MaxMemorySlots= 0;
Platform.DMI.CntMemorySlots= 0;
Platform.DMI.MaxMemorySlots= 0;// number of memory slots polulated by SMBIOS
Platform.DMI.CntMemorySlots= 0;// number of memory slots counted
Platform.DMI.MemoryModules= 0;
for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
{
switch (structHeader->type)
{
/* Bungo
case kSMBTypeSystemInformation:
Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid;
break;
*/
case kSMBTypePhysicalMemoryArray:
Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices;
case kSMBTypeMemoryDevice:
Platform.DMI.CntMemorySlots++;
if (((SMBMemoryDevice *)structHeader)->memorySize != 0)
{
Platform.DMI.MemoryModules++;
}
if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)
{
Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed;
}
dimmnbr++;
break;
default:
break;
}
structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length);
for (; ((uint16_t *)structPtr)[0] != 0; structPtr++);
if (((uint16_t *)structPtr)[0] == 0)
{
structPtr += 2;
}
structHeader = (SMBStructHeader *)structPtr;
}
}
trunk/i386/libsaio/smbios.h
118118
119119
120120
121
122
123
124
125
126
127
121128
122129
123130
SMBString releaseDate; // BIOS release date
SMBByte romSize; // (n); 64K * (n+1) bytes
SMBQWord characteristics; // supported BIOS functions
// Bungo
SMBByte characteristicsExt1; // BIOS characteristics extension byte 1
SMBByte characteristicsExt2; // BIOS characteristics extension byte 2
SMBByte releaseMajor; // BIOS release (major)
SMBByte releaseMinor; // BIOS release (minor)
SMBByte ECreleaseMajor; // Embedded Controller firmware release (major)
SMBByte ECreleaseMinor; // Embedded Controller firmware release (minor)
} __attribute__((packed)) SMBBIOSInformation;
//
trunk/i386/libsaio/fake_efi.c
7676
7777
7878
79
80
79
80
81
82
8183
8284
8385
......
463465
464466
465467
466
468
467469
468470
469471
472
470473
471474
472
475
473476
474477
475478
......
501504
502505
503506
504
505
506
507
507
508
509
510
508511
509512
510513
......
527530
528531
529532
533
530534
531535
532536
......
546550
547551
548552
549
553
554
550555
551556
552557
......
622627
623628
624629
625
630
631
626632
627633
628634
629635
636
630637
638
639
640
641
642
643
631644
632645
633646
static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','2', 0};
static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */
/* Default platform system_id (fix by IntVar) */
static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen
// Bungo
/* Default platform system_id (fix by IntVar)
static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen
*/
/* Just a ret instruction */
static uint8_t const VOIDRET_INSTRUCTIONS[] = {0xc3};
dst[i] = src[i];
}
dst[(*len)] = '\0';
*len = ((*len)+1)*2; // return the CHAR16 bufsize in cluding zero terminated CHAR16
*len = ((*len)+1)*2; // return the CHAR16 bufsize including zero terminated CHAR16
return dst;
}
// Bungo
/*
* Get the SystemID from the bios dmi info
*/
staticEFI_CHAR8* getSmbiosUUID()
{
static EFI_CHAR8 uuid[UUID_LEN];
return uuid;
}
/*
* return a binary UUID value from the overriden SystemID and SMUUID if found,
* or from the bios if not, or from a fixed value if no bios value is found
*/
// return a binary UUID value from the overriden SystemID and SMUUID if found,
// or from the bios if not, or from a fixed value if no bios value is found
static EFI_CHAR8* getSystemID()
{
// unable to determine UUID for host. Error: 35 fix
verbose("Customizing SystemID with : %s\n", getStringFromUUID(ret)); // apply a nice formatting to the displayed output
return ret;
}
*/
/*
* Must be called AFTER setup Acpi because we need to take care of correct
void setupEfiDeviceTree(void)
{
EFI_CHAR8* ret = 0;
// Bungo
// EFI_CHAR8* ret = 0;
EFI_CHAR16* ret16 = 0;
size_t len = 0;
Node*node;
DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &Platform.CPU.CPUFrequency);
}
// Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
// Bungo
/* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
if ((ret=getSystemID()))
{
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32*) ret);
}
*/
if (Platform.UUID)
{
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, Platform.UUID);
}
//
// Export SystemSerialNumber if present
if ((ret16=getSmbiosChar16("SMserial", &len)))
{

Archive Download the corresponding diff file

Revision: 2284