Beispiel #1
0
/******************************************************************************
 * Local function to check if the eeprom signature is good
 * If the eeprom signature is good, calls ixgb)get_eeprom_data.
 *
 * hw - Struct containing variables accessed by shared code
 *
 * Returns:
 *      true: eeprom signature was good and the eeprom read was successful
 *      false: otherwise.
 ******************************************************************************/
static bool
ixgb_check_and_get_eeprom_data (struct ixgb_hw* hw)
{
	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;

	if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
	    == cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
		return true;
	} else {
		return ixgb_get_eeprom_data(hw);
	}
}
static int
ixgb_ethtool_geeprom(struct net_device *dev,
		     struct ethtool_eeprom *eeprom, u8 *data)
{
	struct ixgb_adapter *adapter = dev->priv;
	struct ixgb_hw *hw = &adapter->hw;

	eeprom->magic = hw->vendor_id | (hw->device_id << 16);

	/* use our function to read the eeprom and update our cache */
	ixgb_get_eeprom_data(hw);
	memcpy(data, (char *)hw->eeprom + eeprom->offset, eeprom->len);
	return 0;
}