The attached patch adds code to checksum the pci extension rom and warn

if the stored and calculated checksum differ.

There is no easy way to check extension ROMs in the current machine for
correct signatures, but you could copy out the memory between 0xc0000 -
0xf00000 from /dev/mem and search for extension headers in it (see the
code in pci_rom.c).

Signed-off-by: Alex Beregszaszi <alex@rtfs.hu>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@532 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Alex Beregszaszi 2007-11-29 01:23:08 +00:00
commit 446f7dffbb

View file

@ -33,6 +33,8 @@ struct rom_header *pci_rom_probe(struct device *dev)
unsigned long rom_address;
struct rom_header *rom_header;
struct pci_data *rom_data;
unsigned int i;
unsigned char sum = 0, *rom_bytes;
if (dev->on_mainboard) {
/* In case some device PCI_ROM_ADDRESS can not be set
@ -67,6 +69,14 @@ struct rom_header *pci_rom_probe(struct device *dev)
le32_to_cpu(rom_header->signature));
return NULL;
}
/* checksum */
rom_bytes = (unsigned char *)rom_address;
for (i = 0; i < rom_header->size * 512; i++)
sum += *(rom_bytes + i);
if (sum != 0)
printk(BIOS_ALERT, "Incorrent Expansion ROM checksum (%02x != 0)\n", sum);
rom_data = (struct pci_data *)((unsigned char *)rom_header +
le32_to_cpu(rom_header->data));