On Wed, Sep 24, 2008 at 12:10 PM, Kyle McMartin <[EMAIL PROTECTED]> wrote:
> At the very least, if someone pokes in a hexdump of the firmware, at
> least we might be able to see some of the method to the madness of the
> corruption pattern.

Thanks Kyle!

attached is a patch to dump the eeprom to dmesg (first 64 bytes) at
boot for e1000e, which kind of goes along with your AWOOGA part of
your patch.
e1000e: dump eeprom to dmesg for ich8/9

From: Jesse Brandeburg <[EMAIL PROTECTED]>

dumping the eeprom for now seems like a bit of a verbose
hack, but might be useful when we want to restore it.

if syslogd (or something like) isn't running it won't be kept
however.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
---

 drivers/net/e1000e/netdev.c |   51 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 89ca272..48072fa 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4338,6 +4338,52 @@ static void e1000_eeprom_checks(struct e1000_adapter 
*adapter)
 }
 
 /**
+ * e1000e_dump_eeprom - write the eeprom to kernel log
+ * @adapter: our adapter struct
+ *
+ * Dump the eeprom for users having checksum issues
+ **/
+static void e1000e_dump_eeprom(struct e1000_adapter *adapter)
+{
+       struct net_device *netdev = adapter->netdev;
+       struct ethtool_eeprom eeprom;
+       const struct ethtool_ops *ops = netdev->ethtool_ops;
+       u8 *data;
+       int i;
+       u16 csum_old, csum_new = 0;
+
+       eeprom.len = ops->get_eeprom_len(netdev);
+       eeprom.offset = 0;
+
+       data = kzalloc(eeprom.len, GFP_KERNEL);
+       if (!data) {
+               printk(KERN_ERR "Unable to allocate memory to dump EEPROM"
+                      " data\n");
+               return;
+       }
+
+       ops->get_eeprom(netdev, &eeprom, data);
+
+       csum_old = (data[NVM_CHECKSUM_REG * 2]) +
+                  (data[NVM_CHECKSUM_REG * 2 + 1] << 8);
+       for (i = 0; i < NVM_CHECKSUM_REG * 2; i += 2)
+               csum_new += data[i] + (data[i + 1] << 8);
+       csum_new = NVM_SUM - csum_new;
+
+       printk(KERN_ERR "/*********************/\n");
+       printk(KERN_ERR "Current EEPROM Checksum : 0x%04x\n", csum_old);
+       printk(KERN_ERR "Calculated              : 0x%04x\n", csum_new);
+
+       printk(KERN_ERR "Offset    Values\n");
+       printk(KERN_ERR "========  ======\n");
+       print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, data, 128, 0);
+
+       printk(KERN_ERR "/*********************/\n");
+
+       kfree(data);
+}
+
+/**
  * e1000_probe - Device Initialization Routine
  * @pdev: PCI device information struct
  * @ent: entry in e1000_pci_tbl
@@ -4541,6 +4587,11 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        e1000_eeprom_checks(adapter);
 
+       /* debug code ... dump the first 128 bytes of the eeprom for
+        * ich parts that might get a corruption */
+       if (adapter->flags & FLAG_IS_ICH)
+               e1000e_dump_eeprom(adapter);
+
        /* copy the MAC address out of the NVM */
        if (e1000e_read_mac_addr(&adapter->hw))
                e_err("NVM Read Error while reading MAC address\n");

Reply via email to