1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2013, Michael Ellerman, IBM Corporation.
6 #define pr_fmt(fmt) "pseries-rng: " fmt
8 #include <linux/kernel.h>
10 #include <asm/archrandom.h>
11 #include <asm/machdep.h>
12 #include <asm/plpar_wrappers.h>
15 static int pseries_get_random_long(unsigned long *v
)
17 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
19 if (plpar_hcall(H_RANDOM
, retbuf
) == H_SUCCESS
) {
27 static __init
int rng_init(void)
29 struct device_node
*dn
;
31 dn
= of_find_compatible_node(NULL
, NULL
, "ibm,random");
35 pr_info("Registering arch random hook.\n");
37 ppc_md
.get_random_seed
= pseries_get_random_long
;
42 machine_subsys_initcall(pseries
, rng_init
);