aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-07-05 03:44:11 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-05 03:46:10 -0400
commite3d0e69268dffb9676bf0800a60fb3573a723480 (patch)
tree5ed5b5cdcc55e15ecee40bd7ec94dac4505edf8f /arch/x86/kernel/cpu
parentdbd51be026eaf84088fdee7fab9f38fa92eef26d (diff)
x86: Further clean up of mtrr/generic.c
Yinghai noticed that i defined BIOS_BUG_MSG but added no usage for it. The usage is to clean up this turd in generic.c: printk(KERN_WARNING "WARNING: BIOS bug: VAR MTRR %d " "contains strange UC entry under 1M, check " "with your system vendor!\n", i); Breaking printk lines in the middle looks ugly, is hard to read and breaks 'git grep'. Use the BIOS_BUG_MSG instead. Also complete the moving of structure definitions and variables to the top of the file. Reported-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <20090703164225.GA21447@elte.hu> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/mtrr/cleanup.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index b8aba811b60e..315738c74aad 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -34,14 +34,37 @@
34 34
35#include "mtrr.h" 35#include "mtrr.h"
36 36
37/* Should be related to MTRR_VAR_RANGES nums */
38#define RANGE_NUM 256
39
40struct res_range { 37struct res_range {
41 unsigned long start; 38 unsigned long start;
42 unsigned long end; 39 unsigned long end;
43}; 40};
44 41
42struct var_mtrr_range_state {
43 unsigned long base_pfn;
44 unsigned long size_pfn;
45 mtrr_type type;
46};
47
48struct var_mtrr_state {
49 unsigned long range_startk;
50 unsigned long range_sizek;
51 unsigned long chunk_sizek;
52 unsigned long gran_sizek;
53 unsigned int reg;
54};
55
56/* Should be related to MTRR_VAR_RANGES nums */
57#define RANGE_NUM 256
58
59static struct res_range __initdata range[RANGE_NUM];
60static int __initdata nr_range;
61
62static struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
63
64static int __initdata debug_print;
65#define Dprintk(x...) do { if (debug_print) printk(KERN_DEBUG x); } while (0)
66
67
45static int __init 68static int __init
46add_range(struct res_range *range, int nr_range, 69add_range(struct res_range *range, int nr_range,
47 unsigned long start, unsigned long end) 70 unsigned long start, unsigned long end)
@@ -147,18 +170,6 @@ static int __init cmp_range(const void *x1, const void *x2)
147 return start1 - start2; 170 return start1 - start2;
148} 171}
149 172
150struct var_mtrr_range_state {
151 unsigned long base_pfn;
152 unsigned long size_pfn;
153 mtrr_type type;
154};
155
156static struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
157
158static int __initdata debug_print;
159#define Dprintk(x...) do { if (debug_print) printk(KERN_DEBUG x); } while (0)
160
161
162#define BIOS_BUG_MSG KERN_WARNING \ 173#define BIOS_BUG_MSG KERN_WARNING \
163 "WARNING: BIOS bug: VAR MTRR %d contains strange UC entry under 1M, check with your system vendor!\n" 174 "WARNING: BIOS bug: VAR MTRR %d contains strange UC entry under 1M, check with your system vendor!\n"
164 175
@@ -200,9 +211,7 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
200 if (base < (1<<(20-PAGE_SHIFT)) && mtrr_state.have_fixed && 211 if (base < (1<<(20-PAGE_SHIFT)) && mtrr_state.have_fixed &&
201 (mtrr_state.enabled & 1)) { 212 (mtrr_state.enabled & 1)) {
202 /* Var MTRR contains UC entry below 1M? Skip it: */ 213 /* Var MTRR contains UC entry below 1M? Skip it: */
203 printk(KERN_WARNING "WARNING: BIOS bug: VAR MTRR %d " 214 printk(BIOS_BUG_MSG, i);
204 "contains strange UC entry under 1M, check "
205 "with your system vendor!\n", i);
206 if (base + size <= (1<<(20-PAGE_SHIFT))) 215 if (base + size <= (1<<(20-PAGE_SHIFT)))
207 continue; 216 continue;
208 size -= (1<<(20-PAGE_SHIFT)) - base; 217 size -= (1<<(20-PAGE_SHIFT)) - base;
@@ -244,9 +253,6 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
244 return nr_range; 253 return nr_range;
245} 254}
246 255
247static struct res_range __initdata range[RANGE_NUM];
248static int __initdata nr_range;
249
250#ifdef CONFIG_MTRR_SANITIZER 256#ifdef CONFIG_MTRR_SANITIZER
251 257
252static unsigned long __init sum_ranges(struct res_range *range, int nr_range) 258static unsigned long __init sum_ranges(struct res_range *range, int nr_range)
@@ -284,14 +290,6 @@ static int __init mtrr_cleanup_debug_setup(char *str)
284} 290}
285early_param("mtrr_cleanup_debug", mtrr_cleanup_debug_setup); 291early_param("mtrr_cleanup_debug", mtrr_cleanup_debug_setup);
286 292
287struct var_mtrr_state {
288 unsigned long range_startk;
289 unsigned long range_sizek;
290 unsigned long chunk_sizek;
291 unsigned long gran_sizek;
292 unsigned int reg;
293};
294
295static void __init 293static void __init
296set_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek, 294set_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
297 unsigned char type, unsigned int address_bits) 295 unsigned char type, unsigned int address_bits)