Chameleon

Chameleon Commit Details

Date:2014-06-25 18:46:54 (9 years 8 months ago)
Author:ErmaC
Commit:2382
Parents: 2381
Message:Merge changes from Bungo's branch + fine tuning for DMI.
Changes:
M/trunk/i386/libsaio/smbios.h
M/trunk/i386/libsaio/console.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/bootstruct.c
M/trunk/i386/boot2/boot.h
M/trunk/i386/libsaio/sys.c
M/trunk/i386/libsaio/stringTable.c
M/trunk/i386/libsaio/device_tree.c
M/trunk/i386/libsaio/load.c
M/trunk/i386/libsaio/hfs.c
M/trunk/i386/boot2/drivers.c
M/trunk/i386/libsaio/acpi_patcher.c
M/trunk/i386/libsaio/device_tree.h
M/trunk/i386/libsaio/platform.c
M/trunk/i386/libsaio/bootargs.h
M/trunk/i386/libsaio/cpu.c
M/trunk/i386/libsaio/smbios_getters.c
M/trunk/i386/libsaio/platform.h
M/trunk/i386/libsaio/fake_efi.c
M/trunk/i386/libsaio/device_inject.c
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/boot2/options.c
M/trunk/i386/libsaio/smbios_getters.h
M/trunk/i386/libsaio/smbios_decode.c

File differences

