xref: /openbmc/linux/arch/x86/video/fbdev.c (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
14ac24f63SThomas Gleixner /*
24ac24f63SThomas Gleixner  * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
34ac24f63SThomas Gleixner  *
44ac24f63SThomas Gleixner  * This file is subject to the terms and conditions of the GNU General Public
54ac24f63SThomas Gleixner  * License.  See the file COPYING in the main directory of this archive
64ac24f63SThomas Gleixner  * for more details.
74ac24f63SThomas Gleixner  *
84ac24f63SThomas Gleixner  */
994545f27SThomas Zimmermann 
104ac24f63SThomas Gleixner #include <linux/fb.h>
117c52d551SPaul Gortmaker #include <linux/module.h>
1294545f27SThomas Zimmermann #include <linux/pci.h>
1388674088SMatthew Garrett #include <linux/vgaarb.h>
14*29bf464cSArnd Bergmann #include <asm/fb.h>
154ac24f63SThomas Gleixner 
fb_pgprotect(struct file * file,struct vm_area_struct * vma,unsigned long off)1694545f27SThomas Zimmermann void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off)
1794545f27SThomas Zimmermann {
1894545f27SThomas Zimmermann 	unsigned long prot;
1994545f27SThomas Zimmermann 
2094545f27SThomas Zimmermann 	prot = pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK;
2194545f27SThomas Zimmermann 	if (boot_cpu_data.x86 > 3)
2294545f27SThomas Zimmermann 		pgprot_val(vma->vm_page_prot) =
2394545f27SThomas Zimmermann 			prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
2494545f27SThomas Zimmermann }
2594545f27SThomas Zimmermann EXPORT_SYMBOL(fb_pgprotect);
2694545f27SThomas Zimmermann 
fb_is_primary_device(struct fb_info * info)274ac24f63SThomas Gleixner int fb_is_primary_device(struct fb_info *info)
284ac24f63SThomas Gleixner {
294ac24f63SThomas Gleixner 	struct device *device = info->device;
30743146dbSVitaly Kuznetsov 	struct pci_dev *pci_dev;
314ac24f63SThomas Gleixner 
32743146dbSVitaly Kuznetsov 	if (!device || !dev_is_pci(device))
3388674088SMatthew Garrett 		return 0;
3488674088SMatthew Garrett 
35743146dbSVitaly Kuznetsov 	pci_dev = to_pci_dev(device);
36743146dbSVitaly Kuznetsov 
375ca1479cSDaniel Vetter 	if (pci_dev == vga_default_device())
3888674088SMatthew Garrett 		return 1;
3988674088SMatthew Garrett 	return 0;
4088674088SMatthew Garrett }
414ac24f63SThomas Gleixner EXPORT_SYMBOL(fb_is_primary_device);
4294545f27SThomas Zimmermann 
437b04fa01SAdrian Bunk MODULE_LICENSE("GPL");
44