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.

Signed-off-by: Forest Bond <[email protected]>
---
 src/linux_sysfs.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
index 1832ee7..85afa48 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"
@@ -262,12 +265,20 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
                }
            }
 
-           low_addr = strtoull( next, & next, 16 );
-           high_addr = strtoull( next, & next, 16 );
-           flags = strtoull( next, & next, 16 );
-           if ( low_addr != 0 ) {
-               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->device_class & 0x00ffff00) ==
+               ((PCIC_DISPLAY << 16) | (PCIS_DISPLAY_VGA << 8)))
+           {
+               dev->rom_size = 0x10000;
+           }
+           else {
+               low_addr = strtoull( next, & next, 16 );
+               high_addr = strtoull( next, & next, 16 );
+               flags = strtoull( next, & next, 16 );
+               if ( low_addr != 0 ) {
+                   priv->rom_base = low_addr;
+                   dev->rom_size = (high_addr - low_addr) + 1;
+               }
            }
        }
     }
-- 
1.7.0.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to