drivers/crypto/omap-aes.c
Source file repositories/reference/linux-study-clean/drivers/crypto/omap-aes.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/omap-aes.c- Extension
.c- Size
- 31070 bytes
- Lines
- 1308
- 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
crypto/aes.hcrypto/gcm.hcrypto/internal/aead.hcrypto/internal/engine.hcrypto/internal/skcipher.hlinux/dma-mapping.hlinux/dmaengine.hlinux/err.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/pm_runtime.hlinux/scatterlist.hlinux/string.hlinux/sysfs.hlinux/workqueue.homap-crypto.homap-aes.h
Detected Declarations
function omap_aes_readfunction omap_aes_writefunction omap_aes_write_maskfunction omap_aes_write_nfunction omap_aes_hw_initfunction omap_aes_clear_copy_flagsfunction omap_aes_write_ctrlfunction omap_aes_dma_trigger_omap2function omap_aes_dma_trigger_omap4function omap_aes_dma_stopfunction omap_aes_dma_out_callbackfunction omap_aes_dma_initfunction omap_aes_dma_cleanupfunction omap_aes_crypt_dmafunction omap_aes_crypt_dma_startfunction omap_aes_finish_reqfunction omap_aes_crypt_dma_stopfunction omap_aes_handle_queuefunction omap_aes_prepare_reqfunction omap_aes_crypt_reqfunction omap_aes_copy_ivoutfunction omap_aes_done_taskfunction omap_aes_cryptfunction omap_aes_setkeyfunction omap_aes_ecb_encryptfunction omap_aes_ecb_decryptfunction omap_aes_cbc_encryptfunction omap_aes_cbc_decryptfunction omap_aes_ctr_encryptfunction omap_aes_ctr_decryptfunction omap_aes_init_tfmfunction omap_aes_exit_tfmfunction omap_aes_irqfunction omap_aes_get_res_offunction omap_aes_get_res_offunction omap_aes_get_res_pdevfunction fallback_showfunction fallback_storefunction queue_len_showfunction queue_len_storefunction omap_aes_unregister_algsfunction omap_aes_probefunction omap_aes_removefunction omap_aes_suspendfunction omap_aes_resume
Annotated Snippet
if (ret) {
dev_err(dd->dev, "can't configure OUT dmaengine slave: %d\n",
ret);
return ret;
}
tx_out = dmaengine_prep_slave_sg(dd->dma_lch_out, out_sg,
out_sg_len,
DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!tx_out) {
dev_err(dd->dev, "OUT prep_slave_sg() failed\n");
return -EINVAL;
}
cb_desc = tx_out;
} else {
cb_desc = tx_in;
}
if (dd->flags & FLAGS_GCM)
cb_desc->callback = omap_aes_gcm_dma_out_callback;
else
cb_desc->callback = omap_aes_dma_out_callback;
cb_desc->callback_param = dd;
dmaengine_submit(tx_in);
if (tx_out)
dmaengine_submit(tx_out);
dma_async_issue_pending(dd->dma_lch_in);
if (out_sg_len)
dma_async_issue_pending(dd->dma_lch_out);
/* start DMA */
dd->pdata->trigger(dd, dd->total);
return 0;
}
int omap_aes_crypt_dma_start(struct omap_aes_dev *dd)
{
int err;
pr_debug("total: %zu\n", dd->total);
if (!dd->pio_only) {
err = dma_map_sg(dd->dev, dd->in_sg, dd->in_sg_len,
DMA_TO_DEVICE);
if (!err) {
dev_err(dd->dev, "dma_map_sg() error\n");
return -EINVAL;
}
if (dd->out_sg_len) {
err = dma_map_sg(dd->dev, dd->out_sg, dd->out_sg_len,
DMA_FROM_DEVICE);
if (!err) {
dev_err(dd->dev, "dma_map_sg() error\n");
return -EINVAL;
}
}
}
err = omap_aes_crypt_dma(dd, dd->in_sg, dd->out_sg, dd->in_sg_len,
dd->out_sg_len);
if (err && !dd->pio_only) {
dma_unmap_sg(dd->dev, dd->in_sg, dd->in_sg_len, DMA_TO_DEVICE);
if (dd->out_sg_len)
dma_unmap_sg(dd->dev, dd->out_sg, dd->out_sg_len,
DMA_FROM_DEVICE);
}
return err;
}
static void omap_aes_finish_req(struct omap_aes_dev *dd, int err)
{
struct skcipher_request *req = dd->req;
pr_debug("err: %d\n", err);
crypto_finalize_skcipher_request(dd->engine, req, err);
pm_runtime_put_autosuspend(dd->dev);
}
int omap_aes_crypt_dma_stop(struct omap_aes_dev *dd)
{
Annotation
- Immediate include surface: `crypto/aes.h`, `crypto/gcm.h`, `crypto/internal/aead.h`, `crypto/internal/engine.h`, `crypto/internal/skcipher.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/err.h`.
- Detected declarations: `function omap_aes_read`, `function omap_aes_write`, `function omap_aes_write_mask`, `function omap_aes_write_n`, `function omap_aes_hw_init`, `function omap_aes_clear_copy_flags`, `function omap_aes_write_ctrl`, `function omap_aes_dma_trigger_omap2`, `function omap_aes_dma_trigger_omap4`, `function omap_aes_dma_stop`.
- 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.