drivers/net/ethernet/intel/ice/ice_fw_update.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_fw_update.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_fw_update.c- Extension
.c- Size
- 34210 bytes
- Lines
- 1070
- 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/unaligned.hlinux/uuid.hlinux/crc32.hlinux/pldmfw.hice.hice_lib.hice_fw_update.h
Detected Declarations
struct ice_fwu_privstruct ice_pldm_pci_record_idfunction ice_send_package_datafunction ice_check_component_responsefunction ice_send_component_tablefunction ice_write_one_nvm_blockfunction ice_write_nvm_modulefunction ice_erase_nvm_modulefunction ice_switch_flash_banksfunction ice_flash_componentfunction ice_finalize_updatefunction ice_op_pci_match_recordfunction list_for_each_entryfunction ice_get_pending_updatesfunction ice_cancel_pending_updatefunction ice_devlink_flash_update
Annotated Snippet
struct ice_fwu_priv {
struct pldmfw context;
struct ice_pf *pf;
struct netlink_ext_ack *extack;
/* Track which NVM banks to activate at the end of the update */
u8 activate_flags;
/* Track the firmware response of the required reset to complete the
* flash update.
*
* 0 - ICE_AQC_NVM_POR_FLAG - A full power on is required
* 1 - ICE_AQC_NVM_PERST_FLAG - A cold PCIe reset is required
* 2 - ICE_AQC_NVM_EMPR_FLAG - An EMP reset is required
*/
u8 reset_level;
/* Track if EMP reset is available */
u8 emp_reset_available;
};
/**
* ice_send_package_data - Send record package data to firmware
* @context: PLDM fw update structure
* @data: pointer to the package data
* @length: length of the package data
*
* Send a copy of the package data associated with the PLDM record matching
* this device to the firmware.
*
* Note that this function sends an AdminQ command that will fail unless the
* NVM resource has been acquired.
*
* Returns: zero on success, or a negative error code on failure.
*/
static int
ice_send_package_data(struct pldmfw *context, const u8 *data, u16 length)
{
struct ice_fwu_priv *priv = container_of(context, struct ice_fwu_priv, context);
struct netlink_ext_ack *extack = priv->extack;
struct device *dev = context->dev;
struct ice_pf *pf = priv->pf;
struct ice_hw *hw = &pf->hw;
u8 *package_data;
int status;
dev_dbg(dev, "Sending PLDM record package data to firmware\n");
package_data = kmemdup(data, length, GFP_KERNEL);
if (!package_data)
return -ENOMEM;
status = ice_nvm_set_pkg_data(hw, false, package_data, length, NULL);
kfree(package_data);
if (status) {
dev_err(dev, "Failed to send record package data to firmware, err %d aq_err %s\n",
status, libie_aq_str(hw->adminq.sq_last_status));
NL_SET_ERR_MSG_MOD(extack, "Failed to record package data to firmware");
return -EIO;
}
return 0;
}
/**
* ice_check_component_response - Report firmware response to a component
* @pf: device private data structure
* @id: component id being checked
* @response: indicates whether this component can be updated
* @code: code indicating reason for response
* @extack: netlink extended ACK structure
*
* Check whether firmware indicates if this component can be updated. Report
* a suitable error message over the netlink extended ACK if the component
* cannot be updated.
*
* Returns: zero if the component can be updated, or -ECANCELED of the
* firmware indicates the component cannot be updated.
*/
static int
ice_check_component_response(struct ice_pf *pf, u16 id, u8 response, u8 code,
struct netlink_ext_ack *extack)
{
struct device *dev = ice_pf_to_dev(pf);
const char *component;
switch (id) {
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/uuid.h`, `linux/crc32.h`, `linux/pldmfw.h`, `ice.h`, `ice_lib.h`, `ice_fw_update.h`.
- Detected declarations: `struct ice_fwu_priv`, `struct ice_pldm_pci_record_id`, `function ice_send_package_data`, `function ice_check_component_response`, `function ice_send_component_table`, `function ice_write_one_nvm_block`, `function ice_write_nvm_module`, `function ice_erase_nvm_module`, `function ice_switch_flash_banks`, `function ice_flash_component`.
- 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.