drivers/net/ethernet/intel/ice/ice_nvm.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_nvm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_nvm.c- Extension
.c- Size
- 39580 bytes
- Lines
- 1340
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/vmalloc.hice_common.h
Detected Declarations
function commandsfunction ice_read_flat_nvmfunction commandsfunction commandsfunction ice_read_sr_word_aqfunction ice_acquire_nvmfunction ice_release_nvmfunction ice_get_flash_bank_offsetfunction ice_read_flash_modulefunction ice_read_nvm_modulefunction ice_read_nvm_sr_copyfunction ice_read_netlist_modulefunction ice_read_sr_wordfunction Areafunction ice_read_pba_stringfunction ice_get_nvm_ver_infofunction ice_get_inactive_nvm_verfunction ice_get_orom_civd_datafunction ice_get_orom_ver_infofunction ice_get_inactive_orom_verfunction ice_get_netlist_infofunction ice_get_inactive_netlist_verfunction ice_discover_flash_sizefunction ice_read_sr_pointerfunction ice_read_sr_area_sizefunction ice_determine_active_flash_banksfunction ice_get_nvm_css_hdr_lenfunction ice_determine_css_hdr_lenfunction ice_init_nvmfunction validityfunction flashfunction emprfunction datafunction table
Annotated Snippet
if (status) {
ice_debug(hw, ICE_DBG_INIT, "Failed to read TLV type.\n");
break;
}
/* Read TLV length */
status = ice_read_sr_word(hw, next_tlv + 1, &tlv_len);
if (status) {
ice_debug(hw, ICE_DBG_INIT, "Failed to read TLV length.\n");
break;
}
if (tlv_sub_module_type == module_type) {
if (tlv_len) {
*module_tlv = next_tlv;
*module_tlv_len = tlv_len;
return 0;
}
return -EINVAL;
}
if (check_add_overflow(next_tlv, 2, &next_tlv) ||
check_add_overflow(next_tlv, tlv_len, &next_tlv)) {
dev_warn(ice_hw_to_dev(hw), "TLV of type %u and length 0x%04x caused 16-bit arithmetic overflow. The PFA starts at 0x%04x and has length of 0x%04x\n",
tlv_sub_module_type, tlv_len, pfa_ptr, pfa_len);
return -EINVAL;
}
}
/* Module does not exist */
return -ENOENT;
}
/**
* ice_read_pba_string - Reads part number string from NVM
* @hw: pointer to hardware structure
* @pba_num: stores the part number string from the NVM
* @pba_num_size: part number string buffer length
*
* Reads the part number string from the NVM.
*/
int ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)
{
u16 pba_tlv, pba_tlv_len;
u16 pba_word, pba_size;
int status;
u16 i;
status = ice_get_pfa_module_tlv(hw, &pba_tlv, &pba_tlv_len,
ICE_SR_PBA_BLOCK_PTR);
if (status) {
ice_debug(hw, ICE_DBG_INIT, "Failed to read PBA Block TLV.\n");
return status;
}
/* pba_size is the next word */
status = ice_read_sr_word(hw, (pba_tlv + 2), &pba_size);
if (status) {
ice_debug(hw, ICE_DBG_INIT, "Failed to read PBA Section size.\n");
return status;
}
if (pba_tlv_len < pba_size) {
ice_debug(hw, ICE_DBG_INIT, "Invalid PBA Block TLV size.\n");
return -EINVAL;
}
/* Subtract one to get PBA word count (PBA Size word is included in
* total size)
*/
pba_size--;
if (pba_num_size < (((u32)pba_size * 2) + 1)) {
ice_debug(hw, ICE_DBG_INIT, "Buffer too small for PBA data.\n");
return -EINVAL;
}
for (i = 0; i < pba_size; i++) {
status = ice_read_sr_word(hw, (pba_tlv + 2 + 1) + i, &pba_word);
if (status) {
ice_debug(hw, ICE_DBG_INIT, "Failed to read PBA Block word %d.\n", i);
return status;
}
pba_num[(i * 2)] = (pba_word >> 8) & 0xFF;
pba_num[(i * 2) + 1] = pba_word & 0xFF;
}
pba_num[(pba_size * 2)] = '\0';
return status;
}
/**
* ice_get_nvm_ver_info - Read NVM version information
Annotation
- Immediate include surface: `linux/vmalloc.h`, `ice_common.h`.
- Detected declarations: `function commands`, `function ice_read_flat_nvm`, `function commands`, `function commands`, `function ice_read_sr_word_aq`, `function ice_acquire_nvm`, `function ice_release_nvm`, `function ice_get_flash_bank_offset`, `function ice_read_flash_module`, `function ice_read_nvm_module`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.