drivers/staging/media/ipu3/ipu3-css-fw.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/ipu3/ipu3-css-fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/ipu3/ipu3-css-fw.c- Extension
.c- Size
- 8156 bytes
- Lines
- 267
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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/device.hlinux/firmware.hlinux/mm.hlinux/slab.hipu3-css.hipu3-css-fw.hipu3-dmamap.h
Detected Declarations
function imgu_css_fw_show_binaryfunction imgu_css_fw_obgrid_sizefunction imgu_css_fw_cleanupfunction imgu_css_fw_init
Annotated Snippet
if (bi->type == IMGU_FW_BOOTLOADER_FIRMWARE) {
css->fw_bl = i;
if (bi->info.bl.sw_state >= css->iomem_length ||
bi->info.bl.num_dma_cmds >= css->iomem_length ||
bi->info.bl.dma_cmd_list >= css->iomem_length)
goto bad_fw;
}
if (bi->type == IMGU_FW_SP_FIRMWARE ||
bi->type == IMGU_FW_SP1_FIRMWARE) {
css->fw_sp[bi->type == IMGU_FW_SP_FIRMWARE ? 0 : 1] = i;
if (bi->info.sp.per_frame_data >= css->iomem_length ||
bi->info.sp.init_dmem_data >= css->iomem_length ||
bi->info.sp.host_sp_queue >= css->iomem_length ||
bi->info.sp.isp_started >= css->iomem_length ||
bi->info.sp.sw_state >= css->iomem_length ||
bi->info.sp.sleep_mode >= css->iomem_length ||
bi->info.sp.invalidate_tlb >= css->iomem_length ||
bi->info.sp.host_sp_com >= css->iomem_length ||
bi->info.sp.output + 12 >= css->iomem_length ||
bi->info.sp.host_sp_queues_initialized >=
css->iomem_length)
goto bad_fw;
}
if (bi->type != IMGU_FW_ISP_FIRMWARE)
continue;
if (bi->info.isp.sp.pipeline.mode >= IPU3_CSS_PIPE_ID_NUM)
goto bad_fw;
if (bi->info.isp.sp.iterator.num_stripes >
IPU3_UAPI_MAX_STRIPES)
goto bad_fw;
if (bi->info.isp.num_vf_formats > IMGU_ABI_FRAME_FORMAT_NUM ||
bi->info.isp.num_output_formats > IMGU_ABI_FRAME_FORMAT_NUM)
goto bad_fw;
for (j = 0; j < bi->info.isp.num_output_formats; j++)
if (bi->info.isp.output_formats[j] >=
IMGU_ABI_FRAME_FORMAT_NUM)
goto bad_fw;
for (j = 0; j < bi->info.isp.num_vf_formats; j++)
if (bi->info.isp.vf_formats[j] >=
IMGU_ABI_FRAME_FORMAT_NUM)
goto bad_fw;
if (bi->info.isp.sp.block.block_width <= 0 ||
bi->info.isp.sp.block.block_width > BLOCK_MAX ||
bi->info.isp.sp.block.output_block_height <= 0 ||
bi->info.isp.sp.block.output_block_height > BLOCK_MAX)
goto bad_fw;
if (bi->blob.memory_offsets.offsets[IMGU_ABI_PARAM_CLASS_PARAM]
+ sizeof(struct imgu_fw_param_memory_offsets) >
css->fw->size ||
bi->blob.memory_offsets.offsets[IMGU_ABI_PARAM_CLASS_CONFIG]
+ sizeof(struct imgu_fw_config_memory_offsets) >
css->fw->size ||
bi->blob.memory_offsets.offsets[IMGU_ABI_PARAM_CLASS_STATE]
+ sizeof(struct imgu_fw_state_memory_offsets) >
css->fw->size)
goto bad_fw;
imgu_css_fw_show_binary(dev, bi, name);
}
if (css->fw_bl == -1 || css->fw_sp[0] == -1 || css->fw_sp[1] == -1)
goto bad_fw;
/* Allocate and map fw binaries into IMGU */
css->binary = kzalloc_objs(*css->binary, binary_nr);
if (!css->binary) {
r = -ENOMEM;
goto error_out;
}
for (i = 0; i < css->fwp->file_header.binary_nr; i++) {
struct imgu_fw_info *bi = &css->fwp->binary_header[i];
void *blob = (void *)css->fwp + bi->blob.offset;
size_t size = bi->blob.size;
if (!imgu_dmamap_alloc(imgu, &css->binary[i], size)) {
r = -ENOMEM;
goto error_out;
}
memcpy(css->binary[i].vaddr, blob, size);
}
return 0;
Annotation
- Immediate include surface: `linux/device.h`, `linux/firmware.h`, `linux/mm.h`, `linux/slab.h`, `ipu3-css.h`, `ipu3-css-fw.h`, `ipu3-dmamap.h`.
- Detected declarations: `function imgu_css_fw_show_binary`, `function imgu_css_fw_obgrid_size`, `function imgu_css_fw_cleanup`, `function imgu_css_fw_init`.
- Atlas domain: Driver Families / drivers/staging.
- 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.