Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/dev Add rnd(9) entropy source from keyboard.
details: https://anonhg.NetBSD.org/src/rev/15ac567c64f4
branches: trunk
changeset: 368122:15ac567c64f4
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Jun 25 00:58:36 2022 +0000
description:
Add rnd(9) entropy source from keyboard.
diffstat:
sys/arch/x68k/dev/kbd.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (53 lines):
diff -r 0722a98ac098 -r 15ac567c64f4 sys/arch/x68k/dev/kbd.c
--- a/sys/arch/x68k/dev/kbd.c Fri Jun 24 23:44:18 2022 +0000
+++ b/sys/arch/x68k/dev/kbd.c Sat Jun 25 00:58:36 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kbd.c,v 1.42 2022/06/24 23:44:18 tsutsui Exp $ */
+/* $NetBSD: kbd.c,v 1.43 2022/06/25 00:58:36 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.42 2022/06/24 23:44:18 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.43 2022/06/25 00:58:36 tsutsui Exp $");
#include "ite.h"
#include "bell.h"
@@ -51,6 +51,7 @@
#include <sys/bus.h>
#include <sys/intr.h>
#include <sys/mutex.h>
+#include <sys/rndsource.h>
#include <arch/x68k/dev/intiovar.h>
#include <arch/x68k/dev/mfp.h>
@@ -71,6 +72,7 @@
struct evvar sc_events; /* event queue state */
void *sc_softintr_cookie;
kmutex_t sc_lock;
+ krndsource_t sc_rndsource;
};
void kbdenable(int);
@@ -141,6 +143,9 @@
sc->sc_softintr_cookie = softint_establish(SOFTINT_SERIAL,
kbdsoftint, sc);
+ rnd_attach_source(&sc->sc_rndsource, device_xname(self),
+ RND_TYPE_TTY, RND_FLAG_DEFAULT);
+
kbdenable(1);
sc->sc_event_mode = 0;
sc->sc_events.ev_io = 0;
@@ -338,6 +343,8 @@
c = mfp_get_udr();
+ rnd_add_uint32(&sc->sc_rndsource, (st << 8) | c);
+
if ((st & MFP_RSR_BF) == 0)
return 0; /* intr caused by an err -- no char received */
Home |
Main Index |
Thread Index |
Old Index