diff options
Diffstat (limited to 'meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.32-acpi-cstate-fixup.patch')
-rw-r--r-- | meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.32-acpi-cstate-fixup.patch | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.32-acpi-cstate-fixup.patch b/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.32-acpi-cstate-fixup.patch deleted file mode 100644 index 6a1204d4c1..0000000000 --- a/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.32-acpi-cstate-fixup.patch +++ /dev/null | |||
@@ -1,173 +0,0 @@ | |||
1 | From edeae90d635501a632efa0c7fe0667aa2cbe29be Mon Sep 17 00:00:00 2001 | ||
2 | From: Arjan van de Ven <arjan@linux.intel.com> | ||
3 | Date: Mon, 28 Sep 2009 15:14:04 +0200 | ||
4 | Subject: [PATCH] acpi: Provide a set of tables to check the BIOS tables for correctness | ||
5 | |||
6 | Today, the BIOS provides us with latency information for each C state. | ||
7 | Unfortunately this information is sometimes put into the BIOS by | ||
8 | apprentice BIOS programmers in a hurry, and as a result, it occasionally | ||
9 | contains utter garbage. | ||
10 | |||
11 | This patch adds a table based verification; if the CPU is known in the table, | ||
12 | the values the BIOS provides to us are corrected for the apprentice-factor | ||
13 | so that the CPUIDLE code can rely on the latency and break-even values | ||
14 | to be reasonably sane. | ||
15 | |||
16 | Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> | ||
17 | --- | ||
18 | drivers/acpi/Makefile | 2 +- | ||
19 | drivers/acpi/processor_idle.c | 3 + | ||
20 | drivers/acpi/processor_mwait_table.c | 110 ++++++++++++++++++++++++++++++++++ | ||
21 | include/acpi/processor.h | 3 + | ||
22 | 4 files changed, 117 insertions(+), 1 deletions(-) | ||
23 | create mode 100644 drivers/acpi/processor_mwait_table.c | ||
24 | |||
25 | diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile | ||
26 | index 82cd49d..ab56b28 100644 | ||
27 | --- a/drivers/acpi/Makefile | ||
28 | +++ b/drivers/acpi/Makefile | ||
29 | @@ -60,5 +60,5 @@ obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o | ||
30 | |||
31 | # processor has its own "processor." module_param namespace | ||
32 | processor-y := processor_core.o processor_throttling.o | ||
33 | -processor-y += processor_idle.o processor_thermal.o | ||
34 | +processor-y += processor_idle.o processor_thermal.o processor_mwait_table.o | ||
35 | processor-$(CONFIG_CPU_FREQ) += processor_perflib.o | ||
36 | diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c | ||
37 | index cc61a62..db444a0 100644 | ||
38 | --- a/drivers/acpi/processor_idle.c | ||
39 | +++ b/drivers/acpi/processor_idle.c | ||
40 | @@ -1088,6 +1088,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | ||
41 | state->target_residency = cx->latency * latency_factor; | ||
42 | state->power_usage = cx->power; | ||
43 | |||
44 | + if (cx->entry_method == ACPI_CSTATE_FFH) | ||
45 | + acpi_verify_mwait_data(state, cx); | ||
46 | + | ||
47 | state->flags = 0; | ||
48 | switch (cx->type) { | ||
49 | case ACPI_STATE_C1: | ||
50 | diff --git a/drivers/acpi/processor_mwait_table.c b/drivers/acpi/processor_mwait_table.c | ||
51 | new file mode 100644 | ||
52 | index 0000000..f29c28c | ||
53 | --- /dev/null | ||
54 | +++ b/drivers/acpi/processor_mwait_table.c | ||
55 | @@ -0,0 +1,102 @@ | ||
56 | +/* | ||
57 | + * processor_mwait_table.c: BIOS table verification/correction | ||
58 | + * | ||
59 | + * (C) Copyright 2009 Intel Corporation | ||
60 | + * Authors: | ||
61 | + * Arjan van de Ven <arjan@linux.intel.com> | ||
62 | + * | ||
63 | + * This program is free software; you can redistribute it and/or | ||
64 | + * modify it under the terms of the GNU General Public License | ||
65 | + * as published by the Free Software Foundation; version 2 | ||
66 | + * of the License. | ||
67 | + */ | ||
68 | + | ||
69 | +#include <asm/processor.h> | ||
70 | +#include <linux/acpi.h> | ||
71 | +#include <acpi/processor.h> | ||
72 | +#include <linux/cpuidle.h> | ||
73 | + | ||
74 | + | ||
75 | +#define ATLEAST 1 | ||
76 | +#define ATMOST 2 | ||
77 | +#define EXACTLY 3 | ||
78 | + | ||
79 | +#define MAX_ENTRIES 12 | ||
80 | + | ||
81 | +struct mwait_entry { | ||
82 | + unsigned int mwait_value; | ||
83 | + unsigned long exit_latency; | ||
84 | + unsigned long break_even_point; | ||
85 | + int compare_method; | ||
86 | +}; | ||
87 | + | ||
88 | +struct cpu_entry { | ||
89 | + int vendor; | ||
90 | + int family; | ||
91 | + int model; | ||
92 | + | ||
93 | + struct mwait_entry entries[MAX_ENTRIES]; | ||
94 | +}; | ||
95 | + | ||
96 | +static struct cpu_entry mwait_entries[] = | ||
97 | +{ | ||
98 | + /* Intel "Atom" CPUs */ | ||
99 | + {.vendor = X86_VENDOR_INTEL, .family = 6, . model = 28, | ||
100 | + .entries = { | ||
101 | + {0x00, 1, 1, ATLEAST}, | ||
102 | + {0x10, 2, 20, ATLEAST}, | ||
103 | + {0x30, 57, 300, ATLEAST}, | ||
104 | + {0x50, 64, 4000, ATLEAST}, | ||
105 | + } | ||
106 | + }, | ||
107 | + | ||
108 | + | ||
109 | +}; | ||
110 | + | ||
111 | + | ||
112 | +static unsigned long | ||
113 | +compare_and_set(unsigned long original, unsigned long new, int compare) | ||
114 | +{ | ||
115 | + if (compare == EXACTLY) | ||
116 | + return new; | ||
117 | + if (compare == ATLEAST && new > original) | ||
118 | + return new; | ||
119 | + if (compare == ATMOST && new < original) | ||
120 | + return new; | ||
121 | + return original; | ||
122 | +} | ||
123 | + | ||
124 | + | ||
125 | +void acpi_verify_mwait_data(struct cpuidle_state *state, | ||
126 | + struct acpi_processor_cx *cx) | ||
127 | +{ | ||
128 | +#if defined(__i386__) || defined(__x86_64__) | ||
129 | + int i; | ||
130 | + | ||
131 | + struct cpuinfo_x86 *cpudata = &boot_cpu_data; | ||
132 | + | ||
133 | + | ||
134 | + for (i = 0; i < ARRAY_SIZE(mwait_entries); i++) { | ||
135 | + int j; | ||
136 | + if (mwait_entries[i].vendor != cpudata->x86_vendor) | ||
137 | + continue; | ||
138 | + if (mwait_entries[i].family != cpudata->x86) | ||
139 | + continue; | ||
140 | + if (mwait_entries[i].model != cpudata->x86_model) | ||
141 | + continue; | ||
142 | + for (j = 0; j < ARRAY_SIZE(mwait_entries[i].entries); j++) { | ||
143 | + if (!mwait_entries[i].entries[j].compare_method) | ||
144 | + continue; | ||
145 | + if (mwait_entries[i].entries[j].mwait_value != cx->address) | ||
146 | + continue; | ||
147 | + state->exit_latency = compare_and_set(state->exit_latency, | ||
148 | + mwait_entries[i].entries[j].exit_latency, | ||
149 | + mwait_entries[i].entries[j].compare_method); | ||
150 | + state->target_residency = compare_and_set(state->target_residency, | ||
151 | + mwait_entries[i].entries[j].break_even_point, | ||
152 | + mwait_entries[i].entries[j].compare_method); | ||
153 | + break; | ||
154 | + } | ||
155 | + } | ||
156 | +#endif | ||
157 | +} | ||
158 | diff --git a/include/acpi/processor.h b/include/acpi/processor.h | ||
159 | index 740ac3a..175e4d1 100644 | ||
160 | --- a/include/acpi/processor.h | ||
161 | +++ b/include/acpi/processor.h | ||
162 | @@ -352,5 +352,8 @@ static inline void acpi_thermal_cpufreq_exit(void) | ||
163 | return; | ||
164 | } | ||
165 | #endif | ||
166 | +extern void acpi_verify_mwait_data(struct cpuidle_state *state, | ||
167 | + struct acpi_processor_cx *cx); | ||
168 | + | ||
169 | |||
170 | #endif | ||
171 | -- | ||
172 | 1.6.2.5 | ||
173 | |||