ixgbe: add array of MAC type dependent values
Subsystems (2)
PATCH 1/1 ixgbe: add array of MAC type dependent values
Some of the register addresses and format where unfortunately changed between MAC types. To get around this we add a const u32 *mvals pointer to the ixgbe_hw struct to point to an array of mac-type-dependent values. These can include register offsets, masks, whatever can be in a u32. When the ixgbe_hw struct is initialized, a pointer to the appropriate array must be set.
Signed-off-by Don Skidmore <[email protected]>
--- drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 1 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | 7 - drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 59 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 2 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 6 - drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 43 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 44 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 246 ++++++++++++++++++---- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 41 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 12 + 10 files changed, 328 insertions(+), 133 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +1 -0
@@ -1234,4 +1234,5 @@ struct ixgbe_info ixgbe_82598_info = { .mac_ops = &mac_ops_82598, .eeprom_ops = &eeprom_ops_82598, .phy_ops = &phy_ops_82598, + .mvals = ixgbe_mvals_8259X, };
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +4 -3
@@ -71,7 +71,7 @@ bool ixgbe_mng_enabled(struct ixgbe_hw *hw) {u32 fwsm, manc, factps; - fwsm =IXGBE_READ_REG (hw,IXGBE_FWSM ); + fwsm =IXGBE_READ_REG (hw,IXGBE_FWSM (hw));if ((fwsm &IXGBE_FWSM_MODE_MASK ) !=IXGBE_FWSM_FW_MODE_PT )return false;
@@ -79,7 +79,7 @@ bool ixgbe_mng_enabled(struct ixgbe_hw *hw)if (!(manc &IXGBE_MANC_RCV_TCO_EN ))return false; - factps =IXGBE_READ_REG (hw,IXGBE_FACTPS ); + factps =IXGBE_READ_REG (hw,IXGBE_FACTPS (hw));if (factps &IXGBE_FACTPS_MNGCG )return false;
@@ -510,7 +510,7 @@ static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw) hw->eeprom.ops.read (hw,IXGBE_EEPROM_CTRL_2 , &ee_ctrl_2);/* Check to see if MNG FW could be enabled */ - fwsm =IXGBE_READ_REG (hw,IXGBE_FWSM ); + fwsm =IXGBE_READ_REG (hw,IXGBE_FWSM (hw)); if (((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT) && !hw->wol_enabled &&
@@ -2376,4 +2376,5 @@ struct ixgbe_info ixgbe_82599_info = { .eeprom_ops = &eeprom_ops_82599, .phy_ops = &phy_ops_82599, .mbx_ops = &mbx_ops_generic, + .mvals = ixgbe_mvals_8259X, };
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +32 -27
204 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +2 -0
@@ -118,6 +118,8 @@ bool ixgbe_mng_enabled(struct ixgbe_hw *hw);void ixgbe_set_rxpba_generic (struct ixgbe_hw *hw,int num_pb,u32 headroom,int strategy); +extern const u32 ixgbe_mvals_8259X[IXGBE_MVALS_IDX_LIMIT ]; +#define IXGBE_I2C_THERMAL_SENSOR_ADDR 0xF8#define IXGBE_EMC_INTERNAL_DATA 0x00#define IXGBE_EMC_INTERNAL_THERM_LIMIT 0x20
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +3 -3
@@ -470,16 +470,16 @@ static void ixgbe_get_regs(struct net_device *netdev, regs_buff[7 ] =IXGBE_READ_REG (hw,IXGBE_TCPTIMER );/* NVM Register */ - regs_buff[8 ] =IXGBE_READ_REG (hw,IXGBE_EEC ); + regs_buff[8 ] =IXGBE_READ_REG (hw,IXGBE_EEC (hw)); regs_buff[9 ] =IXGBE_READ_REG (hw,IXGBE_EERD ); - regs_buff[10 ] =IXGBE_READ_REG (hw,IXGBE_FLA ); + regs_buff[10 ] =IXGBE_READ_REG (hw,IXGBE_FLA (hw)); regs_buff[11 ] =IXGBE_READ_REG (hw,IXGBE_EEMNGCTL ); regs_buff[12 ] =IXGBE_READ_REG (hw,IXGBE_EEMNGDATA ); regs_buff[13 ] =IXGBE_READ_REG (hw,IXGBE_FLMNGCTL ); regs_buff[14 ] =IXGBE_READ_REG (hw,IXGBE_FLMNGDATA ); regs_buff[15 ] =IXGBE_READ_REG (hw,IXGBE_FLMNGCNT ); regs_buff[16 ] =IXGBE_READ_REG (hw,IXGBE_FLOP ); - regs_buff[17 ] =IXGBE_READ_REG (hw,IXGBE_GRC ); + regs_buff[17 ] =IXGBE_READ_REG (hw,IXGBE_GRC (hw));/* Interrupt */ /* don't read EICR because it can clear interrupt causes, instead
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +24 -19
137 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +22 -22
135 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +206 -40
343 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +23 -18
125 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +11 -1
@@ -90,7 +90,7 @@ static s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw) eeprom->semaphore_delay =10 ; eeprom->type = ixgbe_flash; - eec =IXGBE_READ_REG (hw,IXGBE_EEC ); + eec =IXGBE_READ_REG (hw,IXGBE_EEC (hw)); eeprom_size = (u16)((eec &IXGBE_EEC_SIZE ) >>IXGBE_EEC_SIZE_SHIFT ); eeprom->word_size = 1 << (eeprom_size +
@@ -1541,6 +1541,14 @@ static struct ixgbe_phy_operations phy_ops_X550EM_x = { .setup_link = NULL, /* defined later */ }; +static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT ] = { +IXGBE_MVALS_INIT (X550 ) +}; + +static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT ] = { +IXGBE_MVALS_INIT (X550EM_x) +}; +struct ixgbe_info ixgbe_X550_info = { .mac = ixgbe_mac_X550, .get_invariants = &ixgbe_get_invariants_X540,
@@ -1548,6 +1556,7 @@ struct ixgbe_info ixgbe_X550_info = { .eeprom_ops = &eeprom_ops_X550, .phy_ops = &phy_ops_X550, .mbx_ops = &mbx_ops_generic, + .mvals = ixgbe_mvals_X550, };struct ixgbe_info ixgbe_X550EM_x_info = {
@@ -1557,4 +1566,5 @@ struct ixgbe_info ixgbe_X550EM_x_info = { .eeprom_ops = &eeprom_ops_X550EM_x, .phy_ops = &phy_ops_X550EM_x, .mbx_ops = &mbx_ops_generic, + .mvals = ixgbe_mvals_X550EM_x, };