drivers/net/ethernet/qlogic/qed/qed_init_ops.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_init_ops.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_init_ops.c- Extension
.c- Size
- 17645 bytes
- Lines
- 657
- 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/types.hlinux/io.hlinux/delay.hlinux/errno.hlinux/kernel.hlinux/slab.hlinux/string.hqed.hqed_hsi.hqed_hw.hqed_init_ops.hqed_iro_hsi.hqed_reg_addr.hqed_sriov.h
Detected Declarations
function qed_init_iro_arrayfunction qed_init_store_rt_regfunction qed_init_store_rt_aggfunction qed_init_rtfunction qed_init_allocfunction qed_init_freefunction qed_init_array_dmaefunction qed_init_fill_dmaefunction qed_init_fillfunction qed_init_cmd_arrayfunction qed_init_cmd_wrfunction comp_eqfunction comp_andfunction comp_orfunction qed_init_cmd_rdfunction qed_init_cmd_cbfunction qed_init_cmd_mode_matchfunction qed_init_cmd_modefunction qed_init_cmd_phasefunction qed_init_runfunction qed_gtt_initfunction qed_init_fw_data
Annotated Snippet
if (!b_must_dmae) {
qed_wr(p_hwfn, p_ptt, addr + (i << 2), p_init_val[i]);
p_valid[i] = false;
continue;
}
/* Start of a new segment */
for (segment = 1; i + segment < size; segment++)
if (!p_valid[i + segment])
break;
rc = qed_dmae_host2grc(p_hwfn, p_ptt,
(uintptr_t)(p_init_val + i),
addr + (i << 2), segment, NULL);
if (rc)
return rc;
/* invalidate after writing */
for (j = i; j < (u32)(i + segment); j++)
p_valid[j] = false;
/* Jump over the entire segment, including invalid entry */
i += segment;
}
return rc;
}
int qed_init_alloc(struct qed_hwfn *p_hwfn)
{
struct qed_rt_data *rt_data = &p_hwfn->rt_data;
if (IS_VF(p_hwfn->cdev))
return 0;
rt_data->b_valid = kzalloc_objs(bool, RUNTIME_ARRAY_SIZE);
if (!rt_data->b_valid)
return -ENOMEM;
rt_data->init_val = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(u32),
GFP_KERNEL);
if (!rt_data->init_val) {
kfree(rt_data->b_valid);
rt_data->b_valid = NULL;
return -ENOMEM;
}
return 0;
}
void qed_init_free(struct qed_hwfn *p_hwfn)
{
kfree(p_hwfn->rt_data.init_val);
p_hwfn->rt_data.init_val = NULL;
kfree(p_hwfn->rt_data.b_valid);
p_hwfn->rt_data.b_valid = NULL;
}
static int qed_init_array_dmae(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
u32 addr,
u32 dmae_data_offset,
u32 size,
const u32 *buf,
bool b_must_dmae,
bool b_can_dmae)
{
int rc = 0;
/* Perform DMAE only for lengthy enough sections or for wide-bus */
if (!b_can_dmae || (!b_must_dmae && (size < 16))) {
const u32 *data = buf + dmae_data_offset;
u32 i;
for (i = 0; i < size; i++)
qed_wr(p_hwfn, p_ptt, addr + (i << 2), data[i]);
} else {
rc = qed_dmae_host2grc(p_hwfn, p_ptt,
(uintptr_t)(buf + dmae_data_offset),
addr, size, NULL);
}
return rc;
}
static int qed_init_fill_dmae(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
u32 addr, u32 fill_count)
{
static u32 zero_buffer[DMAE_MAX_RW_SIZE];
Annotation
- Immediate include surface: `linux/types.h`, `linux/io.h`, `linux/delay.h`, `linux/errno.h`, `linux/kernel.h`, `linux/slab.h`, `linux/string.h`, `qed.h`.
- Detected declarations: `function qed_init_iro_array`, `function qed_init_store_rt_reg`, `function qed_init_store_rt_agg`, `function qed_init_rt`, `function qed_init_alloc`, `function qed_init_free`, `function qed_init_array_dmae`, `function qed_init_fill_dmae`, `function qed_init_fill`, `function qed_init_cmd_array`.
- 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.