Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/i40e_adminq.c
Show All 33 Lines | |||||
#include "i40e_status.h" | #include "i40e_status.h" | ||||
#include "i40e_type.h" | #include "i40e_type.h" | ||||
#include "i40e_register.h" | #include "i40e_register.h" | ||||
#include "i40e_adminq.h" | #include "i40e_adminq.h" | ||||
#include "i40e_prototype.h" | #include "i40e_prototype.h" | ||||
/** | /** | ||||
* i40e_is_nvm_update_op - return TRUE if this is an NVM update operation | |||||
* @desc: API request descriptor | |||||
**/ | |||||
static INLINE bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc) | |||||
{ | |||||
return (desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_erase)) || | |||||
(desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_update)); | |||||
} | |||||
/** | |||||
* i40e_adminq_init_regs - Initialize AdminQ registers | * i40e_adminq_init_regs - Initialize AdminQ registers | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* | * | ||||
* This assumes the alloc_asq and alloc_arq functions have already been called | * This assumes the alloc_asq and alloc_arq functions have already been called | ||||
**/ | **/ | ||||
static void i40e_adminq_init_regs(struct i40e_hw *hw) | static void i40e_adminq_init_regs(struct i40e_hw *hw) | ||||
{ | { | ||||
/* set head and tail registers in our local struct */ | /* set head and tail registers in our local struct */ | ||||
▲ Show 20 Lines • Show All 596 Lines • ▼ Show 20 Lines | enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) | ||||
if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { | if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { | ||||
ret_code = I40E_ERR_FIRMWARE_API_VERSION; | ret_code = I40E_ERR_FIRMWARE_API_VERSION; | ||||
goto init_adminq_free_arq; | goto init_adminq_free_arq; | ||||
} | } | ||||
/* pre-emptive resource lock release */ | /* pre-emptive resource lock release */ | ||||
i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL); | i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL); | ||||
hw->aq.nvm_release_on_done = FALSE; | hw->nvm_release_on_done = FALSE; | ||||
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; | hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; | ||||
ret_code = i40e_aq_set_hmc_resource_profile(hw, | |||||
I40E_HMC_PROFILE_DEFAULT, | |||||
0, | |||||
NULL); | |||||
ret_code = I40E_SUCCESS; | ret_code = I40E_SUCCESS; | ||||
/* success! */ | /* success! */ | ||||
goto init_adminq_exit; | goto init_adminq_exit; | ||||
init_adminq_free_arq: | init_adminq_free_arq: | ||||
i40e_shutdown_arq(hw); | i40e_shutdown_arq(hw); | ||||
init_adminq_free_asq: | init_adminq_free_asq: | ||||
▲ Show 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw, | ||||
wr32(hw, hw->aq.arq.tail, ntc); | wr32(hw, hw->aq.arq.tail, ntc); | ||||
/* ntc is updated to tail + 1 */ | /* ntc is updated to tail + 1 */ | ||||
ntc++; | ntc++; | ||||
if (ntc == hw->aq.num_arq_entries) | if (ntc == hw->aq.num_arq_entries) | ||||
ntc = 0; | ntc = 0; | ||||
hw->aq.arq.next_to_clean = ntc; | hw->aq.arq.next_to_clean = ntc; | ||||
hw->aq.arq.next_to_use = ntu; | hw->aq.arq.next_to_use = ntu; | ||||
if (i40e_is_nvm_update_op(&e->desc)) { | i40e_nvmupd_check_wait_event(hw, LE16_TO_CPU(e->desc.opcode)); | ||||
if (hw->aq.nvm_release_on_done) { | |||||
i40e_release_nvm(hw); | |||||
hw->aq.nvm_release_on_done = FALSE; | |||||
} | |||||
switch (hw->nvmupd_state) { | |||||
case I40E_NVMUPD_STATE_INIT_WAIT: | |||||
hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; | |||||
break; | |||||
case I40E_NVMUPD_STATE_WRITE_WAIT: | |||||
hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | |||||
clean_arq_element_out: | clean_arq_element_out: | ||||
/* Set pending if needed, unlock and return */ | /* Set pending if needed, unlock and return */ | ||||
if (pending != NULL) | if (pending != NULL) | ||||
*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc); | *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc); | ||||
clean_arq_element_err: | clean_arq_element_err: | ||||
i40e_release_spinlock(&hw->aq.arq_spinlock); | i40e_release_spinlock(&hw->aq.arq_spinlock); | ||||
return ret_code; | return ret_code; | ||||
} | } | ||||