trunk/i386/libsaio/smbios_getters.h
1717
1818
1919
20
21
20
21
2222
2323
2424
......
2727
2828
2929
30
30
3131
3232
3333
kSMBString,
kSMBByte,
kSMBWord,
kSMBDWord
//kSMBQWord
kSMBDWord,
kSMBQWord
} SMBValueType;
typedef union
uint8_tbyte;
uint16_tword;
uint32_tdword;
//uint64_tqword;
uint64_tqword;
} returnType;
extern bool getProcessorInformationExternalClock(returnType *value);
trunk/i386/libsaio/console.c
246246
247247
248248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
249268
250269
251270
} else {
vprf(fmt, ap);
}
{
// Kabyl: BooterLog
struct putc_info pi;
if (!msgbuf) {
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) {
return 0;
}
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return(0);
}
trunk/i386/libsaio/bootstruct.c
2929
3030
3131
32
33
34
35
36
37
38
39
40
41
3242
3343
3444
......
5262
5363
5464
55
65
5666
5767
5868
#include "libsaio.h"
#include "bootstruct.h"
#ifndef DEBUG_BOOTSTRUCT
#define DEBUG_BOOTSTRUCT 0
#endif
#if DEBUG_BOOTSTRUCT
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
/*==========================================================================
* Initialize the structure of parameters passed to
* the kernel by the booter.
bootArgs = (boot_args *)malloc(sizeof(boot_args));
bootArgsPreLion = (boot_args_pre_lion *)malloc(sizeof(boot_args_pre_lion));
bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t));
if (bootArgs == 0 || bootInfo == 0)
if (bootArgs == 0 || bootArgsPreLion == 0 || bootInfo == 0)
stop("Couldn't allocate boot info\n");
bzero(bootArgs, sizeof(boot_args));
trunk/i386/libsaio/device_tree.c
398398
399399
400400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
401417
418
419
402420
403421
404422
}
//==============================================================================
// Bungo
Property *
DT__GetProperty(Node *node, const char *name)
{
Property *prop;
for (prop = node->properties; prop; prop = prop->next)
{
if (strcmp(prop->name, name) == 0)
{
return prop;
}
}
return NULL;
}
//==============================================================================
Node *
DT__FindNode(const char *path, bool createIfMissing)
{
trunk/i386/libsaio/hfs.c
304304
305305
306306
307
307
308308
309309
310310
......
370370
371371
372372
373
373
374374
375375
376376
......
435435
436436
437437
438
438
439439
440440
441441
}
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
// Skip a lead '/'. Start in the system folder if there are two.
if (filePath[0] == '/')
{
if (filePath[1] == '/')
if (*dirIndex == -1) return -1;
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
// Skip a lead '/'. Start in the system folder if there are two.
if (dirPath[0] == '/') {
if (dirPath[1] == '/') {
if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]);
if (HFSInitPartition(ih) == -1) return -1;
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
// Skip a lead '/'. Start in the system folder if there are two.
if (filePath[0] == '/') {
if (filePath[1] == '/') {
if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]);
trunk/i386/libsaio/acpi_patcher.c
2323
2424
2525
26
26
2727
2828
2929
......
112112
113113
114114
115
115
116116
117117
118118
......
136136
137137
138138
139
139
140140
141141
142142
......
147147
148148
149149
150
150
151151
152152
153153
......
161161
162162
163163
164
164
165165
166166
167167
168168
169169
170
170
171171
172172
173173
......
182182
183183
184184
185
185
186186
187187
188188
......
196196
197197
198198
199
199
200200
201201
202202
......
205205
206206
207207
208
208
209209
210210
211211
......
234234
235235
236236
237
237
238238
239239
240240
241241
242
242
243243
244244
245245
246246
247247
248248
249
249
250250
251251
252252
......
397397
398398
399399
400
400
401401
402402
403403
404
404
405405
406406
407407
......
419419
420420
421421
422
422
423423
424424
425425
426426
427
427
428428
429429
430430
......
587587
588588
589589
590
590
591591
592592
593593
......
608608
609609
610610
611
611
612612
613613
614614
......
658658
659659
660660
661
661
662662
663663
664664
665665
666
666
667667
668668
669669
......
677677
678678
679679
680
680
681681
682682
683683
......
689689
690690
691691
692
692
693693
694694
695695
......
708708
709709
710710
711
712
713
714
715
716
717
718
719
720
721
722
723
711
712
713
714
715
716
717
718
724719
725
726
727
728
729
730
731
732
733
734
720
721
722
723
724
725
726
727
728
735729
730
731
732
736733
737
734
738735
739736
740737
......
747744
748745
749746
750
747
751748
752749
753750
......
756753
757754
758755
759
756
760757
761758
762759
......
772769
773770
774771
775
772
776773
777774
778775
......
794791
795792
796793
797
794
798795
799796
800797
......
803800
804801
805802
806
803
804
807805
808806
809807
......
823821
824822
825823
824
826825
827826
828827
......
840839
841840
842841
843
844
842
843
844
845845
846846
847847
......
849849
850850
851851
852
852
853853
854854
855855
......
859859
860860
861861
862
863
864
865
862866
863867
864868
......
866870
867871
868872
869
873
870874
871875
872876
......
876880
877881
878882
879
883
880884
881885
882886
......
895899
896900
897901
898
902
899903
900904
901905
......
909913
910914
911915
912
916
913917
914918
915919
916920
917
921
918922
919923
920924
925
921926
922
923
924927
925928
929
926930
927
928931
929932
930933
......
932935
933936
934937
935
938
936939
937940
938
941
939942
940943
941944
......
955958
956959
957960
958
959961
960962
963
961964
962
963965
966
967
968
969
970
971
972
973
974
975
976
977
978
964979
965
980
966981
967982
968
983
984
969985
970986
971987
972988
973
974
975
976
977
978
979
980
981
982
983
984
985989
986990
987991
......
991995
992996
993997
994
998
995999
1000
9961001
9971002
9981003
......
10041009
10051010
10061011
1007
1012
10081013
10091014
10101015
......
10191024
10201025
10211026
1027
1028
1029
10221030
10231031
10241032
1025
1033
10261034
10271035
10281036
1037
10291038
1030
1031
10321039
10331040
1041
10341042
1035
1036
1037
10381043
10391044
10401045
10411046
10421047
10431048
1044
1045
1049
10461050
10471051
1048
1052
10491053
10501054
10511055
10521056
10531057
10541058
1055
1059
10561060
10571061
10581062
1063
10591064
10601065
10611066
10621067
10631068
10641069
1070
10651071
10661072
10671073
10681074
10691075
10701076
1077
1078
1079
10711080
1072
1081
1082
1083
1084
1085
1086
1087
10731088
1089
1090
1091
10741092
10751093
10761094
1077
1095
10781096
10791097
10801098
......
10821100
10831101
10841102
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
10961103
1104
10971105
10981106
1107
10991108
11001109
1101
11021110
1103
11041111
11051112
11061113
1107
11081114
11091115
11101116
11111117
1118
11121119
1113
1114
1120
11151121
1116
11171122
11181123
1119
11201124
11211125
11221126
1123
1124
1127
11251128
11261129
1127
11281130
11291131
11301132
1131
11321133
11331134
11341135
......
11381139
11391140
11401141
1142
11411143
11421144
11431145
#elif DEBUG_ACPI==1
#define DBG(x...) printf(x)
#else
#define DBG(x...)
#define DBG(x...) msglog(x)
#endif
// Slice: New signature compare function
fd = open(dirSpec, 0);
if (fd < 0) {
// NOT FOUND:
verbose("ACPI Table not found: %s\n", filename);
DBG("ACPI Table not found: %s\n", filename);
*dirSpec = '\0';
}
}
{
if (read (fd, tableAddr, file_size (fd))!=file_size (fd))
{
printf("Couldn't read table %s\n",dirspec);
DBG("Couldn't read table %s\n",dirspec);
free (tableAddr);
close (fd);
return NULL;
return tableAddr;
}
close (fd);
printf("Couldn't allocate memory for table \n", dirspec);
DBG("Couldn't allocate memory for table \n", dirspec);
}
//printf("Couldn't find table %s\n", filename);
return NULL;
{
uint32_t i;
DBG("start finding cpu names. length %d\n", length);
DBG("Start finding cpu names. length %d\n", length);
for (i=0; i<length-7; i++)
{
if (dsdt[i] == 0x5B && dsdt[i+1] == 0x83) // ProcessorOP
{
DBG("dsdt: %x%x\n", dsdt[i], dsdt[i+1]);
DBG("DSDT: %x%x\n", dsdt[i], dsdt[i+1]);
uint32_t offset = i + 3 + (dsdt[i+2] >> 6);
if (!aml_isvalidchar(c))
{
add_name = false;
verbose("Invalid character found in ProcessorOP 0x%x!\n", c);
DBG("Invalid character found in ProcessorOP 0x%x!\n", c);
break;
}
}
if (acpi_cpu_count == 0)
acpi_cpu_p_blk = dsdt[i] | (dsdt[i+1] << 8);
verbose("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]);
DBG("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]);
if (++acpi_cpu_count == 32) {
return;
}
}
DBG("end finding cpu names: cpu names found: %d\n", acpi_cpu_count);
DBG("End finding cpu names: cpu names found: %d\n", acpi_cpu_count);
}
struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt)
};
if (Platform.CPU.Vendor != 0x756E6547) {
verbose ("Not an Intel platform: C-States will not be generated !!!\n");
DBG("Not an Intel platform: C-States will not be generated !!!\n");
return NULL;
}
if (fadt == NULL) {
verbose ("FACP not exists: C-States will not be generated !!!\n");
DBG("FACP not exists: C-States will not be generated !!!\n");
return NULL;
}
struct acpi_2_dsdt* dsdt = (void*)fadt->DSDT;
if (dsdt == NULL) {
verbose ("DSDT not found: C-States will not be generated !!!\n");
DBG("DSDT not found: C-States will not be generated !!!\n");
return NULL;
}
// dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length);
verbose ("SSDT with CPU C-States generated successfully\n");
DBG("SSDT with CPU C-States generated successfully\n");
return ssdt;
} else {
verbose ("ACPI CPUs not found: C-States not generated !!!\n");
DBG("ACPI CPUs not found: C-States not generated !!!\n");
}
return NULL;
};
if (Platform.CPU.Vendor != 0x756E6547) {
verbose ("Not an Intel platform: P-States will not be generated !!!\n");
DBG("Not an Intel platform: P-States will not be generated !!!\n");
return NULL;
}
if (!(Platform.CPU.Features & CPU_FEATURE_MSR)) {
verbose ("Unsupported CPU: P-States will not be generated !!! No MSR support\n");
DBG("Unsupported CPU: P-States will not be generated !!! No MSR support\n");
return NULL;
}
minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
DBG("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
// Sanity check
if (maximum.Control < minimum.Control) {
break;
}
default:
verbose ("Unsupported CPU (0x%X): P-States not generated !!!\n", Platform.CPU.Family);
DBG("Unsupported CPU (0x%X): P-States not generated !!!\n", Platform.CPU.Family);
break;
}
}
//dumpPhysAddr("P-States SSDT content: ", ssdt, ssdt->Length);
verbose ("SSDT with CPU P-States generated successfully\n");
DBG("SSDT with CPU P-States generated successfully\n");
return ssdt;
}
} else {
verbose ("ACPI CPUs not found: P-States not generated !!!\n");
DBG("ACPI CPUs not found: P-States not generated !!!\n");
}
return NULL;
bool fadt_rev2_needed = false;
bool fix_restart;
bool fix_restart_ps2;
const char * value;
int value = 1;
// Restart Fix
if (Platform.CPU.Vendor == 0x756E6547) { /* Intel */
getBoolForKey(kRestartFix, &fix_restart, &bootInfo->chameleonConfig);
}
} else {
verbose ("Not an Intel platform: Restart Fix not applied !!!\n");
DBG("Not an Intel platform: Restart Fix not applied !!!\n");
fix_restart = false;
}
fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length);
memcpy(fadt_mod, fadt, fadt->Length);
}
// Determine system type / PM_Model
if ( (value=getStringForKey(kSystemType, &bootInfo->chameleonConfig))!=NULL)
{
if (Platform.Type > 6) {
if(fadt_mod->PM_Profile<=6) {
Platform.Type = fadt_mod->PM_Profile; // get the fadt if correct
} else {
Platform.Type = 1;/* Set a fixed value (Desktop) */
}
verbose("Error: system-type must be 0..6. Defaulting to %d !\n", Platform.Type);
} else {
Platform.Type = (unsigned char) strtoul(value, NULL, 10);
}
// Determine PM Profile
if (getIntForKey(kSystemType, &value, &bootInfo->chameleonConfig)) {
DBG("FADT: changing PM Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, (unsigned char)value);
// user has overriden the PM Profile so take care of it in FACP
fadt_mod->PM_Profile = (unsigned char)value;
} else {
DBG("FADT: PM Profile=0x%02x\n", fadt_mod->PM_Profile);
}
// Set PM_Profile from System-type if only user wanted this value to be forced
if (fadt_mod->PM_Profile != Platform.Type) {
if (value) {
// user has overriden the SystemType so take care of it in FACP
verbose("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type);
fadt_mod->PM_Profile = Platform.Type;
} else {
// PM_Profile has a different value and no override has been set, so reflect the user value to ioregs
Platform.Type = fadt_mod->PM_Profile <= 6 ? fadt_mod->PM_Profile : 1;
}
// Check if PM Profile is correct (1..3), otherwise set it to value
switch (fadt_mod->PM_Profile) {
case 1: break;
case 2: break;
case 3: break;
default:
value = 1;
DBG("FADT: wrong PM Profile (0x%02x), must be 1..3. Defaulting to 0x%02x!\n", fadt_mod->PM_Profile, (unsigned char)value);
fadt_mod->PM_Profile = (unsigned char)value;
}
// Setup system-type
Platform.Type = fadt_mod->PM_Profile;
// We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree()
// because we need to take care of facp original content, if it is correct.
// because we need to take care of FACP original content, if it is correct.
setupSystemType();
// Patch FADT to fix restart
fadt_mod->Reset_AccessWidth= 0x01; // Byte access
fadt_mod->Reset_Address= 0x64; // Address of the register
fadt_mod->Reset_Value= 0xfe; // Value to write to reset the system
msglog("FADT: PS2 Restart Fix applied!\n");
DBG("FADT: PS2 Restart Fix applied!\n");
} else {
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID= 0x01; // System I/O
fadt_mod->Reset_AccessWidth= 0x01; // Byte access
fadt_mod->Reset_Address= 0x0cf9; // Address of the register
fadt_mod->Reset_Value= 0x06; // Value to write to reset the system
verbose("FADT: ACPI Restart Fix applied!\n");
DBG("FADT: ACPI Restart Fix applied!\n");
}
}
DBG("New @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT);
verbose("FADT: Using custom DSDT!\n");
DBG("FADT: Using custom DSDT!\n");
}
// Correct the checksum
if(acpi20_p) {
addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");
} else {
verbose("No ACPI 2.\n");
DBG("No ACPI 2.\n");
}
return 1;
}
int setupAcpi(void)
{
int version;
void *new_dsdt;
void *new_dsdt = NULL; // DSDT.aml DSDT
void *new_table;
const char *filename;
// Load replacement DSDT
new_dsdt = loadACPITable(dirSpec);
// Mozodojo: going to patch FACP and load SSDT's even if DSDT.aml is not present
/*if (!new_dsdt)
{
getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig);
getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig);
DBG("Generating P-States config: %d\n", generate_pstates);
DBG("Generating C-States config: %d\n", generate_cstates);
DBG("Generating P-States config: %s\n", generate_pstates ? "YES" : "NO");
DBG("Generating C-States config: %s\n", generate_cstates ? "YES" : "NO");
//DBG("Generating T-States config: %s\n", generate_tstates ? "YES" : "NO");
{
int i;
for (i = 0; i < 30; i++) {
char filename[512];
sprintf(filename, i > 0?"SSDT-%d.aml":"SSDT.aml", i);
sprintf(filename, i > 0 ? "SSDT-%d.aml" : "SSDT.aml", i);
if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) ) {
ssdt_count++;
}
}
// Load new table
sprintf(dirSpec, "ECDT.aml");
new_table = loadACPITable(dirSpec);
// Do the same procedure for both versions of ACPI
for (version = 0; version < 2; version++) {
struct acpi_2_rsdp *rsdp, *rsdp_mod;
int rsdplength;
// Find original rsdp
rsdp=(struct acpi_2_rsdp *)(version?getAddressOfAcpi20Table():getAddressOfAcpiTable());
rsdp=(struct acpi_2_rsdp *)(version ? getAddressOfAcpi20Table() : getAddressOfAcpiTable());
if (!rsdp) {
DBG("No ACPI version %d found. Ignoring\n", version+1);
if (version) {
}
continue;
}
rsdplength=version?rsdp->Length:20;
rsdplength=version ? rsdp->Length : 20;
DBG("RSDP version %d found @%x. Length=%d\n",version+1,rsdp,rsdplength);
if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000) {
uint32_t *rsdt_entries;
int rsdt_entries_num;
int dropoffset=0, i;
int dropoffset=0, i, j;
// mozo: using malloc cos I didn't found how to free already allocated kernel memory
rsdt_mod=(struct acpi_2_rsdt *)malloc(rsdt->Length);
continue;
}
DBG("TABLE %c%c%c%c,",table[0],table[1],table[2],table[3]);
DBG("TABLE %c%c%c%c@%x: ", table[0],table[1],table[2],table[3],rsdt_entries[i]);
rsdt_entries[i-dropoffset]=rsdt_entries[i];
if (drop_ssdt && tableSign(table, "SSDT")) {
verbose("OEM SSDT tables was dropped\n");
DBG("dropped (OEM)\n");
dropoffset++;
continue;
}
if (tableSign(table, "DSDT")) {
DBG("DSDT found\n");
verbose("Custom DSDT table was found\n");
if(new_dsdt) {
rsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;
DBG("custom table added\n");
}
continue;
}
struct acpi_2_fadt *fadt, *fadt_mod;
fadt=(struct acpi_2_fadt *)rsdt_entries[i];
DBG("FADT found @%x, Length %d\n",fadt, fadt->Length);
DBG("found, Length %d\n",fadt->Length);
if (!fadt || (uint32_t)fadt == 0xffffffff || fadt->Length>0x10000) {
printf("FADT incorrect. Not modified\n");
DBG("FADT incorrect. Not modified\n");
continue;
}
generate_pstates = false; // Generate SSDT only once!
ssdt_count++;
}
continue;
}
DBG("copied (OEM)\n");
}
DBG("\n");
// Mozodojo: Insert additional SSDTs into RSDT
if(ssdt_count > 0) {
for (j=0; j<ssdt_count; j++) {
rsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j];
}
DBG("RSDT: Added %d SSDT table(s)\n", ssdt_count);
}
if (new_table) {
rsdt_entries[i-dropoffset+j]=(uint32_t)new_table;
DBG("RSDT: Added custom table %s @%x\n", "ECDT", new_table);
}
// Allocate rsdt in Kernel memory area
rsdt_mod->Length += 4*ssdt_count - 4*dropoffset;
rsdt_mod->Length += 4*ssdt_count + 4 - 4*dropoffset;
struct acpi_2_rsdt *rsdt_copy = (struct acpi_2_rsdt *)AllocateKernelMemory(rsdt_mod->Length);
memcpy (rsdt_copy, rsdt_mod, rsdt_mod->Length);
free(rsdt_mod); rsdt_mod = rsdt_copy;
free(rsdt_mod);
rsdt_mod = rsdt_copy;
rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod;
rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4;
rsdt_entries=(uint32_t *)(rsdt_mod+1);
// Mozodojo: Insert additional SSDTs into RSDT
if(ssdt_count>0) {
int j;
for (j=0; j<ssdt_count; j++) {
rsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j];
}
verbose("RSDT: Added %d SSDT table(s)\n", ssdt_count);
}
// Correct the checksum of RSDT
DBG("RSDT: Original checksum %d, ", rsdt_mod->Checksum);
DBG("New checksum %d at %x\n", rsdt_mod->Checksum,rsdt_mod);
} else {
rsdp_mod->RsdtAddress=0;
printf("RSDT not found or RSDT incorrect\n");
DBG("RSDT not found or RSDT incorrect\n");
}
DBG("\n");
if (version) {
struct acpi_2_xsdt *xsdt, *xsdt_mod;
if (xsdt && (uint64_t)rsdp->XsdtAddress<0xffffffff && xsdt->Length<0x10000) {
uint64_t *xsdt_entries;
int xsdt_entries_num, i;
int xsdt_entries_num, i, j;
int dropoffset=0;
// mozo: using malloc cos I didn't found how to free already allocated kernel memory
if (!table) {
continue;
}
DBG("TABLE %c%c%c%c@%x: ", table[0],table[1],table[2],table[3],xsdt_entries[i]);
xsdt_entries[i-dropoffset]=xsdt_entries[i];
if (drop_ssdt && tableSign(table, "SSDT")) {
verbose("OEM SSDT tables was dropped\n");
DBG("dropped (OEM)\n");
dropoffset++;
continue;
}
if (tableSign(table, "DSDT")) {
DBG("DSDT found\n");
if (new_dsdt) {
xsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;
DBG("custom table added\n");
}
DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]);
continue;
}
if (tableSign(table, "FACP")) {
struct acpi_2_fadt *fadt, *fadt_mod;
fadt=(struct acpi_2_fadt *)(uint32_t)xsdt_entries[i];
DBG("FADT found @%x%x, Length %d\n",(uint32_t)(xsdt_entries[i]>>32),fadt,
fadt->Length);
DBG("found, Length %d\n",(uint32_t)(xsdt_entries[i]>>32), fadt->Length);
if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000) {
verbose("FADT incorrect or after 4GB. Dropping XSDT\n");
DBG("FADT incorrect or after 4GB. Dropping XSDT\n");
goto drop_xsdt;
}
fadt_mod = patch_fadt(fadt, new_dsdt);
xsdt_entries[i-dropoffset]=(uint32_t)fadt_mod;
DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]);
// DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]);
// Generate _CST SSDT
if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod))) {
DBG("C-States generated\n");
generate_cstates = false; // Generate SSDT only once!
ssdt_count++;
}
// Generating _PSS SSDT
if (generate_pstates && (new_ssdt[ssdt_count] = generate_pss_ssdt((void*)fadt_mod->DSDT))) {
DBG("P-States generated\n");
generate_pstates = false; // Generate SSDT only once!
ssdt_count++;
}
continue;
}
DBG("copied (OEM)\n");
// DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]);
}
DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]);
// Mozodojo: Insert additional SSDTs into XSDT
if(ssdt_count > 0) {
for (j=0; j<ssdt_count; j++) {
xsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j];
}
DBG("Added %d SSDT table(s) into XSDT\n", ssdt_count);
}
if (new_table) {
xsdt_entries[i-dropoffset+j]=(uint32_t)new_table;
DBG("XSDT: Added custom table %s @%x\n", "ECDT", new_table);
}
// Allocate xsdt in Kernel memory area
xsdt_mod->Length += 8*ssdt_count - 8*dropoffset;
xsdt_mod->Length += 8*ssdt_count + 8 - 8*dropoffset;
struct acpi_2_xsdt *xsdt_copy = (struct acpi_2_xsdt *)AllocateKernelMemory(xsdt_mod->Length);
memcpy(xsdt_copy, xsdt_mod, xsdt_mod->Length);
free(xsdt_mod); xsdt_mod = xsdt_copy;
xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8;
xsdt_entries=(uint64_t *)(xsdt_mod+1);
// Mozodojo: Insert additional SSDTs into XSDT
if(ssdt_count > 0) {
int j;
for (j=0; j<ssdt_count; j++) {
xsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j];
}
verbose("Added %d SSDT table(s) into XSDT\n", ssdt_count);
}
// Correct the checksum of XSDT
DBG("XSDT: Original checksum %d, ", xsdt_mod->Checksum);
xsdt_mod->Checksum=0;
xsdt_mod->Checksum=256-checksum8(xsdt_mod,xsdt_mod->Length);
DBG("New checksum %d\n", xsdt_mod->Checksum);
} else {
drop_xsdt:
DBG("About to drop XSDT\n");
/*FIXME: Now we just hope that if MacOS doesn't find XSDT it reverts to RSDT.
* A Better strategy would be to generate
*/
rsdp_mod->XsdtAddress=0xffffffffffffffffLL;
verbose("XSDT not found or XSDT incorrect\n");
}
}
DBG("\n");
// Correct the checksum of RSDP
// Correct the checksum of RSDP
DBG("RSDP: Original checksum %d, ", rsdp_mod->Checksum);
rsdp_mod->Checksum=0;
rsdp_mod->Checksum=256-checksum8(rsdp_mod,20);
DBG("New checksum %d\n", rsdp_mod->Checksum);
if (version) {
DBG("RSDP: Original extended checksum %d", rsdp_mod->ExtendedChecksum);
DBG("RSDP: Original extended checksum %d, ", rsdp_mod->ExtendedChecksum);
rsdp_mod->ExtendedChecksum=0;
rsdp_mod->ExtendedChecksum=256-checksum8(rsdp_mod,rsdp_mod->Length);
DBG("New extended checksum %d\n", rsdp_mod->ExtendedChecksum);
}
//verbose("Patched ACPI version %d DSDT\n", version+1);
if (version) {
/* XXX aserebln why uint32 cast if pointer is uint64 ? */
acpi20_p = (uint64_t)(uint32_t)rsdp_mod;
acpi10_p = (uint64_t)(uint32_t)rsdp_mod;
addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");
}
DBG("ACPI version %d patching finished\n\n", version+1);
}
#if DEBUG_ACPI
printf("Press a key to continue... (DEBUG_ACPI)\n");
trunk/i386/libsaio/device_tree.h
6767
6868
6969
70
71
72
7073
7174
7275
extern char *
DT__GetName(Node *node);
extern Property *
DT__GetProperty(Node *node, const char *name);
void
DT__Initialize(void);
trunk/i386/libsaio/bootargs.h
116116
117117
118118
119
119
120120
121121
122122
......
178178
179179
180180
181
181
182182
183183
184184
uint16_t Revision;/* Revision of boot_args structure */
uint16_t Version;/* Version of boot_args structure */
uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */
uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */
uint8_t debugMode; /* Bit field with behavior changes */
uint8_t __reserved1[2];
uint32_t efiRuntimeServicesPageCount;
uint32_t efiSystemTable; /* physical address of system table in runtime area */
uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */
uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */
uint8_t __reserved1[3];
uint32_t __reserved2[1];
uint32_t performanceDataStart; /* physical address of log */
trunk/i386/libsaio/device_inject.c
2020
2121
2222
23
23
2424
2525
2626
#if DEBUG_INJECT
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#define DBG(x...)msglog(x)
#endif
uint32_t devices_number = 1;
trunk/i386/libsaio/sys.c
6565
6666
6767
68
6869
6970
7071
......
7677
7778
7879
80
81
82
83
84
85
7986
8087
8188
......
203210
204211
205212
206
213
214
207215
208216
209217
210
211
212
218
219
220
221
222
223
213224
214225
215226
216227
228
217229
218230
219231
220232
233
221234
222235
223236
......
230243
231244
232245
233
246
247
234248
235249
236250
#include "disk.h"
#include "ramdisk.h"
#include "xml.h"
#include "sl.h"
#include <libkern/crypto/md5.h>
//#include <uuid/uuid.h>
static unsigned char kFSUUIDNamespaceSHA1[] = {0xB3,0xE2,0x0F,0x39,0xF2,0x92,0x11,0xD6,0x97,0xA4,0x00,0x30,0x65,0x43,0xEC,0xAC};
#endif
#if DEBUG
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
extern int multiboot_partition;
extern int multiboot_partition_set;
extern int multiboot_skip_partition;
readFile = bvr->fs_readfile;
if (readFile != NULL) {
if (readFile != NULL)
{
// Read the first 4096 bytes (fat header)
length = readFile(bvr, (char *)filePath, *binary, 0, 0x1000);
if (length > 0) {
if (ThinFatFile(binary, &length) == 0) {
if (length == 0) {
if (length > 0)
{
if (ThinFatFile(binary, &length) == 0)
{
if (length == 0)
{
return 0;
}
// We found a fat binary; read only the thin part
DBG("Fat Binary found. Reading thin part only...\n");
length = readFile(bvr, (char *)filePath, (void *)kLoadAddr, (unsigned long)(*binary) - kLoadAddr, length);
*binary = (void *)kLoadAddr;
} else {
// Not a fat binary; read the rest of the file
DBG("Thin Binary found. Reading rest of the file...\n");
length2 = readFile(bvr, (char *)filePath, (void *)(kLoadAddr + length), length, 0);
if (length2 == -1) {
} else {
length = bvr->fs_loadfile(bvr, (char *)filePath);
if (length > 0) {
if (length > 0)
{
ThinFatFile(binary, &length);
}
}
trunk/i386/libsaio/load.c
3232
3333
3434
35
36
37
38
39
40
3541
3642
3743
......
5460
5561
5662
57
63
5864
5965
60
66
6167
6268
6369
......
107113
108114
109115
110
111
112
113
114
115
116
117
118
119
120
116
117
118
119
120
121
122
123
124
125
126
127
121128
122129
123130
......
131138
132139
133140
134
141
135142
136143
137144
138
145
139146
140147
141148
......
201208
202209
203210
204
205
206
207
208
209
211
212
213
214
215
216
217
210218
211
212219
213220
214
221
215222
216223
217224
#include <sl.h>
#if DEBUG
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
static long DecodeSegment(long cmdBase, unsigned int*load_addr, unsigned int *load_size);
static long DecodeUnixThread(long cmdBase, unsigned int *entry);
static long DecodeSymbolTable(long cmdBase);
uint32_t fapoffset;
uint32_t fapsize;
if (fhp->magic == FAT_MAGIC) {
if (fhp->magic == FAT_MAGIC)/* 0xcafebabe */{
nfat = fhp->nfat_arch;
swapped = 0;
} else if (fhp->magic == FAT_CIGAM) {
} else if (fhp->magic == FAT_CIGAM)/* 0xbebafeca */{
nfat = OSSwapInt32(fhp->nfat_arch);
swapped = 1;
} else {
mH = (struct mach_header *)(gBinaryAddress);
#if DEBUG
printf("magic: %x\n", (unsigned)mH->magic);
printf("cputype: %x\n", (unsigned)mH->cputype);
printf("cpusubtype: %x\n", (unsigned)mH->cpusubtype);
printf("filetype: %x\n", (unsigned)mH->filetype);
printf("ncmds: %x\n", (unsigned)mH->ncmds);
printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds);
printf("flags: %x\n", (unsigned)mH->flags);
getchar();
#endif
/*#if DEBUG
DBG("magic: 0x%x\n", (unsigned)mH->magic);
DBG("cputype: 0x%x\n", (unsigned)mH->cputype);
DBG("cpusubtype: 0x%x\n", (unsigned)mH->cpusubtype);
DBG("filetype: 0x%x\n", (unsigned)mH->filetype);
DBG("ncmds: 0x%x\n", (unsigned)mH->ncmds);
DBG("sizeofcmds: 0x%x\n", (unsigned)mH->sizeofcmds);
DBG("flags: 0x%x\n", (unsigned)mH->flags);
DBG("archCpuType: 0x%x\n", archCpuType);
//getchar();
#endif*/
switch (archCpuType)
{
case CPU_TYPE_I386:
break;
case CPU_TYPE_X86_64:
/*
if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) {
return -1;
}
*/
if (mH->magic != MH_MAGIC_64) {
error("Mach-O file has bad magic number\n");
return -1;
cmdBase = cmdstart;
for (cnt = 0; cnt < ncmds; cnt++) {
cmd = ((long *)cmdBase)[0];
cmdsize = ((long *)cmdBase)[1];
if (cmd == LC_SYMTAB) {
if (DecodeSymbolTable(cmdBase) != 0) {
return -1;
cmd = ((long *)cmdBase)[0];
cmdsize = ((long *)cmdBase)[1];
if (cmd == LC_SYMTAB) {
if (DecodeSymbolTable(cmdBase) != 0) {
return -1;
}
}
}
cmdBase += cmdsize;
}
}
return ret;
}
trunk/i386/libsaio/platform.c
2020
2121
2222
23
23
2424
2525
2626
#if DEBUG_PLATFORM
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#define DBG(x...)msglog(x)
#endif
PlatformInfo_t Platform;
trunk/i386/libsaio/cpu.c
261261
262262
263263
264
264
265265
266266
267
268
269
267
268
269
270270
271271
272272
273273
274
274
275275
276276
277277
do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]);
}
#if DEBUG_CPU
// #if DEBUG_CPU
{
inti;
printf("CPUID Raw Values:\n");
for (i=0; i<CPUID_MAX; i++) {
printf("%02d: %08x-%08x-%08x-%08x\n", i,
DBG("CPUID Raw Values:\n");
for (i = 0; i < CPUID_MAX; i++) {
DBG("%02d: %08x-%08x-%08x-%08x\n", i,
p->CPU.CPUID[i][0], p->CPU.CPUID[i][1],
p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]);
}
}
#endif
// #endif
/*
EAX (Intel):
trunk/i386/libsaio/platform.h
3131
3232
3333
34
34
3535
36
37
36
37
3838
3939
4040
41
41
4242
4343
4444
......
177177
178178
179179
180
180
181181
182182
183183
#define CPUID_MAX10
#define CPU_MODEL_PRESCOTT0x03// Celeron D, Pentium 4 (90nm)
#define CPU_MODEL_NOCONA0x04// Xeon Nocona, Irwindale (90nm)
#define CPU_MODEL_NOCONA0x04// Xeon Nocona/Paxville, Irwindale (90nm)
#define CPU_MODEL_PRESLER0x06// Pentium 4, Pentium D (65nm)
#define CPU_MODEL_PENTIUM_M0x09// Banias
#define CPU_MODEL_DOTHAN0x0D// Dothan
#define CPU_MODEL_PENTIUM_M0x09// Banias Pentium M (130nm)
#define CPU_MODEL_DOTHAN0x0D// Dothan Pentium M, Celeron M (90nm)
#define CPU_MODEL_YONAH0x0E// Sossaman, Yonah
#define CPU_MODEL_MEROM0x0F// Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom
#define CPU_MODEL_CONROE0x0F//
#define CPU_MODEL_CELERON0x16//
#define CPU_MODEL_CELERON0x16// Merom, Conroe (65nm)
#define CPU_MODEL_PENRYN0x17// Wolfdale, Yorkfield, Harpertown, Penryn
#define CPU_MODEL_WOLFDALE0x17//
#define CPU_MODEL_NEHALEM0x1A// Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown
intDIMM[MAX_RAM_SLOTS];// Information and SPD mapping for each slot
} DMI;
uint8_tType;// System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile)
uint8_tType;// System Type: 1=Desktop, 2=Portable, 3=Workstation... according ACPI2.0 (FACP: PM_Profile)
uint8_t*UUID;
} PlatformInfo_t;
trunk/i386/libsaio/smbios.c
125125
126126
127127
128
128
129129
130130
131131
......
186186
187187
188188
189
190
189
190
191191
192192
193193
......
421421
422422
423423
424
424
425425
426426
427427
......
500500
501501
502502
503
503504
504505
505506
......
534535
535536
536537
537
538
538539
539540
540541
......
546547
547548
548549
550
551
549552
550553
551554
552555
553556
554557
558
559
555560
556561
557562
......
560565
561566
562567
568
563569
564570
565571
566
572
567573
568574
569575
570
576
571577
572
578
579
580
581
573582
574583
575584
......
584593
585594
586595
587
596
588597
589598
590599
......
604613
605614
606615
607
616
608617
609618
610
619
611620
612
621
622
613623
614624
615625
......
643653
644654
645655
646
656
647657
648658
649659
......
685695
686696
687697
698
688699
689700
690701
......
697708
698709
699710
711
700712
701713
702714
......
852864
853865
854866
855
867
856868
857869
858870
......
869881
870882
871883
872
873
874
884
885
886
875887
876888
877889
......
897909
898910
899911
900
901
902
912
913
914
903915
904916
905917
......
10711083
10721084
10731085
1074
1086
10751087
10761088
10771089
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
//#define kSMBOemPlatformFeatureKey
//#define kSMBOemPlatformFeatureKey "SMoemplatformfeature"
/* ==================================================*/
#define getFieldOffset(struct, field)((uint8_t)(uint32_t)&(((struct *)0)->field))
uint8_tchassisType;
char*version;
char*serialNumber;
char*assetTag; // Bungo: renamed folowing convention
//char*skuNumber;
char*assetTag;
char*skuNumber;
} defaultChassis_t;
defaultChassis_t defaultChassis;
//#define KDefaultBoardSerialNumber"C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H
//=========== Mac mini ===========
#define kDefaultMacMiniFamily"Mac mini"
#define kDefaultMacMiniFamily"Napa Mac" // Macmini2,1 family = "Napa Mac" not "Mac mini"
//#define kDefaultMacMiniBoardAssetTagNumber"Mini-Aluminum"
#define kDefaultMacMini"Macmini2,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
#define kDefaultiMacBIOSReleaseDate"02/09/08"
#define kDefaultiMacBoardProduct"Mac-F227BEC8"
#define kDefaultMacFamily"Mac" // iMac8,1 family = "Mac" not "iMac"
// iMac10,1
// iMac11,1 core i3/i5/i7
//#define kDefaultiMacIvyBoardProduct"Mac-FC02E91DDD3FA6A4"
//=========== MacPro ===========
#define kDefaultMacProFamily"Mac Pro"
#define kDefaultMacProFamily"MacPro" // MacPro's family = "MacPro" not "Mac Pro"
//#define KDefauktMacProBoardAssetTagNumber"Pro-Enclosure"
//#define kDefaultMacProBoardType"0xB" // 11
//#define KDefaultMacProBoardSerialNumber"J593902RA4MFE"
// Mac Pro 4,1 core i7/Xeon
#define kDefaultMacProNahWestSystemVersion"0.0"
#define kDefaultMacProNehalem"MacPro4,1"
#define kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B07.0910130729"
#define kDefaultMacProNehalemBIOSReleaseDate"10/13/09"
//#define kDefaultMacProNehalemSystemVersion"1.4"
#define kDefaultMacProNehalemBoardProduct"Mac-F221BEC8"
//#define KDefaultMacProNehalemBoardSerialNumber"J593004RB1LUE"
//"J591302R61LUC " // 2-cpu board
//"J591002JV4MFB " // 1-cpu board
// Mac Pro 5,1 core i7/Xeon
#define kDefaultMacProWestmere"MacPro5,1"
//#define kDefaultMacProWestmereSystemVersion"1.2"
#define kDefaultMacProWestmereBoardProduct"Mac-F221BEC8"
//#define KDefaultMacProWestmereBoardSerialNumber"J522700H7BH8C"
//"J503104H1BH8A " // 2-cpu board
// Mac Pro 6,1
#define kDefaultMacProHaswell"MacPro6,1"
#define kDefaultMacProHaswellBIOSVersion" MP61.88Z.0116.B04.1312061508"
#define kDefaultMacProHaswellBIOSVersion"MP61.88Z.0116.B04.1312061508"
#define kDefaultMacProHaswellBIOSReleaseDate"12/06/2013"
//#define kDefaultMacProHaswellSystemVersion"1.?"
#define kDefaultMacProHaswellBoardProduct"Mac-F60DEB81FF30ACF6"
//#define KDefaultMacProHaswellBoardSerialNumber"?????????????"
//#define KDefaultMacProHaswellBoardSerialNumber"F5K3474008JFNN215"
//#define KDefaultBoardSerialNumber"C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H
//#define KDefaultBoardSerialNumber"C02140302D5DMT31M"
// "C07019501PLDCVHAD"
// "C02032101R5DC771H"
// J593902RA4MFE 3,1
// J5031046RCZJA 5,1
// J521101A5CZJC 3,1
bool useSMBIOSdefaults = true; // Bungo
SMBByte PlatformType= 3; // Bungo: same as Platfom.Type in platform.h
SMBByte PlatformType= 1; // Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED.
/* Rewrite this function */
void setDefaultSMBData(void) // Bungo: setting data from real Macs
defaultChassis.manufacturer = kDefaultVendorManufacturer;
defaultChassis.serialNumber = kDefaultSerialNumber;
defaultChassis.assetTag = kDefaultAssetTag;
//defaultChassis.skuNumber = kDefaultSkuNumber;
defaultChassis.skuNumber = kDefaultSkuNumber;
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing
if (PlatformType == 2) // this method works but it's a substitute
if (PlatformType == 2) // this works but it's a substitute
{
if (Platform.CPU.NoCores > 1) {
if (Platform.CPU.NoCores > 1)
{
defaultSystemInfo.productName = kDefaultMacBookPro;
defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultMacBookProBIOSReleaseDate;
defaultBIOSInfo.version = kDefaultiMacBIOSVersion;
defaultBIOSInfo.releaseDate = kDefaultiMacBIOSReleaseDate;
defaultSystemInfo.productName = kDefaultiMac;
defaultSystemInfo.family = kDefaultiMacFamily;
defaultSystemInfo.family = kDefaultMacFamily; // iMac8,1 family = Mac
defaultBaseBoard.product = kDefaultiMacBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardMotherboard;
defaultChassis.chassisType = kSMBchassisAllInOne;
defaultBIOSInfo.version= kDefaultMacProNehalemBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProNehalemBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProNehalem;
defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;
defaultBIOSInfo.version= kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProWestmereBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProWestmere;
defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion;
defaultSystemInfo.family= kDefaultMacProFamily;
defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct;
defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule;
case kSMBByte:
case kSMBWord:
case kSMBDWord:
//case kSMBQWord:
case kSMBQWord:
if (SMBSetters[idx].keyString) {
parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist);
if (!parsed)
case kSMBWord:
value->word = (uint16_t)val;
break;
//case kSMBQWord:
//value->qword = (uint64_t)val;
//break;
case kSMBQWord:
value->qword = (uint64_t)val;
break;
case kSMBDWord:
default:
value->dword = (uint32_t)val;
case kSMBWord:
value->word = *(uint16_t *)(SMBSetters[idx].defaultValue);
break;
//case kSMBQWord:
//value->qword = *(uint32_t *)(SMBSetters[idx].defaultValue);
//break;
case kSMBQWord:
value->qword = *(uint64_t *)(SMBSetters[idx].defaultValue);
break;
case kSMBDWord:
default:
value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue);
structSize = sizeof(SMBMemoryDevice);
break;
default:
structSize = structPtr->orig->length; // don't change if not to patch
structSize = structPtr->orig->length; // doesn't change a length for unpatched
break;
}
trunk/i386/libsaio/smbios_decode.c
170170
171171
172172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
173192
174193
175194
......
421440
422441
423442
424
443
444
445
446
447
425448
426449
427
428
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
429469
430470
431471
......
480520
481521
482522
483
523
484524
485525
486526
"Socket LGA1356-3" /* 2Ch */
};
static const char *SMBMemoryDeviceFormFactors[] = // Bungo: strings for form factor (Table Type 17 - Memory Device)
{
"Other", /* 01h */
"Unknown", /* 02h */
"SIMM", /* 03h */
"SIP", /* 04h */
"Chip", /* 05h */
"DIP", /* 06h */
"ZIP", /* 07h */
"Proprietary Card", /* 08h */
"DIMM", /* 09h */
"TSOP", /* 0Ah */
"Row of chips", /* 0Bh */
"RIMM", /* 0Ch */
"SODIMM", /* 0Dh */
"SRIMM", /* 0Eh */
"FB-DIMM" /* 0Fh */
};
/*=====
7.18.2
====*/
printHeader(structHeader);
DBG("Memory Device\n");
// Aray Handle
DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle);
if (((SMBMemoryDevice *)structHeader)->errorHandle == 0xFFFF) {
DBG("\tError Information Handle: No Error\n");
} else {
DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle);
}
// Total Width:
// Data Width:
// Size:
// Form Factor:
switch (((SMBMemoryDevice *)structHeader)->memorySize) {
case 0:
DBG("\tSize: No Module Installed\n");
break;
case 0x7FFF:
DBG("\tSize: 32GB or more\n");
break;
case 0xFFFF:
DBG("\tSize: Unknown\n");
break;
default:
DBG("\tSize: %d %s\n", ((SMBMemoryDevice *)structHeader)->memorySize & 0x7FFF, ((((SMBMemoryDevice *)structHeader)->memorySize & 0x8000) == 0x8000) ? "kB" : "MB");
break;
}
if ((((SMBMemoryDevice *)structHeader)->formFactor < 0x01) || (((SMBMemoryDevice *)structHeader)->formFactor > 0x0F)) {
DBG("\tForm Factor: %s\n", OutOfSpecStr);
} else {
DBG("\tForm Factor: %s\n", SMBMemoryDeviceFormFactors[((SMBMemoryDevice *)structHeader)->formFactor - 1]);
}
// Set:
DBG("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask));
DBG("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask));
//}
//-------------------------------------------------------------------------------------------------------------------------
// Specific (Type 134)
// Specific (Type 134)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeOem(SMBStructHeader *structHeader)
//{
trunk/i386/libsaio/smbios.h
2424
2525
2626
27
28
27
28
2929
3030
3131
......
8181
8282
8383
84
85
86
87
84
8885
8986
9087
......
138135
139136
140137
141
142
138
139
143140
144141
145
146
147
142
143
148144
149145
150146
......
163159
164160
165161
166
167
168
162
163
169164
170165
171166
......
182177
183178
184179
185
186
187
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
188203
189204
190205
......
196211
197212
198213
199
214
200215
201
202216
203217
204218
205219
220
206221
207222
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
223
224
227225
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252226
253
227
254228
255229
256230
......
269243
270244
271245
272
246
273247
274
275
276
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
277546
278547
279548
280549
281550
282
283
551
552
284553
285554
286555
......
289558
290559
291560
292
561
293562
294563
295564
......
307576
308577
309578
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
579
580
328581
329582
330583
......
338591
339592
340593
341
342
343
594
595
344596
345597
346598
......
357609
358610
359611
360
361
362
612
613
363614
364615
365616
......
375626
376627
377628
378
379
380
629
630
381631
382632
383633
......
397647
398648
399649
400
401
402
650
651
403652
404653
405654
406655
407656
408657
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
658
659
425660
426
427
428
429
661
662
663
430664
431665
432666
......
435669
436670
437671
438
672
439673
440
441
442
443
674
675
676
444677
445678
446679
......
449682
450683
451684
452
685
453686
454
455
456
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
457704
458705
459706
......
486733
487734
488735
489
490
491
736
737
738
492739
493740
494741
......
502749
503750
504751
505
506
507
752
753
754
508755
509756
510757
......
520767
521768
522769
523
524
525
770
771
526772
527773
528774
......
541787
542788
543789
544
545
546
790
547791
548792
549793
......
555799
556800
557801
802
803
558804
559805
560806
......
564810
565811
566812
567
813
568814
569815
816
817
570818
571819
572820
......
576824
577825
578826
827
828
579829
580830
581831
......
585835
586836
587837
838
839
588840
589841
590842
#define __LIBSAIO_SMBIOS_H
/* Based on System Management BIOS Reference Specification v2.5 */
// http://dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf
/* Based on System Management BIOS Reference Specification v2.4 */
// http://dmtf.org/standards/smbios
typedef uint8_t SMBString;
typedef uint8_t SMBByte;
#define SMB_ANCHOR_RESET(x)\
bzero(x, sizeof(typedef struct SMBAnchor));
/*
=======================
SMBIOS structure types.
======================= */
/* ======================= SMBIOS structure types. ======================= */
enum
{
kSMBTypeBIOSInformation= 0, // BIOS information (Type 0)
kSMBTypeFirmwareVolume= 128, // FirmwareVolume (TYPE 128)
kSMBTypeMemorySPD= 130, // MemorySPD (TYPE 130)
kSMBTypeOemProcessorType= 131, // Processor Type (Type 131)
kSMBTypeOemProcessorBusSpeed= 132 // Processor Bus Speed (Type 132)
//kSMBTypeOemPlatformFeature= 133 // Platform Feature (Type 133)
kSMBTypeOemProcessorBusSpeed= 132, // Processor Bus Speed (Type 132)
kSMBTypeOemPlatformFeature= 133 // Platform Feature (Type 133)
};
/* =======================
BIOS Information (Type 0)
========================= */
//----------------------------------------------------------------------------------------------------------
// Struct - BIOS Information (Type 0)
typedef struct SMBBIOSInformation
{
SMB_STRUCT_HEADER
SMBByte ECreleaseMinor; // Embedded Controller firmware release (minor)
} __attribute__((packed)) SMBBIOSInformation;
/* =========================
System Information (Type 1)
=========================== */
//----------------------------------------------------------------------------------------------------------
// Struct - System Information (Type 1)
typedef struct SMBSystemInformation
{
// 2.0+ spec (8 bytes)
SMBString family;
} __attribute__((packed)) SMBSystemInformation;
/* =========================================
Base Board (or Module) Information (Type 2)
=========================================== */
//----------------------------------------------------------------------------------------------------------
// Base Board (or Module) Information (Type 2)
// Base Board - Board Type.
// Values for SMBBaseBoard.boardType
typedef enum
{
kSMBBaseBoardUnknown = 0x01,// Unknow
kSMBBaseBoardOther = 0x02,// Other
kSMBBaseBoardServerBlade = 0x03,// Server Blade
kSMBBaseBoardConnectivitySwitch = 0x04,// Connectivity Switch
kSMBBaseBoardSystemMgmtModule = 0x05,// System Management Module
kSMBBaseBoardProcessorModule = 0x06,// Processor Module
kSMBBaseBoardIOModule = 0x07,// I/O Module
kSMBBaseBoardMemoryModule = 0x08,// Memory Module
kSMBBaseBoardDaughter = 0x09,// Daughter Board
kSMBBaseBoardMotherboard = 0x0A,// Motherboard (includes processor, memory, and I/O)
kSMBBaseBoardProcessorMemoryModule = 0x0B,// Processor/Memory Module
kSMBBaseBoardProcessorIOModule = 0x0C,// Processor/IO Module
kSMBBaseBoardInterconnect = 0x0D// Interconnect board
} BASE_BOARD_TYPE;
// Struct - Base Board (or Module) Information (Type 2)
typedef struct SMBBaseBoard
{
SMB_STRUCT_HEADER // Type 2
SMBByte featureFlags;// Collection of flag that identify features of this baseboard
SMBStringlocationInChassis;
SMBWord chassisHandle;
SMBByte boardType;// Type of board
SMBByte boardType;// Type of board, numeration value from BASE_BOARD_TYPE.
SMBByte numberOfContainedHandles;
//SMBWord containedObjectHandles[1];
// 0 - 255 contained handles go here but we do not include
// them in our structure. Be careful to use numberOfContainedHandles
// times sizeof(SMBWord) when computing the actual record size,
// if you need it.
SMBByte containedObjectHandles;
} __attribute__((packed)) SMBBaseBoard;
/* ====================================
Values for boardType in Type 2 records
====================================== */
enum
{
kSMBBaseBoardUnknown = 0x01,// Unknow
kSMBBaseBoardOther = 0x02,// Other
kSMBBaseBoardServerBlade = 0x03,// Server Blade
kSMBBaseBoardConnectivitySwitch = 0x04,// Connectivity Switch
kSMBBaseBoardSystemMgmtModule = 0x05,// System Management Module
kSMBBaseBoardProcessorModule = 0x06,// Processor Module
kSMBBaseBoardIOModule = 0x07,// I/O Module
kSMBBaseBoardMemoryModule = 0x08,// Memory Module
kSMBBaseBoardDaughter = 0x09,// Daughter Board
kSMBBaseBoardMotherboard = 0x0A,// Motherboard (includes processor, memory, and I/O)
kSMBBaseBoardProcessorMemoryModule = 0x0B,// Processor/Memory Module
kSMBBaseBoardProcessorIOModule = 0x0C,// Processor/IO Module
kSMBBaseBoardInterconnect = 0x0D// Interconnect board
};
//----------------------------------------------------------------------------------------------------------
// System Enclosure (Type 3)
/* =======================
System Enclosure (Type 3)
========================= */
typedef struct SMBSystemEnclosure
{
SMB_STRUCT_HEADER // Type 3
SMBString manufacturer;
SMBByte chassisType;// System Enclosure Indicator
SMBString version;// Board Number?
SMBString serialNumber;
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
SMBByte securityStatus;// Physical security status of the enclosure when last booted
SMBDWord oemDefined;// OEM- or BIOS vendor-specific information
SMBByte height;// Height of the enclosure, in 'U's
SMBByte numberOfPowerCords;// Number of power cords associated with the enclosure or chassis
SMBByte containedElementCount;// Number of Contained Element record that follow, in the range 0 to 255
//SMBByte containedElementRecord;// Byte leght of each Contained Element record that follow, in the range 0 to 255
//SMBByte containedElements;// Elements, possibly defined by other SMBIOS structures present in chassis
//SMBString skuNumber;// Number of null-terminated string describing the chassis or enclosure SKU number (2.7+)
} __attribute__((packed)) SMBSystemEnclosure;
// Bungo: values for SMBSystemEnclosure.chassisType
enum {
typedef enum {
kSMBchassisOther = 0x01,
kSMBchassisUnknown = 0x02,
kSMBchassisDesktop = 0x03,
kSMBchassisLunchBox = 0x10,
// ... fill up if needed ;-)
kSMBchassisBladeEnclosing = 0x1D
};
} MISC_CHASSIS_TYPE;
/* ============================
Processor Information (Type 4)
============================== */
// System Enclosure or Chassis States.
// values for SMBSystemEnclosure.bootupState
// values for SMBSystemEnclosure.powerSupplyState
// values for SMBSystemEnclosure.thermalState
typedef enum {
kSMBChassisStateOther = 0x01,
kSMBChassisStateUnknown = 0x02,
kSMBChassisStateSafe = 0x03,
kSMBChassisStateWarning = 0x04,
kSMBChassisStateCritical = 0x05,
kSMBChassisStateNonRecoverable = 0x06
} MISC_CHASSIS_STATE;
// System Enclosure or Chassis Security Status.
// values for SMBSystemEnclosure.securityStatus
typedef enum {
kSMBChassisSecurityStatusOther = 0x01,
kSMBChassisSecurityStatusUnknown = 0x02,
kSMBChassisSecurityStatusNone = 0x03,
kSMBChassisSecurityStatusExternalInterfaceLockedOut = 0x04,
kSMBChassisSecurityStatusExternalInterfaceLockedEnabled = 0x05
} MISC_CHASSIS_SECURITY_STATE;
// Struct - System Enclosure (Type 3)
typedef struct SMBSystemEnclosure
{
SMB_STRUCT_HEADER // Type 3
SMBString manufacturer;
SMBByte chassisType;// System Enclosure Indicator
SMBString version;// Board Number?
SMBString serialNumber;
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
SMBByte securityStatus;// Physical security status of the enclosure when last booted
SMBDWord oemDefined;// OEM- or BIOS vendor-specific information
SMBByte height;// Height of the enclosure, in 'U's
SMBByte numberOfPowerCords;// Number of power cords associated with the enclosure or chassis
SMBByte containedElementCount;// Number of Contained Element record that follow, in the range 0 to 255
//SMBByte containedElementRecord;// Byte leght of each Contained Element record that follow, in the range 0 to 255
//SMBByte containedElements;// Elements, possibly defined by other SMBIOS structures present in chassis
//SMBString skuNumber;// Number of null-terminated string describing the chassis or enclosure SKU number (2.7+)
} __attribute__((packed)) SMBSystemEnclosure;
//----------------------------------------------------------------------------------------------------------
// Processor Information (Type 4)
#define kSMBProcessorInformationMinSize 26
// Processor Information - Processor Type.
// Values for SMBProcessorInformation.processorType
typedef enum
{
kSMBprocessorTypeOther = 0x01,
kSMBprocessorTypeUnknown = 0x02,
kSMBprocessorTypeCPU = 0x03,
kSMBprocessorTypeMPU = 0x04,
kSMBprocessorTypeDSP = 0x05,
kSMBprocessorTypeGPU = 0x06
} PROCESSOR_TYPE_DATA;
// Processor Information - Processor Family.
// Values for SMBProcessorInformation.processorFamily
typedef enum {
kSMBprocessorFamilyOther = 0x01,
kSMBprocessorFamilyUnknown = 0x02,
kSMBprocessorFamily8086 = 0x03,
kSMBprocessorFamily80286 = 0x04,
kSMBprocessorFamilyIntel386 = 0x05,
kSMBprocessorFamilyIntel486 = 0x06,
kSMBprocessorFamily8087 = 0x07,
kSMBprocessorFamily80287 = 0x08,
kSMBprocessorFamily80387 = 0x09,
kSMBprocessorFamily80487 = 0x0A,
kSMBprocessorFamilyPentium = 0x0B,
kSMBprocessorFamilyPentiumPro = 0x0C,
kSMBprocessorFamilyPentiumII = 0x0D,
kSMBprocessorFamilyPentiumMMX = 0x0E,
kSMBprocessorFamilyCeleron = 0x0F,
kSMBprocessorFamilyPentiumIIXeon = 0x10,
kSMBprocessorFamilyPentiumIII = 0x11,
kSMBprocessorFamilyM1 = 0x12,
kSMBprocessorFamilyM2 = 0x13,
kSMBprocessorFamilyIntelCeleronM = 0x14,
kSMBprocessorFamilyIntelPentium4Ht = 0x15,
kSMBprocessorFamilyM1Reserved4 = 0x16,
kSMBprocessorFamilyM1Reserved5 = 0x17,
kSMBprocessorFamilyAmdDuron = 0x18,
kSMBprocessorFamilyK5 = 0x19,
kSMBprocessorFamilyK6 = 0x1A,
kSMBprocessorFamilyK6_2 = 0x1B,
kSMBprocessorFamilyK6_3 = 0x1C,
kSMBprocessorFamilyAmdAthlon = 0x1D,
kSMBprocessorFamilyAmd29000 = 0x1E,
kSMBprocessorFamilyK6_2Plus = 0x1F,
kSMBprocessorFamilyPowerPC = 0x20,
kSMBprocessorFamilyPowerPC601 = 0x21,
kSMBprocessorFamilyPowerPC603 = 0x22,
kSMBprocessorFamilyPowerPC603Plus = 0x23,
kSMBprocessorFamilyPowerPC604 = 0x24,
kSMBprocessorFamilyPowerPC620 = 0x25,
kSMBprocessorFamilyPowerPCx704 = 0x26,
kSMBprocessorFamilyPowerPC750 = 0x27,
kSMBprocessorFamilyIntelCoreDuo = 0x28,
kSMBprocessorFamilyIntelCoreDuoMobile = 0x29,
kSMBprocessorFamilyIntelCoreSoloMobile = 0x2A,
kSMBprocessorFamilyIntelAtom = 0x2B,
kSMBprocessorFamilyAlpha3 = 0x30,
kSMBprocessorFamilyAlpha21064 = 0x31,
kSMBprocessorFamilyAlpha21066 = 0x32,
kSMBprocessorFamilyAlpha21164 = 0x33,
kSMBprocessorFamilyAlpha21164PC = 0x34,
kSMBprocessorFamilyAlpha21164a = 0x35,
kSMBprocessorFamilyAlpha21264 = 0x36,
kSMBprocessorFamilyAlpha21364 = 0x37,
kSMBprocessorFamilyAmdTurionIIUltraDualCoreMobileM = 0x38,
kSMBprocessorFamilyAmdTurionIIDualCoreMobileM = 0x39,
kSMBprocessorFamilyAmdAthlonIIDualCoreM = 0x3A,
kSMBprocessorFamilyAmdOpteron6100Series = 0x3B,
kSMBprocessorFamilyAmdOpteron4100Series = 0x3C,
kSMBprocessorFamilyAmdOpteron6200Series = 0x3D,
kSMBprocessorFamilyAmdOpteron4200Series = 0x3E,
kSMBprocessorFamilyMips = 0x40,
kSMBprocessorFamilyMIPSR4000 = 0x41,
kSMBprocessorFamilyMIPSR4200 = 0x42,
kSMBprocessorFamilyMIPSR4400 = 0x43,
kSMBprocessorFamilyMIPSR4600 = 0x44,
kSMBprocessorFamilyMIPSR10000 = 0x45,
kSMBprocessorFamilyAmdCSeries = 0x46,
kSMBprocessorFamilyAmdESeries = 0x47,
kSMBprocessorFamilyAmdSSeries = 0x48,
kSMBprocessorFamilyAmdGSeries = 0x49,
kSMBprocessorFamilySparc = 0x50,
kSMBprocessorFamilySuperSparc = 0x51,
kSMBprocessorFamilymicroSparcII = 0x52,
kSMBprocessorFamilymicroSparcIIep = 0x53,
kSMBprocessorFamilyUltraSparc = 0x54,
kSMBprocessorFamilyUltraSparcII = 0x55,
kSMBprocessorFamilyUltraSparcIIi = 0x56,
kSMBprocessorFamilyUltraSparcIII = 0x57,
kSMBprocessorFamilyUltraSparcIIIi = 0x58,
kSMBprocessorFamily68040 = 0x60,
kSMBprocessorFamily68xxx = 0x61,
kSMBprocessorFamily68000 = 0x62,
kSMBprocessorFamily68010 = 0x63,
kSMBprocessorFamily68020 = 0x64,
kSMBprocessorFamily68030 = 0x65,
kSMBprocessorFamilyHobbit = 0x70,
kSMBprocessorFamilyCrusoeTM5000 = 0x78,
kSMBprocessorFamilyCrusoeTM3000 = 0x79,
kSMBprocessorFamilyEfficeonTM8000 = 0x7A,
kSMBprocessorFamilyWeitek = 0x80,
kSMBprocessorFamilyItanium = 0x82,
kSMBprocessorFamilyAmdAthlon64 = 0x83,
kSMBprocessorFamilyAmdOpteron = 0x84,
kSMBprocessorFamilyAmdSempron = 0x85,
kSMBprocessorFamilyAmdTurion64Mobile = 0x86,
kSMBprocessorFamilyDualCoreAmdOpteron = 0x87,
kSMBprocessorFamilyAmdAthlon64X2DualCore = 0x88,
kSMBprocessorFamilyAmdTurion64X2Mobile = 0x89,
kSMBprocessorFamilyQuadCoreAmdOpteron = 0x8A,
kSMBprocessorFamilyThirdGenerationAmdOpteron = 0x8B,
kSMBprocessorFamilyAmdPhenomFxQuadCore = 0x8C,
kSMBprocessorFamilyAmdPhenomX4QuadCore = 0x8D,
kSMBprocessorFamilyAmdPhenomX2DualCore = 0x8E,
kSMBprocessorFamilyAmdAthlonX2DualCore = 0x8F,
kSMBprocessorFamilyPARISC = 0x90,
kSMBprocessorFamilyPaRisc8500 = 0x91,
kSMBprocessorFamilyPaRisc8000 = 0x92,
kSMBprocessorFamilyPaRisc7300LC = 0x93,
kSMBprocessorFamilyPaRisc7200 = 0x94,
kSMBprocessorFamilyPaRisc7100LC = 0x95,
kSMBprocessorFamilyPaRisc7100 = 0x96,
kSMBprocessorFamilyV30 = 0xA0,
kSMBprocessorFamilyQuadCoreIntelXeon3200Series = 0xA1,
kSMBprocessorFamilyDualCoreIntelXeon3000Series = 0xA2,
kSMBprocessorFamilyQuadCoreIntelXeon5300Series = 0xA3,
kSMBprocessorFamilyDualCoreIntelXeon5100Series = 0xA4,
kSMBprocessorFamilyDualCoreIntelXeon5000Series = 0xA5,
kSMBprocessorFamilyDualCoreIntelXeonLV = 0xA6,
kSMBprocessorFamilyDualCoreIntelXeonULV = 0xA7,
kSMBprocessorFamilyDualCoreIntelXeon7100Series = 0xA8,
kSMBprocessorFamilyQuadCoreIntelXeon5400Series = 0xA9,
kSMBprocessorFamilyQuadCoreIntelXeon = 0xAA,
kSMBprocessorFamilyDualCoreIntelXeon5200Series = 0xAB,
kSMBprocessorFamilyDualCoreIntelXeon7200Series = 0xAC,
kSMBprocessorFamilyQuadCoreIntelXeon7300Series = 0xAD,
kSMBprocessorFamilyQuadCoreIntelXeon7400Series = 0xAE,
kSMBprocessorFamilyMultiCoreIntelXeon7400Series = 0xAF,
kSMBprocessorFamilyPentiumIIIXeon = 0xB0,
kSMBprocessorFamilyPentiumIIISpeedStep = 0xB1,
kSMBprocessorFamilyPentium4 = 0xB2,
kSMBprocessorFamilyIntelXeon = 0xB3,
kSMBprocessorFamilyAS400 = 0xB4,
kSMBprocessorFamilyIntelXeonMP = 0xB5,
kSMBprocessorFamilyAMDAthlonXP = 0xB6,
kSMBprocessorFamilyAMDAthlonMP = 0xB7,
kSMBprocessorFamilyIntelItanium2 = 0xB8,
kSMBprocessorFamilyIntelPentiumM = 0xB9,
kSMBprocessorFamilyIntelCeleronD = 0xBA,
kSMBprocessorFamilyIntelPentiumD = 0xBB,
kSMBprocessorFamilyIntelPentiumEx = 0xBC,
kSMBprocessorFamilyIntelCoreSolo = 0xBD, ///< SMBIOS spec 2.6 correct this value
kSMBprocessorFamilyReserved = 0xBE,
kSMBprocessorFamilyIntelCore2 = 0xBF,
kSMBprocessorFamilyIntelCore2Solo = 0xC0,
kSMBprocessorFamilyIntelCore2Extreme = 0xC1,
kSMBprocessorFamilyIntelCore2Quad = 0xC2,
kSMBprocessorFamilyIntelCore2ExtremeMobile = 0xC3,
kSMBprocessorFamilyIntelCore2DuoMobile = 0xC4,
kSMBprocessorFamilyIntelCore2SoloMobile = 0xC5,
kSMBprocessorFamilyIntelCoreI7 = 0xC6,
kSMBprocessorFamilyDualCoreIntelCeleron = 0xC7,
kSMBprocessorFamilyIBM390 = 0xC8,
kSMBprocessorFamilyG4 = 0xC9,
kSMBprocessorFamilyG5 = 0xCA,
kSMBprocessorFamilyG6 = 0xCB,
kSMBprocessorFamilyzArchitectur = 0xCC,
kSMBprocessorFamilyIntelCoreI5 = 0xCD,
kSMBprocessorFamilyIntelCoreI3 = 0xCE,
kSMBprocessorFamilyViaC7M = 0xD2,
kSMBprocessorFamilyViaC7D = 0xD3,
kSMBprocessorFamilyViaC7 = 0xD4,
kSMBprocessorFamilyViaEden = 0xD5,
kSMBprocessorFamilyMultiCoreIntelXeon = 0xD6,
kSMBprocessorFamilyDualCoreIntelXeon3Series = 0xD7,
kSMBprocessorFamilyQuadCoreIntelXeon3Series = 0xD8,
kSMBprocessorFamilyViaNano = 0xD9,
kSMBprocessorFamilyDualCoreIntelXeon5Series = 0xDA,
kSMBprocessorFamilyQuadCoreIntelXeon5Series = 0xDB,
kSMBprocessorFamilyDualCoreIntelXeon7Series = 0xDD,
kSMBprocessorFamilyQuadCoreIntelXeon7Series = 0xDE,
kSMBprocessorFamilyMultiCoreIntelXeon7Series = 0xDF,
kSMBprocessorFamilyMultiCoreIntelXeon3400Series = 0xE0,
kSMBprocessorFamilyEmbeddedAmdOpteronQuadCore = 0xE6,
kSMBprocessorFamilyAmdPhenomTripleCore = 0xE7,
kSMBprocessorFamilyAmdTurionUltraDualCoreMobile = 0xE8,
kSMBprocessorFamilyAmdTurionDualCoreMobile = 0xE9,
kSMBprocessorFamilyAmdAthlonDualCore = 0xEA,
kSMBprocessorFamilyAmdSempronSI = 0xEB,
kSMBprocessorFamilyAmdPhenomII = 0xEC,
kSMBprocessorFamilyAmdAthlonII = 0xED,
kSMBprocessorFamilySixCoreAmdOpteron = 0xEE,
kSMBprocessorFamilyAmdSempronM = 0xEF,
kSMBprocessorFamilyi860 = 0xFA,
kSMBprocessorFamilyi960 = 0xFB,
kSMBprocessorFamilyIndicatorFamily2 = 0xFE,
kSMBprocessorFamilyReserved1 = 0xFF
} PROCESSOR_FAMILY_DATA;
// Processor Information - Processor Upgrade.
// Values for SMBProcessorInformation.processorUpgrade
typedef enum {
kSMBprocessorUpgradeOther = 0x01,
kSMBprocessorUpgradeUnknown = 0x02,
kSMBprocessorUpgradeDaughterBoard = 0x03,
kSMBprocessorUpgradeZIFSocket = 0x04,
kSMBprocessorUpgradePiggyBack = 0x05, ///< Replaceable.
kSMBprocessorUpgradeNone = 0x06,
kSMBprocessorUpgradeLIFSocket = 0x07,
kSMBprocessorUpgradeSlot1 = 0x08,
kSMBprocessorUpgradeSlot2 = 0x09,
kSMBprocessorUpgrade370PinSocket = 0x0A,
kSMBprocessorUpgradeSlotA = 0x0B,
kSMBprocessorUpgradeSlotM = 0x0C,
kSMBprocessorUpgradeSocket423 = 0x0D,
kSMBprocessorUpgradeSocketA = 0x0E, ///< Socket 462.
kSMBprocessorUpgradeSocket478 = 0x0F,
kSMBprocessorUpgradeSocket754 = 0x10,
kSMBprocessorUpgradeSocket940 = 0x11,
kSMBprocessorUpgradeSocket939 = 0x12,
kSMBprocessorUpgradeSocketmPGA604 = 0x13,
kSMBprocessorUpgradeSocketLGA771 = 0x14,
kSMBprocessorUpgradeSocketLGA775 = 0x15,
kSMBprocessorUpgradeSocketS1 = 0x16,
kSMBprocessorUpgradeAM2 = 0x17,
kSMBprocessorUpgradeF1207 = 0x18,
kSMBprocessorUpgradeSocketLGA1366 = 0x19,
kSMBprocessorUpgradeSocketG34 = 0x1A,
kSMBprocessorUpgradeSocketAM3 = 0x1B,
kSMBprocessorUpgradeSocketC32 = 0x1C,
kSMBprocessorUpgradeSocketLGA1156 = 0x1D,
kSMBprocessorUpgradeSocketLGA1567 = 0x1E,
kSMBprocessorUpgradeSocketPGA988A = 0x1F,
kSMBprocessorUpgradeSocketBGA1288 = 0x20,
kSMBprocessorUpgradeSocketrPGA988B = 0x21,
kSMBprocessorUpgradeSocketBGA1023 = 0x22,
kSMBprocessorUpgradeSocketBGA1224 = 0x23,
kSMBprocessorUpgradeSocketBGA1155 = 0x24,
kSMBprocessorUpgradeSocketLGA1356 = 0x25,
kSMBprocessorUpgradeSocketLGA2011 = 0x26,
kSMBprocessorUpgradeSocketFS1 = 0x27,
kSMBprocessorUpgradeSocketFS2 = 0x28,
kSMBprocessorUpgradeSocketFM1 = 0x29,
kSMBprocessorUpgradeSocketFM2 = 0x2A
} PROCESSOR_UPGRADE;
// Struct - Processor Information (Type 4).
typedef struct SMBProcessorInformation
{
// 2.0+ spec (26 bytes)
SMB_STRUCT_HEADER // Type 4
SMBString socketDesignation;
SMBByte processorType; // CPU = 3
SMBByte processorFamily; // processor family enum
SMBByte processorType; // The enumeration value from PROCESSOR_TYPE_DATA.
SMBByte processorFamily; // The enumeration value from PROCESSOR_FAMILY_DATA.
SMBString manufacturer;
SMBQWord processorID; // based on CPUID
SMBString processorVersion;
SMBWord maximumClock; // max internal clock in MHz
SMBWord currentClock; // current internal clock in MHz
SMBByte status;
SMBByte processorUpgrade; // processor upgrade enum
SMBByte processorUpgrade; // The enumeration value from PROCESSOR_UPGRADE.
// 2.1+ spec (32 bytes)
SMBWord L1CacheHandle;
SMBWord L2CacheHandle;
//SMBWord processorFamily2;
} __attribute__((packed)) SMBProcessorInformation;
#define kSMBProcessorInformationMinSize 26
/* ========================================
Values for processorType in Type 4 records
======================================== */
enum
{
kSMBprocessorTypeOther = 0x01,
kSMBprocessorTypeUnknown = 0x02,
kSMBprocessorTypeCPU = 0x03,
kSMBprocessorTypeMPU = 0x04,
kSMBprocessorTypeDSP = 0x05,
kSMBprocessorTypeGPU = 0x06
};
/* ======================================================================
Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1
======================================================================== */
//----------------------------------------------------------------------------------------------------------
// Struct - Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1
typedef struct SMBMemoryControllerInfo {
SMB_STRUCT_HEADER
SMBByteerrorDetectingMethod;
SMBBytenumberOfMemorySlots;
} __attribute__((packed)) SMBMemoryControllerInfo;
/* ==================================================================
Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1
==================================================================== */
//----------------------------------------------------------------------------------------------------------
// Struct - Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1
typedef struct SMBMemoryModule
{
SMB_STRUCT_HEADER // Type 6
#define kSMBMemoryModuleSizeNotEnabled 0x7E
#define kSMBMemoryModuleSizeNotInstalled 0x7F
/* ========================
Cache Information (Type 7)
========================== */
//----------------------------------------------------------------------------------------------------------
// Struct - Cache Information (Type 7)
typedef struct SMBCacheInformation
{
SMB_STRUCT_HEADER // Type 7
SMBByte associativity;
} __attribute__((packed)) SMBCacheInformation;
/* ===================
System Slots (Type 9)
===================== */
//----------------------------------------------------------------------------------------------------------
// Struct - System Slots (Type 9)
typedef struct SMBSystemSlot
{
// 2.0+ spec (12 bytes)
//SMBBytedeviceFunctionNumber;
} __attribute__((packed)) SMBSystemSlot;
/* ===================
OEM Strings (Type 11)
===================== */
//----------------------------------------------------------------------------------------------------------
// Struct - OEM Strings (Type 11)
typedef struct SMBOEMStrings
{
SMB_STRUCT_HEADER // Type 11
SMBBytecount;// number of strings
} __attribute__((packed)) SMBOEMStrings;
/* =============================
Physical Memory Array (Type 16)
=============================== */
typedef struct SMBPhysicalMemoryArray
{
// 2.1+ spec (15 bytes)
SMB_STRUCT_HEADER // Type 16
SMBByte physicalLocation; // physical location
SMBByte arrayUse; // the use for the memory array
SMBByte errorCorrection; // error correction/detection method
SMBDWord maximumCapacity; // maximum memory capacity in kilobytes
SMBWord errorHandle; // handle of a previously detected error
SMBWord numMemoryDevices; // number of memory slots or sockets
// 2.7+ spec
//SMBQWord extMaximumCapacity;// maximum memory capacity in bytes
} __attribute__((packed)) SMBPhysicalMemoryArray;
//----------------------------------------------------------------------------------------------------------
// Physical Memory Array (Type 16)
/* ================
Memory Array - Use
================== */
enum
// Physical Memory Array - Use.
// Values for SMBPhysicalMemoryArray.arrayUse
typedef enum
{
kSMBMemoryArrayUseOther = 0x01,
kSMBMemoryArrayUseUnknown = 0x02,
kSMBMemoryArrayUseFlashMemory = 0x05,
kSMBMemoryArrayUseNonVolatileMemory = 0x06,
kSMBMemoryArrayUseCacheMemory = 0x07
};
} MEMORY_ARRAY_USE;
/* ===================================
Memory Array - Error Correction Types
===================================== */
enum
// Physical Memory Array - Error Correction Types.
// Values for SMBPhysicalMemoryArray.errorCorrection
typedef enum
{
kSMBMemoryArrayErrorCorrectionTypeOther = 0x01,
kSMBMemoryArrayErrorCorrectionTypeUnknown = 0x02,
kSMBMemoryArrayErrorCorrectionTypeSingleBitECC = 0x05,
kSMBMemoryArrayErrorCorrectionTypeMultiBitECC = 0x06,
kSMBMemoryArrayErrorCorrectionTypeCRC = 0x07
};
} MEMORY_ERROR_CORRECTION;
/* =====================
Memory Device (Type 17)
======================= */
// Struct - Physical Memory Array (Type 16)
typedef struct SMBPhysicalMemoryArray
{
// 2.1+ spec (15 bytes)
SMB_STRUCT_HEADER // Type 16
SMBByte physicalLocation; // physical location
SMBByte arrayUse; // the use for the memory array, The enumeration value from MEMORY_ARRAY_USE.
SMBByte errorCorrection; // error correction/detection method, The enumeration value from MEMORY_ERROR_CORRECTION.
SMBDWord maximumCapacity; // maximum memory capacity in kilobytes
SMBWord errorHandle; // handle of a previously detected error
SMBWord numMemoryDevices; // number of memory slots or sockets
// 2.7+ spec
//SMBQWord extMaximumCapacity;// maximum memory capacity in bytes
} __attribute__((packed)) SMBPhysicalMemoryArray;
//----------------------------------------------------------------------------------------------------------
// Struct - Memory Device (Type 17)
typedef struct SMBMemoryDevice
{
// 2.1+ spec (21 bytes)
//SMBWord configuredVolt;
} __attribute__((packed)) SMBMemoryDevice;
/* ===================================
Memory Array Mapped Address (Type 19)
===================================== */
//----------------------------------------------------------------------------------------------------------
// Struct - Memory Array Mapped Address (Type 19)
//typedef struct SMBMemoryArrayMappedAddress
//{
// 2.1+ spec
//SMBQWord extEndAddress;
//} __attribute__((packed)) SMBMemoryArrayMappedAddress;
/* ====================================
Memory Device Mapped Address (Type 20)
====================================== */
//----------------------------------------------------------------------------------------------------------
// Struct - Memory Device Mapped Address (Type 20)
//typedef struct SMBMemoryDeviceMappedAddress
//{
// 2.1+ spec
//SMBQWord extEndAddress;
//} __attribute__((packed)) SMBMemoryDeviceMappedAddress;
/* =====================================================
Firmware Volume Description (Apple Specific - Type 128)
======================================================= */
//----------------------------------------------------------------------------------------------------------
// Firmware Volume Description (Apple Specific - Type 128)
enum
{
FW_REGION_RESERVED = 0,
SMBDWord EndAddress;
} __attribute__((packed)) FW_REGION_INFO;
/* ========
(Type 128)
========== */
// Struct - Firmware Volume Description (Apple Specific - Type 128)
typedef struct SMBFirmwareVolume
{
SMB_STRUCT_HEADER// Type 128
FW_REGION_INFO FlashMap[ NUM_FLASHMAP_ENTRIES ];
} __attribute__((packed)) SMBFirmwareVolume;
//----------------------------------------------------------------------------------------------------------
/* ===========================================
Memory SPD Data (Apple Specific - Type 130)
============================================= */
SMBWord Type17Handle;
SMBWord Offset;
SMBWord Size;
SMBWord Data[];
SMBWord Data[1];
} __attribute__((packed)) SMBMemorySPD;
//----------------------------------------------------------------------------------------------------------
/* ============================================
OEM Processor Type (Apple Specific - Type 131)
============================================== */
SMBWord ProcessorType;
} __attribute__((packed)) SMBOemProcessorType;
//----------------------------------------------------------------------------------------------------------
/* =================================================
OEM Processor Bus Speed (Apple Specific - Type 132)
=================================================== */
SMBWord ProcessorBusSpeed; // MT/s unit
} __attribute__((packed)) SMBOemProcessorBusSpeed;
//----------------------------------------------------------------------------------------------------------
/* ==============================================
OEM Platform Feature (Apple Specific - Type 133)
================================================ */
trunk/i386/libsaio/stringTable.c
6060
6161
6262
63
63
6464
6565
6666
break;
}
} else if (c == '\"') {
/* Premature end of key */
// Premature end of key
return 1;
}
if (c != *str++) {
trunk/i386/libsaio/fake_efi.c
7474
7575
7676
77
78
7977
78
79
80
8081
8182
8283
......
438439
439440
440441
442
441443
442444
443445
444446
445447
446448
447
449
450
448451
449452
450453
......
567570
568571
569572
570
573
571574
572575
573
574
575
576
577
578
576579
577
578
580
579581
582
583
584
580585
581586
582587
......
598603
599604
600605
606
607
608
609
610
601611
602612
603613
......
618628
619629
620630
621
631
622632
623633
624634
......
674684
675685
676686
677
678
687
688
679689
680
690
681691
692
693
694
695
696
697
698
699
682700
683701
684702
/* Identify ourselves as the EFI firmware vendor */
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. */
// Bungo
//static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */
static EFI_UINT32 const FIRMWARE_REVISION = 0x0001000a; // got from real MBP6,1
// Bungo
/* Default platform system_id (fix by IntVar)
static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen
*/
static const char FIRMWARE_VENDOR_PROP[] = "firmware-vendor";
static const char FIRMWARE_ABI_32_PROP_VALUE[] = "EFI32";
static const char FIRMWARE_ABI_64_PROP_VALUE[] = "EFI64";
static const char EFI_MODE_PROP[] = "efi-mode"; //Bungo
static const char SYSTEM_ID_PROP[] = "system-id";
static const char SYSTEM_SERIAL_PROP[] = "SystemSerialNumber";
static const char SYSTEM_TYPE_PROP[] = "system-type";
static const char MODEL_PROP[] = "Model";
static const char BOARDID_PROP[] = "board-id";
static const char DEV_PATH_SUP[] = "DevicePathsSupported";
static uint32_t DevPathSup = 1;
static EFI_UINT32 DevPathSup = 1;
static EFI_UINT32 MachineSig = 0; //Bungo
/*
* Get an smbios option string option to convert to EFI_CHAR16 string
*/
// But I think eventually we want to fill stuff in the efi node
// too so we might as well create it so we have a pointer for it too.
node = DT__AddChild(node, "efi");
/* Bungo
if (archCpuType == CPU_TYPE_I386) {
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (char*)FIRMWARE_ABI_32_PROP_VALUE);
} else {
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char*)FIRMWARE_ABI_64_PROP_VALUE);
}
} else { */
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char *)FIRMWARE_ABI_64_PROP_VALUE);
//}
DT__AddProperty(node, FIRMWARE_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32*)&FIRMWARE_REVISION);
DT__AddProperty(node, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16*)FIRMWARE_VENDOR);
DT__AddProperty(node, EFI_MODE_PROP, sizeof(EFI_UINT8), (EFI_UINT8 *)&bootArgs->efiMode);
DT__AddProperty(node, FIRMWARE_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32 *)&FIRMWARE_REVISION);
DT__AddProperty(node, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16 *)FIRMWARE_VENDOR);
// TODO: Fill in other efi properties if necessary
// Set up the /efi/runtime-services table node similar to the way a child node of configuration-table
// all of the configuration tables needed by various kernel extensions.
gEfiConfigurationTableNode = DT__AddChild(node, "configuration-table");
// New node: /efi/kernel-compatibility
Node *efiKernelComNode = DT__AddChild(node, "kernel-compatibility");
len = 1;
DT__AddProperty(efiKernelComNode, "x86_64", sizeof(uint32_t), (EFI_UINT32 *)&len);
// Now fill in the /efi/platform Node
Node *efiPlatformNode = DT__AddChild(node, "platform");
DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &Platform.CPU.CPUFrequency);
}
DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(uint32_t), &DevPathSup);
DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(EFI_UINT32), &DevPathSup);
// Bungo
/* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
stop("Couldn't get chosen node");
}
int bootUUIDLength = strlen(gBootUUIDString);
if (bootUUIDLength)
int length = strlen(gBootUUIDString);
if (length)
{
DT__AddProperty(chosenNode, "boot-uuid", bootUUIDLength + 1, gBootUUIDString);
DT__AddProperty(chosenNode, "boot-uuid", length + 1, gBootUUIDString);
}
length = strlen(bootArgs->CommandLine);
DT__AddProperty(chosenNode, "boot-args", length + 1, bootArgs->CommandLine);
length = strlen(bootInfo->bootFile);
DT__AddProperty(chosenNode, "boot-file", length + 1, bootInfo->bootFile);
DT__AddProperty(chosenNode, "machine-signature", sizeof(EFI_UINT32), (EFI_UINT32 *)&MachineSig);
}
/*
trunk/i386/libsaio/smbios_getters.c
3030
3131
3232
33
3334
3435
3536
......
8586
8687
8788
89
8890
8991
9092
91
9293
9394
9495
......
138139
139140
140141
141
142
142143
143144
144145
......
155156
156157
157158
158
159
159160
161
160162
161163
162164
163
165
164166
165
167
168
169
170
171
166172
167173
174
175
168176
169
170177
171178
172179
180
173181
174
182
183
184
175185
186
187
188
189
190
191
192
176193
177
178
179
180
181
182
183194
184195
185196
......
188199
189200
190201
191
202
192203
193204
194205
......
205216
206217
207218
208
219
209220
210221
211222
212223
213224
214225
215
226
216227
217228
218229
......
229240
230241
231242
232
243
233244
234245
235246
236247
237248
238
249
239250
240251
241252
......
252263
253264
254265
255
266
256267
257268
258269
259270
260
271
261272
262273
263274
......
274285
275286
276287
277
288
278289
279290
280291
281292
282
293
283294
284295
285296
286297
287298
288299
289
300
290301
291302
292303
......
303314
304315
305316
306
317
307318
308319
309320
......
332343
333344
334345
346
347
348
349
335350
336351
337352
......
342357
343358
344359
345
360
361
346362
347363
348364
......
358374
359375
360376
377
378
379
380
361381
362382
363383
......
368388
369389
370390
371
391
392
372393
373394
374395
......
378399
379400
380401
402
403
404
405
381406
382407
383408
......
388413
389414
390415
391
392
393
394416
395417
396418
......
400422
401423
402424
425
426
427
428
403429
404430
405
431
406432
407433
408434
......
413439
414440
415441
416
417
418
419442
420443
421444
......
425448
426449
427450
451
452
453
454
428455
429456
430457
......
435462
436463
437464
438
439
440
441465
442466
443467
// set external clock to 0 for SANDY
// removes FSB info from system profiler as on real mac's.
case CPU_MODEL_SANDYBRIDGE:
case CPU_MODEL_JAKETOWN:
case CPU_MODEL_IVYBRIDGE_XEON:
case CPU_MODEL_IVYBRIDGE:
case CPU_MODEL_HASWELL:
case CPU_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
case CPU_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPU_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPU_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPU_MODEL_IVYBRIDGE_XEON:
case CPU_MODEL_HASWELL:
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
{
// thanks to dgobe for i3/i5/i7 bus speed detection
int nhm_bus = 0x3F;
if (Platform.CPU.NoCores >= 4) {
return 0x501;// 1281 - Quad-Core Xeon
} else if (Platform.CPU.NoCores == 1) {
return 0x201;// 513 - Core Solo
return 0x201;// 513 - Core Duo
};
return 0x301;// 769 - Core 2 Duo
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;
}
// Bungo: fixes Oem Processor Type - better matching IMHO
// Bungo: fixes Oem Processor Type - better matching IMHO, needs testing
switch (Platform.CPU.Family) {
case 0x0F:
case 0x06:
{
switch (Platform.CPU.Model) {
case CPU_MODEL_PENTIUM_M:
case CPU_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
value->word = 0x101;// 257
case CPU_MODEL_PRESCOTT:
case CPU_MODEL_NOCONA:
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0x402;// 1026 - Xeon
}
return true;
case CPU_MODEL_PRESLER:
case CPU_MODEL_CELERON:
case CPU_MODEL_YONAH:// 0x0E - Intel Mobile Core Solo, Duo
case CPU_MODEL_CELERON:
value->word = 0x201;// 513
return true;
case CPU_MODEL_MEROM:// 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPU_MODEL_XEON_MP:// 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm
value->word = 0x401;// 1025
case CPU_MODEL_PENRYN:// 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0x402;// 1026 - Xeon
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x301;// 769 - Core 2 Duo
} else {
value->word = 0x402;// 1026 - Core 2 Quad as Xeon
}
return true;
case CPU_MODEL_MEROM:// 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPU_MODEL_PENRYN:// 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
value->word = 0x402;// 1026 - Xeon
}
case CPU_MODEL_PENTIUM_M:// 0x09 - Banias
case CPU_MODEL_LINCROFT:// 0x27 - Intel Atom, "Lincroft", 45nm
case CPU_MODEL_ATOM:// 0x1C - Intel Atom (45nm)
return true;
case CPU_MODEL_NEHALEM:// 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPU_MODEL_FIELDS:// 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPU_MODEL_DALES:// 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale)
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0x501;// 1281 - Lynnfiled Quad-Core Xeon
return true;
}
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x601;// 1537 - Core i5
value->word = 0x901;// - Core i3
}
return true;
case CPU_MODEL_DALES_32NM:// 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale)
case CPU_MODEL_WESTMERE:// 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPU_MODEL_WESTMERE_EX:// 0x2F - Intel Xeon E7
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0x501;// 1281 - Xeon
return true;
}
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x602;// 1538 - Core i5
value->word = 0x901;// - Core i3
}
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")) {
value->word = 0x501;// 1281 - Xeon
return true;
}
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x603;// 1539 - Core i5
value->word = 0x902;// - Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE:// 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm)
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0xA01;// 2561 - Xeon
return true;
}
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x604;// 1540 - Core i5
value->word = 0x903;// - Core i5
}
return true;
case CPU_MODEL_IVYBRIDGE_XEON:// 0x3E - Mac Pro 6,1
value->word = 0xA01;// 2561
value->word = 0xA01;// 2561 - Xeon
return true;
case CPU_MODEL_HASWELL:// 0x3C -
case CPU_MODEL_HASWELL_SVR:// 0x3F -
case CPU_MODEL_HASWELL_ULT:// 0x45 -
case CPU_MODEL_CRYSTALWELL:// 0x46
if (strstr(Platform.CPU.BrandString, "Xeon(R)")) {
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0xA01;// 2561 - Xeon
return true;
}
return true;
}
if (Platform.CPU.NoCores <= 2) {
value->word = 0x605;// 1541 - Core i5
value->word = 0x904;// - Core i3
}
return true;
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
return false;
}
idx++;
if (idx < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[idx];
}
}
return false;
value->byte = 2; // means Unknown
return true;
//value->byte = SMB_MEM_TYPE_DDR2;
//return true;
}
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
return false;
}
idx++;
if (idx < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[idx];
}
}
return false;
value->dword = 0; // means Unknown
return true;
//value->dword = 800;
//return true;
}
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
return false;
}
idx++;
if (idx < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[idx];
}
}
if (!bootInfo->memDetect) {
return false;
}
value->string = NOT_AVAILABLE;
return true;
}
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
return false;
}
idx++;
DBG("getSMBMemoryDeviceSerialNumber index: %d, MAX_RAM_SLOTS: %d\n",idx,MAX_RAM_SLOTS);
//DBG("getSMBMemoryDeviceSerialNumber index: %d, MAX_RAM_SLOTS: %d\n",idx,MAX_RAM_SLOTS);
if (idx < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[idx];
}
}
if (!bootInfo->memDetect) {
return false;
}
value->string = NOT_AVAILABLE;
return true;
}
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
return false;
}
idx++;
if (idx < MAX_RAM_SLOTS) {
map = Platform.DMI.DIMM[idx];
}
}
if (!bootInfo->memDetect) {
return false;
}
value->string = NOT_AVAILABLE;
return true;
}
trunk/i386/boot2/drivers.c
4040
4141
4242
43
43
44
45
46
47
4448
49
50
4551
4652
4753
......
837843
838844
839845
846
847
840848
841849
842850
843
851
844852
845
846
847
853
854
855
848856
849
857
850858
851859
852860
......
854862
855863
856864
857
865
858866
859867
860868
869
870
861871
862872
863
873
864874
865875
866876
......
873883
874884
875885
876
877886
878887
879
880
881
888
889
882890
883
891
884892
885893
886
887
888
894
895
896
889897
890
898
891899
892900
901
902
893903
894904
895905
......
899909
900910
901911
912
913
914
915
916
917
918
902919
903920
904921
#include "ramdisk.h"
#include "modules.h"
//extern char gMacOSVersion[8];
#if DEBUG
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
// extern char gMacOSVersion[8];
struct Module {
struct Module *nextModule;
long willLoad;
static char gPlatformName[64];
#endif
char *gDarwinBuildVerStr = "Darwin Kernel Version"; // Bungo
long
DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)
{
long ret;
long ret = 0;
compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;
u_int32_t uncompressed_size, size;
void *buffer;
unsigned long len;
u_int32_t uncompressed_size = 0, size = 0, adler32 = 0;
void *buffer = NULL;
unsigned long len = 0;
#if 0
/*#if 0
printf("kernel header:\n");
printf("signature: 0x%x\n", kernel_header->signature);
printf("compress_type: 0x%x\n", kernel_header->compress_type);
printf("uncompressed_size: 0x%x\n", kernel_header->uncompressed_size);
printf("compressed_size: 0x%x\n", kernel_header->compressed_size);
getchar();
#endif
#endif*/
if (kernel_header->signature == OSSwapBigToHostConstInt32('comp'))
{
DBG("Decompressing Kernel: ");
if (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss'))
{
error("kernel compression is bad\n");
error("ERROR: kernel compression is bad!\n");
return -1;
}
#if NOTDEF
return -1;
}
#endif
uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size);
binary = buffer = malloc(uncompressed_size);
size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0],
OSSwapBigToHostInt32(kernel_header->compressed_size));
size = decompress_lzss((u_int8_t *)binary, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));
if (uncompressed_size != size) {
error("size mismatch from lzss: %x\n", size);
error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size);
return -1;
}
if (OSSwapBigToHostInt32(kernel_header->adler32) !=
Adler32(binary, uncompressed_size))
adler32 = Adler32(binary, uncompressed_size);
if (OSSwapBigToHostInt32(kernel_header->adler32) != adler32)
{
printf("adler mismatch\n");
error("ERROR: adler mismatch (found: %x, expected: %x).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32));
return -1;
}
DBG("OK.\n");
}
ret = ThinFatFile(&binary, &len);
ret = ThinFatFile(&binary, &len);
}
// Bungo: no range checking, sorry
size = 0;
while (memcmp((uint8_t *)binary + size, (uint8_t *)gDarwinBuildVerStr, 21)) {
size++;
}
gDarwinBuildVerStr = (char *)binary + size;
// Notify modules that the kernel has been decompressed, thinned and is about to be decoded
execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL);
trunk/i386/boot2/boot.c
5959
6060
6161
62
6263
64
65
66
67
68
69
70
71
72
73
6374
6475
6576
......
165176
166177
167178
168
169
170
171179
172180
173181
......
192200
193201
194202
203
204
205
206
195207
196208
197209
......
231243
232244
233245
234
246
235247
236248
237249
......
251263
252264
253265
254
255266
256
257
267
268
269
258270
259
271
272
260273
261274
262275
......
309322
310323
311324
312
325
313326
314327
315328
......
319332
320333
321334
322
335
323336
324337
325338
......
328341
329342
330343
331
344
332345
333346
334347
335348
336349
337
350
338351
339352
340353
......
380393
381394
382395
396
397
398
383399
384400
385401
386
387
388402
389403
390404
......
454468
455469
456470
457
471
458472
459473
460474
......
508522
509523
510524
511
525
512526
513527
514
528
515529
516530
517531
......
603617
604618
605619
606
607
608620
609621
610622
......
623635
624636
625637
626
627
638
628639
629640
630641
631642
632
643
633644
634645
635646
......
680691
681692
682693
683
694
684695
685696
686697
......
712723
713724
714725
715
726
716727
717728
718729
......
720731
721732
722733
723
734
724735
725736
726737
......
736747
737748
738749
739
750
740751
741
752
742753
743754
744755
#include "gui.h"
#include "platform.h"
#include "modules.h"
#include "device_tree.h"
#ifndef DEBUG_BOOT2
#define DEBUG_BOOT2 0
#endif
#if DEBUG_BOOT2
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
/*
* How long to wait (in seconds) to load the
* kernel after displaying the "boot:" prompt.
md0Ramdisk();
verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64");
verbose("Boot Args: %s\n", bootArgs->CommandLine);
// Cleanup the PXE base code.
if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) {
} else {
drawBootGraphics();
}
DBG("Starting Darwin/%s [%s]\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64", gDarwinBuildVerStr);
DBG("Boot Args: %s\n", bootArgs->CommandLine);
setupBooterLog();
finalizeBootStruct();
unsigned long adler32;
if((gBootMode & kBootModeSafe) != 0) {
verbose("Kernel Cache ignored.\n");
DBG("Kernel Cache ignored.\n");
return -1;
}
else if (checkOSVersion("10.6")) {
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
(archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
int lnam = strlen(kernelCacheFile) + 9; //with adler32
char* name;
long prev_time = 0;
intlnam = strlen(kernelCacheFile) + 9; //with adler32
char*name;
longprev_time = 0;
struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow);
structdirstuff* cacheDir = opendir(kDefaultCachePathSnow);
/* TODO: handle error? */
if (cacheDir) {
while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) {
// Exit if kernel cache file wasn't found
if (ret == -1) {
verbose("No Kernel Cache File '%s' found\n", kernelCacheFile);
DBG("No Kernel Cache File '%s' found\n", kernelCacheFile);
return -1;
}
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat)
&& (kerneltime > cachetime)) {
verbose("Kernel file (%s) is more recent than KernelCache (%s), ignoring KernelCache\n",
DBG("Kernel file (%s) is more recent than Kernel Cache (%s)! Ignoring Kernel Cache.\n",
bootInfo->bootFile, kernelCacheFile);
return -1;
}
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
&& (exttime > cachetime)) {
verbose("/System/Library/Extensions is more recent than KernelCache (%s), ignoring KernelCache\n",
DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache file (%s)! Ignoring Kernel Cache.\n",
kernelCacheFile);
return -1;
}
// Since the kernel cache file exists and is the most recent try to load it
verbose("Loading kernel cache %s\n", kernelCachePath);
DBG("Loading kernel cache: '%s'\n", kernelCachePath);
ret = LoadThinFatFile(kernelCachePath, binary);
return ret; // ret contain the length of the binary
// Record the device that the booter was loaded from.
gBIOSDev = biosdev & kBIOSDevMask;
// Initialize boot-log
initBooterLog();
// Initialize boot info structure.
initKernBootStruct();
initBooterLog();
// Setup VGA text mode.
// Not sure if it is safe to call setVideoMode() before the
// config table has been loaded. Call video_mode() instead.
gBootVolume = selectBootVolume(bvChain);
// Intialize module system
// Intialize module system
init_module_system();
#if DEBUG
if (gBootVolume == NULL)
{
freeFilteredBVChain(bvChain);
if (gEnableCDROMRescan)
rescanBIOSDevice(gBIOSDev);
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
setupDeviceList(&bootInfo->themeConfig);
HibernateBoot((char *)val);
break;
}
verbose("Loading Darwin %s\n", gMacOSVersion);
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
if (useKernelCache) do {
}
if (gOverrideKernel && kernelCacheFile[0] == 0) {
verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n",
bootInfo->bootFile);
DBG("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile);
useKernelCache = false;
break;
}
if (gMKextName[0] != 0) {
verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n",
DBG("Using a specific MKext Cache (%s), KernelCache will not be used\n",
gMKextName);
useKernelCache = false;
break;
strlcpy(bootFilePath, bootFile, sizeof(bootFilePath));
}
verbose("Loading kernel %s\n", bootFilePath);
DBG("Loading kernel: '%s'\n", bootFilePath);
ret = LoadThinFatFile(bootFilePath, &binary);
if (ret <= 0 && archCpuType == CPU_TYPE_X86_64)
{
ret = ExecKernel(binary);
}
}
// chainboot
if (status == 1) {
// if we are already in graphics-mode,
setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode.
}
}
if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) {
nbpUnloadBaseCode();
}
CacheReset();
diskFreeMap(oldMap);
oldMap = NULL;
int dev = selectAlternateBootDevice(gBIOSDev);
BVRef bvchain = scanBootVolumes(dev, 0);
BVRef bootVol = selectBootVolume(bvchain);
gBootVolume = bootVol;
trunk/i386/boot2/boot.h
248248
249249
250250
251
251252
252253
253254
/*
* drivers.c
*/
extern char *gDarwinBuildVerStr; // Bungo
extern long LoadExtraDrivers(char * dirSpec);
extern long LoadDrivers(char * dirSpec);
extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
trunk/i386/boot2/options.c
3232
3333
3434
35
36
37
38
39
40
3541
3642
3743
......
12031209
12041210
12051211
1206
1212
12071213
12081214
12091215
......
12541260
12551261
12561262
1257
1263
12581264
12591265
12601266
12611267
1262
1268
12631269
12641270
12651271
12661272
1273
1274
1275
1276
1277
12671278
12681279
12691280
......
12741285
12751286
12761287
1277
1288
12781289
12791290
12801291
1281
1292
12821293
12831294
12841295
12851296
1286
1287
1297
1298
1299
12881300
12891301
12901302
#include "pci.h"
#include "modules.h"
#if DEBUG
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
bool showBootBanner = true; //Azi:showinfo
static bool shouldboot = false;
// Load com.apple.Boot.plist from the selected volume
// and use its contents to override default bootConfig.
loadSystemConfig(&bootInfo->bootConfig);
loadSystemConfig(&bootInfo->bootConfig);
loadChameleonConfig(&bootInfo->chameleonConfig, NULL);
// Use the kernel name specified by the user, or fetch the name
}
}
}
/*
// Try to get the volume uuid string
if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) {
gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString);
}
*/
// If we have the volume uuid add it to the commandline arguments
if (strlen(gBootUUIDString)) {
copyArgument(kBootUUIDKey, gBootUUIDString, strlen(gBootUUIDString), &argP, &cntRemaining);
}
// Try to get the volume uuid string
if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) {
gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString);
DBG("boot-uuid: %s\n", gBootUUIDString);
}
}
if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config,
cnt++;
strlcpy(valueBuffer + 1, val, cnt);
val = valueBuffer;
} else {
} else { /*
if (strlen(gBootUUIDString)) {
val = "*uuid";
cnt = 5;
} else {
} else { */
// Don't set "rd=.." if there is no boot device key
// and no UUID.
val = "";
cnt = 0;
}
}
/* } */
}
if (cnt > 0) {
copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining);
}

Archive Download the corresponding diff file

Revision: 2382