src/dpdk/drivers/net/i40e/base/i40e_nvm.c
enum i40e_status_code i40e_init_nvm(struct i40e_hw *hw)
{
	struct i40e_nvm_info *nvm = &hw->nvm;
	enum i40e_status_code ret_code = I40E_SUCCESS;
	u32 fla, gens;
	u8 sr_size;

	DEBUGFUNC("i40e_init_nvm");

	/* The SR size is stored regardless of the nvm programming mode
	 * as the blank mode may be used in the factory line.
	 */
	gens = rd32(hw, I40E_GLNVM_GENS);
	sr_size = ((gens & I40E_GLNVM_GENS_SR_SIZE_MASK) >>
			   I40E_GLNVM_GENS_SR_SIZE_SHIFT);
	/* Switching to words (sr_size contains power of 2KB) */
	nvm->sr_size = BIT(sr_size) * I40E_SR_WORDS_IN_1KB;

	/* Check if we are in the normal or blank NVM programming mode */
	fla = rd32(hw, I40E_GLNVM_FLA);
	if (fla & I40E_GLNVM_FLA_LOCKED_MASK) { /* Normal programming mode */
		/* Max NVM timeout */
		nvm->timeout = I40E_MAX_NVM_TIMEOUT;
		nvm->blank_nvm_mode = false;
	} else { /* Blank programming mode */
		nvm->blank_nvm_mode = true;
		ret_code = I40E_ERR_NVM_BLANK_MODE;
		i40e_debug(hw, I40E_DEBUG_NVM, "NVM init error: unsupported blank mode.\n");
	}

	return ret_code;
}
/**
 * i40e_init_nvm_ops - Initialize NVM function pointers
 * @hw: pointer to the HW structure
 *
 * Setup the function pointers and the NVM info structure. Should be called
 * once per NVM initialization, e.g. inside the i40e_init_shared_code().
 * Please notice that the NVM term is used here (& in all methods covered
 * in this file) as an equivalent of the FLASH part mapped into the SR.
 * We are accessing FLASH always through the Shadow RAM.
 **/
Initialize NVM function pointers
@hw: pointer to the HW structure

Setup the function pointers and the NVM info structure. Should be called
once per NVM initialization, e.g.
Initialize NVM function pointers @hw : pointer to the HW structure Setup the function pointers and the NVM info structure . Should be called once per NVM initialization e . g .
enum i40e_status_code i40e_init_nvm(struct i40e_hw *hw)
{
	struct i40e_nvm_info *nvm = &hw->nvm;
	enum i40e_status_code ret_code = I40E_SUCCESS;
	u32 fla, gens;
	u8 sr_size;
	DEBUGFUNC("i40e_init_nvm");
	gens = rd32(hw, I40E_GLNVM_GENS);
	sr_size = ((gens & I40E_GLNVM_GENS_SR_SIZE_MASK) >>
			   I40E_GLNVM_GENS_SR_SIZE_SHIFT);
	nvm->sr_size = BIT(sr_size) * I40E_SR_WORDS_IN_1KB;
	fla = rd32(hw, I40E_GLNVM_FLA);
	if (fla & I40E_GLNVM_FLA_LOCKED_MASK) { 
		nvm->timeout = I40E_MAX_NVM_TIMEOUT;
		nvm->blank_nvm_mode = false;
	} else { 
		nvm->blank_nvm_mode = true;
		ret_code = I40E_ERR_NVM_BLANK_MODE;
		i40e_debug(hw, I40E_DEBUG_NVM, "NVM init error: unsupported blank mode.\n");
	}
	return ret_code;
}
enum i40e_status_code i40e_init_nvm ( struct i40e_hw * hw ) { struct i40e_nvm_info * nvm = & hw -> nvm ; enum i40e_status_code ret_code = I40E_SUCCESS ; u32 fla , gens ; u8 sr_size ; DEBUGFUNC ( " " ) ; gens = rd32 ( hw , I40E_GLNVM_GENS ) ; sr_size = ( ( gens & I40E_GLNVM_GENS_SR_SIZE_MASK ) >> I40E_GLNVM_GENS_SR_SIZE_SHIFT ) ; nvm -> sr_size = BIT ( sr_size ) * I40E_SR_WORDS_IN_1KB ; fla = rd32 ( hw , I40E_GLNVM_FLA ) ; if ( fla & I40E_GLNVM_FLA_LOCKED_MASK ) { nvm -> timeout = I40E_MAX_NVM_TIMEOUT ; nvm -> blank_nvm_mode = false ; } else { nvm -> blank_nvm_mode = true ; ret_code = I40E_ERR_NVM_BLANK_MODE ; i40e_debug ( hw , I40E_DEBUG_NVM , " \n " ) ; } return ret_code ; }
i40e_init_nvm_ops - Initialize NVM function pointers
 @hw: pointer to the HW structure
i40e_init_nvm_ops - Initialize NVM function pointers @hw : pointer to the HW structure
/* The SR size is stored regardless of the nvm programming mode
	 * as the blank mode may be used in the factory line.
	 */ /* Switching to words (sr_size contains power of 2KB) */ /* Check if we are in the normal or blank NVM programming mode */ /* Normal programming mode */ /* Max NVM timeout */ /* Blank programming mode */