X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fice%2Fbase%2Fice_nvm.c;h=c0f9e353e24b10ddcdc705833f7c5754b5b704fd;hb=255454425c1d0c1e9e6079a11dbb42e1d3892775;hp=b770abfd052e591c6be36e477b64977bd1c7b490;hpb=abd6cd540ee9c908362e2643dabea5d7b539c04c;p=dpdk.git diff --git a/drivers/net/ice/base/ice_nvm.c b/drivers/net/ice/base/ice_nvm.c index b770abfd05..c0f9e353e2 100644 --- a/drivers/net/ice/base/ice_nvm.c +++ b/drivers/net/ice/base/ice_nvm.c @@ -13,18 +13,20 @@ * @length: length of the section to be read (in bytes from the offset) * @data: command buffer (size [bytes] = length) * @last_command: tells if this is the last command in a series + * @read_shadow_ram: tell if this is a shadow RAM read * @cd: pointer to command details structure or NULL * * Read the NVM using the admin queue commands (0x0701) */ static enum ice_status ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length, - void *data, bool last_command, struct ice_sq_cd *cd) + void *data, bool last_command, bool read_shadow_ram, + struct ice_sq_cd *cd) { struct ice_aq_desc desc; struct ice_aqc_nvm *cmd; - ice_debug(hw, ICE_DBG_TRACE, "ice_aq_read_nvm"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); cmd = &desc.params.nvm; @@ -34,6 +36,9 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_nvm_read); + if (!read_shadow_ram && module_typeid == ICE_AQC_NVM_START_POINT) + cmd->cmd_flags |= ICE_AQC_NVM_FLASH_ONLY; + /* If this is the last command in a series, set the proper flag. */ if (last_command) cmd->cmd_flags |= ICE_AQC_NVM_LAST_CMD; @@ -95,7 +100,7 @@ ice_read_sr_aq(struct ice_hw *hw, u32 offset, u16 words, u16 *data, { enum ice_status status; - ice_debug(hw, ICE_DBG_TRACE, "ice_read_sr_aq"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); status = ice_check_sr_access_params(hw, offset, words); @@ -104,8 +109,9 @@ ice_read_sr_aq(struct ice_hw *hw, u32 offset, u16 words, u16 *data, * So do this conversion while calling ice_aq_read_nvm. */ if (!status) - status = ice_aq_read_nvm(hw, 0, 2 * offset, 2 * words, data, - last_command, NULL); + status = ice_aq_read_nvm(hw, ICE_AQC_NVM_START_POINT, + 2 * offset, 2 * words, data, + last_command, true, NULL); return status; } @@ -123,11 +129,11 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data) { enum ice_status status; - ice_debug(hw, ICE_DBG_TRACE, "ice_read_sr_word_aq"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); status = ice_read_sr_aq(hw, offset, 1, data, true); if (!status) - *data = LE16_TO_CPU(*(__le16 *)data); + *data = LE16_TO_CPU(*(_FORCE_ __le16 *)data); return status; } @@ -152,7 +158,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data) u16 words_read = 0; u16 i = 0; - ice_debug(hw, ICE_DBG_TRACE, "ice_read_sr_buf_aq"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); do { u16 read_size, off_w; @@ -185,7 +191,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data) } while (words_read < *words); for (i = 0; i < *words; i++) - data[i] = LE16_TO_CPU(((__le16 *)data)[i]); + data[i] = LE16_TO_CPU(((_FORCE_ __le16 *)data)[i]); read_nvm_buf_aq_exit: *words = words_read; @@ -202,7 +208,7 @@ read_nvm_buf_aq_exit: static enum ice_status ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access) { - ice_debug(hw, ICE_DBG_TRACE, "ice_acquire_nvm"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); if (hw->nvm.blank_nvm_mode) return ICE_SUCCESS; @@ -218,7 +224,7 @@ ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access) */ static void ice_release_nvm(struct ice_hw *hw) { - ice_debug(hw, ICE_DBG_TRACE, "ice_release_nvm"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); if (hw->nvm.blank_nvm_mode) return; @@ -263,7 +269,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw) u32 fla, gens_stat; u8 sr_size; - ice_debug(hw, ICE_DBG_TRACE, "ice_init_nvm"); + ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); /* The SR size is stored regardless of the NVM programming mode * as the blank mode may be used in the factory line. @@ -286,7 +292,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw) return status; } - status = ice_read_sr_word(hw, ICE_SR_NVM_DEV_STARTER_VER, &hw->nvm.ver); + status = ice_read_sr_word(hw, ICE_SR_NVM_DEV_STARTER_VER, &nvm->ver); if (status) { ice_debug(hw, ICE_DBG_INIT, "Failed to read DEV starter version.\n"); @@ -304,7 +310,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw) return status; } - hw->nvm.eetrack = (eetrack_hi << 16) | eetrack_lo; + nvm->eetrack = (eetrack_hi << 16) | eetrack_lo; status = ice_read_sr_word(hw, ICE_SR_BOOT_CFG_PTR, &cfg_ptr); if (status) { @@ -325,7 +331,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw) return status; } - hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo; + nvm->oem_ver = ((u32)oem_hi << 16) | oem_lo; return status; }