drivers/crypto/atmel-tdes.c
Source file repositories/reference/linux-study-clean/drivers/crypto/atmel-tdes.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/atmel-tdes.c- Extension
.c- Size
- 25700 bytes
- Lines
- 1076
- 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/module.hlinux/slab.hlinux/err.hlinux/clk.hlinux/io.hlinux/hw_random.hlinux/platform_device.hlinux/device.hlinux/dmaengine.hlinux/init.hlinux/errno.hlinux/interrupt.hlinux/irq.hlinux/scatterlist.hlinux/dma-mapping.hlinux/mod_devicetable.hlinux/delay.hlinux/crypto.hcrypto/scatterwalk.hcrypto/algapi.hcrypto/internal/des.hcrypto/internal/skcipher.hatmel-tdes-regs.h
Detected Declarations
struct atmel_tdes_capsstruct atmel_tdes_devstruct atmel_tdes_ctxstruct atmel_tdes_reqctxstruct atmel_tdes_dmastruct atmel_tdes_devstruct atmel_tdes_drvfunction atmel_tdes_sg_copyfunction atmel_tdes_readfunction atmel_tdes_writefunction atmel_tdes_write_nfunction atmel_tdes_hw_initfunction atmel_tdes_get_versionfunction atmel_tdes_hw_version_initfunction atmel_tdes_dma_callbackfunction atmel_tdes_write_ctrlfunction atmel_tdes_crypt_pdc_stopfunction atmel_tdes_buff_initfunction atmel_tdes_buff_cleanupfunction atmel_tdes_crypt_pdcfunction atmel_tdes_crypt_dmafunction atmel_tdes_crypt_startfunction atmel_tdes_set_iv_as_last_ciphertext_blockfunction atmel_tdes_finish_reqfunction atmel_tdes_handle_queuefunction atmel_tdes_crypt_dma_stopfunction atmel_tdes_cryptfunction atmel_tdes_dma_initfunction atmel_tdes_dma_cleanupfunction atmel_des_setkeyfunction atmel_tdes_setkeyfunction atmel_tdes_ecb_encryptfunction atmel_tdes_ecb_decryptfunction atmel_tdes_cbc_encryptfunction atmel_tdes_cbc_decryptfunction atmel_tdes_init_tfmfunction atmel_tdes_skcipher_alg_initfunction atmel_tdes_queue_taskfunction atmel_tdes_done_taskfunction atmel_tdes_irqfunction atmel_tdes_register_algsfunction atmel_tdes_get_capfunction atmel_tdes_probefunction atmel_tdes_remove
Annotated Snippet
struct atmel_tdes_caps {
bool has_dma;
};
struct atmel_tdes_dev;
struct atmel_tdes_ctx {
struct atmel_tdes_dev *dd;
int keylen;
u32 key[DES3_EDE_KEY_SIZE / sizeof(u32)];
unsigned long flags;
u16 block_size;
};
struct atmel_tdes_reqctx {
unsigned long mode;
u8 lastc[DES_BLOCK_SIZE];
};
struct atmel_tdes_dma {
struct dma_chan *chan;
struct dma_slave_config dma_conf;
};
struct atmel_tdes_dev {
struct list_head list;
unsigned long phys_base;
void __iomem *io_base;
struct atmel_tdes_ctx *ctx;
struct device *dev;
struct clk *iclk;
int irq;
unsigned long flags;
spinlock_t lock;
struct crypto_queue queue;
struct tasklet_struct done_task;
struct tasklet_struct queue_task;
struct skcipher_request *req;
size_t total;
struct scatterlist *in_sg;
unsigned int nb_in_sg;
size_t in_offset;
struct scatterlist *out_sg;
unsigned int nb_out_sg;
size_t out_offset;
size_t buflen;
size_t dma_size;
void *buf_in;
int dma_in;
dma_addr_t dma_addr_in;
struct atmel_tdes_dma dma_lch_in;
void *buf_out;
int dma_out;
dma_addr_t dma_addr_out;
struct atmel_tdes_dma dma_lch_out;
struct atmel_tdes_caps caps;
u32 hw_version;
};
struct atmel_tdes_drv {
struct list_head dev_list;
spinlock_t lock;
};
static struct atmel_tdes_drv atmel_tdes = {
.dev_list = LIST_HEAD_INIT(atmel_tdes.dev_list),
.lock = __SPIN_LOCK_UNLOCKED(atmel_tdes.lock),
};
static int atmel_tdes_sg_copy(struct scatterlist **sg, size_t *offset,
void *buf, size_t buflen, size_t total, int out)
{
size_t count, off = 0;
while (buflen && total) {
count = min((*sg)->length - *offset, total);
count = min(count, buflen);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/err.h`, `linux/clk.h`, `linux/io.h`, `linux/hw_random.h`, `linux/platform_device.h`.
- Detected declarations: `struct atmel_tdes_caps`, `struct atmel_tdes_dev`, `struct atmel_tdes_ctx`, `struct atmel_tdes_reqctx`, `struct atmel_tdes_dma`, `struct atmel_tdes_dev`, `struct atmel_tdes_drv`, `function atmel_tdes_sg_copy`, `function atmel_tdes_read`, `function atmel_tdes_write`.
- 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.