summaryrefslogtreecommitdiffstats
path: root/drivers/pci/rom.c
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@gmail.com>2005-07-29 21:16:17 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-29 22:12:51 +0200
commit761a3ac08c63718dacde12aaf0ec6d6760e8c2b7 (patch)
tree9e57362eea27c60a1a8870ed21767dbf89a37867 /drivers/pci/rom.c
parent[PATCH] PCI: Hidden SMBus bridge on Toshiba Tecra M2 (diff)
downloadlinux-761a3ac08c63718dacde12aaf0ec6d6760e8c2b7.tar.xz
linux-761a3ac08c63718dacde12aaf0ec6d6760e8c2b7.zip
[PATCH] PCI: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r--drivers/pci/rom.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 838575e3fac6..713c78f3a65d 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
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;
}