From: Jeff Kirsher Date: Fri, 13 Jan 2006 00:51:23 +0000 (-0800) Subject: [PATCH] e1000: Added firmware version reporting for 8257{1|2|3} controllers X-Git-Tag: v2.6.16-rc2~366^2~23 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a2917e22dcaa53e8ad2d8dc3bcfa55a4b04e6d0f;p=linux-2.6-omap-h63xx.git [PATCH] e1000: Added firmware version reporting for 8257{1|2|3} controllers The EEPROM image version is reported as a firmware version for these controllers. Signed-off-by: Jeff Kirsher Signed-off-by: Jesse Brandeburg Signed-off-by: John Ronciak Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 0f9c86057a5..d252297e4db 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -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;