lkml.org 
[lkml]   [2005]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: Adjust PCI rom code to handle more broken ROMs
There are ROMs reporting that their size exceeds their PCI ROM
resource window. This patch returns the minimum of the resource window
size or the size in the ROM. An example of this breakage is the XGI
Volari Z7.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Patch is in an attachment since gmail will mangle the tabs.

--
Jon Smirl
jonsmirl@gmail.com
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev
image += readw(pds + 16) * 512;
} while (!last_image);

- *size = image - rom;
+ /* never return a size larger than the PCI resource window */
+ /* there are known ROMs that get the size wrong */
+ *size = min((size_t)(image - rom), *size);

return rom;
}
\
 
 \ /
  Last update: 2005-07-16 15:13    [W:0.028 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site