drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c- Extension
.c- Size
- 7164 bytes
- Lines
- 265
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
iwl-trans.hiwl-fh.hiwl-context-info.hgen1_2/internal.hiwl-prph.h
Detected Declarations
function Copyrightfunction iwl_pcie_ctxt_info_alloc_dmafunction iwl_pcie_ctxt_info_free_pagingfunction iwl_pcie_init_fw_secfunction iwl_pcie_ctxt_info_initfunction iwl_pcie_ctxt_info_free
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
* Copyright (C) 2017 Intel Deutschland GmbH
* Copyright (C) 2018-2025 Intel Corporation
*/
#include "iwl-trans.h"
#include "iwl-fh.h"
#include "iwl-context-info.h"
#include "gen1_2/internal.h"
#include "iwl-prph.h"
static void *_iwl_pcie_ctxt_info_dma_alloc_coherent(struct iwl_trans *trans,
size_t size,
dma_addr_t *phys,
int depth)
{
void *result;
if (WARN(depth > 2,
"failed to allocate DMA memory not crossing 2^32 boundary"))
return NULL;
result = dma_alloc_coherent(trans->dev, size, phys, GFP_KERNEL);
if (!result)
return NULL;
if (unlikely(iwl_txq_crosses_4g_boundary(*phys, size))) {
void *old = result;
dma_addr_t oldphys = *phys;
result = _iwl_pcie_ctxt_info_dma_alloc_coherent(trans, size,
phys,
depth + 1);
dma_free_coherent(trans->dev, size, old, oldphys);
}
return result;
}
void *iwl_pcie_ctxt_info_dma_alloc_coherent(struct iwl_trans *trans,
size_t size,
dma_addr_t *phys)
{
return _iwl_pcie_ctxt_info_dma_alloc_coherent(trans, size, phys, 0);
}
int iwl_pcie_ctxt_info_alloc_dma(struct iwl_trans *trans,
const void *data, u32 len,
struct iwl_dram_data *dram)
{
dram->block = iwl_pcie_ctxt_info_dma_alloc_coherent(trans, len,
&dram->physical);
if (!dram->block)
return -ENOMEM;
dram->size = len;
memcpy(dram->block, data, len);
return 0;
}
void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans)
{
struct iwl_self_init_dram *dram = &trans->init_dram;
int i;
if (!dram->paging) {
WARN_ON(dram->paging_cnt);
return;
}
/* free paging*/
for (i = 0; i < dram->paging_cnt; i++)
dma_free_coherent(trans->dev, dram->paging[i].size,
dram->paging[i].block,
dram->paging[i].physical);
kfree(dram->paging);
dram->paging_cnt = 0;
dram->paging = NULL;
}
int iwl_pcie_init_fw_sec(struct iwl_trans *trans,
const struct fw_img *fw,
struct iwl_context_info_dram_nonfseq *ctxt_dram)
{
struct iwl_self_init_dram *dram = &trans->init_dram;
int i, ret, lmac_cnt, umac_cnt, paging_cnt;
Annotation
- Immediate include surface: `iwl-trans.h`, `iwl-fh.h`, `iwl-context-info.h`, `gen1_2/internal.h`, `iwl-prph.h`.
- Detected declarations: `function Copyright`, `function iwl_pcie_ctxt_info_alloc_dma`, `function iwl_pcie_ctxt_info_free_paging`, `function iwl_pcie_init_fw_sec`, `function iwl_pcie_ctxt_info_init`, `function iwl_pcie_ctxt_info_free`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.