aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pat.c
diff options
context:
space:
mode:
authorAndreas Herrmann <andreas.herrmann3@amd.com>2008-06-20 16:03:06 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-24 07:05:50 -0400
commit69e26be9b1d0c83d3581475095ce2a1ccc578215 (patch)
tree986c70f4e9f73b924d30a83d517184d61661f5a1 /arch/x86/mm/pat.c
parentac97991ec9e0a05c8860f4a04f8477227b1c03f2 (diff)
x86: pat.c more trivial changes
- add BUG statement to catch invalid start and end parameters - No need to track the actual type in both req_type and actual_type -- keep req_type unchanged. - removed (IMHO) superfluous comments Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Cc: Suresh B Siddha <suresh.b.siddha@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/pat.c')
-rw-r--r--arch/x86/mm/pat.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index a6507bfb12a7..c996a3641200 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -200,7 +200,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
200 unsigned long actual_type; 200 unsigned long actual_type;
201 int err = 0; 201 int err = 0;
202 202
203 /* Only track when pat_enabled */ 203 BUG_ON(start >= end); /* end is exclusive */
204
204 if (!pat_enabled) { 205 if (!pat_enabled) {
205 /* This is identical to page table setting without PAT */ 206 /* This is identical to page table setting without PAT */
206 if (new_type) { 207 if (new_type) {
@@ -228,17 +229,13 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
228 */ 229 */
229 u8 mtrr_type = mtrr_type_lookup(start, end); 230 u8 mtrr_type = mtrr_type_lookup(start, end);
230 231
231 if (mtrr_type == MTRR_TYPE_WRBACK) { 232 if (mtrr_type == MTRR_TYPE_WRBACK)
232 req_type = _PAGE_CACHE_WB;
233 actual_type = _PAGE_CACHE_WB; 233 actual_type = _PAGE_CACHE_WB;
234 } else { 234 else
235 req_type = _PAGE_CACHE_UC_MINUS;
236 actual_type = _PAGE_CACHE_UC_MINUS; 235 actual_type = _PAGE_CACHE_UC_MINUS;
237 } 236 } else
238 } else { 237 actual_type = pat_x_mtrr_type(start, end,
239 req_type &= _PAGE_CACHE_MASK; 238 req_type & _PAGE_CACHE_MASK);
240 actual_type = pat_x_mtrr_type(start, end, req_type);
241 }
242 239
243 new = kmalloc(sizeof(struct memtype), GFP_KERNEL); 240 new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
244 if (!new) 241 if (!new)
@@ -406,10 +403,8 @@ int free_memtype(u64 start, u64 end)
406 struct memtype *entry; 403 struct memtype *entry;
407 int err = -EINVAL; 404 int err = -EINVAL;
408 405
409 /* Only track when pat_enabled */ 406 if (!pat_enabled)
410 if (!pat_enabled) {
411 return 0; 407 return 0;
412 }
413 408
414 /* Low ISA region is always mapped WB. No need to track */ 409 /* Low ISA region is always mapped WB. No need to track */
415 if (is_ISA_range(start, end - 1)) 410 if (is_ISA_range(start, end - 1))