drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
Source file repositories/reference/linux-study-clean/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c- Extension
.c- Size
- 43679 bytes
- Lines
- 1798
- Domain
- Driver Families
- Bucket
- drivers/crypto
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/ctype.hlinux/firmware.hlinux/string.hlinux/string_choices.hotx2_cptpf_ucode.hotx2_cpt_common.hotx2_cptpf.hotx2_cptlf.hotx2_cpt_reqmgr.hrvu_reg.h
Detected Declarations
struct fw_info_tfunction get_cores_bmapfunction is_eng_typefunction is_2nd_ucode_usedfunction set_ucode_filenamefunction get_ucode_typefunction __write_ucode_basefunction cptx_set_ucode_basefunction for_each_set_bitfunction cpt_set_ucode_basefunction cptx_detach_and_disable_coresfunction for_each_set_bitfunction cpt_detach_and_disable_coresfunction cptx_attach_and_enable_coresfunction cpt_attach_and_enable_coresfunction load_fwfunction cpt_ucode_release_fwfunction list_for_each_entry_safefunction list_for_each_entryfunction print_uc_infofunction list_for_each_entryfunction cpt_ucode_load_fwfunction eng_grp_has_eng_typefunction update_engines_avail_countfunction update_engines_offsetfunction release_enginesfunction do_reserve_enginesfunction check_engines_availabilityfunction reserve_enginesfunction ucode_unloadfunction copy_ucode_to_dma_memfunction enable_eng_grpfunction disable_eng_grpfunction setup_eng_grp_mirroringfunction remove_eng_grp_mirroringfunction update_requested_engsfunction eng_grp_update_masksfunction delete_engine_groupfunction update_ucode_ptrsfunction create_engine_groupfunction delete_engine_grpsfunction rnm_to_cpt_errata_fixupfunction otx2_cpt_get_eng_grpfunction otx2_cpt_create_eng_grpsfunction cptx_disable_all_coresfunction otx2_cpt_disable_all_coresfunction otx2_cpt_cleanup_eng_grpsfunction otx2_cpt_init_eng_grps
Annotated Snippet
struct fw_info_t {
struct list_head ucodes;
};
static struct otx2_cpt_bitmap get_cores_bmap(struct device *dev,
struct otx2_cpt_eng_grp_info *eng_grp)
{
struct otx2_cpt_bitmap bmap = { {0} };
bool found = false;
int i;
if (eng_grp->g->engs_num < 0 ||
eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) {
dev_err(dev, "unsupported number of engines %d on octeontx2\n",
eng_grp->g->engs_num);
return bmap;
}
for (i = 0; i < OTX2_CPT_MAX_ETYPES_PER_GRP; i++) {
if (eng_grp->engs[i].type) {
bitmap_or(bmap.bits, bmap.bits,
eng_grp->engs[i].bmap,
eng_grp->g->engs_num);
bmap.size = eng_grp->g->engs_num;
found = true;
}
}
if (!found)
dev_err(dev, "No engines reserved for engine group %d\n",
eng_grp->idx);
return bmap;
}
static int is_eng_type(int val, int eng_type)
{
return val & (1 << eng_type);
}
static int is_2nd_ucode_used(struct otx2_cpt_eng_grp_info *eng_grp)
{
if (eng_grp->ucode[1].type)
return true;
else
return false;
}
static void set_ucode_filename(struct otx2_cpt_ucode *ucode,
const char *filename)
{
strscpy(ucode->filename, filename, OTX2_CPT_NAME_LENGTH);
}
static char *get_eng_type_str(int eng_type)
{
char *str = "unknown";
switch (eng_type) {
case OTX2_CPT_SE_TYPES:
str = "SE";
break;
case OTX2_CPT_IE_TYPES:
str = "IE";
break;
case OTX2_CPT_AE_TYPES:
str = "AE";
break;
}
return str;
}
static char *get_ucode_type_str(int ucode_type)
{
char *str = "unknown";
switch (ucode_type) {
case (1 << OTX2_CPT_SE_TYPES):
str = "SE";
break;
case (1 << OTX2_CPT_IE_TYPES):
str = "IE";
break;
case (1 << OTX2_CPT_AE_TYPES):
str = "AE";
break;
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/firmware.h`, `linux/string.h`, `linux/string_choices.h`, `otx2_cptpf_ucode.h`, `otx2_cpt_common.h`, `otx2_cptpf.h`, `otx2_cptlf.h`.
- Detected declarations: `struct fw_info_t`, `function get_cores_bmap`, `function is_eng_type`, `function is_2nd_ucode_used`, `function set_ucode_filename`, `function get_ucode_type`, `function __write_ucode_base`, `function cptx_set_ucode_base`, `function for_each_set_bit`, `function cpt_set_ucode_base`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.