xref: /kernel/linux/linux-6.6/arch/x86/video/fbdev.c (revision 62306a36)
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
16void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off)
17{
18	unsigned long prot;
19
20	prot = pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK;
21	if (boot_cpu_data.x86 > 3)
22		pgprot_val(vma->vm_page_prot) =
23			prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
24}
25EXPORT_SYMBOL(fb_pgprotect);
26
27int fb_is_primary_device(struct fb_info *info)
28{
29	struct device *device = info->device;
30	struct pci_dev *pci_dev;
31
32	if (!device || !dev_is_pci(device))
33		return 0;
34
35	pci_dev = to_pci_dev(device);
36
37	if (pci_dev == vga_default_device())
38		return 1;
39	return 0;
40}
41EXPORT_SYMBOL(fb_is_primary_device);
42
43MODULE_LICENSE("GPL");
44