xref: /openbmc/linux/arch/x86/video/fbdev.c (revision 9a32dd32)
1 /*
2  * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
3  *
4  * This file is subject to the terms and conditions of the GNU General Public
5  * License.  See the file COPYING in the main directory of this archive
6  * for more details.
7  *
8  */
9 
10 #include <linux/fb.h>
11 #include <linux/module.h>
12 #include <linux/pci.h>
13 #include <linux/vgaarb.h>
14 
15 void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off)
16 {
17 	unsigned long prot;
18 
19 	prot = pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK;
20 	if (boot_cpu_data.x86 > 3)
21 		pgprot_val(vma->vm_page_prot) =
22 			prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
23 }
24 EXPORT_SYMBOL(fb_pgprotect);
25 
26 int fb_is_primary_device(struct fb_info *info)
27 {
28 	struct device *device = info->device;
29 	struct pci_dev *pci_dev;
30 
31 	if (!device || !dev_is_pci(device))
32 		return 0;
33 
34 	pci_dev = to_pci_dev(device);
35 
36 	if (pci_dev == vga_default_device())
37 		return 1;
38 	return 0;
39 }
40 EXPORT_SYMBOL(fb_is_primary_device);
41 
42 MODULE_LICENSE("GPL");
43