Lines Matching full:rng
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()
63 *v = rng_whiten(rng, __raw_rm_readq(rng->regs_real)); in powernv_get_random_real_mode()
105 struct powernv_rng *rng; in powernv_get_random_long() local
107 rng = get_cpu_var(powernv_rng); in powernv_get_random_long()
109 *v = rng_whiten(rng, in_be64(rng->regs)); in powernv_get_random_long()
111 put_cpu_var(rng); in powernv_get_random_long()
117 static __init void rng_init_per_cpu(struct powernv_rng *rng, in rng_init_per_cpu() argument
129 per_cpu(powernv_rng, cpu) = rng; in rng_init_per_cpu()
136 struct powernv_rng *rng; in rng_create() local
140 rng = kzalloc(sizeof(*rng), GFP_KERNEL); in rng_create()
141 if (!rng) in rng_create()
145 kfree(rng); in rng_create()
149 rng->regs_real = (void __iomem *)res.start; in rng_create()
151 rng->regs = of_iomap(dn, 0); in rng_create()
152 if (!rng->regs) { in rng_create()
153 kfree(rng); in rng_create()
157 val = in_be64(rng->regs); in rng_create()
158 rng->mask = val; in rng_create()
160 rng_init_per_cpu(rng, dn); in rng_create()
174 for_each_compatible_node(dn, NULL, "ibm,power-rng") { in rng_init()
177 pr_err("Failed creating rng for %pOF (%d).\n", in rng_init()