Chameleon

View 0001-fixed-sandy-bridge-max-multiplier-offset.patch

1From 5406342852b4cffafab1684df9e7745aff79eab3 Mon Sep 17 00:00:00 2001
2From: Michael Seydl <michael.seydl@hlw-software.com>
3Date: Wed, 25 Apr 2012 16:53:43 +0200
4Subject: [PATCH] - fixed sandy-bridge max multiplier offset
5
6---
7 i386/libsaio/acpi_patcher.c | 31 ++++++++++++++++++++++++++-----
8 1 file changed, 26 insertions(+), 5 deletions(-)
9
10diff --git a/i386/libsaio/acpi_patcher.c b/i386/libsaio/acpi_patcher.c
11index 3d0343d..8386b9d 100644
12--- a/i386/libsaio/acpi_patcher.c
13+++ b/i386/libsaio/acpi_patcher.c
14@@ -158,10 +158,14 @@ void get_acpi_cpu_names(unsigned char* dsdt, uint32_t length)
15 {
16 uint32_t i;
17
18+ DBG("start finding cpu names. length %d\n", length);
19+
20 for (i=0; i<length-7; i++)
21 {
22 if (dsdt[i] == 0x5B && dsdt[i+1] == 0x83) // ProcessorOP
23 {
24+ DBG("dsdt: %x%x\n", dsdt[i], dsdt[i+1]);
25+
26 uint32_t offset = i + 3 + (dsdt[i+2] >> 6);
27
28 bool add_name = true;
29@@ -195,6 +199,8 @@ void get_acpi_cpu_names(unsigned char* dsdt, uint32_t length)
30 }
31 }
32 }
33+
34+ DBG("end finding cpu names: cpu names found: %d\n", acpi_cpu_count);
35 }
36
37 struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt)
38@@ -385,7 +391,7 @@ struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt)
39
40 aml_destroy_node(root);
41
42-//dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length);
43+// dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length);
44
45 verbose ("SSDT with CPU C-States generated successfully\n");
46
47@@ -416,7 +422,7 @@ struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt)
48 }
49
50 if (!(Platform.CPU.Features & CPU_FEATURE_MSR)) {
51-verbose ("Unsupported CPU: P-States will not be generated !!!\n");
52+verbose ("Unsupported CPU: P-States will not be generated !!! No MSR support\n");
53 return NULL;
54 }
55
56@@ -567,8 +573,14 @@ struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt)
57 case CPU_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
58 case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
59 {
60-maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)...
61-minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
62+if ((Platform.CPU.Model == CPU_MODEL_SANDYBRIDGE) ||
63+ (Platform.CPU.Model == CPU_MODEL_JAKETOWN))
64+ {
65+ maximum.Control = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0xff;
66+ } else {
67+ maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff;
68+ }
69+ minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
70
71 verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
72
73@@ -595,7 +607,7 @@ struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt)
74 break;
75 }
76 default:
77-verbose ("Unsupported CPU: P-States not generated !!!\n");
78+verbose ("Unsupported CPU: P-States not generated !!! Unknown CPU Type\n");
79 break;
80 }
81 }
82@@ -778,10 +790,14 @@ int setupAcpi(void)
83 int version;
84 void *new_dsdt;
85
86+
87 const char *filename;
88 char dirSpec[128];
89 int len = 0;
90
91+ // always reset cpu count to 0 when injecting new acpi
92+ acpi_cpu_count = 0;
93+
94 // Try using the file specified with the DSDT option
95 if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig))
96 {
97@@ -811,6 +827,9 @@ int setupAcpi(void)
98 getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig);
99 getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig);
100
101+ DBG("generating p-states config: %d\n", generate_pstates);
102+ DBG("generating c-states config: %d\n", generate_cstates);
103+
104 {
105 int i;
106
107@@ -918,6 +937,7 @@ int setupAcpi(void)
108 // Generate _CST SSDT
109 if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod)))
110 {
111+ DBG("c-states generated\n");
112 generate_cstates = false; // Generate SSDT only once!
113 ssdt_count++;
114 }
115@@ -925,6 +945,7 @@ int setupAcpi(void)
116 // Generating _PSS SSDT
117 if (generate_pstates && (new_ssdt[ssdt_count] = generate_pss_ssdt((void*)fadt_mod->DSDT)))
118 {
119+ DBG("p-states generated\n");
120 generate_pstates = false; // Generate SSDT only once!
121 ssdt_count++;
122 }
123--
1241.7.9.4
125
126

Archive Download this file

Attachment to issue 247

Created: 12 years 10 hours ago by Moik The