drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c- Extension
.c- Size
- 20607 bytes
- Lines
- 719
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/iopoll.haq_hw.haq_hw_utils.haq_nic.hhw_atl/hw_atl_llh.hhw_atl2_utils.hhw_atl2_llh.hhw_atl2_internal.h
Detected Declarations
function hw_atl2_shared_buffer_read_blockfunction hw_atl2_shared_buffer_finish_ackfunction aq_a2_fw_initfunction aq_a2_fw_deinitfunction a2_link_speed_mask2fwfunction a2_fw_dev_to_eee_maskfunction a2_fw_lkp_to_maskfunction aq_a2_fw_set_link_speedfunction aq_a2_fw_set_mpi_flow_controlfunction aq_a2_fw_upd_eee_rate_bitsfunction aq_a2_fw_set_statefunction aq_a2_fw_update_link_statusfunction aq_a2_fw_get_mac_permanentfunction aq_a2_fill_a0_statsfunction aq_a2_fill_b0_statsfunction aq_a2_fw_update_statsfunction aq_a2_fw_get_phy_tempfunction aq_a2_fw_get_mac_tempfunction aq_a2_fw_set_wol_paramsfunction aq_a2_fw_set_powerfunction aq_a2_fw_set_eee_ratefunction aq_a2_fw_get_eee_ratefunction aq_a2_fw_renegotiatefunction aq_a2_fw_set_flow_controlfunction aq_a2_fw_get_flow_controlfunction aq_a2_fw_set_phyloopbackfunction hw_atl2_utils_get_fw_versionfunction hw_atl2_utils_get_filter_capsfunction aq_a2_fw_set_downshift
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Atlantic Network Driver
* Copyright (C) 2020 Marvell International Ltd.
*/
#include <linux/iopoll.h>
#include "aq_hw.h"
#include "aq_hw_utils.h"
#include "aq_nic.h"
#include "hw_atl/hw_atl_llh.h"
#include "hw_atl2_utils.h"
#include "hw_atl2_llh.h"
#include "hw_atl2_internal.h"
#define AQ_A2_FW_READ_TRY_MAX 1000
#define hw_atl2_shared_buffer_write(HW, ITEM, VARIABLE) \
{\
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \
sizeof(u32)) != 0,\
"Unaligned write " # ITEM);\
BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\
"Unaligned write length " # ITEM);\
hw_atl2_mif_shared_buf_write(HW,\
(offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
(u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32));\
}
#define hw_atl2_shared_buffer_get(HW, ITEM, VARIABLE) \
{\
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \
sizeof(u32)) != 0,\
"Unaligned get " # ITEM);\
BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\
"Unaligned get length " # ITEM);\
hw_atl2_mif_shared_buf_get(HW, \
(offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
(u32 *)&(VARIABLE), \
sizeof(VARIABLE) / sizeof(u32));\
}
/* This should never be used on non atomic fields,
* treat any > u32 read as non atomic.
*/
#define hw_atl2_shared_buffer_read(HW, ITEM, VARIABLE) \
{\
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
sizeof(u32)) != 0,\
"Unaligned read " # ITEM);\
BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\
"Unaligned read length " # ITEM);\
BUILD_BUG_ON_MSG(sizeof(VARIABLE) > sizeof(u32),\
"Non atomic read " # ITEM);\
hw_atl2_mif_shared_buf_read(HW, \
(offsetof(struct fw_interface_out, ITEM) / sizeof(u32)),\
(u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32));\
}
#define hw_atl2_shared_buffer_read_safe(HW, ITEM, DATA) \
({\
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
sizeof(u32)) != 0,\
"Unaligned read_safe " # ITEM);\
BUILD_BUG_ON_MSG((sizeof(((struct fw_interface_out *)0)->ITEM) % \
sizeof(u32)) != 0,\
"Unaligned read_safe length " # ITEM);\
hw_atl2_shared_buffer_read_block((HW), \
(offsetof(struct fw_interface_out, ITEM) / sizeof(u32)),\
sizeof(((struct fw_interface_out *)0)->ITEM) / sizeof(u32),\
(DATA));\
})
static int hw_atl2_shared_buffer_read_block(struct aq_hw_s *self,
u32 offset, u32 dwords, void *data)
{
struct transaction_counter_s tid1, tid2;
int cnt = 0;
do {
do {
hw_atl2_shared_buffer_read(self, transaction_id, tid1);
cnt++;
if (cnt > AQ_A2_FW_READ_TRY_MAX)
return -ETIME;
if (tid1.transaction_cnt_a != tid1.transaction_cnt_b)
mdelay(1);
} while (tid1.transaction_cnt_a != tid1.transaction_cnt_b);
hw_atl2_mif_shared_buf_read(self, offset, (u32 *)data, dwords);
Annotation
- Immediate include surface: `linux/iopoll.h`, `aq_hw.h`, `aq_hw_utils.h`, `aq_nic.h`, `hw_atl/hw_atl_llh.h`, `hw_atl2_utils.h`, `hw_atl2_llh.h`, `hw_atl2_internal.h`.
- Detected declarations: `function hw_atl2_shared_buffer_read_block`, `function hw_atl2_shared_buffer_finish_ack`, `function aq_a2_fw_init`, `function aq_a2_fw_deinit`, `function a2_link_speed_mask2fw`, `function a2_fw_dev_to_eee_mask`, `function a2_fw_lkp_to_mask`, `function aq_a2_fw_set_link_speed`, `function aq_a2_fw_set_mpi_flow_control`, `function aq_a2_fw_upd_eee_rate_bits`.
- 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.