drivers/net/wwan/iosm/iosm_ipc_mmio.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/iosm/iosm_ipc_mmio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/iosm/iosm_ipc_mmio.c- Extension
.c- Size
- 5779 bytes
- Lines
- 228
- 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/delay.hlinux/device.hlinux/io.hlinux/io-64-nonatomic-lo-hi.hlinux/slab.hiosm_ipc_mmio.hiosm_ipc_mux.h
Detected Declarations
function Copyrightfunction ipc_mmio_update_cp_capabilityfunction ipc_mmio_get_exec_stagefunction ipc_mmio_copy_chip_infofunction ipc_mmio_get_ipc_statefunction ipc_mmio_get_rom_exit_codefunction ipc_mmio_configfunction ipc_mmio_set_psi_addr_and_sizefunction ipc_mmio_set_contex_info_addrfunction ipc_mmio_get_cp_version
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2020-21 Intel Corporation.
*/
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/slab.h>
#include "iosm_ipc_mmio.h"
#include "iosm_ipc_mux.h"
/* Definition of MMIO offsets
* note that MMIO_CI offsets are relative to end of chip info structure
*/
/* MMIO chip info size in bytes */
#define MMIO_CHIP_INFO_SIZE 60
/* CP execution stage */
#define MMIO_OFFSET_EXECUTION_STAGE 0x00
/* Boot ROM Chip Info struct */
#define MMIO_OFFSET_CHIP_INFO 0x04
#define MMIO_OFFSET_ROM_EXIT_CODE 0x40
#define MMIO_OFFSET_PSI_ADDRESS 0x54
#define MMIO_OFFSET_PSI_SIZE 0x5C
#define MMIO_OFFSET_IPC_STATUS 0x60
#define MMIO_OFFSET_CONTEXT_INFO 0x64
#define MMIO_OFFSET_BASE_ADDR 0x6C
#define MMIO_OFFSET_END_ADDR 0x74
#define MMIO_OFFSET_CP_VERSION 0xF0
#define MMIO_OFFSET_CP_CAPABILITIES 0xF4
/* Timeout in 50 msec to wait for the modem boot code to write a valid
* execution stage into mmio area
*/
#define IPC_MMIO_EXEC_STAGE_TIMEOUT 50
/* check if exec stage has one of the valid values */
static bool ipc_mmio_is_valid_exec_stage(enum ipc_mem_exec_stage stage)
{
switch (stage) {
case IPC_MEM_EXEC_STAGE_BOOT:
case IPC_MEM_EXEC_STAGE_PSI:
case IPC_MEM_EXEC_STAGE_EBL:
case IPC_MEM_EXEC_STAGE_RUN:
case IPC_MEM_EXEC_STAGE_CRASH:
case IPC_MEM_EXEC_STAGE_CD_READY:
return true;
default:
return false;
}
}
void ipc_mmio_update_cp_capability(struct iosm_mmio *ipc_mmio)
{
u32 cp_cap;
unsigned int ver;
ver = ipc_mmio_get_cp_version(ipc_mmio);
cp_cap = ioread32(ipc_mmio->base + ipc_mmio->offset.cp_capability);
ipc_mmio->mux_protocol = ((ver >= IOSM_CP_VERSION) && (cp_cap &
(UL_AGGR | DL_AGGR))) ? MUX_AGGREGATION
: MUX_LITE;
ipc_mmio->has_ul_flow_credit =
(ver >= IOSM_CP_VERSION) && (cp_cap & UL_FLOW_CREDIT);
}
struct iosm_mmio *ipc_mmio_init(void __iomem *mmio, struct device *dev)
{
struct iosm_mmio *ipc_mmio = kzalloc_obj(*ipc_mmio);
int retries = IPC_MMIO_EXEC_STAGE_TIMEOUT;
enum ipc_mem_exec_stage stage;
if (!ipc_mmio)
return NULL;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/io.h`, `linux/io-64-nonatomic-lo-hi.h`, `linux/slab.h`, `iosm_ipc_mmio.h`, `iosm_ipc_mux.h`.
- Detected declarations: `function Copyright`, `function ipc_mmio_update_cp_capability`, `function ipc_mmio_get_exec_stage`, `function ipc_mmio_copy_chip_info`, `function ipc_mmio_get_ipc_state`, `function ipc_mmio_get_rom_exit_code`, `function ipc_mmio_config`, `function ipc_mmio_set_psi_addr_and_size`, `function ipc_mmio_set_contex_info_addr`, `function ipc_mmio_get_cp_version`.
- 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.