drivers/staging/media/atomisp/pci/sh_css_firmware.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/sh_css_firmware.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/sh_css_firmware.c- Extension
.c- Size
- 9967 bytes
- Lines
- 382
- 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/string.hlinux/slab.hlinux/vmalloc.hhmm.hmath_support.hplatform_support.hsh_css_firmware.hsh_css_defs.hia_css_debug.hsh_css_internal.hia_css_isp_param.hassert_support.hisp.hia_css_isp_params.hia_css_isp_configs.hia_css_isp_states.h
Detected Declarations
struct firmware_headerstruct fw_paramfunction setup_binaryfunction sh_css_load_blob_infofunction sh_css_check_firmware_versionfunction sh_css_load_firmwarefunction sh_css_unload_firmwarefunction sh_css_load_blob
Annotated Snippet
struct firmware_header {
struct sh_css_fw_bi_file_h file_header;
struct ia_css_fw_info binary_header;
};
struct fw_param {
const char *name;
const void *buffer;
};
static struct firmware_header *firmware_header;
/*
* The string STR is a place holder
* which will be replaced with the actual RELEASE_VERSION
* during package generation. Please do not modify
*/
static const char *release_version_2401 = STR(irci_stable_candrpv_0415_20150521_0458);
static const char *release_version_2400 = STR(irci_stable_candrpv_0415_20150423_1753);
#define MAX_FW_REL_VER_NAME 300
static char FW_rel_ver_name[MAX_FW_REL_VER_NAME] = "---";
struct ia_css_fw_info sh_css_sp_fw;
struct ia_css_blob_descr *sh_css_blob_info; /* Only ISP blob info (no SP) */
unsigned int sh_css_num_binaries; /* This includes 1 SP binary */
static struct fw_param *fw_minibuffer;
char *sh_css_get_fw_version(void)
{
return FW_rel_ver_name;
}
/*
* Split the loaded firmware into blobs
*/
/* Setup sp/sp1 binary */
static int
setup_binary(struct ia_css_fw_info *fw, const char *fw_data,
struct ia_css_fw_info *sh_css_fw, unsigned int binary_id)
{
const char *blob_data;
if ((!fw) || (!fw_data))
return -EINVAL;
blob_data = fw_data + fw->blob.offset;
*sh_css_fw = *fw;
sh_css_fw->blob.code = vmalloc(fw->blob.size);
if (!sh_css_fw->blob.code)
return -ENOMEM;
memcpy((void *)sh_css_fw->blob.code, blob_data, fw->blob.size);
sh_css_fw->blob.data = (char *)sh_css_fw->blob.code + fw->blob.data_source;
fw_minibuffer[binary_id].buffer = sh_css_fw->blob.code;
return 0;
}
int
sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi,
struct ia_css_blob_descr *bd,
unsigned int index)
{
const char *name;
const unsigned char *blob;
if ((!fw) || (!bd))
return -EINVAL;
/* Special case: only one binary in fw */
if (!bi)
bi = (const struct ia_css_fw_info *)fw;
name = fw + bi->blob.prog_name_offset;
blob = (const unsigned char *)fw + bi->blob.offset;
/* sanity check */
if (bi->blob.size !=
bi->blob.text_size + bi->blob.icache_size +
bi->blob.data_size + bi->blob.padding_size) {
/* sanity check, note the padding bytes added for section to DDR alignment */
return -EINVAL;
}
if ((bi->blob.offset % (1UL << (ISP_PMEM_WIDTH_LOG2 - 3))) != 0)
Annotation
- Immediate include surface: `linux/string.h`, `linux/slab.h`, `linux/vmalloc.h`, `hmm.h`, `math_support.h`, `platform_support.h`, `sh_css_firmware.h`, `sh_css_defs.h`.
- Detected declarations: `struct firmware_header`, `struct fw_param`, `function setup_binary`, `function sh_css_load_blob_info`, `function sh_css_check_firmware_version`, `function sh_css_load_firmware`, `function sh_css_unload_firmware`, `function sh_css_load_blob`.
- 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.