Module Name:    src
Committed By:   tsutsui
Date:           Sat Jun 25 02:36:27 UTC 2022

Modified Files:
        src/sys/dev/hil: hil.c hilvar.h

Log Message:
Add rnd(9) entropy source from hil(4) devices.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hil/hil.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hil/hilvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/hil/hil.c
diff -u src/sys/dev/hil/hil.c:1.6 src/sys/dev/hil/hil.c:1.7
--- src/sys/dev/hil/hil.c:1.6	Fri Dec 10 20:36:03 2021
+++ src/sys/dev/hil/hil.c	Sat Jun 25 02:36:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hil.c,v 1.6 2021/12/10 20:36:03 andvar Exp $	*/
+/*	$NetBSD: hil.c,v 1.7 2022/06/25 02:36:27 tsutsui Exp $	*/
 /*	$OpenBSD: hil.c,v 1.24 2010/11/20 16:45:46 miod Exp $	*/
 /*
  * Copyright (c) 2003, 2004, Miodrag Vallat.
@@ -139,6 +139,9 @@ void
 hil_attach(struct hil_softc *sc, int *hil_is_console)
 {
 
+	rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev),
+	    RND_TYPE_TTY, RND_FLAG_DEFAULT);
+
 	aprint_normal("\n");
 
 	/*
@@ -290,6 +293,8 @@ hil_intr(void *v)
 	if (sc->sc_status != HIL_STATUS_BUSY)
 		hil_process_pending(sc);
 
+	rnd_add_uint32(&sc->sc_rndsource, (stat << 8) | c);
+
 	return 1;
 }
 

Index: src/sys/dev/hil/hilvar.h
diff -u src/sys/dev/hil/hilvar.h:1.2 src/sys/dev/hil/hilvar.h:1.3
--- src/sys/dev/hil/hilvar.h:1.2	Tue Feb 15 11:05:51 2011
+++ src/sys/dev/hil/hilvar.h	Sat Jun 25 02:36:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hilvar.h,v 1.2 2011/02/15 11:05:51 tsutsui Exp $	*/
+/*	$NetBSD: hilvar.h,v 1.3 2022/06/25 02:36:27 tsutsui Exp $	*/
 /*	$OpenBSD: hilvar.h,v 1.10 2006/11/05 14:39:32 miod Exp $	*/
 /*
  * Copyright (c) 2003, Miodrag Vallat.
@@ -65,6 +65,8 @@
  *	@(#)hilvar.h	8.1 (Berkeley) 6/10/93
  */
 
+#include <sys/rndsource.h>
+
 #define NHILD		8		/* 7 actual + loop pseudo (dev 0) */
 
 struct hildev_softc;
@@ -94,6 +96,7 @@ struct hil_softc {
 #define	HIL_PENDING_UNPLUGGED	0x02
 	u_int		sc_maxdev;	/* number of devices on loop */
 	device_t	sc_devices[NHILD];	/* interrupt dispatcher */
+	krndsource_t	sc_rndsource;
 };
 
 #ifdef _KERNEL

Reply via email to