sound/soc/intel/catpt/loader.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/catpt/loader.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/catpt/loader.c- Extension
.c- Size
- 15492 bytes
- Lines
- 668
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/firmware.hlinux/ioport.hlinux/slab.hcore.hregisters.h
Detected Declarations
struct catpt_fw_hdrstruct catpt_fw_mod_hdrstruct catpt_fw_block_hdrenum catpt_ram_typefunction catpt_sram_freefunction catpt_request_regionfunction catpt_store_streams_contextfunction catpt_store_module_statesfunction catpt_store_memdumpsfunction catpt_restore_streams_contextfunction catpt_restore_memdumpsfunction catpt_restore_fwimagefunction catpt_load_blockfunction catpt_restore_basefwfunction catpt_restore_modulefunction catpt_load_modulefunction catpt_restore_firmwarefunction catpt_load_firmwarefunction catpt_load_imagefunction catpt_load_imagesfunction catpt_boot_firmwarefunction catpt_first_boot_firmware
Annotated Snippet
struct catpt_fw_hdr {
char signature[FW_SIGNATURE_SIZE];
u32 file_size;
u32 modules;
u32 file_format;
u32 reserved[4];
} __packed;
struct catpt_fw_mod_hdr {
char signature[FW_SIGNATURE_SIZE];
u32 mod_size;
u32 blocks;
u16 slot;
u16 module_id;
u32 entry_point;
u32 persistent_size;
u32 scratch_size;
} __packed;
enum catpt_ram_type {
CATPT_RAM_TYPE_IRAM = 1,
CATPT_RAM_TYPE_DRAM = 2,
/* DRAM with module's initial state */
CATPT_RAM_TYPE_INSTANCE = 3,
};
struct catpt_fw_block_hdr {
u32 ram_type;
u32 size;
u32 ram_offset;
u32 rsvd;
} __packed;
void catpt_sram_free(struct resource *sram)
{
struct resource *res, *save;
for (res = sram->child; res;) {
save = res->sibling;
release_resource(res);
kfree(res);
res = save;
}
}
struct resource *
catpt_request_region(struct resource *root, resource_size_t size)
{
struct resource *res = root->child;
resource_size_t addr = root->start;
for (;;) {
if (res->start - addr >= size)
break;
addr = res->end + 1;
res = res->sibling;
if (!res)
return NULL;
}
return __request_region(root, addr, size, NULL, 0);
}
int catpt_store_streams_context(struct catpt_dev *cdev, struct dma_chan *chan)
{
struct catpt_stream_runtime *stream;
/* Lockless as no streams can be added or removed during D3 -> D0 transition. */
list_for_each_entry(stream, &cdev->stream_list, node) {
u32 off, size;
int ret;
off = stream->persistent->start;
size = resource_size(stream->persistent);
dev_dbg(cdev->dev, "storing stream %d ctx: off 0x%08x size %d\n",
stream->info.stream_hw_id, off, size);
ret = catpt_dma_memcpy_fromdsp(cdev, chan,
cdev->dxbuf_paddr + off,
cdev->lpe_base + off,
ALIGN(size, 4));
if (ret) {
dev_err(cdev->dev, "memcpy fromdsp failed: %d\n", ret);
return ret;
}
}
return 0;
}
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/firmware.h`, `linux/ioport.h`, `linux/slab.h`, `core.h`, `registers.h`.
- Detected declarations: `struct catpt_fw_hdr`, `struct catpt_fw_mod_hdr`, `struct catpt_fw_block_hdr`, `enum catpt_ram_type`, `function catpt_sram_free`, `function catpt_request_region`, `function catpt_store_streams_context`, `function catpt_store_module_states`, `function catpt_store_memdumps`, `function catpt_restore_streams_context`.
- Atlas domain: Driver Families / sound/soc.
- 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.