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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <linux/fb.h>
|
|
|
|
#include <linux/pci.h>
|
2011-05-28 00:33:10 +08:00
|
|
|
#include <linux/module.h>
|
2012-04-17 04:26:04 +08:00
|
|
|
#include <linux/vgaarb.h>
|
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;
|
2012-04-17 04:26:04 +08:00
|
|
|
struct pci_dev *default_device = vga_default_device();
|
2016-03-15 16:20:33 +08:00
|
|
|
struct pci_dev *pci_dev;
|
|
|
|
struct resource *res;
|
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);
|
|
|
|
|
2012-04-17 04:26:04 +08:00
|
|
|
if (default_device) {
|
|
|
|
if (pci_dev == default_device)
|
|
|
|
return 1;
|
2016-03-15 16:20:33 +08:00
|
|
|
return 0;
|
2012-04-17 04:26:04 +08:00
|
|
|
}
|
|
|
|
|
2016-03-15 16:20:33 +08:00
|
|
|
res = pci_dev->resource + PCI_ROM_RESOURCE;
|
2007-07-17 19:05:28 +08:00
|
|
|
|
2016-03-15 16:20:33 +08:00
|
|
|
if (res->flags & IORESOURCE_ROM_SHADOW)
|
2012-04-17 04:26:04 +08:00
|
|
|
return 1;
|
2007-07-17 19:05:28 +08:00
|
|
|
|
2012-04-17 04:26:04 +08:00
|
|
|
return 0;
|
2007-07-17 19:05:28 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(fb_is_primary_device);
|
2008-05-03 04:32:32 +08:00
|
|
|
MODULE_LICENSE("GPL");
|