#include "e1000_api.h"
s32 e1000_init_mac_params(struct e1000_hw *hw)
{
s32 ret_val = E1000_SUCCESS;
if (hw->mac.ops.init_params) {
ret_val = hw->mac.ops.init_params(hw);
if (ret_val) {
DEBUGOUT("MAC Initialization Error\n");
goto out;
}
} else {
DEBUGOUT("mac.init_mac_params was NULL\n");
ret_val = -E1000_ERR_CONFIG;
}
out:
return ret_val;
}
s32 e1000_init_nvm_params(struct e1000_hw *hw)
{
s32 ret_val = E1000_SUCCESS;
if (hw->nvm.ops.init_params) {
ret_val = hw->nvm.ops.init_params(hw);
if (ret_val) {
DEBUGOUT("NVM Initialization Error\n");
goto out;
}
} else {
DEBUGOUT("nvm.init_nvm_params was NULL\n");
ret_val = -E1000_ERR_CONFIG;
}
out:
return ret_val;
}
s32 e1000_init_phy_params(struct e1000_hw *hw)
{
s32 ret_val = E1000_SUCCESS;
if (hw->phy.ops.init_params) {
ret_val = hw->phy.ops.init_params(hw);
if (ret_val) {
DEBUGOUT("PHY Initialization Error\n");
goto out;
}
} else {
DEBUGOUT("phy.init_phy_params was NULL\n");
ret_val = -E1000_ERR_CONFIG;
}
out:
return ret_val;
}
s32 e1000_init_mbx_params(struct e1000_hw *hw)
{
s32 ret_val = E1000_SUCCESS;
if (hw->mbx.ops.init_params) {
ret_val = hw->mbx.ops.init_params(hw);
if (ret_val) {
DEBUGOUT("Mailbox Initialization Error\n");
goto out;
}
} else {
DEBUGOUT("mbx.init_mbx_params was NULL\n");
ret_val = -E1000_ERR_CONFIG;
}
out:
return ret_val;
}
s32 e1000_set_mac_type(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
s32 ret_val = E1000_SUCCESS;
DEBUGFUNC("e1000_set_mac_type");
switch (hw->device_id) {
case E1000_DEV_ID_82542:
mac->type = e1000_82542;
break;
case E1000_DEV_ID_82543GC_FIBER:
case E1000_DEV_ID_82543GC_COPPER:
mac->type = e1000_82543;
break;
case E1000_DEV_ID_82544EI_COPPER:
case E1000_DEV_ID_82544EI_FIBER:
case E1000_DEV_ID_82544GC_COPPER:
case E1000_DEV_ID_82544GC_LOM:
mac->type = e1000_82544;
break;
case E1000_DEV_ID_82540EM:
case E1000_DEV_ID_82540EM_LOM:
case E1000_DEV_ID_82540EP:
case E1000_DEV_ID_82540EP_LOM:
case E1000_DEV_ID_82540EP_LP:
mac->type = e1000_82540;
break;
case E1000_DEV_ID_82545EM_COPPER:
case E1000_DEV_ID_82545EM_FIBER:
mac->type = e1000_82545;
break;
case E1000_DEV_ID_82545GM_COPPER:
case E1000_DEV_ID_82545GM_FIBER:
case E1000_DEV_ID_82545GM_SERDES:
mac->type = e1000_82545_rev_3;
break;
case E1000_DEV_ID_82546EB_COPPER:
case E1000_DEV_ID_82546EB_FIBER:
case E1000_DEV_ID_82546EB_QUAD_COPPER:
mac->type = e1000_82546;
break;
case E1000_DEV_ID_82546GB_COPPER:
case E1000_DEV_ID_82546GB_FIBER:
case E1000_DEV_ID_82546GB_SERDES:
case E1000_DEV_ID_82546GB_PCIE:
case E1000_DEV_ID_82546GB_QUAD_COPPER:
case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
mac->type = e1000_82546_rev_3;
break;
case E1000_DEV_ID_82541EI:
case E1000_DEV_ID_82541EI_MOBILE:
case E1000_DEV_ID_82541ER_LOM:
mac->type = e1000_82541;
break;
case E1000_DEV_ID_82541ER:
case E1000_DEV_ID_82541GI:
case E1000_DEV_ID_82541GI_LF:
case E1000_DEV_ID_82541GI_MOBILE:
mac->type = e1000_82541_rev_2;
break;
case E1000_DEV_ID_82547EI:
case E1000_DEV_ID_82547EI_MOBILE:
mac->type = e1000_82547;
break;
case E1000_DEV_ID_82547GI:
mac->type = e1000_82547_rev_2;
break;
case E1000_DEV_ID_82571EB_COPPER:
case E1000_DEV_ID_82571EB_FIBER:
case E1000_DEV_ID_82571EB_SERDES:
case E1000_DEV_ID_82571EB_SERDES_DUAL:
case E1000_DEV_ID_82571EB_SERDES_QUAD:
case E1000_DEV_ID_82571EB_QUAD_COPPER:
case E1000_DEV_ID_82571PT_QUAD_COPPER:
case E1000_DEV_ID_82571EB_QUAD_FIBER:
case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
mac->type = e1000_82571;
break;
case E1000_DEV_ID_82572EI:
case E1000_DEV_ID_82572EI_COPPER:
case E1000_DEV_ID_82572EI_FIBER:
case E1000_DEV_ID_82572EI_SERDES:
mac->type = e1000_82572;
break;
case E1000_DEV_ID_82573E:
case E1000_DEV_ID_82573E_IAMT:
case E1000_DEV_ID_82573L:
mac->type = e1000_82573;
break;
case E1000_DEV_ID_82574L:
case E1000_DEV_ID_82574LA:
mac->type = e1000_82574;
break;
case E1000_DEV_ID_82583V:
mac->type = e1000_82583;
break;
case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
mac->type = e1000_80003es2lan;
break;
case E1000_DEV_ID_ICH8_IFE:
case E1000_DEV_ID_ICH8_IFE_GT:
case E1000_DEV_ID_ICH8_IFE_G:
case E1000_DEV_ID_ICH8_IGP_M:
case E1000_DEV_ID_ICH8_IGP_M_AMT:
case E1000_DEV_ID_ICH8_IGP_AMT:
case E1000_DEV_ID_ICH8_IGP_C:
case E1000_DEV_ID_ICH8_82567V_3:
mac->type = e1000_ich8lan;
break;
case E1000_DEV_ID_ICH9_IFE:
case E1000_DEV_ID_ICH9_IFE_GT:
case E1000_DEV_ID_ICH9_IFE_G:
case E1000_DEV_ID_ICH9_IGP_M:
case E1000_DEV_ID_ICH9_IGP_M_AMT:
case E1000_DEV_ID_ICH9_IGP_M_V:
case E1000_DEV_ID_ICH9_IGP_AMT:
case E1000_DEV_ID_ICH9_BM:
case E1000_DEV_ID_ICH9_IGP_C:
case E1000_DEV_ID_ICH10_R_BM_LM:
case E1000_DEV_ID_ICH10_R_BM_LF:
case E1000_DEV_ID_ICH10_R_BM_V:
mac->type = e1000_ich9lan;
break;
case E1000_DEV_ID_ICH10_D_BM_LM:
case E1000_DEV_ID_ICH10_D_BM_LF:
case E1000_DEV_ID_ICH10_D_BM_V:
mac->type = e1000_ich10lan;
break;
case E1000_DEV_ID_PCH_D_HV_DM:
case E1000_DEV_ID_PCH_D_HV_DC:
case E1000_DEV_ID_PCH_M_HV_LM:
case E1000_DEV_ID_PCH_M_HV_LC:
mac->type = e1000_pchlan;
break;
case E1000_DEV_ID_PCH2_LV_LM:
case E1000_DEV_ID_PCH2_LV_V:
mac->type = e1000_pch2lan;
break;
case E1000_DEV_ID_PCH_LPT_I217_LM:
case E1000_DEV_ID_PCH_LPT_I217_V:
case E1000_DEV_ID_PCH_LPTLP_I218_LM:
case E1000_DEV_ID_PCH_LPTLP_I218_V:
case E1000_DEV_ID_PCH_I218_LM2:
case E1000_DEV_ID_PCH_I218_V2:
case E1000_DEV_ID_PCH_I218_LM3:
case E1000_DEV_ID_PCH_I218_V3:
mac->type = e1000_pch_lpt;
break;
case E1000_DEV_ID_PCH_SPT_I219_LM:
case E1000_DEV_ID_PCH_SPT_I219_V:
case E1000_DEV_ID_PCH_SPT_I219_LM2:
case E1000_DEV_ID_PCH_SPT_I219_V2:
case E1000_DEV_ID_PCH_LBG_I219_LM3:
case E1000_DEV_ID_PCH_SPT_I219_LM4:
case E1000_DEV_ID_PCH_SPT_I219_V4:
case E1000_DEV_ID_PCH_SPT_I219_LM5:
case E1000_DEV_ID_PCH_SPT_I219_V5:
mac->type = e1000_pch_spt;
break;
case E1000_DEV_ID_PCH_CNP_I219_LM6:
case E1000_DEV_ID_PCH_CNP_I219_V6:
case E1000_DEV_ID_PCH_CNP_I219_LM7:
case E1000_DEV_ID_PCH_CNP_I219_V7:
case E1000_DEV_ID_PCH_ICP_I219_LM8:
case E1000_DEV_ID_PCH_ICP_I219_V8:
case E1000_DEV_ID_PCH_ICP_I219_LM9:
case E1000_DEV_ID_PCH_ICP_I219_V9:
case E1000_DEV_ID_PCH_CMP_I219_LM10:
case E1000_DEV_ID_PCH_CMP_I219_V10:
case E1000_DEV_ID_PCH_CMP_I219_LM11:
case E1000_DEV_ID_PCH_CMP_I219_V11:
case E1000_DEV_ID_PCH_CMP_I219_LM12:
case E1000_DEV_ID_PCH_CMP_I219_V12:
mac->type = e1000_pch_cnp;
break;
case E1000_DEV_ID_PCH_TGP_I219_LM13:
case E1000_DEV_ID_PCH_TGP_I219_V13:
case E1000_DEV_ID_PCH_TGP_I219_LM14:
case E1000_DEV_ID_PCH_TGP_I219_V14:
case E1000_DEV_ID_PCH_TGP_I219_LM15:
case E1000_DEV_ID_PCH_TGP_I219_V15:
mac->type = e1000_pch_tgp;
break;
case E1000_DEV_ID_PCH_ADP_I219_LM16:
case E1000_DEV_ID_PCH_ADP_I219_V16:
case E1000_DEV_ID_PCH_ADP_I219_LM17:
case E1000_DEV_ID_PCH_ADP_I219_V17:
mac->type = e1000_pch_adp;
break;
case E1000_DEV_ID_PCH_MTP_I219_LM18:
case E1000_DEV_ID_PCH_MTP_I219_V18:
case E1000_DEV_ID_PCH_MTP_I219_LM19:
case E1000_DEV_ID_PCH_MTP_I219_V19:
mac->type = e1000_pch_mtp;
break;
case E1000_DEV_ID_PCH_LNP_I219_LM20:
case E1000_DEV_ID_PCH_LNP_I219_V20:
case E1000_DEV_ID_PCH_LNP_I219_LM21:
case E1000_DEV_ID_PCH_LNP_I219_V21:
mac->type = e1000_pch_lnp;
break;
case E1000_DEV_ID_PCH_RPL_I219_LM22:
case E1000_DEV_ID_PCH_RPL_I219_V22:
case E1000_DEV_ID_PCH_RPL_I219_LM23:
case E1000_DEV_ID_PCH_RPL_I219_V23:
mac->type = e1000_pch_rpl;
break;
case E1000_DEV_ID_PCH_ARL_I219_LM24:
case E1000_DEV_ID_PCH_ARL_I219_V24:
mac->type = e1000_pch_arl;
break;
case E1000_DEV_ID_PCH_PTP_I219_LM25:
case E1000_DEV_ID_PCH_PTP_I219_V25:
case E1000_DEV_ID_PCH_PTP_I219_LM26:
case E1000_DEV_ID_PCH_PTP_I219_V26:
case E1000_DEV_ID_PCH_PTP_I219_LM27:
case E1000_DEV_ID_PCH_PTP_I219_V27:
mac->type = e1000_pch_ptp;
break;
case E1000_DEV_ID_PCH_NVL_I219_LM29:
case E1000_DEV_ID_PCH_NVL_I219_V29:
mac->type = e1000_pch_nvl;
break;
case E1000_DEV_ID_82575EB_COPPER:
case E1000_DEV_ID_82575EB_FIBER_SERDES:
case E1000_DEV_ID_82575GB_QUAD_COPPER:
mac->type = e1000_82575;
break;
case E1000_DEV_ID_82576:
case E1000_DEV_ID_82576_FIBER:
case E1000_DEV_ID_82576_SERDES:
case E1000_DEV_ID_82576_QUAD_COPPER:
case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
case E1000_DEV_ID_82576_NS:
case E1000_DEV_ID_82576_NS_SERDES:
case E1000_DEV_ID_82576_SERDES_QUAD:
mac->type = e1000_82576;
break;
case E1000_DEV_ID_82580_COPPER:
case E1000_DEV_ID_82580_FIBER:
case E1000_DEV_ID_82580_SERDES:
case E1000_DEV_ID_82580_SGMII:
case E1000_DEV_ID_82580_COPPER_DUAL:
case E1000_DEV_ID_82580_QUAD_FIBER:
case E1000_DEV_ID_DH89XXCC_SGMII:
case E1000_DEV_ID_DH89XXCC_SERDES:
case E1000_DEV_ID_DH89XXCC_BACKPLANE:
case E1000_DEV_ID_DH89XXCC_SFP:
mac->type = e1000_82580;
break;
case E1000_DEV_ID_I350_COPPER:
case E1000_DEV_ID_I350_FIBER:
case E1000_DEV_ID_I350_SERDES:
case E1000_DEV_ID_I350_SGMII:
case E1000_DEV_ID_I350_DA4:
mac->type = e1000_i350;
break;
case E1000_DEV_ID_I210_COPPER_FLASHLESS:
case E1000_DEV_ID_I210_SERDES_FLASHLESS:
case E1000_DEV_ID_I210_COPPER:
case E1000_DEV_ID_I210_COPPER_OEM1:
case E1000_DEV_ID_I210_COPPER_IT:
case E1000_DEV_ID_I210_FIBER:
case E1000_DEV_ID_I210_SERDES:
case E1000_DEV_ID_I210_SGMII:
mac->type = e1000_i210;
break;
case E1000_DEV_ID_I211_COPPER:
mac->type = e1000_i211;
break;
case E1000_DEV_ID_82576_VF:
case E1000_DEV_ID_82576_VF_HV:
mac->type = e1000_vfadapt;
break;
case E1000_DEV_ID_I350_VF:
case E1000_DEV_ID_I350_VF_HV:
mac->type = e1000_vfadapt_i350;
break;
case E1000_DEV_ID_I354_BACKPLANE_1GBPS:
case E1000_DEV_ID_I354_SGMII:
case E1000_DEV_ID_I354_BACKPLANE_2_5GBPS:
mac->type = e1000_i354;
break;
default:
ret_val = -E1000_ERR_MAC_INIT;
break;
}
return ret_val;
}
s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
{
s32 ret_val;
ret_val = e1000_set_mac_type(hw);
if (ret_val) {
DEBUGOUT("ERROR: MAC type could not be set properly.\n");
goto out;
}
if (!hw->hw_addr) {
DEBUGOUT("ERROR: Registers not mapped\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
e1000_init_mac_ops_generic(hw);
e1000_init_phy_ops_generic(hw);
e1000_init_nvm_ops_generic(hw);
e1000_init_mbx_ops_generic(hw);
switch (hw->mac.type) {
case e1000_82542:
e1000_init_function_pointers_82542(hw);
break;
case e1000_82543:
case e1000_82544:
e1000_init_function_pointers_82543(hw);
break;
case e1000_82540:
case e1000_82545:
case e1000_82545_rev_3:
case e1000_82546:
case e1000_82546_rev_3:
e1000_init_function_pointers_82540(hw);
break;
case e1000_82541:
case e1000_82541_rev_2:
case e1000_82547:
case e1000_82547_rev_2:
e1000_init_function_pointers_82541(hw);
break;
case e1000_82571:
case e1000_82572:
case e1000_82573:
case e1000_82574:
case e1000_82583:
e1000_init_function_pointers_82571(hw);
break;
case e1000_80003es2lan:
e1000_init_function_pointers_80003es2lan(hw);
break;
case e1000_ich8lan:
case e1000_ich9lan:
case e1000_ich10lan:
case e1000_pchlan:
case e1000_pch2lan:
case e1000_pch_lpt:
case e1000_pch_spt:
case e1000_pch_cnp:
case e1000_pch_tgp:
case e1000_pch_adp:
case e1000_pch_mtp:
case e1000_pch_lnp:
case e1000_pch_rpl:
case e1000_pch_arl:
case e1000_pch_ptp:
case e1000_pch_nvl:
e1000_init_function_pointers_ich8lan(hw);
break;
case e1000_82575:
case e1000_82576:
case e1000_82580:
case e1000_i350:
case e1000_i354:
e1000_init_function_pointers_82575(hw);
break;
case e1000_i210:
case e1000_i211:
e1000_init_function_pointers_i210(hw);
break;
case e1000_vfadapt:
e1000_init_function_pointers_vf(hw);
break;
case e1000_vfadapt_i350:
e1000_init_function_pointers_vf(hw);
break;
default:
DEBUGOUT("Hardware not supported\n");
ret_val = -E1000_ERR_CONFIG;
break;
}
if (!(ret_val) && init_device) {
ret_val = e1000_init_mac_params(hw);
if (ret_val)
goto out;
ret_val = e1000_init_nvm_params(hw);
if (ret_val)
goto out;
ret_val = e1000_init_phy_params(hw);
if (ret_val)
goto out;
ret_val = e1000_init_mbx_params(hw);
if (ret_val)
goto out;
}
out:
return ret_val;
}
s32 e1000_get_bus_info(struct e1000_hw *hw)
{
if (hw->mac.ops.get_bus_info)
return hw->mac.ops.get_bus_info(hw);
return E1000_SUCCESS;
}
void e1000_clear_vfta(struct e1000_hw *hw)
{
if (hw->mac.ops.clear_vfta)
hw->mac.ops.clear_vfta(hw);
}
void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
{
if (hw->mac.ops.write_vfta)
hw->mac.ops.write_vfta(hw, offset, value);
}
void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
u32 mc_addr_count)
{
if (hw->mac.ops.update_mc_addr_list)
hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
mc_addr_count);
}
s32 e1000_force_mac_fc(struct e1000_hw *hw)
{
return e1000_force_mac_fc_generic(hw);
}
s32 e1000_check_for_link(struct e1000_hw *hw)
{
if (hw->mac.ops.check_for_link)
return hw->mac.ops.check_for_link(hw);
return -E1000_ERR_CONFIG;
}
bool e1000_check_mng_mode(struct e1000_hw *hw)
{
if (hw->mac.ops.check_mng_mode)
return hw->mac.ops.check_mng_mode(hw);
return FALSE;
}
s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
{
return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
}
s32 e1000_reset_hw(struct e1000_hw *hw)
{
if (hw->mac.ops.reset_hw)
return hw->mac.ops.reset_hw(hw);
return -E1000_ERR_CONFIG;
}
s32 e1000_init_hw(struct e1000_hw *hw)
{
if (hw->mac.ops.init_hw)
return hw->mac.ops.init_hw(hw);
return -E1000_ERR_CONFIG;
}
s32 e1000_setup_link(struct e1000_hw *hw)
{
if (hw->mac.ops.setup_link)
return hw->mac.ops.setup_link(hw);
return -E1000_ERR_CONFIG;
}
s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
{
if (hw->mac.ops.get_link_up_info)
return hw->mac.ops.get_link_up_info(hw, speed, duplex);
return -E1000_ERR_CONFIG;
}
s32 e1000_setup_led(struct e1000_hw *hw)
{
if (hw->mac.ops.setup_led)
return hw->mac.ops.setup_led(hw);
return E1000_SUCCESS;
}
s32 e1000_cleanup_led(struct e1000_hw *hw)
{
if (hw->mac.ops.cleanup_led)
return hw->mac.ops.cleanup_led(hw);
return E1000_SUCCESS;
}
s32 e1000_blink_led(struct e1000_hw *hw)
{
if (hw->mac.ops.blink_led)
return hw->mac.ops.blink_led(hw);
return E1000_SUCCESS;
}
s32 e1000_id_led_init(struct e1000_hw *hw)
{
if (hw->mac.ops.id_led_init)
return hw->mac.ops.id_led_init(hw);
return E1000_SUCCESS;
}
s32 e1000_led_on(struct e1000_hw *hw)
{
if (hw->mac.ops.led_on)
return hw->mac.ops.led_on(hw);
return E1000_SUCCESS;
}
s32 e1000_led_off(struct e1000_hw *hw)
{
if (hw->mac.ops.led_off)
return hw->mac.ops.led_off(hw);
return E1000_SUCCESS;
}
void e1000_reset_adaptive(struct e1000_hw *hw)
{
e1000_reset_adaptive_generic(hw);
}
void e1000_update_adaptive(struct e1000_hw *hw)
{
e1000_update_adaptive_generic(hw);
}
s32 e1000_disable_pcie_master(struct e1000_hw *hw)
{
return e1000_disable_pcie_master_generic(hw);
}
void e1000_config_collision_dist(struct e1000_hw *hw)
{
if (hw->mac.ops.config_collision_dist)
hw->mac.ops.config_collision_dist(hw);
}
int e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
{
if (hw->mac.ops.rar_set)
return hw->mac.ops.rar_set(hw, addr, index);
return E1000_SUCCESS;
}
s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
{
if (hw->mac.ops.validate_mdi_setting)
return hw->mac.ops.validate_mdi_setting(hw);
return E1000_SUCCESS;
}
u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
{
return e1000_hash_mc_addr_generic(hw, mc_addr);
}
bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
{
return e1000_enable_tx_pkt_filtering_generic(hw);
}
s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
u16 offset, u8 *sum)
{
return e1000_mng_host_if_write_generic(hw, buffer, length, offset, sum);
}
s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
struct e1000_host_mng_command_header *hdr)
{
return e1000_mng_write_cmd_header_generic(hw, hdr);
}
s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
{
return e1000_mng_enable_host_if_generic(hw);
}
s32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr)
{
if (hw->mac.ops.set_obff_timer)
return hw->mac.ops.set_obff_timer(hw, itr);
return E1000_SUCCESS;
}
s32 e1000_check_reset_block(struct e1000_hw *hw)
{
if (hw->phy.ops.check_reset_block)
return hw->phy.ops.check_reset_block(hw);
return E1000_SUCCESS;
}
s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
{
if (hw->phy.ops.read_reg)
return hw->phy.ops.read_reg(hw, offset, data);
return E1000_SUCCESS;
}
s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
{
if (hw->phy.ops.write_reg)
return hw->phy.ops.write_reg(hw, offset, data);
return E1000_SUCCESS;
}
void e1000_release_phy(struct e1000_hw *hw)
{
if (hw->phy.ops.release)
hw->phy.ops.release(hw);
}
s32 e1000_acquire_phy(struct e1000_hw *hw)
{
if (hw->phy.ops.acquire)
return hw->phy.ops.acquire(hw);
return E1000_SUCCESS;
}
s32 e1000_cfg_on_link_up(struct e1000_hw *hw)
{
if (hw->phy.ops.cfg_on_link_up)
return hw->phy.ops.cfg_on_link_up(hw);
return E1000_SUCCESS;
}
s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
{
return e1000_read_kmrn_reg_generic(hw, offset, data);
}
s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
{
return e1000_write_kmrn_reg_generic(hw, offset, data);
}
s32 e1000_get_cable_length(struct e1000_hw *hw)
{
if (hw->phy.ops.get_cable_length)
return hw->phy.ops.get_cable_length(hw);
return E1000_SUCCESS;
}
s32 e1000_get_phy_info(struct e1000_hw *hw)
{
if (hw->phy.ops.get_info)
return hw->phy.ops.get_info(hw);
return E1000_SUCCESS;
}
s32 e1000_phy_hw_reset(struct e1000_hw *hw)
{
if (hw->phy.ops.reset)
return hw->phy.ops.reset(hw);
return E1000_SUCCESS;
}
s32 e1000_phy_commit(struct e1000_hw *hw)
{
if (hw->phy.ops.commit)
return hw->phy.ops.commit(hw);
return E1000_SUCCESS;
}
s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
{
if (hw->phy.ops.set_d0_lplu_state)
return hw->phy.ops.set_d0_lplu_state(hw, active);
return E1000_SUCCESS;
}
s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
{
if (hw->phy.ops.set_d3_lplu_state)
return hw->phy.ops.set_d3_lplu_state(hw, active);
return E1000_SUCCESS;
}
s32 e1000_read_mac_addr(struct e1000_hw *hw)
{
if (hw->mac.ops.read_mac_addr)
return hw->mac.ops.read_mac_addr(hw);
return e1000_read_mac_addr_generic(hw);
}
s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
{
return e1000_read_pba_string_generic(hw, pba_num, pba_num_size);
}
s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
{
return e1000_read_pba_length_generic(hw, pba_num_size);
}
s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
{
if (hw->nvm.ops.validate)
return hw->nvm.ops.validate(hw);
return -E1000_ERR_CONFIG;
}
s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
{
if (hw->nvm.ops.update)
return hw->nvm.ops.update(hw);
return -E1000_ERR_CONFIG;
}
void e1000_reload_nvm(struct e1000_hw *hw)
{
if (hw->nvm.ops.reload)
hw->nvm.ops.reload(hw);
}
s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{
if (hw->nvm.ops.read)
return hw->nvm.ops.read(hw, offset, words, data);
return -E1000_ERR_CONFIG;
}
s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{
if (hw->nvm.ops.write)
return hw->nvm.ops.write(hw, offset, words, data);
return E1000_SUCCESS;
}
s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
u8 data)
{
return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
}
void e1000_power_up_phy(struct e1000_hw *hw)
{
if (hw->phy.ops.power_up)
hw->phy.ops.power_up(hw);
e1000_setup_link(hw);
}
void e1000_power_down_phy(struct e1000_hw *hw)
{
if (hw->phy.ops.power_down)
hw->phy.ops.power_down(hw);
}
void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw)
{
if (hw->mac.ops.power_up_serdes)
hw->mac.ops.power_up_serdes(hw);
}
void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
{
if (hw->mac.ops.shutdown_serdes)
hw->mac.ops.shutdown_serdes(hw);
}