drivers/crypto/amcc/crypto4xx_core.c
Source file repositories/reference/linux-study-clean/drivers/crypto/amcc/crypto4xx_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/amcc/crypto4xx_core.c- Extension
.c- Size
- 37162 bytes
- Lines
- 1364
- 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/kernel.hlinux/interrupt.hlinux/spinlock_types.hlinux/random.hlinux/scatterlist.hlinux/crypto.hlinux/dma-mapping.hlinux/platform_device.hlinux/init.hlinux/module.hlinux/of_address.hlinux/of_irq.hlinux/of_platform.hlinux/slab.hasm/dcr.hasm/dcr-regs.hasm/cacheflush.hcrypto/aead.hcrypto/aes.hcrypto/ctr.hcrypto/gcm.hcrypto/sha1.hcrypto/scatterwalk.hcrypto/skcipher.hcrypto/internal/aead.hcrypto/internal/skcipher.hcrypto4xx_reg_def.hcrypto4xx_core.hcrypto4xx_sa.hcrypto4xx_trng.h
Detected Declarations
function Copyrightfunction crypto4xx_alloc_safunction crypto4xx_free_safunction crypto4xx_build_pdrfunction crypto4xx_destroy_pdrfunction crypto4xx_get_pd_from_pdr_nolockfunction crypto4xx_put_pd_to_pdrfunction crypto4xx_build_gdrfunction crypto4xx_destroy_gdrfunction crypto4xx_get_n_gdfunction crypto4xx_put_gd_to_gdrfunction crypto4xx_build_sdrfunction crypto4xx_destroy_sdrfunction crypto4xx_get_n_sdfunction crypto4xx_put_sd_to_sdrfunction crypto4xx_copy_pkt_to_dstfunction crypto4xx_ret_sg_descfunction crypto4xx_cipher_donefunction crypto4xx_aead_donefunction crypto4xx_pd_donefunction crypto4xx_stop_allfunction get_next_gdfunction get_next_sdfunction crypto4xx_build_pdfunction crypto4xx_ctx_initfunction crypto4xx_sk_initfunction crypto4xx_common_exitfunction crypto4xx_sk_exitfunction crypto4xx_aead_initfunction crypto4xx_aead_exitfunction crypto4xx_register_algfunction crypto4xx_unregister_algfunction list_for_each_entry_safefunction crypto4xx_bh_tasklet_cbfunction crypto4xx_interrupt_handlerfunction crypto4xx_ce_interrupt_handlerfunction crypto4xx_ce_interrupt_handler_revbfunction crypto4xx_probefunction crypto4xx_remove
Annotated Snippet
if (overflow) {
first_sd = 0;
last_sd = overflow;
dst_start += to_copy;
overflow = 0;
}
}
}
static void crypto4xx_ret_sg_desc(struct crypto4xx_device *dev,
struct pd_uinfo *pd_uinfo)
{
int i;
if (pd_uinfo->num_gd) {
for (i = 0; i < pd_uinfo->num_gd; i++)
crypto4xx_put_gd_to_gdr(dev);
pd_uinfo->first_gd = 0xffffffff;
pd_uinfo->num_gd = 0;
}
if (pd_uinfo->num_sd) {
for (i = 0; i < pd_uinfo->num_sd; i++)
crypto4xx_put_sd_to_sdr(dev);
pd_uinfo->first_sd = 0xffffffff;
pd_uinfo->num_sd = 0;
}
}
static void crypto4xx_cipher_done(struct crypto4xx_device *dev,
struct pd_uinfo *pd_uinfo,
struct ce_pd *pd)
{
struct skcipher_request *req;
struct scatterlist *dst;
req = skcipher_request_cast(pd_uinfo->async_req);
if (pd_uinfo->sa_va->sa_command_0.bf.scatter) {
crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
req->cryptlen, req->dst);
} else {
dst = pd_uinfo->dest_va;
dma_unmap_page(dev->core_dev->device, pd->dest, dst->length,
DMA_FROM_DEVICE);
}
if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) {
struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
crypto4xx_memcpy_from_le32((u32 *)req->iv,
pd_uinfo->sr_va->save_iv,
crypto_skcipher_ivsize(skcipher));
}
crypto4xx_ret_sg_desc(dev, pd_uinfo);
if (pd_uinfo->state & PD_ENTRY_BUSY)
skcipher_request_complete(req, -EINPROGRESS);
skcipher_request_complete(req, 0);
}
static void crypto4xx_aead_done(struct crypto4xx_device *dev,
struct pd_uinfo *pd_uinfo,
struct ce_pd *pd)
{
struct aead_request *aead_req = container_of(pd_uinfo->async_req,
struct aead_request, base);
struct scatterlist *dst = pd_uinfo->dest_va;
size_t cp_len = crypto_aead_authsize(
crypto_aead_reqtfm(aead_req));
u32 icv[AES_BLOCK_SIZE];
int err = 0;
if (pd_uinfo->sa_va->sa_command_0.bf.scatter) {
crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
pd->pd_ctl_len.bf.pkt_len,
dst);
} else {
dma_unmap_page(dev->core_dev->device, pd->dest, dst->length,
DMA_FROM_DEVICE);
}
if (pd_uinfo->sa_va->sa_command_0.bf.dir == DIR_OUTBOUND) {
/* append icv at the end */
crypto4xx_memcpy_from_le32(icv, pd_uinfo->sr_va->save_digest,
sizeof(icv));
scatterwalk_map_and_copy(icv, dst, aead_req->cryptlen,
cp_len, 1);
} else {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/interrupt.h`, `linux/spinlock_types.h`, `linux/random.h`, `linux/scatterlist.h`, `linux/crypto.h`, `linux/dma-mapping.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function crypto4xx_alloc_sa`, `function crypto4xx_free_sa`, `function crypto4xx_build_pdr`, `function crypto4xx_destroy_pdr`, `function crypto4xx_get_pd_from_pdr_nolock`, `function crypto4xx_put_pd_to_pdr`, `function crypto4xx_build_gdr`, `function crypto4xx_destroy_gdr`, `function crypto4xx_get_n_gd`.
- 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.