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 #include <asm/fb.h>
15 
pgprot_framebuffer(pgprot_t prot,unsigned long vm_start,unsigned long vm_end,unsigned long offset)16 pgprot_t pgprot_framebuffer(pgprot_t prot,
17 			    unsigned long vm_start, unsigned long vm_end,
18 			    unsigned long offset)
19 {
20 	pgprot_val(prot) &= ~_PAGE_CACHE_MASK;
21 	if (boot_cpu_data.x86 > 3)
22 		pgprot_val(prot) |= cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
23 
24 	return prot;
25 }
26 EXPORT_SYMBOL(pgprot_framebuffer);
27 
fb_is_primary_device(struct fb_info * info)28 int fb_is_primary_device(struct fb_info *info)
29 {
30 	struct device *device = info->device;
31 	struct pci_dev *pci_dev;
32 
33 	if (!device || !dev_is_pci(device))
34 		return 0;
35 
36 	pci_dev = to_pci_dev(device);
37 
38 	if (pci_dev == vga_default_device())
39 		return 1;
40 	return 0;
41 }
42 EXPORT_SYMBOL(fb_is_primary_device);
43 
44 MODULE_LICENSE("GPL");
45