fbdev: Remove conflicting devices on PCI bus

Remove firmware devices on the PCI bus, by calling
aperture_remove_conflicting_pci_devices() in the probe function of
each related fbdev driver. iSo far, most of these drivers did not
remove conflicting VESA or EFI devices, or outride failed for
resource conflicts (i.e., matroxfb.) This must have been broken
for quite some time.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220718072322.8927-7-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann
2022-07-18 09:23:17 +02:00
parent 8d69d008f4
commit 145eed48de
39 changed files with 206 additions and 5 deletions

View File

@@ -11,6 +11,7 @@
* Code is based on s3fb
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -949,6 +950,10 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
int rc;
u8 regval;
rc = aperture_remove_conflicting_pci_devices(dev, "arkfb");
if (rc < 0)
return rc;
/* Ignore secondary VGA device because there is no VGA arbitration */
if (! svga_primary_device(dev)) {
dev_info(&(dev->dev), "ignoring secondary device\n");

View File

@@ -29,6 +29,7 @@
* more details.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -545,6 +546,10 @@ static int asiliantfb_pci_init(struct pci_dev *dp,
struct fb_info *p;
int err;
err = aperture_remove_conflicting_pci_devices(dp, "asiliantfb");
if (err)
return err;
if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
return -ENODEV;
addr = pci_resource_start(dp, 0);

View File

@@ -47,6 +47,7 @@
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
@@ -2055,6 +2056,10 @@ static int aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
void __iomem *bios = NULL;
#endif
err = aperture_remove_conflicting_pci_devices(pdev, "aty128fb");
if (err)
return err;
/* Enable device in PCI config */
if ((err = pci_enable_device(pdev))) {
printk(KERN_ERR "aty128fb: Cannot enable PCI device: %d\n",

View File

@@ -48,6 +48,7 @@
******************************************************************************/
#include <linux/aperture.h>
#include <linux/compat.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -3533,7 +3534,11 @@ static int atyfb_pci_probe(struct pci_dev *pdev,
struct fb_info *info;
struct resource *rp;
struct atyfb_par *par;
int rc = -ENOMEM;
int rc;
rc = aperture_remove_conflicting_pci_devices(pdev, "atyfb");
if (rc)
return rc;
/* Enable device in PCI config */
if (pci_enable_device(pdev)) {

View File

@@ -7,6 +7,7 @@
* - FB1 is display 1 with unique memory area
* - both display use 32 bit colors
*/
#include <linux/aperture.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/fb.h>
@@ -614,6 +615,10 @@ static int carminefb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
struct fb_info *info;
int ret;
ret = aperture_remove_conflicting_pci_devices(dev, "carminefb");
if (ret)
return ret;
ret = pci_enable_device(dev);
if (ret)
return ret;

View File

@@ -14,6 +14,7 @@
* more details.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -351,7 +352,11 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
struct fb_info *p;
unsigned long addr;
unsigned short cmd;
int rc = -ENODEV;
int rc;
rc = aperture_remove_conflicting_pci_devices(dp, "chipsfb");
if (rc)
return rc;
if (pci_enable_device(dp) < 0) {
dev_err(&dp->dev, "Cannot enable PCI device\n");

View File

@@ -34,6 +34,7 @@
*
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -2085,6 +2086,10 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
unsigned long board_addr, board_size;
int ret;
ret = aperture_remove_conflicting_pci_devices(pdev, "cirrusfb");
if (ret)
return ret;
ret = pci_enable_device(pdev);
if (ret < 0) {
printk(KERN_ERR "cirrusfb: Cannot enable PCI device\n");

View File

@@ -33,6 +33,7 @@
* (which, incidentally, is about the same saving as a 2.5in hard disk
* entering standby mode.)
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -1720,6 +1721,10 @@ static int cyberpro_pci_probe(struct pci_dev *dev,
sprintf(name, "CyberPro%4X", id->device);
err = aperture_remove_conflicting_pci_devices(dev, name);
if (err)
return err;
err = pci_enable_device(dev);
if (err)
return err;

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2005 Arcom Control Systems Ltd.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -320,6 +321,10 @@ static int gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct fb_info *info;
int ret;
ret = aperture_remove_conflicting_pci_devices(pdev, "gx1fb");
if (ret)
return ret;
info = gx1fb_init_fbinfo(&pdev->dev);
if (!info)
return -ENOMEM;

View File

@@ -15,6 +15,7 @@
*
* 16 MiB of framebuffer memory is assumed to be available.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -364,6 +365,10 @@ static int gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct fb_videomode *modedb_ptr;
unsigned int modedb_size;
ret = aperture_remove_conflicting_pci_devices(pdev, "gxfb");
if (ret)
return ret;
info = gxfb_init_fbinfo(&pdev->dev);
if (!info)
return -ENOMEM;

View File

@@ -6,6 +6,7 @@
* Built from gxfb (which is Copyright (C) 2006 Arcom Control Systems Ltd.)
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -484,6 +485,10 @@ static int lxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct fb_videomode *modedb_ptr;
unsigned int modedb_size;
ret = aperture_remove_conflicting_pci_devices(pdev, "lxfb");
if (ret)
return ret;
info = lxfb_init_fbinfo(&pdev->dev);
if (info == NULL)

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2006 Paul Mackerras, IBM Corp. <paulus@samba.org>
*/
#include <linux/aperture.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fb.h>
@@ -621,6 +622,10 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct fb_var_screeninfo var;
enum gxt_cards cardtype;
err = aperture_remove_conflicting_pci_devices(pdev, "gxt4500fb");
if (err)
return err;
err = pci_enable_device(pdev);
if (err) {
dev_err(&pdev->dev, "gxt4500: cannot enable PCI device: %d\n",

View File

@@ -12,6 +12,7 @@
* i740fb by Patrick LERDA, v0.9
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -1008,6 +1009,10 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
bool found = false;
u8 *edid;
ret = aperture_remove_conflicting_pci_devices(dev, "i740fb");
if (ret)
return ret;
info = framebuffer_alloc(sizeof(struct i740fb_par), &(dev->dev));
if (!info)
return -ENOMEM;

View File

@@ -28,6 +28,7 @@
* more details.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -2016,6 +2017,10 @@ static int i810fb_init_pci(struct pci_dev *dev,
struct fb_videomode mode;
int err = -1, vfreq, hfreq, pixclock;
err = aperture_remove_conflicting_pci_devices(dev, "i810fb");
if (err)
return err;
info = framebuffer_alloc(sizeof(struct i810fb_par), &dev->dev);
if (!info)
return -ENOMEM;

View File

@@ -16,6 +16,7 @@
* more details.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -1469,7 +1470,12 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct imstt_par *par;
struct fb_info *info;
struct device_node *dp;
int ret = -ENOMEM;
int ret;
ret = aperture_remove_conflicting_pci_devices(pdev, "imsttfb");
if (ret)
return ret;
ret = -ENOMEM;
dp = pci_device_to_OF_node(pdev);
if(dp)

View File

@@ -107,6 +107,7 @@
* Add support for 945GME. (Phil Endecott <spam_from_intelfb@chezphil.org>)
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -483,6 +484,10 @@ static int intelfb_pci_register(struct pci_dev *pdev,
DBG_MSG("intelfb_pci_register\n");
err = aperture_remove_conflicting_pci_devices(pdev, "intelfb");
if (err)
return err;
num_registered++;
if (num_registered != 1) {
ERR_MSG("Attempted to register %d devices "

View File

@@ -9,6 +9,7 @@
* for more details.
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
@@ -676,6 +677,10 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
unsigned long size;
int err;
err = aperture_remove_conflicting_pci_devices(pdev, "kyrofb");
if (err)
return err;
if ((err = pci_enable_device(pdev))) {
printk(KERN_WARNING "kyrofb: Can't enable pdev: %d\n", err);
return err;

View File

@@ -100,6 +100,7 @@
*
*/
#include <linux/aperture.h>
#include <linux/version.h>
#include "matroxfb_base.h"
@@ -2044,6 +2045,10 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
u_int32_t cmd;
DBG(__func__)
err = aperture_remove_conflicting_pci_devices(pdev, "matroxfb");
if (err)
return err;
svid = pdev->subsystem_vendor;
sid = pdev->subsystem_device;
for (b = dev_list; b->vendor; b++) {

View File

@@ -10,6 +10,7 @@
#undef DEBUG
#include <linux/aperture.h>
#include <linux/fb.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
@@ -999,6 +1000,10 @@ static int mb862xx_pci_probe(struct pci_dev *pdev,
struct device *dev = &pdev->dev;
int ret;
ret = aperture_remove_conflicting_pci_devices(pdev, "mb862xxfb");
if (ret)
return ret;
ret = pci_enable_device(pdev);
if (ret < 0) {
dev_err(dev, "Cannot enable PCI device\n");

View File

@@ -54,6 +54,7 @@
*
*/
#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -2029,6 +2030,10 @@ static int neofb_probe(struct pci_dev *dev, const struct pci_device_id *id)
DBG("neofb_probe");
err = aperture_remove_conflicting_pci_devices(dev, "neofb");
if (err)
return err;
err = pci_enable_device(dev);
if (err)
return err;

Some files were not shown because too many files have changed in this diff Show More