2007-07-17 19:05:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file COPYING in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
*/
|
2023-04-24 16:47:51 +08:00
|
|
|
|
2007-07-17 19:05:28 +08:00
|
|
|
#include <linux/fb.h>
|
2011-05-28 00:33:10 +08:00
|
|
|
#include <linux/module.h>
|
2023-04-24 16:47:51 +08:00
|
|
|
#include <linux/pci.h>
|
2012-04-17 04:26:04 +08:00
|
|
|
#include <linux/vgaarb.h>
|
2023-05-17 03:35:43 +08:00
|
|
|
#include <asm/fb.h>
|
2007-07-17 19:05:28 +08:00
|
|
|
|
2023-04-24 16:47:51 +08:00
|
|
|
void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off)
|
|
|
|
{
|
|
|
|
unsigned long prot;
|
|
|
|
|
|
|
|
prot = pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK;
|
|
|
|
if (boot_cpu_data.x86 > 3)
|
|
|
|
pgprot_val(vma->vm_page_prot) =
|
|
|
|
prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(fb_pgprotect);
|
|
|
|
|
2007-07-17 19:05:28 +08:00
|
|
|
int fb_is_primary_device(struct fb_info *info)
|
|
|
|
{
|
2007-07-17 19:05:28 +08:00
|
|
|
struct device *device = info->device;
|
2016-03-15 16:20:33 +08:00
|
|
|
struct pci_dev *pci_dev;
|
2007-07-17 19:05:28 +08:00
|
|
|
|
2016-03-15 16:20:33 +08:00
|
|
|
if (!device || !dev_is_pci(device))
|
2012-04-17 04:26:04 +08:00
|
|
|
return 0;
|
|
|
|
|
2016-03-15 16:20:33 +08:00
|
|
|
pci_dev = to_pci_dev(device);
|
|
|
|
|
2023-04-06 21:21:08 +08:00
|
|
|
if (pci_dev == vga_default_device())
|
2012-04-17 04:26:04 +08:00
|
|
|
return 1;
|
|
|
|
return 0;
|
2007-07-17 19:05:28 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(fb_is_primary_device);
|
2023-04-24 16:47:51 +08:00
|
|
|
|
2008-05-03 04:32:32 +08:00
|
|
|
MODULE_LICENSE("GPL");
|