diff options
-rw-r--r-- | arch/x86/kernel/cpu/addon_cpuid_features.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/pat.c | 29 | ||||
-rw-r--r-- | include/asm-x86/pat.h | 6 |
3 files changed, 16 insertions, 21 deletions
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 2df461f06a52..84a8220a6072 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -1,9 +1,7 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * Routines to indentify additional cpu features that are scattered in | 2 | * Routines to indentify additional cpu features that are scattered in |
4 | * cpuid space. | 3 | * cpuid space. |
5 | */ | 4 | */ |
6 | |||
7 | #include <linux/cpu.h> | 5 | #include <linux/cpu.h> |
8 | 6 | ||
9 | #include <asm/pat.h> | 7 | #include <asm/pat.h> |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 65105b1195a3..a8b69bb26972 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -66,7 +66,7 @@ enum { | |||
66 | PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */ | 66 | PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */ |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define PAT(x,y) ((u64)PAT_ ## y << ((x)*8)) | 69 | #define PAT(x, y) ((u64)PAT_ ## y << ((x)*8)) |
70 | 70 | ||
71 | void pat_init(void) | 71 | void pat_init(void) |
72 | { | 72 | { |
@@ -100,8 +100,8 @@ void pat_init(void) | |||
100 | * 011 UC _PAGE_CACHE_UC | 100 | * 011 UC _PAGE_CACHE_UC |
101 | * PAT bit unused | 101 | * PAT bit unused |
102 | */ | 102 | */ |
103 | pat = PAT(0,WB) | PAT(1,WC) | PAT(2,UC_MINUS) | PAT(3,UC) | | 103 | pat = PAT(0, WB) | PAT(1, WC) | PAT(2, UC_MINUS) | PAT(3, UC) | |
104 | PAT(4,WB) | PAT(5,WC) | PAT(6,UC_MINUS) | PAT(7,UC); | 104 | PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC); |
105 | 105 | ||
106 | /* Boot CPU check */ | 106 | /* Boot CPU check */ |
107 | if (!boot_pat_state) | 107 | if (!boot_pat_state) |
@@ -117,11 +117,11 @@ void pat_init(void) | |||
117 | static char *cattr_name(unsigned long flags) | 117 | static char *cattr_name(unsigned long flags) |
118 | { | 118 | { |
119 | switch (flags & _PAGE_CACHE_MASK) { | 119 | switch (flags & _PAGE_CACHE_MASK) { |
120 | case _PAGE_CACHE_UC: return "uncached"; | 120 | case _PAGE_CACHE_UC: return "uncached"; |
121 | case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; | 121 | case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; |
122 | case _PAGE_CACHE_WB: return "write-back"; | 122 | case _PAGE_CACHE_WB: return "write-back"; |
123 | case _PAGE_CACHE_WC: return "write-combining"; | 123 | case _PAGE_CACHE_WC: return "write-combining"; |
124 | default: return "broken"; | 124 | default: return "broken"; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
@@ -536,11 +536,11 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
536 | * we maintain the tradition of paranoia in this code. | 536 | * we maintain the tradition of paranoia in this code. |
537 | */ | 537 | */ |
538 | if (!pat_wc_enabled && | 538 | if (!pat_wc_enabled && |
539 | ! ( boot_cpu_has(X86_FEATURE_MTRR) || | 539 | !(boot_cpu_has(X86_FEATURE_MTRR) || |
540 | boot_cpu_has(X86_FEATURE_K6_MTRR) || | 540 | boot_cpu_has(X86_FEATURE_K6_MTRR) || |
541 | boot_cpu_has(X86_FEATURE_CYRIX_ARR) || | 541 | boot_cpu_has(X86_FEATURE_CYRIX_ARR) || |
542 | boot_cpu_has(X86_FEATURE_CENTAUR_MCR)) && | 542 | boot_cpu_has(X86_FEATURE_CENTAUR_MCR)) && |
543 | (pfn << PAGE_SHIFT) >= __pa(high_memory)) { | 543 | (pfn << PAGE_SHIFT) >= __pa(high_memory)) { |
544 | flags = _PAGE_CACHE_UC; | 544 | flags = _PAGE_CACHE_UC; |
545 | } | 545 | } |
546 | #endif | 546 | #endif |
@@ -562,7 +562,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
562 | return 0; | 562 | return 0; |
563 | 563 | ||
564 | if (pfn <= max_pfn_mapped && | 564 | if (pfn <= max_pfn_mapped && |
565 | ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) { | 565 | ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) { |
566 | free_memtype(offset, offset + size); | 566 | free_memtype(offset, offset + size); |
567 | printk(KERN_INFO | 567 | printk(KERN_INFO |
568 | "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", | 568 | "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", |
@@ -600,4 +600,3 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot) | |||
600 | 600 | ||
601 | free_memtype(addr, addr + size); | 601 | free_memtype(addr, addr + size); |
602 | } | 602 | } |
603 | |||
diff --git a/include/asm-x86/pat.h b/include/asm-x86/pat.h index 88f60cc6a227..6fa9710ae09a 100644 --- a/include/asm-x86/pat.h +++ b/include/asm-x86/pat.h | |||
@@ -1,6 +1,5 @@ | |||
1 | |||
2 | #ifndef _ASM_PAT_H | 1 | #ifndef _ASM_PAT_H |
3 | #define _ASM_PAT_H 1 | 2 | #define _ASM_PAT_H |
4 | 3 | ||
5 | #include <linux/types.h> | 4 | #include <linux/types.h> |
6 | 5 | ||
@@ -8,7 +7,7 @@ | |||
8 | extern int pat_wc_enabled; | 7 | extern int pat_wc_enabled; |
9 | extern void validate_pat_support(struct cpuinfo_x86 *c); | 8 | extern void validate_pat_support(struct cpuinfo_x86 *c); |
10 | #else | 9 | #else |
11 | static const int pat_wc_enabled = 0; | 10 | static const int pat_wc_enabled; |
12 | static inline void validate_pat_support(struct cpuinfo_x86 *c) { } | 11 | static inline void validate_pat_support(struct cpuinfo_x86 *c) { } |
13 | #endif | 12 | #endif |
14 | 13 | ||
@@ -21,4 +20,3 @@ extern int free_memtype(u64 start, u64 end); | |||
21 | extern void pat_disable(char *reason); | 20 | extern void pat_disable(char *reason); |
22 | 21 | ||
23 | #endif | 22 | #endif |
24 | |||