[PATCH libpciaccess] linux_sysfs: use rom_size = 0x1000 for VGA devices

Forest Bond forest at alittletooquiet.net
Tue Mar 22 08:24:14 PDT 2011


Hi,

On Tue, Mar 22, 2011 at 11:15:27AM -0400, Adam Jackson wrote:
> On Tue, 2011-03-22 at 10:31 -0400, Forest Bond wrote:
> > This patch brings the linux_sysfs backend in parity with other backends,
> > which assume that VGA devices have fixed rom_size of 0x1000.  On my
> > machines, the previous behavior invariably gives rom_size = 0.
> 
> So cards with ROMs bigger than 64k just get silently truncated?  No
> thanks.

Sorry, the details are beyond me.  Is this better (untested)?


diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
index 1832ee7..82254d5 100644
--- a/src/linux_sysfs.c
+++ b/src/linux_sysfs.c
@@ -55,6 +55,9 @@
 #include "pciaccess_private.h"
 #include "linux_devmem.h"
 
+#define	PCIC_DISPLAY	0x03
+#define	PCIS_DISPLAY_VGA	0x00
+
 static const struct pci_system_methods linux_sysfs_methods;
 
 #define SYS_BUS_PCI "/sys/bus/pci/devices"
@@ -269,6 +272,14 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
 		priv->rom_base = low_addr;
 		dev->rom_size = (high_addr - low_addr) + 1;
 	    }
+
+	    /* If it's a VGA device, set up the rom size for read_rom */
+	    if (dev->rom_size == 0
+		&& (dev->device_class & 0x00ffff00) ==
+		   ((PCIC_DISPLAY << 16) | (PCIS_DISPLAY_VGA << 8)))
+	    {
+		dev->rom_size = 0x10000;
+	    }
 	}
     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110322/86bd2256/attachment.pgp>


More information about the xorg-devel mailing list