Chameleon

Chameleon Commit Details

Date:2014-11-14 01:25:55 (5 years 3 months ago)
Author:ErmaC
Commit:2475
Parents: 2474
Message:Make some constant arrays static; other minor fixes (acpi_patcher.c)
Changes:
M/trunk/i386/libsaio/acpi_patcher.c
M/trunk/CHANGES

File differences

trunk/i386/libsaio/acpi_patcher.c
105105
106106
107107
108
108
109
109110
110111
111112
112113
113114
114115
115
116
117
116118
117119
118120
......
126128
127129
128130
129
130131
131132
132133
133134
134
135
135136
136
137
137138
138139
139140
......
165166
166167
167168
168
169
169170
170171
171172
......
177178
178179
179180
180
181
181182
182183
183184
......
196197
197198
198199
200
199201
202
200203
201204
202205
203
206
207
204208
205209
206210
......
212216
213217
214218
215
219
216220
217221
218222
......
411415
412416
413417
414
418
415419
416420
417421
......
515519
516520
517521
518
522
519523
520524
521525
......
526530
527531
528532
529
530
533
534
535
531536
532537
533538
534539
535
536
540
541
542
543
537544
538545
539
546
547
548
540549
541550
542551
543
552
553
544554
545555
546556
......
567577
568578
569579
570
580
571581
572
582
573583
574584
575585
......
583593
584594
585595
586
596
597
598
587599
588600
589601
......
592604
593605
594606
595
607
608
596609
597610
598
611
612
613
599614
600615
601616
602
617
618
603619
604620
605621
......
617633
618634
619635
620
636
637
621638
622639
623640
......
626643
627644
628645
629
646
647
630648
631649
632650
......
638656
639657
640658
641
659
660
642661
643662
644663
......
664683
665684
666685
667
686
687
688
668689
669690
670691
......
682703
683704
684705
685
706
707
686708
687709
688
710
711
689712
690
713
714
715
691716
692717
693
718
719
720
694721
695722
696723
697724
698
725
726
699727
700728
701729
......
706734
707735
708736
709
737
738
739
710740
711741
712742
713743
714744
715745
716
717
746
747
748
749
718750
719
751
752
753
720754
721755
722756
723
757
758
759
724760
725761
726762
727763
728
729
764
765
766
767
730768
731769
732770
733
771
772
773
734774
735775
736776
......
740780
741781
742782
743
744
783
784
785
786
745787
746788
747789
......
750792
751793
752794
753
795
796
797
754798
755799
756800
......
764808
765809
766810
767
811
812
768813
769814
770815
771
816
817
772818
773819
774820
......
793839
794840
795841
796
842
843
797844
798
845
846
847
799848
800849
801850
......
816865
817866
818867
819
868
869
820870
821
871
872
873
822874
823875
824876
......
849901
850902
851903
852
904
905
853906
854907
855908
856909
857
910
911
858912
859
913
914
915
860916
861917
862918
863919
864920
865921
866
922
923
867924
868925
869926
870927
871928
872929
873
930
931
874932
875
933
934
876935
877
936
937
938
878939
879940
880941
......
893954
894955
895956
896
957
897958
898
959
960
899961
900962
901963
......
906968
907969
908970
909
971
972
910973
911
974
975
912976
913977
914978
......
916980
917981
918982
919
983
984
920985
921986
922987
923988
924989
925
990
991
926992
927993
928
994
995
929996
930997
998
931999
9321000
9331001
934
1002
1003
9351004
9361005
9371006
9381007
9391008
940
1009
1010
9411011
9421012
9431013
......
9461016
9471017
9481018
949
1019
1020
9501021
9511022
9521023
9531024
9541025
9551026
956
1027
1028
9571029
9581030
9591031
......
9731045
9741046
9751047
976
1048
1049
9771050
9781051
979
1052
1053
9801054
9811055
1056
9821057
9831058
9841059
......
9901065
9911066
9921067
993
1068
1069
1070
9941071
9951072
9961073
9971074
9981075
999
1076
1077
10001078
10011079
10021080
......
10041082
10051083
10061084
1007
1085
1086
10081087
10091088
10101089
......
10161095
10171096
10181097
1019
1098
1099
10201100
1021
1101
1102
10221103
10231104
10241105
10251106
1026
1107
1108
10271109
10281110
10291111
10301112
1031
1113
1114
10321115
10331116
1034
1117
1118
10351119
10361120
10371121
......
10401124
10411125
10421126
1043
1127
1128
10441129
10451130
10461131
10471132
10481133
10491134
1050
1135
1136
10511137
10521138
10531139
......
10581144
10591145
10601146
1061
1147
1148
10621149
10631150
10641151
10651152
10661153
10671154
1068
1155
1156
10691157
10701158
10711159
......
10871175
10881176
10891177
1090
1178
1179
10911180
10921181
1093
1182
1183
10941184
10951185
10961186
10971187
1188
10981189
10991190
11001191
11011192
11021193
1103
1194
1195
1196
11041197
11051198
11061199
......
11181211
11191212
11201213
1214
11211215
11221216
1217
11231218
11241219
1125
1220
1221
11261222
1223
11271224
11281225
1226
11291227
1228
11301229
11311230
11321231
// Start searching any potential location for ACPI Table
snprintf(dirSpec, sizeof(dirSpec), "%s", filename);
fd = open(dirSpec, 0);
if (fd < 0) {
if (fd < 0)
{
snprintf(dirSpec, sizeof(dirSpec), "/Extra/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0) {
if (fd < 0)
{
// NOT FOUND:
DBG("ACPI Table not found: %s\n", filename);
*dirSpec = '\0';
void *loadACPITable (const char * filename)
{
void *tableAddr;
const char * dirspec=NULL;
int fd = search_and_get_acpi_fd(filename, &dirspec);
if (fd>=0)
if (fd >= 0)
{
tableAddr=(void*)AllocateKernelMemory(file_size (fd));
void *tableAddr = (void*)AllocateKernelMemory(file_size (fd));
if (tableAddr)
{
if (read (fd, tableAddr, file_size (fd))!=file_size (fd))
DBG("Start finding cpu names. length %d\n", length);
for (i=0; i<length-7; i++)
for (i=0; i<length-7; i++)
{
if (dsdt[i] == 0x5B && dsdt[i+1] == 0x83) // ProcessorOP
{
uint8_t j;
for (j=0; j<4; j++)
for (j=0; j<4; j++)
{
char c = dsdt[offset+j];
i = offset + 5;
if (acpi_cpu_count == 0)
{
acpi_cpu_p_blk = dsdt[i] | (dsdt[i+1] << 8);
}
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) {
if (++acpi_cpu_count == 32)
{
return;
}
}
struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt)
{
char ssdt_header[] = // cst_ssdt_header
static char const ssdt_header[] = // cst_ssdt_header
{
0x53, 0x53, 0x44, 0x54, 0xE7, 0x00, 0x00, 0x00, /* SSDT.... */
0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */
struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt)
{
char ssdt_header[] = // pss_ssdt_header
static char const ssdt_header[] = // pss_ssdt_header
{
0x53, 0x53, 0x44, 0x54, 0x7E, 0x00, 0x00, 0x00, /* SSDT.... */
0x01, 0x6A, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x00, /* ..PmRef. */
p_states_count = 0;
} else {
uint8_t vidstep;
uint8_t i = 0, u, invalid = 0;
uint8_t u, invalid = 0;
// Finalize P-States
// Find how many P-States machine supports
p_states_count = (uint8_t)(maximum.CID - minimum.CID + 1);
vidstep = ((maximum.VID << 2) - (minimum.VID << 2)) / (p_states_count - 1);
for (u = 0; u < p_states_count; u++) {
i = u - invalid;
for (u = 0; u < p_states_count; u++)
{
uint8_t i = u - invalid;
p_states[i].CID = maximum.CID - u;
p_states[i].FID = (uint8_t)(p_states[i].CID >> 1);
if (p_states[i].FID < 0x6) {
if (cpu_dynamic_fsb) {
if (p_states[i].FID < 0x6)
{
if (cpu_dynamic_fsb)
{
p_states[i].FID = (p_states[i].FID << 1) | 0x80;
}
} else if (cpu_noninteger_bus_ratio) {
}
else if (cpu_noninteger_bus_ratio)
{
p_states[i].FID = p_states[i].FID | (0x40 * (p_states[i].CID & 0x1));
}
if (i && p_states[i].FID == p_states[i-1].FID) {
if (i && p_states[i].FID == p_states[i-1].FID)
{
invalid++;
}
p_states[i].VID = ((maximum.VID << 2) - (vidstep * u)) >> 2;
case CPU_MODEL_WESTMERE:// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPU_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPU_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (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_HASWELL://
case CPU_MODEL_HASWELL://
case CPU_MODEL_IVYBRIDGE_XEON: //
//case CPU_MODEL_HASWELL_H://
case CPU_MODEL_HASWELL_SVR://
(Platform.CPU.Model == CPU_MODEL_HASWELL_ULT) || (Platform.CPU.Model == CPU_MODEL_CRYSTALWELL))
{
maximum.Control = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0xff;
} else {
}
else
{
maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff;
}
DBG("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
// Sanity check
if (maximum.Control < minimum.Control) {
if (maximum.Control < minimum.Control)
{
DBG("Insane control values!");
p_states_count = 0;
} else {
}
else
{
uint8_t i;
p_states_count = 0;
for (i = maximum.Control; i >= minimum.Control; i--) {
for (i = maximum.Control; i >= minimum.Control; i--)
{
p_states[p_states_count].Control = i;
p_states[p_states_count].CID = p_states[p_states_count].Control << 1;
p_states[p_states_count].Frequency = (Platform.CPU.FSBFrequency / 1000000) * i;
}
// Generating SSDT
if (p_states_count > 0) {
if (p_states_count > 0)
{
int i;
AML_CHUNK* root = aml_create_node(NULL);
AML_CHUNK* name = aml_add_name(scop, "PSS_");
AML_CHUNK* pack = aml_add_package(name);
for (i = 0; i < p_states_count; i++) {
for (i = 0; i < p_states_count; i++)
{
AML_CHUNK* pstt = aml_add_package(pack);
aml_add_dword(pstt, p_states[i].Frequency);
}
// Add aliaces
for (i = 0; i < acpi_cpu_count; i++) {
for (i = 0; i < acpi_cpu_count; i++)
{
char name[9];
sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]);
return ssdt;
}
} else {
}
else
{
DBG("ACPI CPUs not found: P-States not generated !!!\n");
}
const char * value;
// Restart Fix
if (Platform.CPU.Vendor == 0x756E6547) { /* Intel */
if (Platform.CPU.Vendor == 0x756E6547)
{/* Intel */
fix_restart = true;
fix_restart_ps2 = false;
if ( getBoolForKey(kPS2RestartFix, &fix_restart_ps2, &bootInfo->chameleonConfig) && fix_restart_ps2) {
if ( getBoolForKey(kPS2RestartFix, &fix_restart_ps2, &bootInfo->chameleonConfig) && fix_restart_ps2)
{
fix_restart = true;
} else {
}
else
{
getBoolForKey(kRestartFix, &fix_restart, &bootInfo->chameleonConfig);
}
} else {
}
else
{
DBG("Not an Intel platform: Restart Fix not applied !!!\n");
fix_restart = false;
}
if (fix_restart) {
if (fix_restart)
{
fadt_rev2_needed = true;
}
memcpy(fadt_mod, fadt, fadt->Length);
fadt_mod->Length = 0x84;
fadt_mod->Revision = 0x02; // FADT rev 2 (ACPI 1.0B MS extensions)
} else {
}
else
{
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) {
if (Platform.Type > 6)
{
if(fadt_mod->PM_Profile<=6)
{
Platform.Type = fadt_mod->PM_Profile; // get the fadt if correct
} else {
}
else
{
Platform.Type = 1;/* Set a fixed value (Desktop) */
}
DBG("Error: system-type must be 0..6. Defaulting to %d !\n", Platform.Type);
} else {
}
else
{
Platform.Type = (unsigned char) strtoul(value, NULL, 10);
}
}
// Set PM_Profile from System-type if only user wanted this value to be forced
if (fadt_mod->PM_Profile != Platform.Type) {
if (value) {
if (fadt_mod->PM_Profile != Platform.Type)
{
if (value)
{
// user has overriden the SystemType so take care of it in FACP
DBG("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type);
fadt_mod->PM_Profile = Platform.Type;
} else {
}
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;
}
setupSystemType();
// Patch FADT to fix restart
if (fix_restart) {
if (fix_restart_ps2) {
if (fix_restart)
{
if (fix_restart_ps2)
{
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID= 0x01; // System I/O
fadt_mod->Reset_BitWidth= 0x08; // 1 byte
fadt_mod->Reset_Address= 0x64; // Address of the register
fadt_mod->Reset_Value= 0xfe; // Value to write to reset the system
DBG("FADT: PS2 Restart Fix applied!\n");
} else {
}
else
{
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID= 0x01; // System I/O
fadt_mod->Reset_BitWidth= 0x08; // 1 byte
}
// Patch DSDT Address if we have loaded DSDT.aml
if(new_dsdt) {
if(new_dsdt)
{
DBG("DSDT: Old @%x,%x, ",fadt_mod->DSDT,fadt_mod->X_DSDT);
fadt_mod->DSDT=(uint32_t)new_dsdt;
if ((uint32_t)(&(fadt_mod->X_DSDT))-(uint32_t)fadt_mod+8<=fadt_mod->Length) {
if ((uint32_t)(&(fadt_mod->X_DSDT))-(uint32_t)fadt_mod+8<=fadt_mod->Length)
{
fadt_mod->X_DSDT=(uint32_t)new_dsdt;
}
acpi10_p = (uint64_t)(uint32_t)getAddressOfAcpiTable();
acpi20_p = (uint64_t)(uint32_t)getAddressOfAcpi20Table();
addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");
if(acpi20_p) {
if(acpi20_p)
{
addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");
} else {
}
else
{
DBG("No ACPI 2.\n");
}
return 1;
acpi_cpu_count = 0;
/* Try using the file specified with the DSDT option */
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig)) {
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig))
{
snprintf(dirSpec, sizeof(dirSpec), filename);
} else {
}
else
{
sprintf(dirSpec, "DSDT.aml");
//verbose("dirSpec, DSDT.aml");
}
{
int i;
for (i = 0; i < 30; i++) {
for (i = 0; i < 30; i++)
{
char filename[512];
sprintf(filename, i > 0 ? "SSDT-%d.aml" : "SSDT.aml", i);
if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) ) {
if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) )
{
ssdt_count++;
} else {
}
else
{
break;
}
}
}
// Do the same procedure for both versions of ACPI
for (version = 0; version < 2; version++) {
for (version = 0; version < 2; version++)
{
struct acpi_2_rsdp *rsdp, *rsdp_mod;
struct acpi_2_rsdt *rsdt, *rsdt_mod;
int rsdplength;
// Find original rsdp
rsdp=(struct acpi_2_rsdp *)(version ? getAddressOfAcpi20Table() : getAddressOfAcpiTable());
if (!rsdp) {
if (!rsdp)
{
DBG("No ACPI version %d found. Ignoring\n", version+1);
if (version) {
if (version)
{
addConfigurationTable(&gEfiAcpi20TableGuid, NULL, "ACPI_20");
} else {
}
else
{
addConfigurationTable(&gEfiAcpiTableGuid, NULL, "ACPI");
}
continue;
rsdt=(struct acpi_2_rsdt *)(rsdp->RsdtAddress);
DBG("RSDT @%x, Length %d\n",rsdt, rsdt->Length);
DBG("RSDT @%x, Length %d\n",rsdt, rsdt ? rsdt->Length : 0);
if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000) {
if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000)
{
uint32_t *rsdt_entries;
int rsdt_entries_num;
int dropoffset=0, i;
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);
for (i=0;i<rsdt_entries_num;i++) {
for (i=0;i<rsdt_entries_num;i++)
{
char *table=(char *)(rsdt_entries[i]);
if (!table) {
if (!table)
{
continue;
}
rsdt_entries[i-dropoffset]=rsdt_entries[i];
if (drop_ssdt && tableSign(table, "SSDT")) {
if (drop_ssdt && tableSign(table, "SSDT"))
{
DBG("OEM SSDT tables was dropped\n");
dropoffset++;
continue;
}
if (tableSign(table, "DSDT")) {
if (tableSign(table, "DSDT"))
{
DBG("DSDT found\n");
verbose("Custom DSDT table was found\n");
if(new_dsdt) {
if(new_dsdt)
{
rsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;
}
continue;
}
if (tableSign(table, "FACP")) {
if (tableSign(table, "FACP"))
{
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);
if (!fadt || (uint32_t)fadt == 0xffffffff || fadt->Length>0x10000) {
if (!fadt || (uint32_t)fadt == 0xffffffff || fadt->Length>0x10000)
{
DBG("FADT incorrect. Not modified\n");
continue;
}
rsdt_entries[i-dropoffset]=(uint32_t)fadt_mod;
// Generate _CST SSDT
if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod))) {
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))) {
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++;
rsdt_entries=(uint32_t *)(rsdt_mod+1);
// Mozodojo: Insert additional SSDTs into RSDT
if(ssdt_count > 0) {
if(ssdt_count > 0)
{
int j;
for (j=0; j<ssdt_count; j++) {
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);
}
rsdt_mod->Checksum=256-checksum8(rsdt_mod,rsdt_mod->Length);
DBG("New checksum %d at %x\n", rsdt_mod->Checksum,rsdt_mod);
} else {
}
else
{
rsdp_mod->RsdtAddress=0;
DBG("RSDT not found or RSDT incorrect\n");
}
DBG("\n");
if (version) {
if (version)
{
struct acpi_2_xsdt *xsdt, *xsdt_mod;
// FIXME: handle 64-bit address correctly
xsdt=(struct acpi_2_xsdt*) ((uint32_t)rsdp->XsdtAddress);
DBG("XSDT @%x;%x, Length=%d\n", (uint32_t)(rsdp->XsdtAddress>>32),(uint32_t)rsdp->XsdtAddress, xsdt->Length);
if (xsdt && (uint64_t)rsdp->XsdtAddress<0xffffffff && xsdt->Length<0x10000) {
if (xsdt && (uint64_t)rsdp->XsdtAddress<0xffffffff && xsdt->Length<0x10000)
{
uint64_t *xsdt_entries;
int xsdt_entries_num, i;
int dropoffset=0;
rsdp_mod->XsdtAddress=(uint32_t)xsdt_mod;
xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8;
xsdt_entries=(uint64_t *)(xsdt_mod+1);
for (i=0;i<xsdt_entries_num;i++) {
for (i=0;i<xsdt_entries_num;i++)
{
char *table=(char *)((uint32_t)(xsdt_entries[i]));
if (!table) {
if (!table)
{
continue;
}
xsdt_entries[i-dropoffset]=xsdt_entries[i];
if (drop_ssdt && tableSign(table, "SSDT")) {
if (drop_ssdt && tableSign(table, "SSDT"))
{
DBG("dropped (OEM)\n");
dropoffset++;
continue;
}
if (tableSign(table, "DSDT")) {
if (tableSign(table, "DSDT"))
{
DBG("DSDT found\n");
if (new_dsdt) {
if (new_dsdt)
{
xsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;
DBG("custom table added\n");
}
continue;
}
if (tableSign(table, "FACP")) {
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);
if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000) {
if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000)
{
DBG("FADT incorrect or after 4GB. Dropping XSDT\n");
goto drop_xsdt;
}
// 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))) {
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))) {
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++;
xsdt_entries=(uint64_t *)(xsdt_mod+1);
// Mozodojo: Insert additional SSDTs into XSDT
if(ssdt_count > 0) {
if(ssdt_count > 0)
{
int j;
for (j=0; j<ssdt_count; 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
xsdt_mod->Checksum=0;
xsdt_mod->Checksum=256-checksum8(xsdt_mod,xsdt_mod->Length);
} else {
}
else
{
drop_xsdt:
DBG("About to drop XSDT\n");
// 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) {
if (version)
{
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);
}
if (version)
trunk/CHANGES
1
12
23
34
- bitshoveler : Make some constant arrays static; other minor fixes (acpi_patcher.c)
- bitshoveler : Make 'buffer' arg to aml_add_buffer 'const char *', was just 'char *' (aml_generator)
- bitshoveler : Various fixes to problems exposed by Clang static analyzer (picopng.c)
- ErmaC : Rollback changes for msdos.c (2327) thx to bltz

Archive Download the corresponding diff file

Revision: 2475