drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c- Extension
.c- Size
- 26080 bytes
- Lines
- 1100
- 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
../aq_nic.h../aq_hw_utils.hhw_atl_utils.hhw_atl_llh.hhw_atl_llh_internal.hlinux/random.h
Detected Declarations
struct aq_hw_atl_utils_fw_rpc_tid_senum mcp_areafunction hw_atl_utils_initfwfunction hw_atl_utils_soft_reset_flbfunction hw_atl_utils_soft_reset_rblfunction hw_atl_utils_soft_resetfunction hw_atl_utils_fw_downld_dwordsfunction hw_atl_utils_write_b1_mboxfunction hw_atl_utils_write_b0_mboxfunction hw_atl_utils_fw_upload_dwordsfunction hw_atl_write_fwcfg_dwordsfunction hw_atl_write_fwsettings_dwordsfunction hw_atl_utils_ver_matchfunction hw_atl_utils_init_ucpfunction hw_atl_utils_fw_rpc_callfunction hw_atl_utils_fw_rpc_waitfunction hw_atl_utils_mpi_createfunction hw_atl_utils_mpi_read_mboxfunction hw_atl_utils_mpi_read_statsfunction hw_atl_utils_mpi_set_speedfunction hw_atl_utils_mpi_set_statefunction hw_atl_utils_mpi_get_link_statusfunction hw_atl_utils_get_mac_permanentfunction hw_atl_utils_mbps_2_speed_indexfunction hw_atl_utils_hw_chip_features_initfunction hw_atl_fw1x_deinitfunction hw_atl_utils_update_statsfunction hw_atl_utils_hw_get_regsfunction hw_atl_utils_get_fw_versionfunction aq_fw1x_set_wake_magicfunction aq_fw1x_set_powerfunction hw_atl_utils_get_mpi_mbox_tidfunction hw_atl_utils_mpi_get_statefunction hw_atl_utils_mif_cmd_getfunction hw_atl_utils_mif_addr_getfunction hw_atl_utils_rpc_state_getfunction aq_fw1x_rpc_get
Annotated Snippet
struct aq_hw_atl_utils_fw_rpc_tid_s {
union {
u32 val;
struct {
u16 tid;
u16 len;
};
};
};
#define hw_atl_utils_fw_rpc_init(_H_) hw_atl_utils_fw_rpc_wait(_H_, NULL)
int hw_atl_utils_fw_rpc_call(struct aq_hw_s *self, unsigned int rpc_size)
{
struct aq_hw_atl_utils_fw_rpc_tid_s sw;
int err = 0;
if (!ATL_HW_IS_CHIP_FEATURE(self, MIPS)) {
err = -1;
goto err_exit;
}
err = hw_atl_write_fwcfg_dwords(self, (u32 *)(void *)&self->rpc,
(rpc_size + sizeof(u32) -
sizeof(u8)) / sizeof(u32));
if (err < 0)
goto err_exit;
sw.tid = 0xFFFFU & (++self->rpc_tid);
sw.len = (u16)rpc_size;
aq_hw_write_reg(self, HW_ATL_RPC_CONTROL_ADR, sw.val);
err_exit:
return err;
}
int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self,
struct hw_atl_utils_fw_rpc **rpc)
{
struct aq_hw_atl_utils_fw_rpc_tid_s sw;
struct aq_hw_atl_utils_fw_rpc_tid_s fw;
int err = 0;
do {
sw.val = aq_hw_read_reg(self, HW_ATL_RPC_CONTROL_ADR);
self->rpc_tid = sw.tid;
err = readx_poll_timeout_atomic(hw_atl_utils_rpc_state_get,
self, fw.val,
sw.tid == fw.tid,
1000U, 100000U);
if (err < 0)
goto err_exit;
err = aq_hw_err_from_flags(self);
if (err < 0)
goto err_exit;
if (fw.len == 0xFFFFU) {
if (sw.len > sizeof(self->rpc)) {
printk(KERN_INFO "Invalid sw len: %x\n", sw.len);
err = -EINVAL;
goto err_exit;
}
err = hw_atl_utils_fw_rpc_call(self, sw.len);
if (err < 0)
goto err_exit;
}
} while (sw.tid != fw.tid || 0xFFFFU == fw.len);
if (rpc) {
if (fw.len) {
if (fw.len > sizeof(self->rpc)) {
printk(KERN_INFO "Invalid fw len: %x\n", fw.len);
err = -EINVAL;
goto err_exit;
}
err =
hw_atl_utils_fw_downld_dwords(self,
self->rpc_addr,
(u32 *)(void *)
&self->rpc,
(fw.len + sizeof(u32) -
sizeof(u8)) /
sizeof(u32));
if (err < 0)
goto err_exit;
}
*rpc = &self->rpc;
Annotation
- Immediate include surface: `../aq_nic.h`, `../aq_hw_utils.h`, `hw_atl_utils.h`, `hw_atl_llh.h`, `hw_atl_llh_internal.h`, `linux/random.h`.
- Detected declarations: `struct aq_hw_atl_utils_fw_rpc_tid_s`, `enum mcp_area`, `function hw_atl_utils_initfw`, `function hw_atl_utils_soft_reset_flb`, `function hw_atl_utils_soft_reset_rbl`, `function hw_atl_utils_soft_reset`, `function hw_atl_utils_fw_downld_dwords`, `function hw_atl_utils_write_b1_mbox`, `function hw_atl_utils_write_b0_mbox`, `function hw_atl_utils_fw_upload_dwords`.
- 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.