i40e: Add AQ command for rearrange NVM structure
authorPiotr Azarewicz <piotr.azarewicz@intel.com>
Tue, 31 Jul 2018 10:41:47 +0000 (03:41 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 7 Aug 2018 19:20:45 +0000 (12:20 -0700)
During switching between old NVM structure approach (called structured
NVM) to new one (called flat NVM) or backward flash needs to be
rearranged to required NVM structure. This is a part of transition from
one NVM structure to another. The function is introduced to command
firmware to start rearrangement process.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_prototype.h
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h

index 7d888e05f96f703c256142c2061bae5eb2b561b3..80e3eec6134ee82f0ab69725e5eb08695685b11b 100644 (file)
@@ -2247,6 +2247,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_phy_register_access);
 struct i40e_aqc_nvm_update {
        u8      command_flags;
 #define I40E_AQ_NVM_LAST_CMD                   0x01
+#define I40E_AQ_NVM_REARRANGE_TO_FLAT          0x20
+#define I40E_AQ_NVM_REARRANGE_TO_STRUCT                0x40
 #define I40E_AQ_NVM_FLASH_ONLY                 0x80
 #define I40E_AQ_NVM_PRESERVATION_FLAGS_SHIFT   1
 #define I40E_AQ_NVM_PRESERVATION_FLAGS_MASK    0x03
index eb2d1530d3316db8e0364fe9645e24f9604eb05a..85f75b5978fca572f776f7eab2ea7f6365cf78d3 100644 (file)
@@ -3540,6 +3540,41 @@ i40e_aq_update_nvm_exit:
        return status;
 }
 
+/**
+ * i40e_aq_rearrange_nvm
+ * @hw: pointer to the hw struct
+ * @rearrange_nvm: defines direction of rearrangement
+ * @cmd_details: pointer to command details structure or NULL
+ *
+ * Rearrange NVM structure, available only for transition FW
+ **/
+i40e_status i40e_aq_rearrange_nvm(struct i40e_hw *hw,
+                                 u8 rearrange_nvm,
+                                 struct i40e_asq_cmd_details *cmd_details)
+{
+       struct i40e_aqc_nvm_update *cmd;
+       i40e_status status;
+       struct i40e_aq_desc desc;
+
+       cmd = (struct i40e_aqc_nvm_update *)&desc.params.raw;
+
+       i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_nvm_update);
+
+       rearrange_nvm &= (I40E_AQ_NVM_REARRANGE_TO_FLAT |
+                        I40E_AQ_NVM_REARRANGE_TO_STRUCT);
+
+       if (!rearrange_nvm) {
+               status = I40E_ERR_PARAM;
+               goto i40e_aq_rearrange_nvm_exit;
+       }
+
+       cmd->command_flags |= rearrange_nvm;
+       status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+
+i40e_aq_rearrange_nvm_exit:
+       return status;
+}
+
 /**
  * i40e_aq_get_lldp_mib
  * @hw: pointer to the hw struct
index 3170655cdeb990b02f12edf5ffa42c6811201d58..e08d754824b13e97f7e7db73d762668aeff87931 100644 (file)
@@ -193,6 +193,9 @@ i40e_status i40e_aq_update_nvm(struct i40e_hw *hw, u8 module_pointer,
                                u32 offset, u16 length, void *data,
                                bool last_command, u8 preservation_flags,
                                struct i40e_asq_cmd_details *cmd_details);
+i40e_status i40e_aq_rearrange_nvm(struct i40e_hw *hw,
+                                 u8 rearrange_nvm,
+                                 struct i40e_asq_cmd_details *cmd_details);
 i40e_status i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type,
                                u8 mib_type, void *buff, u16 buff_size,
                                u16 *local_len, u16 *remote_len,
index aa81e87cd4713ab68e08c073bcd2856a375df0b5..5fd8529465d48db0ee9b5ac27835253fbcf9beea 100644 (file)
@@ -2175,6 +2175,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_phy_register_access);
 struct i40e_aqc_nvm_update {
        u8      command_flags;
 #define I40E_AQ_NVM_LAST_CMD                   0x01
+#define I40E_AQ_NVM_REARRANGE_TO_FLAT          0x20
+#define I40E_AQ_NVM_REARRANGE_TO_STRUCT                0x40
 #define I40E_AQ_NVM_FLASH_ONLY                 0x80
 #define I40E_AQ_NVM_PRESERVATION_FLAGS_SHIFT   1
 #define I40E_AQ_NVM_PRESERVATION_FLAGS_MASK    0x03