Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/arch/evbarm/fdt Teach arm fdt kernel to use /chose...
details: https://anonhg.NetBSD.org/src-all/rev/293284a5a652
branches: trunk
changeset: 932547:293284a5a652
user: Taylor R Campbell <riastradh%NetBSD.org@localhost>
date: Mon May 11 02:12:09 2020 +0000
description:
Teach arm fdt kernel to use /chosen/netbsd,efirng data.
Feed it in as a separate random source, with zero entropy since this
is a best-effort fallback for devices we really don't know anything
about.
diffstat:
sys/arch/evbarm/fdt/fdt_machdep.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diffs (49 lines):
diff -r 9354be028204 -r 293284a5a652 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Mon May 11 02:11:09 2020 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Mon May 11 02:12:09 2020 +0000
@@ -65,6 +65,7 @@
#include <sys/md5.h>
#include <sys/pserialize.h>
#include <sys/rnd.h>
+#include <sys/rndsource.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -451,6 +452,27 @@
rnd_seed(rndseed, rndseed_size);
}
+static void
+fdt_probe_efirng(void)
+{
+ static struct krndsource efirng_source;
+ int chosen, nrngdata;
+ const void *rngdata;
+
+ chosen = OF_finddevice("/chosen");
+ if (chosen < 0)
+ return;
+
+ rngdata = fdtbus_get_prop(chosen, "netbsd,efirng", &nrngdata);
+ if (rngdata == NULL || nrngdata <= 0)
+ return;
+ fdt_delprop(fdt_data, chosen, "netbsd.efirng");
+
+ rnd_attach_source(&efirng_source, "efirng", RND_TYPE_RNG,
+ RND_FLAG_DEFAULT);
+ rnd_add_data(&efirng_source, rngdata, nrngdata, 0);
+}
+
#ifdef EFI_RUNTIME
static void
fdt_map_efi_runtime(const char *prop, enum arm_efirt_mem_type type)
@@ -537,6 +559,9 @@
VPRINTF("stdout\n");
fdt_update_stdout_path();
+ /* Parse EFI RNG data */
+ fdt_probe_efirng();
+
/*
* Done making changes to the FDT.
*/
Home |
Main Index |
Thread Index |
Old Index