aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/rom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/rom.c')
-rw-r--r--drivers/pci/rom.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 132a78159b60..36864a935d68 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -55,6 +55,7 @@ void pci_disable_rom(struct pci_dev *pdev)
55 55
56/** 56/**
57 * pci_get_rom_size - obtain the actual size of the ROM image 57 * pci_get_rom_size - obtain the actual size of the ROM image
58 * @pdev: target PCI device
58 * @rom: kernel virtual pointer to image of ROM 59 * @rom: kernel virtual pointer to image of ROM
59 * @size: size of PCI window 60 * @size: size of PCI window
60 * return: size of actual ROM image 61 * return: size of actual ROM image
@@ -63,7 +64,7 @@ void pci_disable_rom(struct pci_dev *pdev)
63 * The PCI window size could be much larger than the 64 * The PCI window size could be much larger than the
64 * actual image size. 65 * actual image size.
65 */ 66 */
66size_t pci_get_rom_size(void __iomem *rom, size_t size) 67size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
67{ 68{
68 void __iomem *image; 69 void __iomem *image;
69 int last_image; 70 int last_image;
@@ -72,8 +73,10 @@ size_t pci_get_rom_size(void __iomem *rom, size_t size)
72 do { 73 do {
73 void __iomem *pds; 74 void __iomem *pds;
74 /* Standard PCI ROMs start out with these bytes 55 AA */ 75 /* Standard PCI ROMs start out with these bytes 55 AA */
75 if (readb(image) != 0x55) 76 if (readb(image) != 0x55) {
77 dev_err(&pdev->dev, "Invalid ROM contents\n");
76 break; 78 break;
79 }
77 if (readb(image + 1) != 0xAA) 80 if (readb(image + 1) != 0xAA)
78 break; 81 break;
79 /* get the PCI data structure and check its signature */ 82 /* get the PCI data structure and check its signature */
@@ -159,7 +162,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
159 * size is much larger than the actual size of the ROM. 162 * size is much larger than the actual size of the ROM.
160 * True size is important if the ROM is going to be copied. 163 * True size is important if the ROM is going to be copied.
161 */ 164 */
162 *size = pci_get_rom_size(rom, *size); 165 *size = pci_get_rom_size(pdev, rom, *size);
163 return rom; 166 return rom;
164} 167}
165 168