[PATCH] e1000: Added firmware version reporting for 8257{1|2|3} controllers
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 13 Jan 2006 00:51:23 +0000 (16:51 -0800)
committerJeff Garzik <jgarzik@pobox.com>
Tue, 17 Jan 2006 12:48:04 +0000 (07:48 -0500)
The EEPROM image version is reported as a firmware version for these controllers.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/e1000/e1000_ethtool.c

index 0f9c86057a58740993a3d10ea4c03c8d79289876..d252297e4db0826a676baf48a4833b55f9b7d5ad 100644 (file)
@@ -582,10 +582,29 @@ e1000_get_drvinfo(struct net_device *netdev,
                        struct ethtool_drvinfo *drvinfo)
 {
        struct e1000_adapter *adapter = netdev_priv(netdev);
+       char firmware_version[32];
+       uint16_t eeprom_data;
 
        strncpy(drvinfo->driver,  e1000_driver_name, 32);
        strncpy(drvinfo->version, e1000_driver_version, 32);
-       strncpy(drvinfo->fw_version, "N/A", 32);
+
+       /* EEPROM image version # is reported as firmware version # for
+        * 8257{1|2|3} controllers */
+       e1000_read_eeprom(&adapter->hw, 5, 1, &eeprom_data);
+       switch (adapter->hw.mac_type) {
+       case e1000_82571:
+       case e1000_82572:
+       case e1000_82573:
+               sprintf(firmware_version, "%d.%d-%d",
+                       (eeprom_data & 0xF000) >> 12,
+                       (eeprom_data & 0x0FF0) >> 4,
+                       eeprom_data & 0x000F);
+               break;
+       default:
+               sprintf(firmware_version, "N/A");
+       }
+
+       strncpy(drvinfo->fw_version, firmware_version, 32);
        strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
        drvinfo->n_stats = E1000_STATS_LEN;
        drvinfo->testinfo_len = E1000_TEST_LEN;