[LinuxBIOS] r532 - LinuxBIOSv3/device

svn at openbios.org svn at openbios.org
Thu Nov 29 02:23:08 CET 2007


Author: alex
Date: 2007-11-29 02:23:08 +0100 (Thu, 29 Nov 2007)
New Revision: 532

Modified:
   LinuxBIOSv3/device/pci_rom.c
Log:
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 at rtfs.hu>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>



Modified: LinuxBIOSv3/device/pci_rom.c
===================================================================
--- LinuxBIOSv3/device/pci_rom.c	2007-11-28 22:51:31 UTC (rev 531)
+++ LinuxBIOSv3/device/pci_rom.c	2007-11-29 01:23:08 UTC (rev 532)
@@ -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,15 @@
 		       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));
 





More information about the coreboot mailing list