Chameleon

Chameleon Commit Details

Date:2010-12-12 06:41:24 (13 years 4 months ago)
Author:Evan Lojewski
Commit:656
Parents: 655
Message:ACPI patcher update, now in sync with trunk. Slight makefile change.
Changes:
A/branches/meklort/i386/modules/ACPIPatcher/ACPIPatcher.h
M/branches/meklort/i386/modules/MakeInc.dir
M/branches/meklort/i386/modules/ACPIPatcher/acpi_patcher.c
M/branches/meklort/i386/modules/ACPIPatcher/aml_generator.h
M/branches/meklort/i386/modules/ACPIPatcher/acpi_patcher.h

File differences

branches/meklort/i386/modules/ACPIPatcher/acpi_patcher.c
2525
2626
2727
28
29
3028
31
3229
3330
31
3432
3533
3634
......
106104
107105
108106
109
110107
111108
112109
113110
114111
115
112
116113
117114
118115
......
130127
131128
132129
133
130
134131
135132
136133
137134
138
139135
140136
141137
......
146142
147143
148144
149
145
150146
151147
152148
......
266262
267263
268264
269
270
265
266
271267
272268
269
270
273271
274272
273
274
275
275276
276277
277278
......
462463
463464
464465
465
466
466467
467468
468469
......
512513
513514
514515
515
516
517
518
516519
517520
518521
......
520523
521524
522525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
523554
524555
525556
......
669700
670701
671702
672
673703
674704
675705
......
744774
745775
746776
777
747778
748779
749780
#define DBG(x...)
#endif
uint64_t acpi10_p;
uint64_t acpi20_p;
extern char* gSMBIOSBoardModel;
// Slice: New signature compare function
boolean_t tableSign(char *table, const char *sgn)
{
sprintf(dirSpec,"%s.%s", gSMBIOSBoardModel, filename);
fd = open(dirSpec, 0);
}
if (fd < 0)
{
sprintf(dirSpec, "%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
{
if(gSMBIOSBoardModel)
{
sprintf(dirSpec, "/Extra/%s.%s", gSMBIOSBoardModel, filename);
fd = open(dirSpec, 0);
}
if (fd < 0)
{
{
sprintf(dirSpec, "bt(0,0)/Extra/%s", filename);
fd = open(dirSpec, 0);
}
}
}
}
}
verbose("ACPI table not found: %s\n", filename);
*dirSpec = '\0';
}
if (outDirspec) *outDirspec = dirSpec;
return fd;
}
if (acpi_cpu_count > 0)
{
bool c2_enabled = fadt->C2_Latency < 100;
bool c3_enabled = fadt->C3_Latency < 1000;
bool c2_enabled = false;
bool c3_enabled = false;
bool c4_enabled = false;
getBoolForKey(kEnableC2States, &c2_enabled, &bootInfo->bootConfig);
getBoolForKey(kEnableC3States, &c3_enabled, &bootInfo->bootConfig);
getBoolForKey(kEnableC4States, &c4_enabled, &bootInfo->bootConfig);
c2_enabled = c2_enabled | (fadt->C2_Latency < 100);
c3_enabled = c3_enabled | (fadt->C3_Latency < 1000);
unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + (c3_enabled ? 1 : 0);
struct aml_chunk* root = aml_create_node(NULL);
if (maximum.CID < minimum.CID)
{
DBG("Insane FID values!");
p_states_count = 1;
p_states_count = 0;
}
else
{
p_states_count -= invalid;
}
} break;
break;
}
case CPU_MODEL_FIELDS:
case CPU_MODEL_DALES:
case CPU_MODEL_DALES_32NM:
case CPU_MODEL_NEHALEM_EX:
case CPU_MODEL_WESTMERE:
case CPU_MODEL_WESTMERE_EX:
{
maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)...
minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
// Sanity check
if (maximum.Control < minimum.Control)
{
DBG("Insane control values!");
p_states_count = 0;
}
else
{
uint8_t i;
p_states_count = 0;
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;
p_states_count++;
}
}
break;
}
default:
verbose ("Unsupported CPU: P-States not generated !!!\n");
break;
{
DBG("DSDT: Old @%x,%x, ",fadt_mod->DSDT,fadt_mod->X_DSDT);
// Insert old dsdt into the IORegistery
Node* node = DT__FindNode("/dsdt", false);
if(node == NULL)
sprintf(dirSpec, "DSDT.%s.aml", gSMBIOSBoardModel);
new_dsdt = loadACPITable(dirSpec);
}
// Mozodojo: going to patch FACP and load SSDT's even if DSDT.aml is not present
/*if (!new_dsdt)
{
branches/meklort/i386/modules/ACPIPatcher/aml_generator.h
1111
1212
1313
14
1415
16
1517
1618
1719
#define __LIBSAIO_AML_GENERATOR_H
#include "libsaio.h"
#include "ACPIPatcher.h"
#defineAML_CHUNK_NONE0xff
#defineAML_CHUNK_ZERO0x00
#defineAML_CHUNK_ONE0x01
branches/meklort/i386/modules/ACPIPatcher/acpi_patcher.h
77
88
99
10
1011
1112
1213
#include "libsaio.h"
#include "efi.h"
#include "ACPIPatcher.h"
#define ACPI_2_02
#define ACPI_1_01
branches/meklort/i386/modules/ACPIPatcher/ACPIPatcher.h
1
2
3
#define kEnableC2States"EnableC2State"/* acpi_patcher.c */
#define kEnableC3States"EnableC3State"/* acpi_patcher.c */
#define kEnableC4States"EnableC4State"/* acpi_patcher.c */
branches/meklort/i386/modules/MakeInc.dir
1616
1717
1818
19
19
2020
2121
2222
HAVE_MODULES := $(wildcard $(SYMROOT)/*.dylib)
ifneq ($(strip $(HAVE_MODULES)),)
dylib: ${MODULE_OBJS}
@echo "\tLD $(MODULE_NAME).dylib"
@echo "\t[LD] $(MODULE_NAME).dylib"
@ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \

Archive Download the corresponding diff file

Revision: 656