drivers/net/wwan/iosm/iosm_ipc_pcie.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/iosm/iosm_ipc_pcie.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/iosm/iosm_ipc_pcie.c- Extension
.c- Size
- 14255 bytes
- Lines
- 587
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
linux/acpi.hlinux/bitfield.hlinux/module.hlinux/suspend.hnet/rtnetlink.hiosm_ipc_imem.hiosm_ipc_pcie.hiosm_ipc_protocol.h
Detected Declarations
function ipc_pcie_resources_releasefunction ipc_pcie_cleanupfunction ipc_pcie_deinitfunction ipc_pcie_removefunction ipc_pcie_resources_requestfunction ipc_pcie_check_aspm_enabledfunction ipc_pcie_check_data_link_activefunction ipc_pcie_check_aspm_supportedfunction ipc_pcie_config_aspmfunction ipc_pcie_config_initfunction ipc_pcie_read_bios_cfgfunction ipc_pcie_probefunction ipc_pcie_suspend_s2idlefunction ipc_pcie_resume_s2idlefunction ipc_pcie_suspendfunction ipc_pcie_resumefunction ipc_pcie_suspend_cbfunction ipc_pcie_resume_cbfunction ipc_pcie_addr_mapfunction ipc_pcie_addr_unmapfunction ipc_pcie_kfree_skbfunction pm_notifyfunction iosm_ipc_driver_initfunction iosm_ipc_driver_exitmodule init iosm_ipc_driver_init
Annotated Snippet
static struct pci_driver iosm_ipc_driver = {
.name = KBUILD_MODNAME,
.probe = ipc_pcie_probe,
.remove = ipc_pcie_remove,
.driver = {
.pm = &iosm_ipc_pm,
},
.id_table = iosm_ipc_ids,
};
int ipc_pcie_addr_map(struct iosm_pcie *ipc_pcie, unsigned char *data,
size_t size, dma_addr_t *mapping, int direction)
{
if (ipc_pcie->pci) {
*mapping = dma_map_single(&ipc_pcie->pci->dev, data, size,
direction);
if (dma_mapping_error(&ipc_pcie->pci->dev, *mapping)) {
dev_err(ipc_pcie->dev, "dma mapping failed");
return -EINVAL;
}
}
return 0;
}
void ipc_pcie_addr_unmap(struct iosm_pcie *ipc_pcie, size_t size,
dma_addr_t mapping, int direction)
{
if (!mapping)
return;
if (ipc_pcie->pci)
dma_unmap_single(&ipc_pcie->pci->dev, mapping, size, direction);
}
struct sk_buff *ipc_pcie_alloc_local_skb(struct iosm_pcie *ipc_pcie,
gfp_t flags, size_t size)
{
struct sk_buff *skb;
if (!ipc_pcie || !size) {
pr_err("invalid pcie object or size");
return NULL;
}
skb = __netdev_alloc_skb(NULL, size, flags);
if (!skb)
return NULL;
IPC_CB(skb)->op_type = (u8)UL_DEFAULT;
IPC_CB(skb)->mapping = 0;
return skb;
}
struct sk_buff *ipc_pcie_alloc_skb(struct iosm_pcie *ipc_pcie, size_t size,
gfp_t flags, dma_addr_t *mapping,
int direction, size_t headroom)
{
struct sk_buff *skb = ipc_pcie_alloc_local_skb(ipc_pcie, flags,
size + headroom);
if (!skb)
return NULL;
if (headroom)
skb_reserve(skb, headroom);
if (ipc_pcie_addr_map(ipc_pcie, skb->data, size, mapping, direction)) {
dev_kfree_skb(skb);
return NULL;
}
BUILD_BUG_ON(sizeof(*IPC_CB(skb)) > sizeof(skb->cb));
/* Store the mapping address in skb scratch pad for later usage */
IPC_CB(skb)->mapping = *mapping;
IPC_CB(skb)->direction = direction;
IPC_CB(skb)->len = size;
return skb;
}
void ipc_pcie_kfree_skb(struct iosm_pcie *ipc_pcie, struct sk_buff *skb)
{
if (!skb)
return;
ipc_pcie_addr_unmap(ipc_pcie, IPC_CB(skb)->len, IPC_CB(skb)->mapping,
IPC_CB(skb)->direction);
IPC_CB(skb)->mapping = 0;
dev_kfree_skb(skb);
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/bitfield.h`, `linux/module.h`, `linux/suspend.h`, `net/rtnetlink.h`, `iosm_ipc_imem.h`, `iosm_ipc_pcie.h`, `iosm_ipc_protocol.h`.
- Detected declarations: `function ipc_pcie_resources_release`, `function ipc_pcie_cleanup`, `function ipc_pcie_deinit`, `function ipc_pcie_remove`, `function ipc_pcie_resources_request`, `function ipc_pcie_check_aspm_enabled`, `function ipc_pcie_check_data_link_active`, `function ipc_pcie_check_aspm_supported`, `function ipc_pcie_config_aspm`, `function ipc_pcie_config_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.