提交 10eb2659 编写于 作者: A Antonino A. Daplas 提交者: Linus Torvalds

fbdev: move arch-specific bits to their respective subdirectories

Move arch-specific bits of fb_mmap() to their respective subdirectories

[bob.picco@hp.com: efi_range_is_wc is referenced but not declared]
[bunk@stusta.de: fix include/asm-m68k/fb.h]
Signed-off-by: NAntonino Daplas <adaplas@gmail.com>
Acked-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NAdrian Bunk <bunk@stusta.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0c6c1ce0
...@@ -33,17 +33,10 @@ ...@@ -33,17 +33,10 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/fb.h>
#if defined(__mc68000__) || defined(CONFIG_APUS) #include <asm/fb.h>
#include <asm/setup.h>
#endif
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <linux/fb.h>
/* /*
* Frame buffer device initialization and setup routines * Frame buffer device initialization and setup routines
...@@ -1155,17 +1148,15 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1155,17 +1148,15 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
#endif #endif
static int static int
fb_mmap(struct file *file, struct vm_area_struct * vma) fb_mmap(struct file *file, struct vm_area_struct * vma)
{ {
int fbidx = iminor(file->f_path.dentry->d_inode); int fbidx = iminor(file->f_path.dentry->d_inode);
struct fb_info *info = registered_fb[fbidx]; struct fb_info *info = registered_fb[fbidx];
struct fb_ops *fb = info->fbops; struct fb_ops *fb = info->fbops;
unsigned long off; unsigned long off;
#if !defined(__sparc__) || defined(__sparc_v9__)
unsigned long start; unsigned long start;
u32 len; u32 len;
#endif
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
return -EINVAL; return -EINVAL;
...@@ -1180,12 +1171,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) ...@@ -1180,12 +1171,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
return res; return res;
} }
#if defined(__sparc__) && !defined(__sparc_v9__)
/* Should never get here, all fb drivers should have their own
mmap routines */
return -EINVAL;
#else
/* !sparc32... */
lock_kernel(); lock_kernel();
/* frame buffer memory */ /* frame buffer memory */
...@@ -1209,50 +1194,11 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) ...@@ -1209,50 +1194,11 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
vma->vm_pgoff = off >> PAGE_SHIFT; vma->vm_pgoff = off >> PAGE_SHIFT;
/* This is an IO map - tell maydump to skip this VMA */ /* This is an IO map - tell maydump to skip this VMA */
vma->vm_flags |= VM_IO | VM_RESERVED; vma->vm_flags |= VM_IO | VM_RESERVED;
#if defined(__mc68000__) fb_pgprotect(file, vma, off);
#if defined(CONFIG_SUN3)
pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
#elif defined(CONFIG_MMU)
if (CPU_IS_020_OR_030)
pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
if (CPU_IS_040_OR_060) {
pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
/* Use no-cache mode, serialized */
pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
}
#endif
#elif defined(__powerpc__)
vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
#elif defined(__alpha__)
/* Caching is off in the I/O space quadrant by design. */
#elif defined(__i386__) || defined(__x86_64__)
if (boot_cpu_data.x86 > 3)
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
#elif defined(__mips__) || defined(__sparc_v9__)
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#elif defined(__hppa__)
pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
#elif defined(__arm__) || defined(__sh__) || defined(__m32r__)
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
#elif defined(__avr32__)
vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
& ~_PAGE_CACHABLE)
| (_PAGE_BUFFER | _PAGE_DIRTY));
#elif defined(__ia64__)
if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
else
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#else
#warning What do we have to do here??
#endif
if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
vma->vm_end - vma->vm_start, vma->vm_page_prot)) vma->vm_end - vma->vm_start, vma->vm_page_prot))
return -EAGAIN; return -EAGAIN;
return 0; return 0;
#endif /* !sparc32 */
} }
static int static int
......
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
/* Caching is off in the I/O space quadrant by design. */
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot)
& ~_PAGE_CACHABLE)
| (_PAGE_BUFFER | _PAGE_DIRTY));
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
if (boot_cpu_data.x86 > 3)
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <linux/efi.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
else
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
#include <asm/setup.h>
#ifdef CONFIG_SUN3
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
}
#else
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
if (CPU_IS_020_OR_030)
pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
if (CPU_IS_040_OR_060) {
pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
/* Use no-cache mode, serialized */
pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
}
}
#endif /* CONFIG_SUN3 */
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#include <linux/fs.h>
#include <asm/page.h>
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
if (boot_cpu_data.x86 > 3)
pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
}
#endif /* _ASM_FB_H_ */
#ifndef _ASM_FB_H_
#define _ASM_FB_H_
#define fb_pgprotect(...) do {} while (0)
#endif /* _ASM_FB_H_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册