aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/fbmem.c62
-rw-r--r--include/asm-alpha/fb.h7
-rw-r--r--include/asm-arm/fb.h13
-rw-r--r--include/asm-arm26/fb.h6
-rw-r--r--include/asm-avr32/fb.h15
-rw-r--r--include/asm-blackfin/fb.h6
-rw-r--r--include/asm-cris/fb.h6
-rw-r--r--include/asm-frv/fb.h6
-rw-r--r--include/asm-h8300/fb.h6
-rw-r--r--include/asm-i386/fb.h14
-rw-r--r--include/asm-ia64/fb.h17
-rw-r--r--include/asm-m32r/fb.h13
-rw-r--r--include/asm-m68k/fb.h28
-rw-r--r--include/asm-m68knommu/fb.h6
-rw-r--r--include/asm-mips/fb.h13
-rw-r--r--include/asm-parisc/fb.h13
-rw-r--r--include/asm-powerpc/fb.h15
-rw-r--r--include/asm-s390/fb.h6
-rw-r--r--include/asm-sh/fb.h13
-rw-r--r--include/asm-sh64/fb.h13
-rw-r--r--include/asm-sparc/fb.h6
-rw-r--r--include/asm-sparc64/fb.h12
-rw-r--r--include/asm-v850/fb.h6
-rw-r--r--include/asm-x86_64/fb.h14
-rw-r--r--include/asm-xtensa/fb.h6
25 files changed, 264 insertions, 58 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 38c2e2558f5e..8d6dbe8b8dd1 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -33,17 +33,10 @@
33#include <linux/err.h> 33#include <linux/err.h>
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/efi.h> 35#include <linux/efi.h>
36#include <linux/fb.h>
36 37
37#if defined(__mc68000__) || defined(CONFIG_APUS) 38#include <asm/fb.h>
38#include <asm/setup.h>
39#endif
40
41#include <asm/io.h>
42#include <asm/uaccess.h>
43#include <asm/page.h>
44#include <asm/pgtable.h>
45 39
46#include <linux/fb.h>
47 40
48 /* 41 /*
49 * Frame buffer device initialization and setup routines 42 * Frame buffer device initialization and setup routines
@@ -1155,17 +1148,15 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1155} 1148}
1156#endif 1149#endif
1157 1150
1158static int 1151static int
1159fb_mmap(struct file *file, struct vm_area_struct * vma) 1152fb_mmap(struct file *file, struct vm_area_struct * vma)
1160{ 1153{
1161 int fbidx = iminor(file->f_path.dentry->d_inode); 1154 int fbidx = iminor(file->f_path.dentry->d_inode);
1162 struct fb_info *info = registered_fb[fbidx]; 1155 struct fb_info *info = registered_fb[fbidx];
1163 struct fb_ops *fb = info->fbops; 1156 struct fb_ops *fb = info->fbops;
1164 unsigned long off; 1157 unsigned long off;
1165#if !defined(__sparc__) || defined(__sparc_v9__)
1166 unsigned long start; 1158 unsigned long start;
1167 u32 len; 1159 u32 len;
1168#endif
1169 1160
1170 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) 1161 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
1171 return -EINVAL; 1162 return -EINVAL;
@@ -1180,12 +1171,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
1180 return res; 1171 return res;
1181 } 1172 }
1182 1173
1183#if defined(__sparc__) && !defined(__sparc_v9__)
1184 /* Should never get here, all fb drivers should have their own
1185 mmap routines */
1186 return -EINVAL;
1187#else
1188 /* !sparc32... */
1189 lock_kernel(); 1174 lock_kernel();
1190 1175
1191 /* frame buffer memory */ 1176 /* frame buffer memory */
@@ -1209,50 +1194,11 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
1209 vma->vm_pgoff = off >> PAGE_SHIFT; 1194 vma->vm_pgoff = off >> PAGE_SHIFT;
1210 /* This is an IO map - tell maydump to skip this VMA */ 1195 /* This is an IO map - tell maydump to skip this VMA */
1211 vma->vm_flags |= VM_IO | VM_RESERVED; 1196 vma->vm_flags |= VM_IO | VM_RESERVED;
1212#if defined(__mc68000__) 1197 fb_pgprotect(file, vma, off);
1213#if defined(CONFIG_SUN3)
1214 pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
1215#elif defined(CONFIG_MMU)
1216 if (CPU_IS_020_OR_030)
1217 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
1218 if (CPU_IS_040_OR_060) {
1219 pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
1220 /* Use no-cache mode, serialized */
1221 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
1222 }
1223#endif
1224#elif defined(__powerpc__)
1225 vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
1226 vma->vm_end - vma->vm_start,
1227 vma->vm_page_prot);
1228#elif defined(__alpha__)
1229 /* Caching is off in the I/O space quadrant by design. */
1230#elif defined(__i386__) || defined(__x86_64__)
1231 if (boot_cpu_data.x86 > 3)
1232 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
1233#elif defined(__mips__) || defined(__sparc_v9__)
1234 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1235#elif defined(__hppa__)
1236 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
1237#elif defined(__arm__) || defined(__sh__) || defined(__m32r__)
1238 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
1239#elif defined(__avr32__)
1240 vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
1241 & ~_PAGE_CACHABLE)
1242 | (_PAGE_BUFFER | _PAGE_DIRTY));
1243#elif defined(__ia64__)
1244 if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
1245 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
1246 else
1247 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1248#else
1249#warning What do we have to do here??
1250#endif
1251 if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, 1198 if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
1252 vma->vm_end - vma->vm_start, vma->vm_page_prot)) 1199 vma->vm_end - vma->vm_start, vma->vm_page_prot))
1253 return -EAGAIN; 1200 return -EAGAIN;
1254 return 0; 1201 return 0;
1255#endif /* !sparc32 */
1256} 1202}
1257 1203
1258static int 1204static int
diff --git a/include/asm-alpha/fb.h b/include/asm-alpha/fb.h
new file mode 100644
index 000000000000..ca714a4e3557
--- /dev/null
+++ b/include/asm-alpha/fb.h
@@ -0,0 +1,7 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4/* Caching is off in the I/O space quadrant by design. */
5#define fb_pgprotect(...) do {} while (0)
6
7#endif /* _ASM_FB_H_ */
diff --git a/include/asm-arm/fb.h b/include/asm-arm/fb.h
new file mode 100644
index 000000000000..4bf5b88d90bf
--- /dev/null
+++ b/include/asm-arm/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-arm26/fb.h b/include/asm-arm26/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-arm26/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-avr32/fb.h b/include/asm-avr32/fb.h
new file mode 100644
index 000000000000..d22a4a876694
--- /dev/null
+++ b/include/asm-avr32/fb.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
11 & ~_PAGE_CACHABLE)
12 | (_PAGE_BUFFER | _PAGE_DIRTY));
13}
14
15#endif /* _ASM_FB_H_ */
diff --git a/include/asm-blackfin/fb.h b/include/asm-blackfin/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-blackfin/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-cris/fb.h b/include/asm-cris/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-cris/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-frv/fb.h b/include/asm-frv/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-frv/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-h8300/fb.h b/include/asm-h8300/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-h8300/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-i386/fb.h b/include/asm-i386/fb.h
new file mode 100644
index 000000000000..d30073c75586
--- /dev/null
+++ b/include/asm-i386/fb.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 if (boot_cpu_data.x86 > 3)
11 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
12}
13
14#endif /* _ASM_FB_H_ */
diff --git a/include/asm-ia64/fb.h b/include/asm-ia64/fb.h
new file mode 100644
index 000000000000..9d4577f9fe0e
--- /dev/null
+++ b/include/asm-ia64/fb.h
@@ -0,0 +1,17 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <linux/efi.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
12 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
13 else
14 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
15}
16
17#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m32r/fb.h b/include/asm-m32r/fb.h
new file mode 100644
index 000000000000..4bf5b88d90bf
--- /dev/null
+++ b/include/asm-m32r/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m68k/fb.h b/include/asm-m68k/fb.h
new file mode 100644
index 000000000000..f78bad476b08
--- /dev/null
+++ b/include/asm-m68k/fb.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6#include <asm/setup.h>
7
8#ifdef CONFIG_SUN3
9static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
10 unsigned long off)
11{
12 pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
13}
14#else
15static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
16 unsigned long off)
17{
18 if (CPU_IS_020_OR_030)
19 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
20 if (CPU_IS_040_OR_060) {
21 pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
22 /* Use no-cache mode, serialized */
23 pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
24 }
25}
26#endif /* CONFIG_SUN3 */
27
28#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m68knommu/fb.h b/include/asm-m68knommu/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-m68knommu/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-mips/fb.h b/include/asm-mips/fb.h
new file mode 100644
index 000000000000..ac23d96e261a
--- /dev/null
+++ b/include/asm-mips/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-parisc/fb.h b/include/asm-parisc/fb.h
new file mode 100644
index 000000000000..d5e47edf5321
--- /dev/null
+++ b/include/asm-parisc/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-powerpc/fb.h b/include/asm-powerpc/fb.h
new file mode 100644
index 000000000000..e13d6ebc116d
--- /dev/null
+++ b/include/asm-powerpc/fb.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
11 vma->vm_end - vma->vm_start,
12 vma->vm_page_prot);
13}
14
15#endif /* _ASM_FB_H_ */
diff --git a/include/asm-s390/fb.h b/include/asm-s390/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-s390/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sh/fb.h b/include/asm-sh/fb.h
new file mode 100644
index 000000000000..4bf5b88d90bf
--- /dev/null
+++ b/include/asm-sh/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sh64/fb.h b/include/asm-sh64/fb.h
new file mode 100644
index 000000000000..4bf5b88d90bf
--- /dev/null
+++ b/include/asm-sh64/fb.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
11}
12
13#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sparc/fb.h b/include/asm-sparc/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-sparc/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h
new file mode 100644
index 000000000000..8703c707e142
--- /dev/null
+++ b/include/asm-sparc64/fb.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fs.h>
4#include <asm/page.h>
5
6static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
7 unsigned long off)
8{
9 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-v850/fb.h b/include/asm-v850/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-v850/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */
diff --git a/include/asm-x86_64/fb.h b/include/asm-x86_64/fb.h
new file mode 100644
index 000000000000..d30073c75586
--- /dev/null
+++ b/include/asm-x86_64/fb.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fs.h>
5#include <asm/page.h>
6
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off)
9{
10 if (boot_cpu_data.x86 > 3)
11 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
12}
13
14#endif /* _ASM_FB_H_ */
diff --git a/include/asm-xtensa/fb.h b/include/asm-xtensa/fb.h
new file mode 100644
index 000000000000..9f8c88d05df4
--- /dev/null
+++ b/include/asm-xtensa/fb.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#define fb_pgprotect(...) do {} while (0)
5
6#endif /* _ASM_FB_H_ */