Update IXGBE base driver
Subsystems (2)
PATCH v3 25/30 net/ixgbe/base: enable E610 device support
In reply to Anatoly BurakovFrom: Piotr Kwapulinski <[email protected]>
Add high level link management support for E610 device, as well as enable all code paths related to E610 initialization. This makes it so that E610 can be brought up using ixgbe driver.
--- drivers/net/ixgbe/base/ixgbe_82599.c | 7 +- drivers/net/ixgbe/base/ixgbe_api.c | 60 +- drivers/net/ixgbe/base/ixgbe_api.h | 7 +- drivers/net/ixgbe/base/ixgbe_common.c | 31 +- drivers/net/ixgbe/base/ixgbe_e610.c | 1077 ++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_e610.h | 19 + drivers/net/ixgbe/base/ixgbe_hv_vf.c | 5 +- drivers/net/ixgbe/base/ixgbe_mbx.c | 5 +- drivers/net/ixgbe/base/ixgbe_phy.c | 6 +- drivers/net/ixgbe/base/ixgbe_type.h | 6 + drivers/net/ixgbe/base/ixgbe_type_e610.h | 102 ++ 11 files changed, 1302 insertions(+), 23 deletions(-)
drivers/net/ixgbe/base/ixgbe_82599.c +5 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2001-2020 Intel Corporation +* Copyright(c) 2001-2024 Intel Corporation */ #include "ixgbe_type.h"
@@ -1389,7 +1389,8 @@ void ixgbe_set_fdir_drop_queue_82599(struct ixgbe_hw *hw, u8 dropqueue) fdirctrl |= (dropqueue <<IXGBE_FDIRCTRL_DROP_Q_SHIFT );if ((hw->mac.type == ixgbe_mac_X550) || (hw->mac.type == ixgbe_mac_X550EM_x) || - (hw->mac.type == ixgbe_mac_X550EM_a)) + (hw->mac.type == ixgbe_mac_X550EM_a) || + (hw->mac.type == ixgbe_mac_E610)) fdirctrl |=IXGBE_FDIRCTRL_DROP_NO_MATCH ; IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
@@ -1804,6 +1805,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,case ixgbe_mac_X550:case ixgbe_mac_X550EM_x:case ixgbe_mac_X550EM_a: +case ixgbe_mac_E610:IXGBE_WRITE_REG (hw,IXGBE_FDIRSCTPM ,0xFFFFFFFF );break ;default :
@@ -1827,6 +1829,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,case ixgbe_mac_X550:case ixgbe_mac_X550EM_x:case ixgbe_mac_X550EM_a: +case ixgbe_mac_E610:IXGBE_WRITE_REG (hw,IXGBE_FDIRSCTPM , ~fdirtcpm);break ;default :
drivers/net/ixgbe/base/ixgbe_api.c +58 -2
91 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_api.h +5 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2001-2020 Intel Corporation +* Copyright(c) 2001-2024 Intel Corporation */ #ifndef _IXGBE_API_H_
@@ -18,6 +18,7 @@ extern s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw);extern s32 ixgbe_init_ops_X550EM (struct ixgbe_hw *hw);extern s32 ixgbe_init_ops_X550EM_x (struct ixgbe_hw *hw);extern s32 ixgbe_init_ops_X550EM_a (struct ixgbe_hw *hw); +extern s32 ixgbe_init_ops_E610 (struct ixgbe_hw *hw);extern s32 ixgbe_init_ops_vf (struct ixgbe_hw *hw);s32 ixgbe_set_mac_type (struct ixgbe_hw *hw);
@@ -105,6 +106,7 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw);s32 ixgbe_setup_fc (struct ixgbe_hw *hw);s32 ixgbe_set_fw_drv_ver (struct ixgbe_hw *hw,u8 maj,u8 min,u8 build,u8 ver,u16 len,char *driver_ver); +bool ixgbe_get_fw_tsam_mode (struct ixgbe_hw *hw);s32 ixgbe_get_thermal_sensor_data (struct ixgbe_hw *hw);s32 ixgbe_init_thermal_sensor_thresh (struct ixgbe_hw *hw);void ixgbe_set_mta (struct ixgbe_hw *hw,u8 *mc_addr);
@@ -192,5 +194,6 @@ void ixgbe_disable_rx(struct ixgbe_hw *hw);void ixgbe_enable_rx (struct ixgbe_hw *hw);s32 ixgbe_negotiate_fc (struct ixgbe_hw *hw,u32 adv_reg,u32 lp_reg,u32 adv_sym,u32 adv_asm,u32 lp_sym,u32 lp_asm); - +s32 ixgbe_get_fw_version (struct ixgbe_hw *hw); +s32 ixgbe_get_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm);#endif /* _IXGBE_API_H_ */
drivers/net/ixgbe/base/ixgbe_common.c +19 -12
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2001-2020 Intel Corporation +* Copyright(c) 2001-2024 Intel Corporation */ #include "ixgbe_common.h"
@@ -61,6 +61,7 @@ s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw) ixgbe_validate_eeprom_checksum_generic; eeprom->ops.update_checksum = ixgbe_update_eeprom_checksum_generic; eeprom->ops.calc_checksum = ixgbe_calc_eeprom_checksum_generic; + eeprom->ops.read_pba_string = ixgbe_read_pba_string_generic;/* MAC */ mac->ops.init_hw = ixgbe_init_hw_generic;
@@ -146,6 +147,7 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)case IXGBE_DEV_ID_X550EM_A_SFP_N :case IXGBE_DEV_ID_X550EM_A_QSFP :case IXGBE_DEV_ID_X550EM_A_QSFP_N : +case IXGBE_DEV_ID_E610_SFP : supported = false;break ;default :
@@ -177,6 +179,8 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)case IXGBE_DEV_ID_X550EM_A_10G_T :case IXGBE_DEV_ID_X550EM_A_1G_T :case IXGBE_DEV_ID_X550EM_A_1G_T_L : +case IXGBE_DEV_ID_E610_10G_T : +case IXGBE_DEV_ID_E610_2_5G_T : supported = true;break ;default :
@@ -577,17 +581,11 @@ s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw) } } -if (hw->mac.type == ixgbe_mac_X550 || hw->mac.type == ixgbe_mac_X540) { +if (hw->mac.type == ixgbe_mac_X540 || + hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_E610) {if (hw->phy.id ==0 )ixgbe_identify_phy (hw); - hw->phy.ops.read_reg (hw,IXGBE_PCRC8ECL , -IXGBE_MDIO_PCS_DEV_TYPE , &i); - hw->phy.ops.read_reg (hw,IXGBE_PCRC8ECH , -IXGBE_MDIO_PCS_DEV_TYPE , &i); - hw->phy.ops.read_reg (hw,IXGBE_LDPCECL , -IXGBE_MDIO_PCS_DEV_TYPE , &i); - hw->phy.ops.read_reg (hw,IXGBE_LDPCECH , -IXGBE_MDIO_PCS_DEV_TYPE , &i); }return IXGBE_SUCCESS ;
@@ -998,6 +996,9 @@ void ixgbe_set_pci_config_data_generic(struct ixgbe_hw *hw, u16 link_status)case IXGBE_PCI_LINK_SPEED_8000 : hw->bus.speed = ixgbe_bus_speed_8000;break ; +case IXGBE_PCI_LINK_SPEED_16000 : + hw->bus.speed = ixgbe_bus_speed_16000; +break ;default : hw->bus.speed = ixgbe_bus_speed_unknown;break ;
@@ -1020,7 +1021,9 @@ s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)DEBUGFUNC ("ixgbe_get_bus_info_generic" );/* Get the negotiated link width and speed from PCI config space */ - link_status =IXGBE_READ_PCIE_WORD (hw,IXGBE_PCI_LINK_STATUS ); + link_status =IXGBE_READ_PCIE_WORD (hw, hw->mac.type == ixgbe_mac_E610 ? +IXGBE_PCI_LINK_STATUS_E610 : +IXGBE_PCI_LINK_STATUS );ixgbe_set_pci_config_data_generic (hw, link_status);
@@ -3653,6 +3656,10 @@ u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw) pcie_offset =IXGBE_PCIE_MSIX_82599_CAPS ; max_msix_count =IXGBE_MAX_MSIX_VECTORS_82599 ;break ; +case ixgbe_mac_E610: + pcie_offset =IXGBE_PCIE_MSIX_E610_CAPS ; + max_msix_count =IXGBE_MAX_MSIX_VECTORS_82599 ; +break ;default :return msix_count; }
@@ -4228,7 +4235,7 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,break ;case IXGBE_LINKS_SPEED_100_82599 : *speed =IXGBE_LINK_SPEED_100_FULL ; -if (hw->mac.type == ixgbe_mac_X550) { +if (hw->mac.type == ixgbe_mac_X550 || hw->mac.type == ixgbe_mac_E610) {if (links_reg &IXGBE_LINKS_SPEED_NON_STD ) *speed =IXGBE_LINK_SPEED_5GB_FULL ; }
drivers/net/ixgbe/base/ixgbe_e610.c +1077 -0
1,134 lines not on this page · raw message
drivers/net/ixgbe/base/ixgbe_e610.h +19 -0
@@ -18,6 +18,8 @@ s32 ixgbe_aci_get_event(struct ixgbe_hw *hw, struct ixgbe_aci_event *e,void ixgbe_fill_dflt_direct_cmd_desc (struct ixgbe_aci_desc *desc,u16 opcode); +s32 ixgbe_aci_get_fw_ver (struct ixgbe_hw *hw); +s32 ixgbe_aci_send_driver_ver (struct ixgbe_hw *hw,struct ixgbe_driver_ver *dv);s32 ixgbe_acquire_res (struct ixgbe_hw *hw,enum ixgbe_aci_res_ids res,enum ixgbe_aci_res_access_type access,u32 timeout);void ixgbe_release_res (struct ixgbe_hw *hw,enum ixgbe_aci_res_ids res);
@@ -67,7 +69,10 @@ s32 ixgbe_aci_read_nvm(struct ixgbe_hw *hw, u16 module_typeid, u32 offset,s32 ixgbe_nvm_validate_checksum (struct ixgbe_hw *hw);s32 ixgbe_nvm_recalculate_checksum (struct ixgbe_hw *hw); +s32 ixgbe_get_inactive_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm); +s32 ixgbe_get_active_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm);s32 ixgbe_read_sr_word_aci (struct ixgbe_hw *hw,u16 offset,u16 *data); +s32 ixgbe_read_sr_buf_aci (struct ixgbe_hw *hw,u16 offset,u16 *words,u16 *data);s32 ixgbe_read_flat_nvm (struct ixgbe_hw *hw,u32 offset,u32 *length,u8 *data,bool read_shadow_ram); s32 ixgbe_aci_get_internal_data(struct ixgbe_hw *hw, u16 cluster_id,
@@ -75,7 +80,11 @@ s32 ixgbe_aci_get_internal_data(struct ixgbe_hw *hw, u16 cluster_id, u16 buf_size, u16 *ret_buf_size, u16 *ret_next_cluster, u16 *ret_next_table, u32 *ret_next_index); +/* E610 operations */ +s32 ixgbe_reset_hw_E610 (struct ixgbe_hw *hw); +s32 ixgbe_start_hw_E610 (struct ixgbe_hw *hw);enum ixgbe_media_type ixgbe_get_media_type_E610 (struct ixgbe_hw *hw); +u64 ixgbe_get_supported_physical_layer_E610 (struct ixgbe_hw *hw);s32 ixgbe_setup_link_E610 (struct ixgbe_hw *hw,ixgbe_link_speed speed,bool autoneg_wait); s32 ixgbe_check_link_E610(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
@@ -88,7 +97,12 @@ s32 ixgbe_cfg_phy_fc(struct ixgbe_hw *hw, enum ixgbe_fc_mode req_mode);s32 ixgbe_setup_fc_E610 (struct ixgbe_hw *hw);void ixgbe_fc_autoneg_E610 (struct ixgbe_hw *hw); +s32 ixgbe_set_fw_drv_ver_E610 (struct ixgbe_hw *hw,u8 maj,u8 min,u8 build, +u8 sub,u16 len,const char *driver_ver);void ixgbe_disable_rx_E610 (struct ixgbe_hw *hw); +s32 ixgbe_setup_eee_E610 (struct ixgbe_hw *hw,bool enable_eee); +bool ixgbe_fw_recovery_mode_E610 (struct ixgbe_hw *hw); +bool ixgbe_get_fw_tsam_mode_E610 (struct ixgbe_hw *hw);s32 ixgbe_init_phy_ops_E610 (struct ixgbe_hw *hw);s32 ixgbe_identify_phy_E610 (struct ixgbe_hw *hw);s32 ixgbe_identify_module_E610 (struct ixgbe_hw *hw);
@@ -104,7 +118,12 @@ s32 ixgbe_write_i2c_eeprom_E610(struct ixgbe_hw *hw, u8 byte_offset,s32 ixgbe_check_overtemp_E610 (struct ixgbe_hw *hw);s32 ixgbe_set_phy_power_E610 (struct ixgbe_hw *hw,bool on);s32 ixgbe_enter_lplu_E610 (struct ixgbe_hw *hw); +s32 ixgbe_init_eeprom_params_E610 (struct ixgbe_hw *hw);s32 ixgbe_read_ee_aci_E610 (struct ixgbe_hw *hw,u16 offset,u16 *data); +s32 ixgbe_read_ee_aci_buffer_E610 (struct ixgbe_hw *hw,u16 offset, +u16 words,u16 *data); +s32 ixgbe_calc_eeprom_checksum_E610 (struct ixgbe_hw *hw);s32 ixgbe_validate_eeprom_checksum_E610 (struct ixgbe_hw *hw,u16 *checksum_val); +s32 ixgbe_read_pba_string_E610 (struct ixgbe_hw *hw,u8 *pba_num,u32 pba_num_size);#endif /* _IXGBE_E610_H_ */
drivers/net/ixgbe/base/ixgbe_hv_vf.c +3 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2001-2020 Intel Corporation +* Copyright(c) 2001-2024 Intel Corporation */ #include "ixgbe_vf.h"
@@ -136,7 +136,8 @@ static s32 ixgbevf_hv_check_mac_link_vf(struct ixgbe_hw *hw,break ;case IXGBE_LINKS_SPEED_100_82599 : *speed =IXGBE_LINK_SPEED_100_FULL ; -if (hw->mac.type == ixgbe_mac_X550) { +if (hw->mac.type == ixgbe_mac_X550 || + hw->mac.type == ixgbe_mac_E610) {if (links_reg &IXGBE_LINKS_SPEED_NON_STD ) *speed =IXGBE_LINK_SPEED_5GB_FULL ; }
drivers/net/ixgbe/base/ixgbe_mbx.c +4 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2001-2020 Intel Corporation +* Copyright(c) 2001-2024 Intel Corporation */ #include "ixgbe_type.h"
@@ -777,6 +777,7 @@ STATIC s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_id)case ixgbe_mac_X550EM_x:case ixgbe_mac_X550EM_a:case ixgbe_mac_X540: +case ixgbe_mac_E610: vflre =IXGBE_READ_REG (hw,IXGBE_PFVFLREC (index));break ;default :
@@ -1061,6 +1062,7 @@ void ixgbe_init_mbx_params_pf(struct ixgbe_hw *hw) hw->mac.type != ixgbe_mac_X550 && hw->mac.type != ixgbe_mac_X550EM_x && hw->mac.type != ixgbe_mac_X550EM_a && + hw->mac.type != ixgbe_mac_E610 && hw->mac.type != ixgbe_mac_X540) return;
@@ -1103,6 +1105,7 @@ void ixgbe_upgrade_mbx_params_pf(struct ixgbe_hw *hw, u16 vf_id) hw->mac.type != ixgbe_mac_X550 && hw->mac.type != ixgbe_mac_X550EM_x && hw->mac.type != ixgbe_mac_X550EM_a && + hw->mac.type != ixgbe_mac_E610 && hw->mac.type != ixgbe_mac_X540) return;
drivers/net/ixgbe/base/ixgbe_phy.c +4 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2001-2020 Intel Corporation +* Copyright(c) 2001-2024 Intel Corporation */ #include "ixgbe_api.h"
@@ -800,7 +800,8 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)IXGBE_MDIO_AUTO_NEG_DEV_TYPE , &autoneg_reg); -if (hw->mac.type == ixgbe_mac_X550) { +if ((hw->mac.type == ixgbe_mac_X550) || + (hw->mac.type == ixgbe_mac_E610)) {/* Set or unset auto-negotiation 5G advertisement */ autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE ; if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) &&
@@ -915,6 +916,7 @@ static s32 ixgbe_get_copper_speeds_supported(struct ixgbe_hw *hw)switch (hw->mac.type) {case ixgbe_mac_X550: +case ixgbe_mac_E610: hw->phy.speeds_supported |=IXGBE_LINK_SPEED_2_5GB_FULL ; hw->phy.speeds_supported |=IXGBE_LINK_SPEED_5GB_FULL ;break ;
drivers/net/ixgbe/base/ixgbe_type.h +6 -0
@@ -2511,6 +2511,7 @@ enum {#define IXGBE_PCI_LINK_SPEED_2500 0x1#define IXGBE_PCI_LINK_SPEED_5000 0x2#define IXGBE_PCI_LINK_SPEED_8000 0x3 +#define IXGBE_PCI_LINK_SPEED_16000 0x4#define IXGBE_PCI_HEADER_TYPE_REGISTER 0x0E#define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80#define IXGBE_PCI_DEVICE_CONTROL2_16ms 0x0005
@@ -3797,6 +3798,7 @@ enum ixgbe_bus_speed { ixgbe_bus_speed_2500 =2500 , ixgbe_bus_speed_5000 =5000 , ixgbe_bus_speed_8000 =8000 , + ixgbe_bus_speed_16000 =16000 , ixgbe_bus_speed_reserved };
@@ -3941,6 +3943,7 @@ struct ixgbe_eeprom_operations {s32 (*validate_checksum)(struct ixgbe_hw *,u16 *);s32 (*update_checksum)(struct ixgbe_hw *);s32 (*calc_checksum)(struct ixgbe_hw *); +s32 (*read_pba_string)(struct ixgbe_hw *,u8 *,u32 ); };struct ixgbe_mac_operations {
@@ -4047,6 +4050,9 @@ struct ixgbe_mac_operations {void (*mdd_event)(struct ixgbe_hw *hw,u32 *vf_bitmap);void (*restore_mdd_vf)(struct ixgbe_hw *hw,u32 vf);bool (*fw_recovery_mode)(struct ixgbe_hw *hw); +bool (*get_fw_tsam_mode)(struct ixgbe_hw *hw); +s32 (*get_fw_version)(struct ixgbe_hw *hw); +s32 (*get_nvm_version)(struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm); };struct ixgbe_phy_operations {
drivers/net/ixgbe/base/ixgbe_type_e610.h +102 -0
128 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v3 26/30 net/ixgbe/base: add i2c and GPIO read/write API
In reply to Anatoly BurakovThe E610 hardware supports reading/writing values from/to GPIO and I2C registers through Admin Command Interface. Add API's to do so.
--- drivers/net/ixgbe/base/ixgbe_e610.c | 158 ++++++++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_e610.h | 10 ++ 2 files changed, 168 insertions(+)
drivers/net/ixgbe/base/ixgbe_e610.c +158 -0
@@ -1859,6 +1859,164 @@ s32 ixgbe_find_netlist_node(struct ixgbe_hw *hw, u8 node_type_ctx,return IXGBE_ERR_NOT_SUPPORTED ; } +/** +* ixgbe_aci_read_i2c - read I2C register value +* @hw: pointer to the hw struct +* @topo_addr: topology address for a device to communicate with +* @bus_addr: 7-bit I2C bus address +* @addr: I2C memory address (I2C offset) with up to 16 bits +* @params: I2C parameters: bit [7] - Repeated start, +* bits [6:5] data offset size, +* bit [4] - I2C address type, bits [3:0] - data size +* to read (0-16 bytes) +* @data: pointer to data (0 to 16 bytes) to be read from the I2C device +* +* Read the value of the I2C pin register using ACI command (0x06E2). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_aci_read_i2c (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_addr topo_addr, +u16 bus_addr,__le16 addr,u8 params,u8 *data) +{ +struct ixgbe_aci_desc desc = {0 }; +struct ixgbe_aci_cmd_i2c *cmd; +u8 data_size; +s32 status; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_read_i2c); + cmd = &desc.params.read_write_i2c; + +if (!data) +return IXGBE_ERR_PARAM ; + + data_size = (params &IXGBE_ACI_I2C_DATA_SIZE_M ) >> +IXGBE_ACI_I2C_DATA_SIZE_S ; + + cmd->i2c_bus_addr =IXGBE_CPU_TO_LE16 (bus_addr); + cmd->topo_addr = topo_addr; + cmd->i2c_params = params; + cmd->i2c_addr = addr; + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +if (!status) { +struct ixgbe_aci_cmd_read_i2c_resp *resp; +u8 i; + + resp = &desc.params.read_i2c_resp; +for (i =0 ; i < data_size; i++) { + *data = resp->i2c_data[i]; + data++; + } + } + +return status; +} + +/** +* ixgbe_aci_write_i2c - write a value to I2C register +* @hw: pointer to the hw struct +* @topo_addr: topology address for a device to communicate with +* @bus_addr: 7-bit I2C bus address +* @addr: I2C memory address (I2C offset) with up to 16 bits +* @params: I2C parameters: bit [4] - I2C address type, bits [3:0] - data size +* to write (0-7 bytes) +* @data: pointer to data (0 to 4 bytes) to be written to the I2C device +* +* Write a value to the I2C pin register using ACI command (0x06E3). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_aci_write_i2c (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_addr topo_addr, +u16 bus_addr,__le16 addr,u8 params,u8 *data) +{ +struct ixgbe_aci_desc desc = {0 }; +struct ixgbe_aci_cmd_i2c *cmd; +u8 i, data_size; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_write_i2c); + cmd = &desc.params.read_write_i2c; + + data_size = (params &IXGBE_ACI_I2C_DATA_SIZE_M ) >> +IXGBE_ACI_I2C_DATA_SIZE_S ; + +/* data_size limited to 4 */ +if (data_size >4 ) +return IXGBE_ERR_PARAM ; + + cmd->i2c_bus_addr =IXGBE_CPU_TO_LE16 (bus_addr); + cmd->topo_addr = topo_addr; + cmd->i2c_params = params; + cmd->i2c_addr = addr; + +for (i =0 ; i < data_size; i++) { + cmd->i2c_data[i] = *data; + data++; + } + +return ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +} + +/** +* ixgbe_aci_set_gpio - set GPIO pin state +* @hw: pointer to the hw struct +* @gpio_ctrl_handle: GPIO controller node handle +* @pin_idx: IO Number of the GPIO that needs to be set +* @value: SW provide IO value to set in the LSB +* +* Set the GPIO pin state that is a part of the topology +* using ACI command (0x06EC). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_aci_set_gpio (struct ixgbe_hw *hw,u16 gpio_ctrl_handle,u8 pin_idx, +bool value) +{ +struct ixgbe_aci_cmd_gpio *cmd; +struct ixgbe_aci_desc desc; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_set_gpio); + cmd = &desc.params.read_write_gpio; + cmd->gpio_ctrl_handle =IXGBE_CPU_TO_LE16 (gpio_ctrl_handle); + cmd->gpio_num = pin_idx; + cmd->gpio_val = value ?1 :0 ; + +return ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +} + +/** +* ixgbe_aci_get_gpio - get GPIO pin state +* @hw: pointer to the hw struct +* @gpio_ctrl_handle: GPIO controller node handle +* @pin_idx: IO Number of the GPIO that needs to be set +* @value: IO value read +* +* Get the value of a GPIO signal which is part of the topology +* using ACI command (0x06ED). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_aci_get_gpio (struct ixgbe_hw *hw,u16 gpio_ctrl_handle,u8 pin_idx, +bool *value) +{ +struct ixgbe_aci_cmd_gpio *cmd; +struct ixgbe_aci_desc desc; +s32 status; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_get_gpio); + cmd = &desc.params.read_write_gpio; + cmd->gpio_ctrl_handle =IXGBE_CPU_TO_LE16 (gpio_ctrl_handle); + cmd->gpio_num = pin_idx; + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +if (status) +return status; + + *value = !!cmd->gpio_val; +return IXGBE_SUCCESS ; +} +/** * ixgbe_aci_sff_eeprom - read/write SFF EEPROM * @hw: pointer to the HW struct
drivers/net/ixgbe/base/ixgbe_e610.h +10 -0
@@ -55,6 +55,16 @@ s32 ixgbe_aci_get_netlist_node_pin(struct ixgbe_hw *hw, u16 *node_handle);s32 ixgbe_find_netlist_node (struct ixgbe_hw *hw,u8 node_type_ctx,u8 node_part_number,u16 *node_handle); +s32 ixgbe_aci_read_i2c (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_addr topo_addr, +u16 bus_addr,__le16 addr,u8 params,u8 *data); +s32 ixgbe_aci_write_i2c (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_addr topo_addr, +u16 bus_addr,__le16 addr,u8 params,u8 *data); +s32 ixgbe_aci_set_gpio (struct ixgbe_hw *hw,u16 gpio_ctrl_handle,u8 pin_idx, +bool value); +s32 ixgbe_aci_get_gpio (struct ixgbe_hw *hw,u16 gpio_ctrl_handle,u8 pin_idx, +bool *value);s32 ixgbe_aci_sff_eeprom (struct ixgbe_hw *hw,u16 lport,u8 bus_addr,u16 mem_addr,u8 page,u8 page_bank_ctrl,u8 *data,u8 length,bool write);
Signature · 1 line
2.43.0
PATCH v3 27/30 net/ixgbe/base: add NVM init and populate
In reply to Anatoly BurakovThe driver can store NVM settings in its internal structures. Add functions to initialize and populate these structures through the Admin Command Interface.
--- drivers/net/ixgbe/base/ixgbe_e610.c | 245 ++++++++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_e610.h | 2 + 2 files changed, 247 insertions(+)
drivers/net/ixgbe/base/ixgbe_e610.c +245 -0
@@ -2528,6 +2528,251 @@ s32 ixgbe_get_active_nvm_ver(struct ixgbe_hw *hw, struct ixgbe_nvm_info *nvm)return ixgbe_get_nvm_ver_info (hw,IXGBE_ACTIVE_FLASH_BANK , nvm); } +/** +* ixgbe_read_sr_pointer - Read the value of a Shadow RAM pointer word +* @hw: pointer to the HW structure +* @offset: the word offset of the Shadow RAM word to read +* @pointer: pointer value read from Shadow RAM +* +* Read the given Shadow RAM word, and convert it to a pointer value specified +* in bytes. This function assumes the specified offset is a valid pointer +* word. +* +* Each pointer word specifies whether it is stored in word size or 4KB +* sector size by using the highest bit. The reported pointer value will be in +* bytes, intended for flat NVM reads. +* +* Return: the exit code of the operation. +*/ +static s32 ixgbe_read_sr_pointer (struct ixgbe_hw *hw,u16 offset,u32 *pointer) +{ +s32 status; +u16 value; + + status =ixgbe_read_ee_aci_E610 (hw, offset, &value); +if (status) +return status; + +/* Determine if the pointer is in 4KB or word units */ +if (value &IXGBE_SR_NVM_PTR_4KB_UNITS ) + *pointer = (value & ~IXGBE_SR_NVM_PTR_4KB_UNITS ) *4 *1024 ; +else + *pointer = value *2 ; + +return IXGBE_SUCCESS ; +} + +/** +* ixgbe_read_sr_area_size - Read an area size from a Shadow RAM word +* @hw: pointer to the HW structure +* @offset: the word offset of the Shadow RAM to read +* @size: size value read from the Shadow RAM +* +* Read the given Shadow RAM word, and convert it to an area size value +* specified in bytes. This function assumes the specified offset is a valid +* area size word. +* +* Each area size word is specified in 4KB sector units. This function reports +* the size in bytes, intended for flat NVM reads. +* +* Return: the exit code of the operation. +*/ +static s32 ixgbe_read_sr_area_size (struct ixgbe_hw *hw,u16 offset,u32 *size) +{ +s32 status; +u16 value; + + status =ixgbe_read_ee_aci_E610 (hw, offset, &value); +if (status) +return status; + +/* Area sizes are always specified in 4KB units */ + *size = value *4 *1024 ; + +return IXGBE_SUCCESS ; +} + +/** +* ixgbe_discover_flash_size - Discover the available flash size. +* @hw: pointer to the HW struct +* +* The device flash could be up to 16MB in size. However, it is possible that +* the actual size is smaller. Use bisection to determine the accessible size +* of flash memory. +* +* Return: the exit code of the operation. +*/ +static s32 ixgbe_discover_flash_size (struct ixgbe_hw *hw) +{ +u32 min_size =0 , max_size =IXGBE_ACI_NVM_MAX_OFFSET +1 ; +s32 status; + + status =ixgbe_acquire_nvm (hw,IXGBE_RES_READ ); +if (status) +return status; + +while ((max_size - min_size) >1 ) { +u32 offset = (max_size + min_size) /2 ; +u32 len =1 ; +u8 data; + + status =ixgbe_read_flat_nvm (hw, offset, &len, &data, false); +if (status ==IXGBE_ERR_ACI_ERROR && + hw->aci.last_status ==IXGBE_ACI_RC_EINVAL ) { + status =IXGBE_SUCCESS ; + max_size = offset; + }else if (!status) { + min_size = offset; + }else { +/* an unexpected error occurred */ + goto err_read_flat_nvm; + } + } + + hw->flash.flash_size = max_size; + +err_read_flat_nvm: +ixgbe_release_nvm (hw); + +return status; +} + +/** +* ixgbe_determine_active_flash_banks - Discover active bank for each module +* @hw: pointer to the HW struct +* +* Read the Shadow RAM control word and determine which banks are active for +* the NVM, OROM, and Netlist modules. Also read and calculate the associated +* pointer and size. These values are then cached into the ixgbe_flash_info +* structure for later use in order to calculate the correct offset to read +* from the active module. +* +* Return: the exit code of the operation. +*/ +static s32 ixgbe_determine_active_flash_banks (struct ixgbe_hw *hw) +{ +struct ixgbe_bank_info *banks = &hw->flash.banks; +u16 ctrl_word; +s32 status; + + status =ixgbe_read_ee_aci_E610 (hw,E610_SR_NVM_CTRL_WORD , &ctrl_word); +if (status) { +return status; + } + +/* Check that the control word indicates validity */ +if ((ctrl_word &IXGBE_SR_CTRL_WORD_1_M ) >>IXGBE_SR_CTRL_WORD_1_S != +IXGBE_SR_CTRL_WORD_VALID ) { +return IXGBE_ERR_CONFIG ; + } + +if (!(ctrl_word &IXGBE_SR_CTRL_WORD_NVM_BANK )) + banks->nvm_bank =IXGBE_1ST_FLASH_BANK ; +else + banks->nvm_bank =IXGBE_2ND_FLASH_BANK ; + +if (!(ctrl_word &IXGBE_SR_CTRL_WORD_OROM_BANK )) + banks->orom_bank =IXGBE_1ST_FLASH_BANK ; +else + banks->orom_bank =IXGBE_2ND_FLASH_BANK ; + +if (!(ctrl_word &IXGBE_SR_CTRL_WORD_NETLIST_BANK )) + banks->netlist_bank =IXGBE_1ST_FLASH_BANK ; +else + banks->netlist_bank =IXGBE_2ND_FLASH_BANK ; + + status =ixgbe_read_sr_pointer (hw,E610_SR_1ST_NVM_BANK_PTR , + &banks->nvm_ptr); +if (status) { +return status; + } + + status =ixgbe_read_sr_area_size (hw,E610_SR_NVM_BANK_SIZE , + &banks->nvm_size); +if (status) { +return status; + } + + status =ixgbe_read_sr_pointer (hw,E610_SR_1ST_OROM_BANK_PTR , + &banks->orom_ptr); +if (status) { +return status; + } + + status =ixgbe_read_sr_area_size (hw,E610_SR_OROM_BANK_SIZE , + &banks->orom_size); +if (status) { +return status; + } + + status =ixgbe_read_sr_pointer (hw,E610_SR_NETLIST_BANK_PTR , + &banks->netlist_ptr); +if (status) { +return status; + } + + status =ixgbe_read_sr_area_size (hw,E610_SR_NETLIST_BANK_SIZE , + &banks->netlist_size); +if (status) { +return status; + } + +return IXGBE_SUCCESS ; +} + +/** +* ixgbe_init_nvm - initializes NVM setting +* @hw: pointer to the HW struct +* +* Read and populate NVM settings such as Shadow RAM size, +* max_timeout, and blank_nvm_mode +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_init_nvm (struct ixgbe_hw *hw) +{ +struct ixgbe_flash_info *flash = &hw->flash; +u32 fla, gens_stat, status; +u8 sr_size; + +/* The SR size is stored regardless of the NVM programming mode +* as the blank mode may be used in the factory line. +*/ + gens_stat =IXGBE_READ_REG (hw,GLNVM_GENS ); + sr_size = (gens_stat &GLNVM_GENS_SR_SIZE_M ) >>GLNVM_GENS_SR_SIZE_S ; + +/* Switching to words (sr_size contains power of 2) */ + flash->sr_words =BIT (sr_size) *IXGBE_SR_WORDS_IN_1KB ; + +/* Check if we are in the normal or blank NVM programming mode */ + fla =IXGBE_READ_REG (hw,GLNVM_FLA ); +if (fla &GLNVM_FLA_LOCKED_M ) {/* Normal programming mode */ + flash->blank_nvm_mode = false; + }else { +/* Blank programming mode */ + flash->blank_nvm_mode = true; +return IXGBE_ERR_NVM_BLANK_MODE ; + } + + status =ixgbe_discover_flash_size (hw); +if (status) { +return status; + } + + status =ixgbe_determine_active_flash_banks (hw); +if (status) { +return status; + } + + status =ixgbe_get_nvm_ver_info (hw,IXGBE_ACTIVE_FLASH_BANK , + &flash->nvm); +if (status) { +return status; + } + +return IXGBE_SUCCESS ; +} +/** * ixgbe_read_sr_word_aci - Reads Shadow RAM via ACI * @hw: pointer to the HW structure
drivers/net/ixgbe/base/ixgbe_e610.h +2 -0
@@ -81,6 +81,8 @@ s32 ixgbe_nvm_recalculate_checksum(struct ixgbe_hw *hw);s32 ixgbe_get_inactive_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm);s32 ixgbe_get_active_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm); +s32 ixgbe_init_nvm (struct ixgbe_hw *hw); +s32 ixgbe_read_sr_word_aci (struct ixgbe_hw *hw,u16 offset,u16 *data);s32 ixgbe_read_sr_buf_aci (struct ixgbe_hw *hw,u16 offset,u16 *words,u16 *data); s32 ixgbe_read_flat_nvm(struct ixgbe_hw *hw, u32 offset, u32 *length,
Signature · 1 line
2.43.0
PATCH v3 28/30 net/ixgbe/base: alternate structure operations support
In reply to Anatoly BurakovAdd support for read/write/clear operations on alternate structure.
--- drivers/net/ixgbe/base/ixgbe_e610.c | 132 ++++++++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_e610.h | 9 ++ 2 files changed, 141 insertions(+)
drivers/net/ixgbe/base/ixgbe_e610.c +132 -0
@@ -2893,6 +2893,138 @@ s32 ixgbe_read_flat_nvm(struct ixgbe_hw *hw, u32 offset, u32 *length,return status; } +/** +* ixgbe_aci_alternate_write - write to alternate structure +* @hw: pointer to the hardware structure +* @reg_addr0: address of first dword to be written +* @reg_val0: value to be written under 'reg_addr0' +* @reg_addr1: address of second dword to be written +* @reg_val1: value to be written under 'reg_addr1' +* +* Write one or two dwords to alternate structure using ACI command (0x0900). +* Fields are indicated by 'reg_addr0' and 'reg_addr1' register numbers. +* +* Return: 0 on success and error code on failure. +*/ +s32 ixgbe_aci_alternate_write (struct ixgbe_hw *hw,u32 reg_addr0, +u32 reg_val0,u32 reg_addr1,u32 reg_val1) +{ +struct ixgbe_aci_cmd_read_write_alt_direct *cmd; +struct ixgbe_aci_desc desc; +s32 status; + + cmd = &desc.params.read_write_alt_direct; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_write_alt_direct); + cmd->dword0_addr =IXGBE_CPU_TO_LE32 (reg_addr0); + cmd->dword1_addr =IXGBE_CPU_TO_LE32 (reg_addr1); + cmd->dword0_value =IXGBE_CPU_TO_LE32 (reg_val0); + cmd->dword1_value =IXGBE_CPU_TO_LE32 (reg_val1); + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); + +return status; +} + +/** +* ixgbe_aci_alternate_read - read from alternate structure +* @hw: pointer to the hardware structure +* @reg_addr0: address of first dword to be read +* @reg_val0: pointer for data read from 'reg_addr0' +* @reg_addr1: address of second dword to be read +* @reg_val1: pointer for data read from 'reg_addr1' +* +* Read one or two dwords from alternate structure using ACI command (0x0902). +* Fields are indicated by 'reg_addr0' and 'reg_addr1' register numbers. +* If 'reg_val1' pointer is not passed then only register at 'reg_addr0' +* is read. +* +* Return: 0 on success and error code on failure. +*/ +s32 ixgbe_aci_alternate_read (struct ixgbe_hw *hw,u32 reg_addr0, +u32 *reg_val0,u32 reg_addr1,u32 *reg_val1) +{ +struct ixgbe_aci_cmd_read_write_alt_direct *cmd; +struct ixgbe_aci_desc desc; +s32 status; + + cmd = &desc.params.read_write_alt_direct; + +if (!reg_val0) +return IXGBE_ERR_PARAM ; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_read_alt_direct); + cmd->dword0_addr =IXGBE_CPU_TO_LE32 (reg_addr0); + cmd->dword1_addr =IXGBE_CPU_TO_LE32 (reg_addr1); + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); + +if (status ==IXGBE_SUCCESS ) { + *reg_val0 =IXGBE_LE32_TO_CPU (cmd->dword0_value); + +if (reg_val1) + *reg_val1 =IXGBE_LE32_TO_CPU (cmd->dword1_value); + } + +return status; +} + +/** +* ixgbe_aci_alternate_write_done - check if writing to alternate structure +* is done +* @hw: pointer to the HW structure. +* @bios_mode: indicates whether the command is executed by UEFI or legacy BIOS +* @reset_needed: indicates the SW should trigger GLOBAL reset +* +* Indicates to the FW that alternate structures have been changed. +* +* Return: 0 on success and error code on failure. +*/ +s32 ixgbe_aci_alternate_write_done (struct ixgbe_hw *hw,u8 bios_mode, +bool *reset_needed) +{ +struct ixgbe_aci_cmd_done_alt_write *cmd; +struct ixgbe_aci_desc desc; +s32 status; + + cmd = &desc.params.done_alt_write; + +if (!reset_needed) +return IXGBE_ERR_PARAM ; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_done_alt_write); + cmd->flags = bios_mode; + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +if (!status) + *reset_needed = (IXGBE_LE16_TO_CPU (cmd->flags) & +IXGBE_ACI_RESP_RESET_NEEDED ) !=0 ; + +return status; +} + +/** +* ixgbe_aci_alternate_clear - clear alternate structure +* @hw: pointer to the HW structure. +* +* Clear the alternate structures of the port from which the function +* is called. +* +* Return: 0 on success and error code on failure. +*/ +s32 ixgbe_aci_alternate_clear (struct ixgbe_hw *hw) +{ +struct ixgbe_aci_desc desc; +s32 status; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, + ixgbe_aci_opc_clear_port_alt_write); + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); + +return status; +} +/** * ixgbe_aci_get_internal_data - get internal FW/HW data * @hw: pointer to the hardware structure
drivers/net/ixgbe/base/ixgbe_e610.h +9 -0
@@ -87,6 +87,15 @@ s32 ixgbe_read_sr_word_aci(struct ixgbe_hw *hw, u16 offset, u16 *data);s32 ixgbe_read_sr_buf_aci (struct ixgbe_hw *hw,u16 offset,u16 *words,u16 *data);s32 ixgbe_read_flat_nvm (struct ixgbe_hw *hw,u32 offset,u32 *length,u8 *data,bool read_shadow_ram); + +s32 ixgbe_aci_alternate_write (struct ixgbe_hw *hw,u32 reg_addr0, +u32 reg_val0,u32 reg_addr1,u32 reg_val1); +s32 ixgbe_aci_alternate_read (struct ixgbe_hw *hw,u32 reg_addr0, +u32 *reg_val0,u32 reg_addr1,u32 *reg_val1); +s32 ixgbe_aci_alternate_write_done (struct ixgbe_hw *hw,u8 bios_mode, +bool *reset_needed); +s32 ixgbe_aci_alternate_clear (struct ixgbe_hw *hw); + s32 ixgbe_aci_get_internal_data(struct ixgbe_hw *hw, u16 cluster_id, u16 table_id, u32 start, void *buf, u16 buf_size, u16 *ret_buf_size,
Signature · 1 line
2.43.0
PATCH v3 29/30 net/ixgbe/base: support more NVM-related operations
In reply to Anatoly BurakovAdd support for more NVM-related operations through Admin Command Interface, such as:
- NVM read/write
- Recalculating NVM checksum
- Sanitize NVM
- Clear user data from NVM
- Validate an NVM read/write request
- Read/program topology device
- Read Option ROM and Minimum Security Revision
--- drivers/net/ixgbe/base/ixgbe_e610.c | 319 +++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_e610.h | 15 ++ drivers/net/ixgbe/base/ixgbe_type_e610.h | 151 +++++++++++ 3 files changed, 485 insertions(+)
drivers/net/ixgbe/base/ixgbe_e610.c +319 -0
@@ -2063,6 +2063,72 @@ s32 ixgbe_aci_sff_eeprom(struct ixgbe_hw *hw, u16 lport, u8 bus_addr,return status; } +/** +* ixgbe_aci_prog_topo_dev_nvm - program Topology Device NVM +* @hw: pointer to the hardware structure +* @topo_params: pointer to structure storing topology parameters for a device +* +* Program Topology Device NVM using ACI command (0x06F2). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_aci_prog_topo_dev_nvm (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_params *topo_params) +{ +struct ixgbe_aci_cmd_prog_topo_dev_nvm *cmd; +struct ixgbe_aci_desc desc; + + cmd = &desc.params.prog_topo_dev_nvm; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_prog_topo_dev_nvm); + +memcpy (&cmd->topo_params, topo_params,sizeof (*topo_params)); + +return ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +} + +/** +* ixgbe_aci_read_topo_dev_nvm - read Topology Device NVM +* @hw: pointer to the hardware structure +* @topo_params: pointer to structure storing topology parameters for a device +* @start_address: byte offset in the topology device NVM +* @data: pointer to data buffer +* @data_size: number of bytes to be read from the topology device NVM +* Read Topology Device NVM (0x06F3) +* +* Read Topology of Device NVM using ACI command (0x06F3). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_aci_read_topo_dev_nvm (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_params *topo_params, +u32 start_address,u8 *data,u8 data_size) +{ +struct ixgbe_aci_cmd_read_topo_dev_nvm *cmd; +struct ixgbe_aci_desc desc; +s32 status; + +if (!data || data_size ==0 || + data_size >IXGBE_ACI_READ_TOPO_DEV_NVM_DATA_READ_SIZE ) +return IXGBE_ERR_PARAM ; + + cmd = &desc.params.read_topo_dev_nvm; + +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_read_topo_dev_nvm); + + desc.datalen =IXGBE_CPU_TO_LE16 (data_size); +memcpy (&cmd->topo_params, topo_params,sizeof (*topo_params)); + cmd->start_address =IXGBE_CPU_TO_LE32 (start_address); + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +if (status) +return status; + +memcpy (data, cmd->data_read, data_size); + +return IXGBE_SUCCESS ; +} +/** * ixgbe_acquire_nvm - Generic request for acquiring the NVM ownership * @hw: pointer to the HW structure
@@ -2422,6 +2488,60 @@ static s32 ixgbe_read_nvm_sr_copy(struct ixgbe_hw *hw,return ixgbe_read_nvm_module (hw, bank, hdr_len + offset, data); } +/** +* ixgbe_get_nvm_minsrevs - Get the minsrevs values from flash +* @hw: pointer to the HW struct +* @minsrevs: structure to store NVM and OROM minsrev values +* +* Read the Minimum Security Revision TLV and extract +* the revision values from the flash image +* into a readable structure for processing. +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_get_nvm_minsrevs (struct ixgbe_hw *hw, +struct ixgbe_minsrev_info *minsrevs) +{ +struct ixgbe_aci_cmd_nvm_minsrev data; +s32 status; +u16 valid; + + status =ixgbe_acquire_nvm (hw,IXGBE_RES_READ ); +if (status) +return status; + + status =ixgbe_aci_read_nvm (hw,IXGBE_ACI_NVM_MINSREV_MOD_ID , +0 ,sizeof (data), &data, + true, false); + +ixgbe_release_nvm (hw); + +if (status) +return status; + + valid =IXGBE_LE16_TO_CPU (data.validity); + +/* Extract NVM minimum security revision */ +if (valid &IXGBE_ACI_NVM_MINSREV_NVM_VALID ) { +u16 minsrev_l =IXGBE_LE16_TO_CPU (data.nvm_minsrev_l); +u16 minsrev_h =IXGBE_LE16_TO_CPU (data.nvm_minsrev_h); + + minsrevs->nvm = minsrev_h <<16 | minsrev_l; + minsrevs->nvm_valid = true; + } + +/* Extract the OROM minimum security revision */ +if (valid &IXGBE_ACI_NVM_MINSREV_OROM_VALID ) { +u16 minsrev_l =IXGBE_LE16_TO_CPU (data.orom_minsrev_l); +u16 minsrev_h =IXGBE_LE16_TO_CPU (data.orom_minsrev_h); + + minsrevs->orom = minsrev_h <<16 | minsrev_l; + minsrevs->orom_valid = true; + } + +return IXGBE_SUCCESS ; +} +/** * ixgbe_get_nvm_srev - Read the security revision from the NVM CSS header * @hw: pointer to the HW struct
@@ -2773,6 +2893,63 @@ s32 ixgbe_init_nvm(struct ixgbe_hw *hw)return IXGBE_SUCCESS ; } +/** +* ixgbe_sanitize_operate - Clear the user data +* @hw: pointer to the HW struct +* +* Clear user data from NVM using ACI command (0x070C). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_sanitize_operate (struct ixgbe_hw *hw) +{ +s32 status; +u8 values; + +u8 cmd_flags =IXGBE_ACI_SANITIZE_REQ_OPERATE | +IXGBE_ACI_SANITIZE_OPERATE_SUBJECT_CLEAR ; + + status =ixgbe_sanitize_nvm (hw, cmd_flags, &values); +if (status) +return status; +if ((!(values &IXGBE_ACI_SANITIZE_OPERATE_HOST_CLEAN_DONE ) && + !(values &IXGBE_ACI_SANITIZE_OPERATE_BMC_CLEAN_DONE )) || + ((values &IXGBE_ACI_SANITIZE_OPERATE_HOST_CLEAN_DONE ) && + !(values &IXGBE_ACI_SANITIZE_OPERATE_HOST_CLEAN_SUCCESS )) || + ((values &IXGBE_ACI_SANITIZE_OPERATE_BMC_CLEAN_DONE ) && + !(values &IXGBE_ACI_SANITIZE_OPERATE_BMC_CLEAN_SUCCESS ))) +return IXGBE_ERR_ACI_ERROR ; + +return IXGBE_SUCCESS ; +} + +/** +* ixgbe_sanitize_nvm - Sanitize NVM +* @hw: pointer to the HW struct +* @cmd_flags: flag to the ACI command +* @values: values returned from the command +* +* Sanitize NVM using ACI command (0x070C). +* +* Return: the exit code of the operation. +*/ +s32 ixgbe_sanitize_nvm (struct ixgbe_hw *hw,u8 cmd_flags,u8 *values) +{ +struct ixgbe_aci_desc desc; +struct ixgbe_aci_cmd_nvm_sanitization *cmd; +s32 status; + + cmd = &desc.params.nvm_sanitization; +ixgbe_fill_dflt_direct_cmd_desc (&desc, ixgbe_aci_opc_nvm_sanitization); + cmd->cmd_flags = cmd_flags; + + status =ixgbe_aci_send_cmd (hw, &desc,NULL ,0 ); +if (values) + *values = cmd->values; + +return status; +} +/** * ixgbe_read_sr_word_aci - Reads Shadow RAM via ACI * @hw: pointer to the HW structure
@@ -3080,6 +3257,148 @@ s32 ixgbe_aci_get_internal_data(struct ixgbe_hw *hw, u16 cluster_id,return status; } +/** +* ixgbe_validate_nvm_rw_reg - Check that an NVM access request is valid +* @cmd: NVM access command structure +* +* Validates that an NVM access structure is request to read or write a valid +* register offset. First validates that the module and flags are correct, and +* then ensures that the register offset is one of the accepted registers. +* +* Return: 0 if the register access is valid, out of range error code otherwise. +*/ +static s32 +ixgbe_validate_nvm_rw_reg (struct ixgbe_nvm_access_cmd *cmd) +{ +u16 i; + +switch (cmd->offset) { +case GL_HICR : +case GL_HICR_EN :/* Note, this register is read only */ +case GL_FWSTS : +case GL_MNG_FWSM : +case GLNVM_GENS : +case GLNVM_FLA : +case GL_FWRESETCNT : +return 0 ; +default : +break ; + } + +for (i =0 ; i <=GL_HIDA_MAX_INDEX ; i++) +if (cmd->offset == (u32 )GL_HIDA (i)) +return 0 ; + +for (i =0 ; i <=GL_HIBA_MAX_INDEX ; i++) +if (cmd->offset == (u32 )GL_HIBA (i)) +return 0 ; + +/* All other register offsets are not valid */ +return IXGBE_ERR_OUT_OF_RANGE ; +} + +/** +* ixgbe_nvm_access_read - Handle an NVM read request +* @hw: pointer to the HW struct +* @cmd: NVM access command to process +* @data: storage for the register value read +* +* Process an NVM access request to read a register. +* +* Return: 0 if the register read is valid and successful, +* out of range error code otherwise. +*/ +static s32 ixgbe_nvm_access_read (struct ixgbe_hw *hw, +struct ixgbe_nvm_access_cmd *cmd, +struct ixgbe_nvm_access_data *data) +{ +s32 status; + +/* Always initialize the output data, even on failure */ +memset (&data->regval,0 , cmd->data_size); + +/* Make sure this is a valid read/write access request */ + status =ixgbe_validate_nvm_rw_reg (cmd); +if (status) +return status; + +DEBUGOUT1 ("NVM access: reading register %08x\n" , cmd->offset); + +/* Read the register and store the contents in the data field */ + data->regval =IXGBE_READ_REG (hw, cmd->offset); + +return 0 ; +} + +/** +* ixgbe_nvm_access_write - Handle an NVM write request +* @hw: pointer to the HW struct +* @cmd: NVM access command to process +* @data: NVM access data to write +* +* Process an NVM access request to write a register. +* +* Return: 0 if the register write is valid and successful, +* out of range error code otherwise. +*/ +static s32 ixgbe_nvm_access_write (struct ixgbe_hw *hw, +struct ixgbe_nvm_access_cmd *cmd, +struct ixgbe_nvm_access_data *data) +{ +s32 status; + +/* Make sure this is a valid read/write access request */ + status =ixgbe_validate_nvm_rw_reg (cmd); +if (status) +return status; + +/* Reject requests to write to read-only registers */ +switch (cmd->offset) { +case GL_HICR_EN : +return IXGBE_ERR_OUT_OF_RANGE ; +default : +break ; + } + +DEBUGOUT2 ("NVM access: writing register %08x with value %08x\n" , + cmd->offset, data->regval); + +/* Write the data field to the specified register */ +IXGBE_WRITE_REG (hw, cmd->offset, data->regval); + +return 0 ; +} + +/** +* ixgbe_handle_nvm_access - Handle an NVM access request +* @hw: pointer to the HW struct +* @cmd: NVM access command info +* @data: pointer to read or return data +* +* Process an NVM access request. Read the command structure information and +* determine if it is valid. If not, report an error indicating the command +* was invalid. +* +* For valid commands, perform the necessary function, copying the data into +* the provided data buffer. +* +* Return: 0 if the nvm access request is valid and successful, +* error code otherwise. +*/ +s32 ixgbe_handle_nvm_access (struct ixgbe_hw *hw, +struct ixgbe_nvm_access_cmd *cmd, +struct ixgbe_nvm_access_data *data) +{ +switch (cmd->command) { +case IXGBE_NVM_CMD_READ : +return ixgbe_nvm_access_read (hw, cmd, data); +case IXGBE_NVM_CMD_WRITE : +return ixgbe_nvm_access_write (hw, cmd, data); +default : +return IXGBE_ERR_PARAM ; + } +} +/** * ixgbe_init_ops_E610 - Inits func ptrs and MAC type * @hw: pointer to hardware structure
drivers/net/ixgbe/base/ixgbe_e610.h +15 -0
@@ -68,6 +68,12 @@ s32 ixgbe_aci_get_gpio(struct ixgbe_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx,s32 ixgbe_aci_sff_eeprom (struct ixgbe_hw *hw,u16 lport,u8 bus_addr,u16 mem_addr,u8 page,u8 page_bank_ctrl,u8 *data,u8 length,bool write); +s32 ixgbe_aci_prog_topo_dev_nvm (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_params *topo_params); +s32 ixgbe_aci_read_topo_dev_nvm (struct ixgbe_hw *hw, +struct ixgbe_aci_cmd_link_topo_params *topo_params, +u32 start_address,u8 *data,u8 data_size); +s32 ixgbe_acquire_nvm (struct ixgbe_hw *hw,enum ixgbe_aci_res_access_type access);void ixgbe_release_nvm (struct ixgbe_hw *hw);
@@ -79,10 +85,14 @@ s32 ixgbe_aci_read_nvm(struct ixgbe_hw *hw, u16 module_typeid, u32 offset,s32 ixgbe_nvm_validate_checksum (struct ixgbe_hw *hw);s32 ixgbe_nvm_recalculate_checksum (struct ixgbe_hw *hw); +s32 ixgbe_get_nvm_minsrevs (struct ixgbe_hw *hw,struct ixgbe_minsrev_info *minsrevs);s32 ixgbe_get_inactive_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm);s32 ixgbe_get_active_nvm_ver (struct ixgbe_hw *hw,struct ixgbe_nvm_info *nvm);s32 ixgbe_init_nvm (struct ixgbe_hw *hw); +s32 ixgbe_sanitize_operate (struct ixgbe_hw *hw); +s32 ixgbe_sanitize_nvm (struct ixgbe_hw *hw,u8 cmd_flags,u8 *values); +s32 ixgbe_read_sr_word_aci (struct ixgbe_hw *hw,u16 offset,u16 *data);s32 ixgbe_read_sr_buf_aci (struct ixgbe_hw *hw,u16 offset,u16 *words,u16 *data); s32 ixgbe_read_flat_nvm(struct ixgbe_hw *hw, u32 offset, u32 *length,
@@ -101,6 +111,11 @@ s32 ixgbe_aci_get_internal_data(struct ixgbe_hw *hw, u16 cluster_id, u16 buf_size, u16 *ret_buf_size, u16 *ret_next_cluster, u16 *ret_next_table, u32 *ret_next_index); + +s32 ixgbe_handle_nvm_access (struct ixgbe_hw *hw, +struct ixgbe_nvm_access_cmd *cmd, +struct ixgbe_nvm_access_data *data); +/* E610 operations */ s32 ixgbe_reset_hw_E610 (struct ixgbe_hw *hw);s32 ixgbe_start_hw_E610 (struct ixgbe_hw *hw);
drivers/net/ixgbe/base/ixgbe_type_e610.h +151 -0
206 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v3 30/30 net/ixgbe/base: add various miscellaneous features
In reply to Anatoly BurakovAdd various changes to the base driver that are not specifically about any features but are present in the shared code snapshot, to better align base code with DPDK.
Also, update documentation to reflect new base code snapshot version, as well as document new hardware support.
---
Notes:
This fix seems to be kernel-specific, so Cc:stable was intentionally omitted.
doc/guides/rel_notes/release_24_07.rst | 4 + drivers/net/ixgbe/base/README | 6 +- drivers/net/ixgbe/base/ixgbe_api.c | 2 - drivers/net/ixgbe/base/ixgbe_type.h | 1 + drivers/net/ixgbe/base/ixgbe_type_e610.h | 207 +++++++++++++++++++++++ 5 files changed, 216 insertions(+), 4 deletions(-)
doc/guides/rel_notes/release_24_07.rst +4 -0
@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated IXGBE base code.** + + * Updated shared code to more recent version. + * Added support for E610 device family. Removed Items -------------
drivers/net/ixgbe/base/README +4 -2
@@ -1,12 +1,12 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2020 Intel Corporation + * Copyright(c) 2010-2024 Intel Corporation */ Intel® IXGBE driver =================== This directory contains source code of FreeBSD ixgbe driver of version -not-released-cid-ixgbe.2020.06.09.tar.gz released by the team which develop +not-released-cid-ixgbe.2024.04.24.tar.gz released by the team which develop basic drivers for any ixgbe NIC. The sub-directory of base/ contains the original source package. This driver is valid for the product(s) listed below
@@ -24,6 +24,7 @@ This driver is valid for the product(s) listed below * Intel® Ethernet Server Adapter X520 Series * Intel® Ethernet Server Adapter X520-T2 * Intel® Ethernet Controller X550 Series +* Intel® Ethernet Controller E610 Series Updating the driver ===================
@@ -32,3 +33,4 @@ NOTE: The source code in this directory should not be modified apart from the following file(s): ixgbe_osdep.h + ixgbe_osdep.c
drivers/net/ixgbe/base/ixgbe_api.c +0 -2
@@ -227,8 +227,6 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)break ; } -DEBUGOUT2 ("ixgbe_set_mac_type found mac: %d, returns: %d\n" , - hw->mac.type, ret_val);return ret_val; }
drivers/net/ixgbe/base/ixgbe_type.h +1 -0
@@ -3396,6 +3396,7 @@ struct ixgbe_adv_tx_context_desc {#define IXGBE_ADVTXD_POPTS_RSV 0x00002000/* POPTS Reserved */ #define IXGBE_ADVTXD_PAYLEN_SHIFT 14/* Adv desc PAYLEN shift */ #define IXGBE_ADVTXD_MACLEN_SHIFT 9/* Adv ctxt desc mac len shift */ +#define IXGBE_ADVTXD_MACLEN_MASK (0x7F << IXGBE_ADVTXD_MACLEN_SHIFT)/* Adv ctxt desc mac len mask */ #define IXGBE_ADVTXD_VLAN_SHIFT 16/* Adv ctxt vlan tag shift */ #define IXGBE_ADVTXD_TUCMD_IPV4 0x00000400/* IP Packet Type: 1=IPv4 */ #define IXGBE_ADVTXD_TUCMD_IPV6 0x00000000/* IP Packet Type: 0=IPv6 */
drivers/net/ixgbe/base/ixgbe_type_e610.h +207 -0
219 lines not on this page · raw message
Signature · 1 line
2.43.0
Bruce Richardson
AppliedQuoted 10 lines · Anatoly Burakov
This patchset updates IXGBE base driver to latest shared code snapshot, fixing a few issues as well as adding support for new hardware.
v3:
- Split out big patch with definitions into a separate patch
- Split out the "miscellaneous" patch into smaller patches and scattered its contents across different patches where appropriate
- Rolled in DPDK-unrelated changes into "miscellaneous" patch
- Removed unused function definition in final patch
Quoted 4 lines
v2:
- Split giant E610 patch into set of smaller patches
- Added release notes
Applied to dpdk-next-net-intel with some small cleanups:
* some minor commit rewording, including line shortening
* added new author/reviewer names to mailmap
Thanks, Anatoly.
/Bruce