/Linux-v5.10/drivers/crypto/ |
D | exynos-rng.c | 3 * exynos-rng.c - Random Number Generator driver for the Exynos 7 * Loosely based on old driver from drivers/char/hw_random/exynos-rng.c: 21 #include <crypto/internal/rng.h> 66 struct exynos_rng_dev *rng; member 87 static u32 exynos_rng_readl(struct exynos_rng_dev *rng, u32 offset) in exynos_rng_readl() argument 89 return readl_relaxed(rng->mem + offset); in exynos_rng_readl() 92 static void exynos_rng_writel(struct exynos_rng_dev *rng, u32 val, u32 offset) in exynos_rng_writel() argument 94 writel_relaxed(val, rng->mem + offset); in exynos_rng_writel() 97 static int exynos_rng_set_seed(struct exynos_rng_dev *rng, in exynos_rng_set_seed() argument 117 exynos_rng_writel(rng, val, EXYNOS_RNG_SEED(seed_reg)); in exynos_rng_set_seed() [all …]
|
D | qcom-rng.c | 4 // Based on msm-rng.c and downstream driver 6 #include <crypto/internal/rng.h> 37 struct qcom_rng *rng; member 42 static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max) in qcom_rng_read() argument 49 val = readl_relaxed(rng->base + PRNG_STATUS); in qcom_rng_read() 53 val = readl_relaxed(rng->base + PRNG_DATA_OUT); in qcom_rng_read() 76 struct qcom_rng *rng = ctx->rng; in qcom_rng_generate() local 79 ret = clk_prepare_enable(rng->clk); in qcom_rng_generate() 83 mutex_lock(&rng->lock); in qcom_rng_generate() 85 ret = qcom_rng_read(rng, dstn, dlen); in qcom_rng_generate() [all …]
|
/Linux-v5.10/drivers/char/hw_random/ |
D | Makefile | 3 # Makefile for HW Random Number Generator (RNG) device drivers. 6 obj-$(CONFIG_HW_RANDOM) += rng-core.o 7 rng-core-y := core.o 8 obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o 9 obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o 10 obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o 11 obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o 12 obj-$(CONFIG_HW_RANDOM_BA431) += ba431-rng.o 13 obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o 14 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o [all …]
|
D | core.c | 31 /* the current rng has been explicitly chosen by user via sysfs */ 38 /* Protects rng read functions, data_avail, rng_buffer and rng_fillbuf */ 53 static int hwrng_init(struct hwrng *rng); 56 static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, 64 static void add_early_randomness(struct hwrng *rng) in add_early_randomness() argument 70 bytes_read = rng_get_data(rng, rng_buffer, size, 0); in add_early_randomness() 78 struct hwrng *rng = container_of(kref, struct hwrng, ref); in cleanup_rng() local 80 if (rng->cleanup) in cleanup_rng() 81 rng->cleanup(rng); in cleanup_rng() 83 complete(&rng->cleanup_done); in cleanup_rng() [all …]
|
D | hisi-rng.c | 23 #define to_hisi_rng(p) container_of(p, struct hisi_rng, rng) 31 struct hwrng rng; member 34 static int hisi_rng_init(struct hwrng *rng) in hisi_rng_init() argument 36 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_init() 57 static void hisi_rng_cleanup(struct hwrng *rng) in hisi_rng_cleanup() argument 59 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_cleanup() 64 static int hisi_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in hisi_rng_read() argument 66 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_read() 75 struct hisi_rng *rng; in hisi_rng_probe() local 78 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in hisi_rng_probe() [all …]
|
D | cavium-rng.c | 25 /* Enable the RNG hardware and activate the VF */ 29 struct cavium_rng_pf *rng; in cavium_rng_probe() local 32 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in cavium_rng_probe() 33 if (!rng) in cavium_rng_probe() 36 /*Map the RNG control */ in cavium_rng_probe() 37 rng->control_status = pcim_iomap(pdev, 0, 0); in cavium_rng_probe() 38 if (!rng->control_status) { in cavium_rng_probe() 44 /* Enable the RNG hardware and entropy source */ in cavium_rng_probe() 46 rng->control_status); in cavium_rng_probe() 48 pci_set_drvdata(pdev, rng); in cavium_rng_probe() [all …]
|
D | ingenic-rng.c | 18 /* RNG register offsets */ 36 struct hwrng rng; member 39 static int ingenic_rng_init(struct hwrng *rng) in ingenic_rng_init() argument 41 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_init() 48 static void ingenic_rng_cleanup(struct hwrng *rng) in ingenic_rng_cleanup() argument 50 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_cleanup() 55 static int ingenic_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ingenic_rng_read() argument 57 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_read() 66 pr_err("%s: Wait for RNG data ready timeout\n", __func__); in ingenic_rng_read() 71 * A delay is required so that the current RNG data is not bit shifted in ingenic_rng_read() [all …]
|
D | mtk-rng.c | 33 #define to_mtk_rng(p) container_of(p, struct mtk_rng, rng) 38 struct hwrng rng; member 41 static int mtk_rng_init(struct hwrng *rng) in mtk_rng_init() argument 43 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_init() 58 static void mtk_rng_cleanup(struct hwrng *rng) in mtk_rng_cleanup() argument 60 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_cleanup() 70 static bool mtk_rng_wait_ready(struct hwrng *rng, bool wait) in mtk_rng_wait_ready() argument 72 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_wait_ready() 83 static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in mtk_rng_read() argument 85 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_read() [all …]
|
D | stm32-rng.c | 31 struct hwrng rng; member 38 static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) in stm32_rng_read() argument 41 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_read() 45 pm_runtime_get_sync((struct device *) priv->rng.priv); in stm32_rng_read() 50 /* care of initial delay time when enabling rng */ in stm32_rng_read() 57 dev_err((struct device *)priv->rng.priv, in stm32_rng_read() 64 "bad RNG status - %x\n", sr)) in stm32_rng_read() 76 pm_runtime_mark_last_busy((struct device *) priv->rng.priv); in stm32_rng_read() 77 pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv); in stm32_rng_read() 82 static int stm32_rng_init(struct hwrng *rng) in stm32_rng_init() argument [all …]
|
D | npcm-rng.c | 29 #define to_npcm_rng(p) container_of(p, struct npcm_rng, rng) 33 struct hwrng rng; member 36 static int npcm_rng_init(struct hwrng *rng) in npcm_rng_init() argument 38 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_init() 46 static void npcm_rng_cleanup(struct hwrng *rng) in npcm_rng_cleanup() argument 48 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_cleanup() 53 static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in npcm_rng_read() argument 55 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_read() 59 pm_runtime_get_sync((struct device *)priv->rng.priv); in npcm_rng_read() 81 pm_runtime_mark_last_busy((struct device *)priv->rng.priv); in npcm_rng_read() [all …]
|
D | cavium-rng-vf.c | 23 /* Read data from the RNG unit */ 24 static int cavium_rng_read(struct hwrng *rng, void *dat, size_t max, bool wait) in cavium_rng_read() argument 26 struct cavium_rng *p = container_of(rng, struct cavium_rng, ops); in cavium_rng_read() 42 /* Map Cavium RNG to an HWRNG object */ 46 struct cavium_rng *rng; in cavium_rng_probe_vf() local 49 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in cavium_rng_probe_vf() 50 if (!rng) in cavium_rng_probe_vf() 53 /* Map the RNG result */ in cavium_rng_probe_vf() 54 rng->result = pcim_iomap(pdev, 0, 0); in cavium_rng_probe_vf() 55 if (!rng->result) { in cavium_rng_probe_vf() [all …]
|
D | bcm2835-rng.c | 22 /* enable rng */ 31 struct hwrng rng; member 37 static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng) in to_rng_priv() argument 39 return container_of(rng, struct bcm2835_rng_priv, rng); in to_rng_priv() 62 static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max, in bcm2835_rng_read() argument 65 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_read() 85 static int bcm2835_rng_init(struct hwrng *rng) in bcm2835_rng_init() argument 87 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_init() 111 static void bcm2835_rng_cleanup(struct hwrng *rng) in bcm2835_rng_cleanup() argument 113 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_cleanup() [all …]
|
D | octeon-rng.c | 28 static int octeon_rng_init(struct hwrng *rng) in octeon_rng_init() argument 31 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_init() 35 ctl.s.rng_en = 1; /* Enable the RNG hardware. */ in octeon_rng_init() 40 static void octeon_rng_cleanup(struct hwrng *rng) in octeon_rng_cleanup() argument 43 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_cleanup() 50 static int octeon_rng_data_read(struct hwrng *rng, u32 *data) in octeon_rng_data_read() argument 52 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_data_read() 62 struct octeon_rng *rng; in octeon_rng_probe() local 71 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in octeon_rng_probe() 72 if (!rng) in octeon_rng_probe() [all …]
|
D | mxc-rnga.c | 3 * RNG driver for Freescale RNGA 11 * This driver is based on other RNG drivers. 56 struct hwrng rng; member 61 static int mxc_rnga_data_present(struct hwrng *rng, int wait) in mxc_rnga_data_present() argument 64 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_data_present() 77 static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) in mxc_rnga_data_read() argument 81 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_data_read() 100 static int mxc_rnga_init(struct hwrng *rng) in mxc_rnga_init() argument 103 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_init() 123 static void mxc_rnga_cleanup(struct hwrng *rng) in mxc_rnga_cleanup() argument [all …]
|
D | tx4939-rng.c | 2 * RNG driver for TX4939 Random Number Generators (RNG) 29 struct hwrng rng; member 65 static int tx4939_rng_data_present(struct hwrng *rng, int wait) in tx4939_rng_data_present() argument 67 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); in tx4939_rng_data_present() 84 /* Start RNG */ in tx4939_rng_data_present() 98 static int tx4939_rng_data_read(struct hwrng *rng, u32 *buffer) in tx4939_rng_data_read() argument 100 struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); in tx4939_rng_data_read() 119 rngdev->rng.name = dev_name(&dev->dev); in tx4939_rng_probe() 120 rngdev->rng.data_present = tx4939_rng_data_present; in tx4939_rng_probe() 121 rngdev->rng.data_read = tx4939_rng_data_read; in tx4939_rng_probe() [all …]
|
D | pic32-rng.c | 3 * PIC32 RNG driver 38 struct hwrng rng; member 49 static int pic32_rng_read(struct hwrng *rng, void *buf, size_t max, in pic32_rng_read() argument 52 struct pic32_rng *priv = container_of(rng, struct pic32_rng, rng); in pic32_rng_read() 96 priv->rng.name = pdev->name; in pic32_rng_probe() 97 priv->rng.read = pic32_rng_read; in pic32_rng_probe() 99 ret = hwrng_register(&priv->rng); in pic32_rng_probe() 114 struct pic32_rng *rng = platform_get_drvdata(pdev); in pic32_rng_remove() local 116 hwrng_unregister(&rng->rng); in pic32_rng_remove() 117 writel(0, rng->base + RNGCON); in pic32_rng_remove() [all …]
|
D | pasemi-rng.c | 7 * Driver for the PWRficient onchip rng 34 static int pasemi_rng_data_present(struct hwrng *rng, int wait) in pasemi_rng_data_present() argument 36 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_data_present() 49 static int pasemi_rng_data_read(struct hwrng *rng, u32 *data) in pasemi_rng_data_read() argument 51 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_data_read() 56 static int pasemi_rng_init(struct hwrng *rng) in pasemi_rng_init() argument 58 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_init() 68 static void pasemi_rng_cleanup(struct hwrng *rng) in pasemi_rng_cleanup() argument 70 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_cleanup() 96 pr_info("Registering PA Semi RNG\n"); in rng_probe() [all …]
|
D | iproc-rng200.c | 51 struct hwrng rng; member 55 #define to_rng_priv(rng) container_of(rng, struct iproc_rng200_dev, rng) argument 70 /* Reset RNG and RBG */ in iproc_rng200_restart() 94 static int iproc_rng200_read(struct hwrng *rng, void *buf, size_t max, in iproc_rng200_read() argument 97 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_read() 109 /* Is RNG sane? If not, reset it. */ in iproc_rng200_read() 155 static int iproc_rng200_init(struct hwrng *rng) in iproc_rng200_init() argument 157 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_init() 160 /* Setup RNG. */ in iproc_rng200_init() 169 static void iproc_rng200_cleanup(struct hwrng *rng) in iproc_rng200_cleanup() argument [all …]
|
/Linux-v5.10/arch/powerpc/platforms/powernv/ |
D | rng.c | 6 #define pr_fmt(fmt) "powernv-rng: " fmt 34 struct powernv_rng *rng; in powernv_hwrng_present() local 36 rng = get_cpu_var(powernv_rng); in powernv_hwrng_present() 37 put_cpu_var(rng); in powernv_hwrng_present() 38 return rng != NULL; in powernv_hwrng_present() 41 static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) in rng_whiten() argument 49 val ^= rng->mask; in rng_whiten() 52 rng->mask = (rng->mask << 1) | (parity & 1); in rng_whiten() 59 struct powernv_rng *rng; in powernv_get_random_real_mode() local 61 rng = raw_cpu_read(powernv_rng); in powernv_get_random_real_mode() [all …]
|
/Linux-v5.10/Documentation/devicetree/bindings/rng/ |
D | mtk-rng.txt | 6 "mediatek,mt7622-rng", "mediatek,mt7623-rng" : for MT7622 7 "mediatek,mt7629-rng", "mediatek,mt7623-rng" : for MT7629 8 "mediatek,mt7623-rng" : for MT7623 9 "mediatek,mt8516-rng", "mediatek,mt7623-rng" : for MT8516 12 - clock-names : Should contain "rng" entries; 17 rng: rng@1020f000 { 18 compatible = "mediatek,mt7623-rng"; 21 clock-names = "rng";
|
D | brcm,bcm2835.yaml | 4 $id: http://devicetree.org/schemas/rng/brcm,bcm2835.yaml# 17 - brcm,bcm2835-rng 18 - brcm,bcm-nsp-rng 19 - brcm,bcm5301x-rng 20 - brcm,bcm6368-rng 42 rng@7e104000 { 43 compatible = "brcm,bcm2835-rng"; 49 rng@18033000 { 50 compatible = "brcm,bcm-nsp-rng"; 55 rng@10004180 { [all …]
|
D | omap_rng.txt | 6 RNG versions: 7 - "ti,omap2-rng" for OMAP2. 8 - "ti,omap4-rng" for OMAP4, OMAP5 and AM33XX. 11 - ti,hwmods: Name of the hwmod associated with the RNG module 13 - interrupts : the interrupt number for the RNG module. 14 Used for "ti,omap4-rng" and "inside-secure,safexcel-eip76" 25 rng: rng@48310000 { 26 compatible = "ti,omap4-rng"; 27 ti,hwmods = "rng"; 33 trng: rng@f2760000 {
|
D | sparc_sun_oracle_rng.txt | 6 RNG versions: 7 - 'SUNW,n2-rng' for Niagara 2 Platform (SUN UltraSPARC T2 CPU) 8 - 'SUNW,vf-rng' for Victoria Falls Platform (SUN UltraSPARC T2 Plus CPU) 9 …- 'SUNW,kt-rng' for Rainbow/Yosemite Falls Platform (SUN SPARC T3/T4), (UltraSPARC KT/Niagara 3 - … 11 - 'ORCL,m4-rng' for SPARC T5/M5 12 - 'ORCL,m7-rng' for SPARC T7/M7 18 rng-#units: 00000002 19 compatible: 'ORCL,m4-rng' 25 rng-#units: 00000003 26 compatible: 'ORCL,m7-rng'
|
/Linux-v5.10/drivers/crypto/amcc/ |
D | crypto4xx_trng.c | 3 * Generic PowerPC 44x RNG driver 28 static int ppc4xx_trng_data_present(struct hwrng *rng, int wait) in ppc4xx_trng_data_present() argument 30 struct crypto4xx_device *dev = (void *)rng->priv; in ppc4xx_trng_data_present() 45 static int ppc4xx_trng_data_read(struct hwrng *rng, u32 *data) in ppc4xx_trng_data_read() argument 47 struct crypto4xx_device *dev = (void *)rng->priv; in ppc4xx_trng_data_read() 65 { .compatible = "ppc4xx-rng", }, 66 { .compatible = "amcc,ppc460ex-rng", }, 67 { .compatible = "amcc,ppc440epx-rng", }, 75 struct hwrng *rng = NULL; in ppc4xx_trng_probe() local 90 rng = kzalloc(sizeof(*rng), GFP_KERNEL); in ppc4xx_trng_probe() [all …]
|
/Linux-v5.10/include/linux/ |
D | hw_random.h | 22 * @name: Unique RNG name. 26 * on the RNG. If NULL, it is assumed that 28 * @data_read: Read data from the RNG device. 34 * @priv: Private data, for use by the RNG driver. 35 * @quality: Estimation of true entropy in RNG's bitstream 41 int (*init)(struct hwrng *rng); 42 void (*cleanup)(struct hwrng *rng); 43 int (*data_present)(struct hwrng *rng, int wait); 44 int (*data_read)(struct hwrng *rng, u32 *data); 45 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); [all …]
|