drivers/net/ethernet/pensando/ionic/ionic_fw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/pensando/ionic/ionic_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/pensando/ionic/ionic_fw.c- Extension
.c- Size
- 5645 bytes
- Lines
- 202
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/types.hlinux/errno.hlinux/firmware.hionic.hionic_dev.hionic_lif.hionic_devlink.h
Detected Declarations
function ionic_dev_cmd_firmware_downloadfunction ionic_dev_cmd_firmware_installfunction ionic_dev_cmd_firmware_activatefunction ionic_fw_status_long_waitfunction ionic_firmware_update
Annotated Snippet
if (offset >= next_interval) {
devlink_flash_update_status_notify(dl, "Downloading", NULL,
offset, fw->size);
next_interval = offset + (fw->size / IONIC_FW_INTERVAL_FRACTION);
}
copy_sz = min_t(unsigned int, buf_sz, fw->size - offset);
mutex_lock(&ionic->dev_cmd_lock);
memcpy_toio(&idev->dev_cmd_regs->data, fw->data + offset, copy_sz);
ionic_dev_cmd_firmware_download(idev,
offsetof(union ionic_dev_cmd_regs, data),
offset, copy_sz);
err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
mutex_unlock(&ionic->dev_cmd_lock);
if (err) {
netdev_err(netdev,
"download failed offset 0x%x addr 0x%lx len 0x%x\n",
offset, offsetof(union ionic_dev_cmd_regs, data),
copy_sz);
NL_SET_ERR_MSG_MOD(extack, "Segment download failed");
goto err_out;
}
offset += copy_sz;
}
devlink_flash_update_status_notify(dl, "Downloading", NULL,
fw->size, fw->size);
devlink_flash_update_timeout_notify(dl, "Installing", NULL,
IONIC_FW_INSTALL_TIMEOUT);
mutex_lock(&ionic->dev_cmd_lock);
ionic_dev_cmd_firmware_install(idev);
err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
ionic_dev_cmd_comp(idev, (union ionic_dev_cmd_comp *)&comp);
fw_slot = comp.fw_control.slot;
mutex_unlock(&ionic->dev_cmd_lock);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Failed to start firmware install");
goto err_out;
}
err = ionic_fw_status_long_wait(ionic, "Installing",
IONIC_FW_INSTALL_TIMEOUT,
IONIC_FW_INSTALL_STATUS,
extack);
if (err)
goto err_out;
devlink_flash_update_timeout_notify(dl, "Selecting", NULL,
IONIC_FW_SELECT_TIMEOUT);
mutex_lock(&ionic->dev_cmd_lock);
ionic_dev_cmd_firmware_activate(idev, fw_slot);
err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
mutex_unlock(&ionic->dev_cmd_lock);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Failed to start firmware select");
goto err_out;
}
err = ionic_fw_status_long_wait(ionic, "Selecting",
IONIC_FW_SELECT_TIMEOUT,
IONIC_FW_ACTIVATE_STATUS,
extack);
if (err)
goto err_out;
netdev_info(netdev, "Firmware update completed\n");
err_out:
if (err)
devlink_flash_update_status_notify(dl, "Flash failed", NULL, 0, 0);
else
devlink_flash_update_status_notify(dl, "Flash done", NULL, 0, 0);
return err;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/errno.h`, `linux/firmware.h`, `ionic.h`, `ionic_dev.h`, `ionic_lif.h`, `ionic_devlink.h`.
- Detected declarations: `function ionic_dev_cmd_firmware_download`, `function ionic_dev_cmd_firmware_install`, `function ionic_dev_cmd_firmware_activate`, `function ionic_fw_status_long_wait`, `function ionic_firmware_update`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.