From: Helin Zhang Date: Tue, 8 Mar 2016 08:14:10 +0000 (+0800) Subject: i40e/base: acquire NVM ownership before reading it X-Git-Tag: spdx-start~7386 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2427bcaa0ae4e41e46a17fc46e59503262470ef6;p=dpdk.git i40e/base: acquire NVM ownership before reading it SW needs to acquire the NVM ownership before issuing an AQ read to the X722 NVM otherwise it will get EBUSY from the firmware. Also it should be released when done. Signed-off-by: Helin Zhang Acked-by: Jingjing Wu Acked-by: Remy Horton --- diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c index 60f2bb9eaa..bfa33157f8 100644 --- a/drivers/net/i40e/base/i40e_nvm.c +++ b/drivers/net/i40e/base/i40e_nvm.c @@ -217,11 +217,22 @@ static enum i40e_status_code i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw) enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset, u16 *data) { + enum i40e_status_code ret_code = I40E_SUCCESS; + #ifdef X722_SUPPORT - if (hw->mac.type == I40E_MAC_X722) - return i40e_read_nvm_word_aq(hw, offset, data); + if (hw->mac.type == I40E_MAC_X722) { + ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); + if (!ret_code) { + ret_code = i40e_read_nvm_word_aq(hw, offset, data); + i40e_release_nvm(hw); + } + } else { + ret_code = i40e_read_nvm_word_srctl(hw, offset, data); + } +#else + ret_code = i40e_read_nvm_word_srctl(hw, offset, data); #endif - return i40e_read_nvm_word_srctl(hw, offset, data); + return ret_code; } /** @@ -309,11 +320,23 @@ enum i40e_status_code i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset, enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset, u16 *words, u16 *data) { + enum i40e_status_code ret_code = I40E_SUCCESS; + #ifdef X722_SUPPORT - if (hw->mac.type == I40E_MAC_X722) - return i40e_read_nvm_buffer_aq(hw, offset, words, data); + if (hw->mac.type == I40E_MAC_X722) { + ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); + if (!ret_code) { + ret_code = i40e_read_nvm_buffer_aq(hw, offset, words, + data); + i40e_release_nvm(hw); + } + } else { + ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data); + } +#else + ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data); #endif - return i40e_read_nvm_buffer_srctl(hw, offset, words, data); + return ret_code; } /**