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/a04c1656aded
branches: trunk
changeset: 932544:a04c1656aded
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 | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diffs (48 lines):
diff -r 680c94613de7 -r a04c1656aded 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,26 @@
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;
+
+ 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)
@@ -582,6 +603,9 @@
/* Parse rndseed */
fdt_probe_rndseed(&rndseed_start, &rndseed_end);
+ /* Parse EFI RNG data */
+ fdt_probe_efirng();
+
/*
* Populate bootconfig structure for the benefit of
* dodumpsys
Home |
Main Index |
Thread Index |
Old Index