aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/iomap_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm/iomap_32.c')
-rw-r--r--arch/x86/mm/iomap_32.c55
1 files changed, 4 insertions, 51 deletions
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index d5e28424622c..04102d42ff42 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -20,63 +20,16 @@
20#include <asm/pat.h> 20#include <asm/pat.h>
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23#ifdef CONFIG_X86_PAE 23int is_io_mapping_possible(resource_size_t base, unsigned long size)
24static int
25is_io_mapping_possible(resource_size_t base, unsigned long size)
26{
27 return 1;
28}
29#else
30static int
31is_io_mapping_possible(resource_size_t base, unsigned long size)
32{ 24{
25#ifndef CONFIG_X86_PAE
33 /* There is no way to map greater than 1 << 32 address without PAE */ 26 /* There is no way to map greater than 1 << 32 address without PAE */
34 if (base + size > 0x100000000ULL) 27 if (base + size > 0x100000000ULL)
35 return 0; 28 return 0;
36
37 return 1;
38}
39#endif 29#endif
40 30 return 1;
41int
42reserve_io_memtype_wc(u64 base, unsigned long size, pgprot_t *prot)
43{
44 unsigned long ret_flag;
45
46 if (!is_io_mapping_possible(base, size))
47 goto out_err;
48
49 if (!pat_enabled) {
50 *prot = pgprot_noncached(PAGE_KERNEL);
51 return 0;
52 }
53
54 if (reserve_memtype(base, base + size, _PAGE_CACHE_WC, &ret_flag))
55 goto out_err;
56
57 if (ret_flag == _PAGE_CACHE_WB)
58 goto out_free;
59
60 if (kernel_map_sync_memtype(base, size, ret_flag))
61 goto out_free;
62
63 *prot = __pgprot(__PAGE_KERNEL | ret_flag);
64 return 0;
65
66out_free:
67 free_memtype(base, base + size);
68out_err:
69 return -EINVAL;
70}
71EXPORT_SYMBOL_GPL(reserve_io_memtype_wc);
72
73void
74free_io_memtype(u64 base, unsigned long size)
75{
76 if (pat_enabled)
77 free_memtype(base, base + size);
78} 31}
79EXPORT_SYMBOL_GPL(free_io_memtype); 32EXPORT_SYMBOL_GPL(is_io_mapping_possible);
80 33
81/* Map 'pfn' using fixed map 'type' and protections 'prot' 34/* Map 'pfn' using fixed map 'type' and protections 'prot'
82 */ 35 */