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