ixgbe: added support for NVM update via ixgbe driver
Subsystems (2)
PATCH 1/1 ixgbe: added support for NVM update via ixgbe driver
When Secure Boot is enabled access to the /dev/mem is forbidden for user-space applications and clients are reporting inability to use tools in Secure Boot Mode. The way to perform NVM update is to use ixgbe driver. Currently 10G Linux Base Driver has API which allows only EEPROM access. There is a need to extend IOCTL API to allow NVM and registers access.
--- .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 38 ++++++ .../net/ethernet/intel/ixgbe/ixgbe_common.c | 17 +++ .../net/ethernet/intel/ixgbe/ixgbe_common.h | 3 + .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 74 +++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 + drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 50 +++++-- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 41 ++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 129 ++++++++++++++++++ 8 files changed, 346 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +38 -0
@@ -2159,6 +2159,43 @@ static s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,return status; } +/** +* ixgbe_validate_register_82599 - Validate requested offset +* @offset: offset to validate +* @eeprom_len: EEPROM length +* +* Validate requested offset for NVM Update API +* +* Returns -ENOTTY if the offset is not available on the list +**/ +s32 ixgbe_validate_register_82599 (u32 offset,u32 eeprom_len) +{ +switch (offset) { +case IXGBE_STATUS : +case IXGBE_ESDP : +case IXGBE_MSCA : +case IXGBE_MSRWD : +case IXGBE_AUTOC : +case IXGBE_EEC_8259X : +case IXGBE_EERD : +case IXGBE_FLA_8259X : +case IXGBE_FLOP : +case IXGBE_SWSM_8259X : +case IXGBE_FWSM_8259X : +case IXGBE_FACTPS_8259X : +case IXGBE_GSSR : +case IXGBE_BARCTRL : +return 0 ; +default : +if ((offset >=IXGBE_MAVTV (0 ) && offset <=IXGBE_MAVTV (7 )) || + (offset >=IXGBE_RAL (0 ) && offset <=IXGBE_RAH (15 )) || + (offset >=0x00020000 && offset <= eeprom_len)) +return 0 ; + } + +return -ENOTTY ; +} +static const struct ixgbe_mac_operations mac_ops_82599 = { .init_hw = &ixgbe_init_hw_generic, .reset_hw = &ixgbe_reset_hw_82599,
@@ -2243,6 +2280,7 @@ static const struct ixgbe_phy_operations phy_ops_82599 = { .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, .check_overtemp = &ixgbe_tn_check_overtemp, + .validate_register = &ixgbe_validate_register_82599, };const struct ixgbe_info ixgbe_82599_info = {
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +17 -0
@@ -837,6 +837,23 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index)return 0 ; } +/** +* ixgbe_init_nvmupd_features - Initialize NVM Update params +* @hw: pointer to hardware structure +**/ +void ixgbe_init_nvmupd_features (struct ixgbe_hw *hw) +{ + hw->nvmupd_features.major =IXGBE_NVMUPD_FEATURES_API_VER_MAJOR ; + hw->nvmupd_features.minor =IXGBE_NVMUPD_FEATURES_API_VER_MINOR ; + hw->nvmupd_features.size =sizeof (hw->nvmupd_features); +memset (hw->nvmupd_features.features,0x0 , +IXGBE_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN * +sizeof (*hw->nvmupd_features.features)); + + hw->nvmupd_features.features[0 ] = +IXGBE_NVMUPD_FEATURE_REGISTER_ACCESS_SUPPORT ; +} +/** * ixgbe_init_eeprom_params_generic - Initialize EEPROM params * @hw: pointer to hardware structure
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +3 -0
@@ -26,6 +26,7 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index);s32 ixgbe_led_off_generic (struct ixgbe_hw *hw,u32 index);s32 ixgbe_init_led_link_act_generic (struct ixgbe_hw *hw); +void ixgbe_init_nvmupd_features (struct ixgbe_hw *hw);s32 ixgbe_init_eeprom_params_generic (struct ixgbe_hw *hw);s32 ixgbe_write_eeprom_generic (struct ixgbe_hw *hw,u16 offset,u16 data); s32 ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
@@ -172,6 +173,8 @@ static inline void ixgbe_write_reg64(struct ixgbe_hw *hw, u32 reg, u64 value)u32 ixgbe_read_reg (struct ixgbe_hw *hw,u32 reg);#define IXGBE_READ_REG (a, reg) ixgbe_read_reg((a), (reg)) +#define IXGBE_R32 (a, reg) ixgbe_read_reg((a), (reg)) +#define IXGBE_R8 (a, reg) readb(READ_ONCE((a)->hw_addr) + (reg))#define IXGBE_WRITE_REG_ARRAY (a, reg, offset, value) \ ixgbe_write_reg((a), (reg) + ((offset) << 2), (value))
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +73 -1
107 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -0
@@ -6400,6 +6400,9 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,/* set default work limits */ adapter->tx_work_limit =IXGBE_DEFAULT_TX_WORK ; +/* NVM Update features initialization */ +ixgbe_init_nvmupd_features (hw); +/* initialize eeprom parameters */ if (ixgbe_init_eeprom_params_generic (hw)) {e_dev_err ("EEPROM initialization failed\n" );
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +42 -8
86 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +41 -0
53 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +129 -0
153 lines not on this page · raw message
Signature · 1 line
2.22.0.rc3
Bowers
PATCH 1/1 ixgbe: added support for NVM update via ixgbe driver
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Piotr Skajewski
Sent: Wednesday, July 3, 2019 3:44 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Skajewski, PiotrX <[email protected]>
Subject: [Intel-wired-lan] [PATCH] ixgbe: added support for NVM update via ixgbe driverWhen Secure Boot is enabled access to the
/dev/memis forbidden for user- space applications and clients are reporting inability to use tools in Secure Boot Mode. The way to perform NVM update is to use ixgbe driver. Currently 10G Linux Base Driver has API which allows only EEPROM access. There is a need to extend IOCTL API to allow NVM and registers access.Signed-off-by Piotr Skajewski <[email protected]>
Quoted 10 lines
--- .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 38 ++++++ .../net/ethernet/intel/ixgbe/ixgbe_common.c | 17 +++ .../net/ethernet/intel/ixgbe/ixgbe_common.h | 3 + .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 74 +++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 + drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 50 +++++-- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 41 ++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 129 ++++++++++++++++++ 8 files changed, 346 insertions(+), 9 deletions(-)