Lines Matching +full:inactive +full:-

1 // SPDX-License-Identifier: GPL-2.0
32 return -EINVAL; in ice_aq_read_nvm()
37 cmd->cmd_flags |= ICE_AQC_NVM_FLASH_ONLY; in ice_aq_read_nvm()
41 cmd->cmd_flags |= ICE_AQC_NVM_LAST_CMD; in ice_aq_read_nvm()
42 cmd->module_typeid = cpu_to_le16(module_typeid); in ice_aq_read_nvm()
43 cmd->offset_low = cpu_to_le16(offset & 0xFFFF); in ice_aq_read_nvm()
44 cmd->offset_high = (offset >> 16) & 0xFF; in ice_aq_read_nvm()
45 cmd->length = cpu_to_le16(length); in ice_aq_read_nvm()
51 * ice_read_flat_nvm - Read portion of NVM by flat offset
77 if (read_shadow_ram && ((offset + inlen) > (hw->flash.sr_words * 2u))) { in ice_read_flat_nvm()
79 return -EINVAL; in ice_read_flat_nvm()
91 read_size = min_t(u32, ICE_AQ_MAX_BUF_LEN - sector_offset, in ice_read_flat_nvm()
92 inlen - bytes_read); in ice_read_flat_nvm()
136 return -EINVAL; in ice_aq_update_nvm()
140 cmd->cmd_flags |= command_flags; in ice_aq_update_nvm()
144 cmd->cmd_flags |= ICE_AQC_NVM_LAST_CMD; in ice_aq_update_nvm()
145 cmd->module_typeid = cpu_to_le16(module_typeid); in ice_aq_update_nvm()
146 cmd->offset_low = cpu_to_le16(offset & 0xFFFF); in ice_aq_update_nvm()
147 cmd->offset_high = (offset >> 16) & 0xFF; in ice_aq_update_nvm()
148 cmd->length = cpu_to_le16(length); in ice_aq_update_nvm()
172 cmd->module_typeid = cpu_to_le16(module_typeid); in ice_aq_erase_nvm()
173 cmd->length = cpu_to_le16(ICE_AQC_NVM_ERASE_LEN); in ice_aq_erase_nvm()
174 cmd->offset_low = 0; in ice_aq_erase_nvm()
175 cmd->offset_high = 0; in ice_aq_erase_nvm()
181 * ice_read_sr_word_aq - Reads Shadow RAM via AQ
183 * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
207 * ice_acquire_nvm - Generic request for acquiring the NVM ownership
215 if (hw->flash.blank_nvm_mode) in ice_acquire_nvm()
222 * ice_release_nvm - Generic request for releasing the NVM ownership
229 if (hw->flash.blank_nvm_mode) in ice_release_nvm()
236 * ice_get_flash_bank_offset - Get offset into requested flash bank
238 * @bank: whether to read from the active or inactive flash bank
249 struct ice_bank_info *banks = &hw->flash.banks; in ice_get_flash_bank_offset()
256 offset = banks->nvm_ptr; in ice_get_flash_bank_offset()
257 size = banks->nvm_size; in ice_get_flash_bank_offset()
258 active_bank = banks->nvm_bank; in ice_get_flash_bank_offset()
261 offset = banks->orom_ptr; in ice_get_flash_bank_offset()
262 size = banks->orom_size; in ice_get_flash_bank_offset()
263 active_bank = banks->orom_bank; in ice_get_flash_bank_offset()
266 offset = banks->netlist_ptr; in ice_get_flash_bank_offset()
267 size = banks->netlist_size; in ice_get_flash_bank_offset()
268 active_bank = banks->netlist_bank; in ice_get_flash_bank_offset()
290 * we want the active or inactive bank, calculate the desired offset. in ice_get_flash_bank_offset()
304 * ice_read_flash_module - Read a word from one of the main NVM modules
313 * whether or not to read from the active bank or the inactive bank of that
317 * hw->flash.banks data being setup by ice_determine_active_flash_banks()
331 return -EINVAL; in ice_read_flash_module()
346 * ice_read_nvm_module - Read from the active main NVM module
348 * @bank: whether to read from active or inactive NVM module
370 * ice_read_nvm_sr_copy - Read a word from the Shadow RAM copy in the NVM bank
372 * @bank: whether to read from the active or inactive NVM module
386 * ice_read_netlist_module - Read data from the netlist module area
388 * @bank: whether to read from the active or inactive module
409 * ice_read_sr_word - Reads Shadow RAM word and acquire NVM if necessary
411 * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
430 * ice_get_pfa_module_tlv - Reads sub module TLV from NVM PFA
484 return -EINVAL; in ice_get_pfa_module_tlv()
492 return -ENOENT; in ice_get_pfa_module_tlv()
496 * ice_read_pba_string - Reads part number string from NVM
526 return -EINVAL; in ice_read_pba_string()
532 pba_size--; in ice_read_pba_string()
535 return -EINVAL; in ice_read_pba_string()
554 * ice_get_nvm_ver_info - Read NVM version information
556 * @bank: whether to read from the active or inactive flash bank
574 nvm->major = FIELD_GET(ICE_NVM_VER_HI_MASK, ver); in ice_get_nvm_ver_info()
575 nvm->minor = FIELD_GET(ICE_NVM_VER_LO_MASK, ver); in ice_get_nvm_ver_info()
588 nvm->eetrack = (eetrack_hi << 16) | eetrack_lo; in ice_get_nvm_ver_info()
594 * ice_get_inactive_nvm_ver - Read Option ROM version from the inactive bank
599 * inactive NVM bank. Used to access version data for a pending update that
608 * ice_get_orom_civd_data - Get the combo version information from Option ROM
610 * @bank: whether to read from the active or inactive flash module
637 orom_data = vzalloc(hw->flash.banks.orom_size); in ice_get_orom_civd_data()
639 return -ENOMEM; in ice_get_orom_civd_data()
642 orom_data, hw->flash.banks.orom_size); in ice_get_orom_civd_data()
650 for (offset = 0; (offset + 512) <= hw->flash.banks.orom_size; offset += 512) { in ice_get_orom_civd_data()
657 if (memcmp("$CIV", tmp->signature, sizeof(tmp->signature)) != 0) in ice_get_orom_civd_data()
682 return -EIO; in ice_get_orom_civd_data()
686 * ice_get_orom_ver_info - Read Option ROM version information
688 * @bank: whether to read from the active or inactive flash module
709 orom->major = FIELD_GET(ICE_OROM_VER_MASK, combo_ver); in ice_get_orom_ver_info()
710 orom->patch = FIELD_GET(ICE_OROM_VER_PATCH_MASK, combo_ver); in ice_get_orom_ver_info()
711 orom->build = FIELD_GET(ICE_OROM_VER_BUILD_MASK, combo_ver); in ice_get_orom_ver_info()
717 * ice_get_inactive_orom_ver - Read Option ROM version from the inactive bank
721 * Reads the Option ROM version and security revision data for the inactive
733 * @bank: whether to read from the active or inactive flash bank
755 return -EIO; in ice_get_netlist_info()
766 return -EIO; in ice_get_netlist_info()
776 return -ENOMEM; in ice_get_netlist_info()
788 netlist->major = id_blk[ICE_NETLIST_ID_BLK_MAJOR_VER_HIGH] << 16 | in ice_get_netlist_info()
790 netlist->minor = id_blk[ICE_NETLIST_ID_BLK_MINOR_VER_HIGH] << 16 | in ice_get_netlist_info()
792 netlist->type = id_blk[ICE_NETLIST_ID_BLK_TYPE_HIGH] << 16 | in ice_get_netlist_info()
794 netlist->rev = id_blk[ICE_NETLIST_ID_BLK_REV_HIGH] << 16 | in ice_get_netlist_info()
796 netlist->cust_ver = id_blk[ICE_NETLIST_ID_BLK_CUST_VER]; in ice_get_netlist_info()
798 netlist->hash = id_blk[ICE_NETLIST_ID_BLK_SHA_HASH_WORD(15)] << 16 | in ice_get_netlist_info()
812 * Read the netlist version data from the inactive netlist bank. Used to
822 * ice_discover_flash_size - Discover the available flash size.
838 while ((max_size - min_size) > 1) { in ice_discover_flash_size()
844 if (status == -EIO && in ice_discover_flash_size()
845 hw->adminq.sq_last_status == ICE_AQ_RC_EINVAL) { in ice_discover_flash_size()
862 hw->flash.flash_size = max_size; in ice_discover_flash_size()
871 * ice_read_sr_pointer - Read the value of a Shadow RAM pointer word
903 * ice_read_sr_area_size - Read an area size from a Shadow RAM word
931 * ice_determine_active_flash_banks - Discover active bank for each module
942 struct ice_bank_info *banks = &hw->flash.banks; in ice_determine_active_flash_banks()
956 return -EIO; in ice_determine_active_flash_banks()
960 banks->nvm_bank = ICE_1ST_FLASH_BANK; in ice_determine_active_flash_banks()
962 banks->nvm_bank = ICE_2ND_FLASH_BANK; in ice_determine_active_flash_banks()
965 banks->orom_bank = ICE_1ST_FLASH_BANK; in ice_determine_active_flash_banks()
967 banks->orom_bank = ICE_2ND_FLASH_BANK; in ice_determine_active_flash_banks()
970 banks->netlist_bank = ICE_1ST_FLASH_BANK; in ice_determine_active_flash_banks()
972 banks->netlist_bank = ICE_2ND_FLASH_BANK; in ice_determine_active_flash_banks()
974 status = ice_read_sr_pointer(hw, ICE_SR_1ST_NVM_BANK_PTR, &banks->nvm_ptr); in ice_determine_active_flash_banks()
980 status = ice_read_sr_area_size(hw, ICE_SR_NVM_BANK_SIZE, &banks->nvm_size); in ice_determine_active_flash_banks()
986 status = ice_read_sr_pointer(hw, ICE_SR_1ST_OROM_BANK_PTR, &banks->orom_ptr); in ice_determine_active_flash_banks()
992 status = ice_read_sr_area_size(hw, ICE_SR_OROM_BANK_SIZE, &banks->orom_size); in ice_determine_active_flash_banks()
998 status = ice_read_sr_pointer(hw, ICE_SR_NETLIST_BANK_PTR, &banks->netlist_ptr); in ice_determine_active_flash_banks()
1004 status = ice_read_sr_area_size(hw, ICE_SR_NETLIST_BANK_SIZE, &banks->netlist_size); in ice_determine_active_flash_banks()
1014 * ice_init_nvm - initializes NVM setting
1022 struct ice_flash_info *flash = &hw->flash; in ice_init_nvm()
1034 flash->sr_words = BIT(sr_size) * ICE_SR_WORDS_IN_1KB; in ice_init_nvm()
1039 flash->blank_nvm_mode = false; in ice_init_nvm()
1042 flash->blank_nvm_mode = true; in ice_init_nvm()
1044 return -EIO; in ice_init_nvm()
1059 status = ice_get_nvm_ver_info(hw, ICE_ACTIVE_FLASH_BANK, &flash->nvm); in ice_init_nvm()
1065 status = ice_get_orom_ver_info(hw, ICE_ACTIVE_FLASH_BANK, &flash->orom); in ice_init_nvm()
1070 status = ice_get_netlist_info(hw, ICE_ACTIVE_FLASH_BANK, &flash->netlist); in ice_init_nvm()
1096 cmd->flags = ICE_AQC_NVM_CHECKSUM_VERIFY; in ice_nvm_validate_checksum()
1102 if (le16_to_cpu(cmd->checksum) != ICE_AQC_NVM_CHECKSUM_CORRECT) in ice_nvm_validate_checksum()
1103 status = -EIO; in ice_nvm_validate_checksum()
1137 cmd->cmd_flags = (u8)(cmd_flags & 0xFF); in ice_nvm_write_activate()
1138 cmd->offset_high = (u8)((cmd_flags >> 8) & 0xFF); in ice_nvm_write_activate()
1142 *response_flags = cmd->cmd_flags; in ice_nvm_write_activate()
1185 return -EINVAL; in ice_nvm_set_pkg_data()
1193 cmd->cmd_flags |= ICE_AQC_NVM_PKG_DELETE; in ice_nvm_set_pkg_data()
1224 return -EINVAL; in ice_nvm_pass_component_tbl()
1232 cmd->transfer_flag = transfer_flag; in ice_nvm_pass_component_tbl()
1236 *comp_response = cmd->component_response; in ice_nvm_pass_component_tbl()
1237 *comp_response_code = cmd->component_response_code; in ice_nvm_pass_component_tbl()