On Wed, Oct 17, 2007 at 11:30:30AM +0200, Stefan Reinauer wrote:
Is this checksum reliably correct? I am hesitating to add new restrictions that might break otherwise working cards.
You are right, attached is a correct method. There is no fixed checksum byte, instead the whole should sum to zero.
-- Alex
Signed-off-by: Alex Beregszaszi alex@rtfs.hu
Acked-by: Stefan Reinauer stepan@coresystems.de
Index: device/pci_rom.c
--- device/pci_rom.c (revision 494) +++ device/pci_rom.c (working copy) @@ -33,6 +33,8 @@ 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,7 +69,17 @@ 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_ERR, "Incorrent Expansion ROM checksum (%02x != 0)\n", sum);
return NULL;
}
Doesn't this mean it'll abort upon incorrect checksum? If so, NACK. This should be a warning only, and not abort execution.
If it's implemented as warning only (without aborting): Acked-by: Uwe Hermann uwe@hermann-uwe.de
Uwe.