diff options
-rw-r--r-- | drivers/pci/rom.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index eb0ad530dc43..5a1a39df75a1 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -77,22 +77,18 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) | |||
77 | do { | 77 | do { |
78 | void __iomem *pds; | 78 | void __iomem *pds; |
79 | /* Standard PCI ROMs start out with these bytes 55 AA */ | 79 | /* Standard PCI ROMs start out with these bytes 55 AA */ |
80 | if (readb(image) != 0x55) { | 80 | if (readw(image) != 0xAA55) { |
81 | dev_err(&pdev->dev, "Invalid ROM contents\n"); | 81 | dev_err(&pdev->dev, "Invalid PCI ROM header signature: expecting 0xaa55, got %#06x\n", |
82 | readw(image)); | ||
82 | break; | 83 | break; |
83 | } | 84 | } |
84 | if (readb(image + 1) != 0xAA) | 85 | /* get the PCI data structure and check its "PCIR" signature */ |
85 | break; | ||
86 | /* get the PCI data structure and check its signature */ | ||
87 | pds = image + readw(image + 24); | 86 | pds = image + readw(image + 24); |
88 | if (readb(pds) != 'P') | 87 | if (readl(pds) != 0x52494350) { |
89 | break; | 88 | dev_err(&pdev->dev, "Invalid PCI ROM data signature: expecting 0x52494350, got %#010x\n", |
90 | if (readb(pds + 1) != 'C') | 89 | readl(pds)); |
91 | break; | ||
92 | if (readb(pds + 2) != 'I') | ||
93 | break; | ||
94 | if (readb(pds + 3) != 'R') | ||
95 | break; | 90 | break; |
91 | } | ||
96 | last_image = readb(pds + 21) & 0x80; | 92 | last_image = readb(pds + 21) & 0x80; |
97 | length = readw(pds + 16); | 93 | length = readw(pds + 16); |
98 | image += length * 512; | 94 | image += length * 512; |