* i40e_init_nvm - 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 acces
| 17 | * We are accessing FLASH always through the Shadow RAM. |
| 18 | **/ |
| 19 | enum i40e_status_code i40e_init_nvm(struct i40e_hw *hw) |
| 20 | { |
| 21 | struct i40e_nvm_info *nvm = &hw->nvm; |
| 22 | enum i40e_status_code ret_code = I40E_SUCCESS; |
| 23 | u32 fla, gens; |
| 24 | u8 sr_size; |
| 25 | |
| 26 | DEBUGFUNC("i40e_init_nvm"); |
| 27 | |
| 28 | /* The SR size is stored regardless of the nvm programming mode |
| 29 | * as the blank mode may be used in the factory line. |
| 30 | */ |
| 31 | gens = rd32(hw, I40E_GLNVM_GENS); |
| 32 | sr_size = ((gens & I40E_GLNVM_GENS_SR_SIZE_MASK) >> |
| 33 | I40E_GLNVM_GENS_SR_SIZE_SHIFT); |
| 34 | /* Switching to words (sr_size contains power of 2KB) */ |
| 35 | nvm->sr_size = BIT(sr_size) * I40E_SR_WORDS_IN_1KB; |
| 36 | |
| 37 | /* Check if we are in the normal or blank NVM programming mode */ |
| 38 | fla = rd32(hw, I40E_GLNVM_FLA); |
| 39 | if (fla & I40E_GLNVM_FLA_LOCKED_MASK) { /* Normal programming mode */ |
| 40 | /* Max NVM timeout */ |
| 41 | nvm->timeout = I40E_MAX_NVM_TIMEOUT; |
| 42 | nvm->blank_nvm_mode = false; |
| 43 | } else { /* Blank programming mode */ |
| 44 | nvm->blank_nvm_mode = true; |
| 45 | ret_code = I40E_ERR_NVM_BLANK_MODE; |
| 46 | i40e_debug(hw, I40E_DEBUG_NVM, "NVM init error: unsupported blank mode.\n"); |
| 47 | } |
| 48 | |
| 49 | return ret_code; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * i40e_acquire_nvm - Generic request for acquiring the NVM ownership |
no test coverage detected