[LinuxBIOS] [PATCH] pci_rom.c checksum extension rom

Uwe Hermann uwe at hermann-uwe.de
Thu Oct 25 18:43:01 CEST 2007


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 at rtfs.hu>
>  
> Acked-by: Stefan Reinauer <stepan at 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 at hermann-uwe.de>


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20071025/c148969b/attachment.sig>


More information about the coreboot mailing list