Hi all. I've attached a patch that combines a previously reviewed
patch with some extra warning messages, so that people who have the same
problem that Xorg was having with ROM reading will maybe be able to solve it
more quickly.
However, I have a feeling I might've missed something. Can people
have a look at this?
It seems from the FAQ that the appropriate next step is to get "the
maintainer" to ok my patch. Does anyone know who that is for PCI? Or is
there a different way to do things for PCI?
:)
---------------------------------------------------------------------
| Name: Tim Nelson | Because the Creator is, |
| E-mail: wayland@xxxxxxxxxxxxx | I am |
---------------------------------------------------------------------
----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V-
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----
diff -urN linux-2.6.27/drivers/pci/pci-sysfs.c linux-2.6.27/drivers/pci/pci-sysfs.c
--- linux-2.6.27/drivers/pci/pci-sysfs.c 2008-10-10 09:13:53.000000000 +1100
+++ linux-2.6.27/drivers/pci/pci-sysfs.c 2009-01-12 10:29:34.000000000 +1100
@@ -694,8 +694,8 @@
return -EINVAL;
rom = pci_map_rom(pdev, &size); /* size starts out as PCI window size */
- if (!rom)
- return 0;
+ if (!rom || !size)
+ return -EIO;
if (off >= size)
count = 0;
diff -urN linux-2.6.27/drivers/pci/rom.c linux-2.6.27/drivers/pci/rom.c
--- linux-2.6.27/drivers/pci/rom.c 2008-10-10 09:13:53.000000000 +1100
+++ linux-2.6.27/drivers/pci/rom.c 2009-01-12 17:06:58.000000000 +1100
@@ -72,8 +72,12 @@
do {
void __iomem *pds;
/* Standard PCI ROMs start out with these bytes 55 AA */
- if (readb(image) != 0x55)
+ if (readb(image) != 0x55) {
+ printk(KERN_INFO " %s: Invalid ROM contents\n", __FUNCTION__);
+ printk(KERN_INFO " %s: suggest echoing 1 into /sys/bus/pci/<deviceID>/enable\n", __FUNCTION__);
+ printk(KERN_INFO " %s: to enable device before trying to do rom reading\n", __FUNCTION__);
break;
+ }
if (readb(image + 1) != 0xAA)
break;
/* get the PCI data structure and check its signature */