drivers/crypto/hifn_795x.c
Source file repositories/reference/linux-study-clean/drivers/crypto/hifn_795x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/hifn_795x.c- Extension
.c- Size
- 72034 bytes
- Lines
- 2562
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/moduleparam.hlinux/mod_devicetable.hlinux/interrupt.hlinux/pci.hlinux/slab.hlinux/delay.hlinux/mm.hlinux/dma-mapping.hlinux/scatterlist.hlinux/string.hlinux/highmem.hlinux/crypto.hlinux/hw_random.hlinux/ktime.hcrypto/algapi.hcrypto/internal/des.hcrypto/internal/skcipher.h
Detected Declarations
struct hifn_descstruct hifn_dmastruct hifn_devicestruct hifn_base_commandstruct hifn_crypt_commandstruct hifn_base_resultstruct hifn_comp_resultstruct hifn_mac_resultstruct hifn_crypt_resultstruct hifn_crypto_algstruct hifn_cipher_walkstruct hifn_contextstruct hifn_request_contextstruct hifn_alg_templatefunction hifn_read_0function hifn_read_1function hifn_write_0function hifn_write_1function hifn_wait_pucfunction hifn_reset_pucfunction hifn_stop_devicefunction hifn_reset_dmafunction hifn_next_signaturefunction hifn_rng_data_presentfunction hifn_rng_data_readfunction hifn_register_rngfunction hifn_unregister_rngfunction hifn_init_pubrngfunction hifn_enable_cryptofunction hifn_init_dmafunction parameterfunction hifn_init_registersfunction hifn_setup_base_commandfunction hifn_setup_crypto_commandfunction hifn_setup_cmd_descfunction hifn_setup_src_descfunction hifn_setup_res_descfunction hifn_setup_dst_descfunction hifn_setup_dmafunction hifn_cipher_walk_initfunction hifn_cipher_walk_exitfunction skcipher_addfunction hifn_cipher_walkfunction hifn_setup_sessionfunction hifn_start_devicefunction skcipher_getfunction hifn_complete_safunction hifn_process_ready
Annotated Snippet
static struct pci_driver hifn_pci_driver = {
.name = "hifn795x",
.id_table = hifn_pci_tbl,
.probe = hifn_probe,
.remove = hifn_remove,
};
static int __init hifn_init(void)
{
unsigned int freq;
int err;
if (strncmp(hifn_pll_ref, "ext", 3) &&
strncmp(hifn_pll_ref, "pci", 3)) {
pr_err("hifn795x: invalid hifn_pll_ref clock, must be pci or ext");
return -EINVAL;
}
/*
* For the 7955/7956 the reference clock frequency must be in the
* range of 20MHz-100MHz. For the 7954 the upper bound is 66.67MHz,
* but this chip is currently not supported.
*/
if (hifn_pll_ref[3] != '\0') {
freq = simple_strtoul(hifn_pll_ref + 3, NULL, 10);
if (freq < 20 || freq > 100) {
pr_err("hifn795x: invalid hifn_pll_ref frequency, must"
"be in the range of 20-100");
return -EINVAL;
}
}
err = pci_register_driver(&hifn_pci_driver);
if (err < 0) {
pr_err("Failed to register PCI driver for %s device.\n",
hifn_pci_driver.name);
return -ENODEV;
}
pr_info("Driver for HIFN 795x crypto accelerator chip "
"has been successfully registered.\n");
return 0;
}
static void __exit hifn_fini(void)
{
pci_unregister_driver(&hifn_pci_driver);
pr_info("Driver for HIFN 795x crypto accelerator chip "
"has been successfully unregistered.\n");
}
module_init(hifn_init);
module_exit(hifn_fini);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
MODULE_DESCRIPTION("Driver for HIFN 795x crypto accelerator chip.");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/mod_devicetable.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/slab.h`, `linux/delay.h`.
- Detected declarations: `struct hifn_desc`, `struct hifn_dma`, `struct hifn_device`, `struct hifn_base_command`, `struct hifn_crypt_command`, `struct hifn_base_result`, `struct hifn_comp_result`, `struct hifn_mac_result`, `struct hifn_crypt_result`, `struct hifn_crypto_alg`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: pattern 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.