Lines Matching +full:inactive +full:-
1 // SPDX-License-Identifier: GPL-2.0
31 return -EINVAL; in ice_aq_read_nvm()
36 cmd->cmd_flags |= ICE_AQC_NVM_FLASH_ONLY; in ice_aq_read_nvm()
40 cmd->cmd_flags |= ICE_AQC_NVM_LAST_CMD; in ice_aq_read_nvm()
41 cmd->module_typeid = cpu_to_le16(module_typeid); in ice_aq_read_nvm()
42 cmd->offset_low = cpu_to_le16(offset & 0xFFFF); in ice_aq_read_nvm()
43 cmd->offset_high = (offset >> 16) & 0xFF; in ice_aq_read_nvm()
44 cmd->length = cpu_to_le16(length); in ice_aq_read_nvm()
50 * ice_read_flat_nvm - Read portion of NVM by flat offset
76 if (read_shadow_ram && ((offset + inlen) > (hw->flash.sr_words * 2u))) { in ice_read_flat_nvm()
78 return -EINVAL; in ice_read_flat_nvm()
90 read_size = min_t(u32, ICE_AQ_MAX_BUF_LEN - sector_offset, in ice_read_flat_nvm()
91 inlen - bytes_read); in ice_read_flat_nvm()
135 return -EINVAL; in ice_aq_update_nvm()
139 cmd->cmd_flags |= command_flags; in ice_aq_update_nvm()
143 cmd->cmd_flags |= ICE_AQC_NVM_LAST_CMD; in ice_aq_update_nvm()
144 cmd->module_typeid = cpu_to_le16(module_typeid); in ice_aq_update_nvm()
145 cmd->offset_low = cpu_to_le16(offset & 0xFFFF); in ice_aq_update_nvm()
146 cmd->offset_high = (offset >> 16) & 0xFF; in ice_aq_update_nvm()
147 cmd->length = cpu_to_le16(length); in ice_aq_update_nvm()
171 cmd->module_typeid = cpu_to_le16(module_typeid); in ice_aq_erase_nvm()
172 cmd->length = cpu_to_le16(ICE_AQC_NVM_ERASE_LEN); in ice_aq_erase_nvm()
173 cmd->offset_low = 0; in ice_aq_erase_nvm()
174 cmd->offset_high = 0; in ice_aq_erase_nvm()
180 * ice_read_sr_word_aq - Reads Shadow RAM via AQ
182 * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
206 * ice_acquire_nvm - Generic request for acquiring the NVM ownership
214 if (hw->flash.blank_nvm_mode) in ice_acquire_nvm()
221 * ice_release_nvm - Generic request for releasing the NVM ownership
228 if (hw->flash.blank_nvm_mode) in ice_release_nvm()
235 * ice_get_flash_bank_offset - Get offset into requested flash bank
237 * @bank: whether to read from the active or inactive flash bank
248 struct ice_bank_info *banks = &hw->flash.banks; in ice_get_flash_bank_offset()
255 offset = banks->nvm_ptr; in ice_get_flash_bank_offset()
256 size = banks->nvm_size; in ice_get_flash_bank_offset()
257 active_bank = banks->nvm_bank; in ice_get_flash_bank_offset()
260 offset = banks->orom_ptr; in ice_get_flash_bank_offset()
261 size = banks->orom_size; in ice_get_flash_bank_offset()
262 active_bank = banks->orom_bank; in ice_get_flash_bank_offset()
265 offset = banks->netlist_ptr; in ice_get_flash_bank_offset()
266 size = banks->netlist_size; in ice_get_flash_bank_offset()
267 active_bank = banks->netlist_bank; in ice_get_flash_bank_offset()
289 * we want the active or inactive bank, calculate the desired offset. in ice_get_flash_bank_offset()
303 * ice_read_flash_module - Read a word from one of the main NVM modules
312 * whether or not to read from the active bank or the inactive bank of that
316 * hw->flash.banks data being setup by ice_determine_active_flash_banks()
330 return -EINVAL; in ice_read_flash_module()
345 * ice_read_nvm_module - Read from the active main NVM module
347 * @bank: whether to read from active or inactive NVM module
369 * ice_read_nvm_sr_copy - Read a word from the Shadow RAM copy in the NVM bank
371 * @bank: whether to read from the active or inactive NVM module
379 * is aligned to 64-byte (32-word) offsets.
388 sr_copy = roundup(hw->flash.banks.active_css_hdr_len, 32); in ice_read_nvm_sr_copy()
391 sr_copy = roundup(hw->flash.banks.inactive_css_hdr_len, 32); in ice_read_nvm_sr_copy()
399 * ice_read_netlist_module - Read data from the netlist module area
401 * @bank: whether to read from the active or inactive module
422 * ice_read_sr_word - Reads Shadow RAM word and acquire NVM if necessary
424 * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
443 * ice_get_pfa_module_tlv - Reads sub module TLV from NVM PFA
471 /* The Preserved Fields Area contains a sequence of Type-Length-Value in ice_get_pfa_module_tlv()
476 if (check_add_overflow(pfa_ptr, pfa_len - 1, &max_tlv)) { in ice_get_pfa_module_tlv()
477 …dev_warn(ice_hw_to_dev(hw), "PFA starts at offset %u. PFA length of %u caused 16-bit arithmetic ov… in ice_get_pfa_module_tlv()
479 return -EINVAL; in ice_get_pfa_module_tlv()
508 return -EINVAL; in ice_get_pfa_module_tlv()
513 …dev_warn(ice_hw_to_dev(hw), "TLV of type %u and length 0x%04x caused 16-bit arithmetic overflow. T… in ice_get_pfa_module_tlv()
515 return -EINVAL; in ice_get_pfa_module_tlv()
519 return -ENOENT; in ice_get_pfa_module_tlv()
523 * ice_read_pba_string - Reads part number string from NVM
553 return -EINVAL; in ice_read_pba_string()
559 pba_size--; in ice_read_pba_string()
562 return -EINVAL; in ice_read_pba_string()
581 * ice_get_nvm_ver_info - Read NVM version information
583 * @bank: whether to read from the active or inactive flash bank
601 nvm->major = FIELD_GET(ICE_NVM_VER_HI_MASK, ver); in ice_get_nvm_ver_info()
602 nvm->minor = FIELD_GET(ICE_NVM_VER_LO_MASK, ver); in ice_get_nvm_ver_info()
615 nvm->eetrack = (eetrack_hi << 16) | eetrack_lo; in ice_get_nvm_ver_info()
621 * ice_get_inactive_nvm_ver - Read Option ROM version from the inactive bank
626 * inactive NVM bank. Used to access version data for a pending update that
635 * ice_get_orom_civd_data - Get the combo version information from Option ROM
637 * @bank: whether to read from the active or inactive flash module
664 orom_data = vzalloc(hw->flash.banks.orom_size); in ice_get_orom_civd_data()
666 return -ENOMEM; in ice_get_orom_civd_data()
669 orom_data, hw->flash.banks.orom_size); in ice_get_orom_civd_data()
677 for (offset = 0; (offset + 512) <= hw->flash.banks.orom_size; offset += 512) { in ice_get_orom_civd_data()
684 if (memcmp("$CIV", tmp->signature, sizeof(tmp->signature)) != 0) in ice_get_orom_civd_data()
709 return -EIO; in ice_get_orom_civd_data()
713 * ice_get_orom_ver_info - Read Option ROM version information
715 * @bank: whether to read from the active or inactive flash module
736 orom->major = FIELD_GET(ICE_OROM_VER_MASK, combo_ver); in ice_get_orom_ver_info()
737 orom->patch = FIELD_GET(ICE_OROM_VER_PATCH_MASK, combo_ver); in ice_get_orom_ver_info()
738 orom->build = FIELD_GET(ICE_OROM_VER_BUILD_MASK, combo_ver); in ice_get_orom_ver_info()
744 * ice_get_inactive_orom_ver - Read Option ROM version from the inactive bank
748 * Reads the Option ROM version and security revision data for the inactive
760 * @bank: whether to read from the active or inactive flash bank
782 return -EIO; in ice_get_netlist_info()
793 return -EIO; in ice_get_netlist_info()
803 return -ENOMEM; in ice_get_netlist_info()
815 netlist->major = id_blk[ICE_NETLIST_ID_BLK_MAJOR_VER_HIGH] << 16 | in ice_get_netlist_info()
817 netlist->minor = id_blk[ICE_NETLIST_ID_BLK_MINOR_VER_HIGH] << 16 | in ice_get_netlist_info()
819 netlist->type = id_blk[ICE_NETLIST_ID_BLK_TYPE_HIGH] << 16 | in ice_get_netlist_info()
821 netlist->rev = id_blk[ICE_NETLIST_ID_BLK_REV_HIGH] << 16 | in ice_get_netlist_info()
823 netlist->cust_ver = id_blk[ICE_NETLIST_ID_BLK_CUST_VER]; in ice_get_netlist_info()
825 netlist->hash = id_blk[ICE_NETLIST_ID_BLK_SHA_HASH_WORD(15)] << 16 | in ice_get_netlist_info()
839 * Read the netlist version data from the inactive netlist bank. Used to
849 * ice_discover_flash_size - Discover the available flash size.
865 while ((max_size - min_size) > 1) { in ice_discover_flash_size()
871 if (status == -EIO && in ice_discover_flash_size()
872 hw->adminq.sq_last_status == ICE_AQ_RC_EINVAL) { in ice_discover_flash_size()
889 hw->flash.flash_size = max_size; in ice_discover_flash_size()
898 * ice_read_sr_pointer - Read the value of a Shadow RAM pointer word
930 * ice_read_sr_area_size - Read an area size from a Shadow RAM word
958 * ice_determine_active_flash_banks - Discover active bank for each module
969 struct ice_bank_info *banks = &hw->flash.banks; in ice_determine_active_flash_banks()
983 return -EIO; in ice_determine_active_flash_banks()
987 banks->nvm_bank = ICE_1ST_FLASH_BANK; in ice_determine_active_flash_banks()
989 banks->nvm_bank = ICE_2ND_FLASH_BANK; in ice_determine_active_flash_banks()
992 banks->orom_bank = ICE_1ST_FLASH_BANK; in ice_determine_active_flash_banks()
994 banks->orom_bank = ICE_2ND_FLASH_BANK; in ice_determine_active_flash_banks()
997 banks->netlist_bank = ICE_1ST_FLASH_BANK; in ice_determine_active_flash_banks()
999 banks->netlist_bank = ICE_2ND_FLASH_BANK; in ice_determine_active_flash_banks()
1001 status = ice_read_sr_pointer(hw, ICE_SR_1ST_NVM_BANK_PTR, &banks->nvm_ptr); in ice_determine_active_flash_banks()
1007 status = ice_read_sr_area_size(hw, ICE_SR_NVM_BANK_SIZE, &banks->nvm_size); in ice_determine_active_flash_banks()
1013 status = ice_read_sr_pointer(hw, ICE_SR_1ST_OROM_BANK_PTR, &banks->orom_ptr); in ice_determine_active_flash_banks()
1019 status = ice_read_sr_area_size(hw, ICE_SR_OROM_BANK_SIZE, &banks->orom_size); in ice_determine_active_flash_banks()
1025 status = ice_read_sr_pointer(hw, ICE_SR_NETLIST_BANK_PTR, &banks->netlist_ptr); in ice_determine_active_flash_banks()
1031 status = ice_read_sr_area_size(hw, ICE_SR_NETLIST_BANK_SIZE, &banks->netlist_size); in ice_determine_active_flash_banks()
1041 * ice_get_nvm_css_hdr_len - Read the CSS header length from the NVM CSS header
1043 * @bank: whether to read from the active or inactive flash bank
1079 * ice_determine_css_hdr_len - Discover CSS header length for the device
1090 struct ice_bank_info *banks = &hw->flash.banks; in ice_determine_css_hdr_len()
1094 &banks->active_css_hdr_len); in ice_determine_css_hdr_len()
1099 &banks->inactive_css_hdr_len); in ice_determine_css_hdr_len()
1107 * ice_init_nvm - initializes NVM setting
1115 struct ice_flash_info *flash = &hw->flash; in ice_init_nvm()
1127 flash->sr_words = BIT(sr_size) * ICE_SR_WORDS_IN_1KB; in ice_init_nvm()
1132 flash->blank_nvm_mode = false; in ice_init_nvm()
1135 flash->blank_nvm_mode = true; in ice_init_nvm()
1137 return -EIO; in ice_init_nvm()
1158 status = ice_get_nvm_ver_info(hw, ICE_ACTIVE_FLASH_BANK, &flash->nvm); in ice_init_nvm()
1164 status = ice_get_orom_ver_info(hw, ICE_ACTIVE_FLASH_BANK, &flash->orom); in ice_init_nvm()
1169 status = ice_get_netlist_info(hw, ICE_ACTIVE_FLASH_BANK, &flash->netlist); in ice_init_nvm()
1195 cmd->flags = ICE_AQC_NVM_CHECKSUM_VERIFY; in ice_nvm_validate_checksum()
1201 if (le16_to_cpu(cmd->checksum) != ICE_AQC_NVM_CHECKSUM_CORRECT) in ice_nvm_validate_checksum()
1202 status = -EIO; in ice_nvm_validate_checksum()
1236 cmd->cmd_flags = (u8)(cmd_flags & 0xFF); in ice_nvm_write_activate()
1237 cmd->offset_high = (u8)((cmd_flags >> 8) & 0xFF); in ice_nvm_write_activate()
1241 *response_flags = cmd->cmd_flags; in ice_nvm_write_activate()
1284 return -EINVAL; in ice_nvm_set_pkg_data()
1292 cmd->cmd_flags |= ICE_AQC_NVM_PKG_DELETE; in ice_nvm_set_pkg_data()
1323 return -EINVAL; in ice_nvm_pass_component_tbl()
1331 cmd->transfer_flag = transfer_flag; in ice_nvm_pass_component_tbl()
1335 *comp_response = cmd->component_response; in ice_nvm_pass_component_tbl()
1336 *comp_response_code = cmd->component_response_code; in ice_nvm_pass_component_tbl()