If rnd is configured into the kernel, do rnd(4) entropy collection
from devices connected to pckbc: - Do actual sample collection in pckbc. - Add rndsource_element_t to the slot data. - Change pckbc_set_inputhandler() to take an additional argument, the name of the device, which is (eventually) passed into rnd_attach_source() to identify the source. - Change callers of pckbc_set_inputhander() appropriately.
This commit is contained in:
parent
60a5fb3613
commit
bcf02ec8ff
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pccons.c,v 1.139 2000/03/23 06:39:15 thorpej Exp $ */
|
||||
/* $NetBSD: pccons.c,v 1.140 2000/06/05 22:20:56 sommerfeld Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -730,7 +730,7 @@ pcattach(parent, self, aux)
|
|||
do_async_update((void *)1);
|
||||
|
||||
#if (NPCCONSKBD > 0)
|
||||
pckbc_set_inputhandler(kbctag, kbcslot, pcinput, sc);
|
||||
pckbc_set_inputhandler(kbctag, kbcslot, pcinput, sc, sc->sc_dev.dv_xname);
|
||||
#else
|
||||
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
|
||||
IPL_TTY, pcintr, sc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pms.c,v 1.46 1999/12/03 22:48:24 thorpej Exp $ */
|
||||
/* $NetBSD: pms.c,v 1.47 2000/06/05 22:20:56 sommerfeld Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1997 Charles M. Hannum.
|
||||
|
@ -364,7 +364,7 @@ opms_pckbc_attach(parent, self, aux)
|
|||
sc->sc_state = 0;
|
||||
|
||||
pckbc_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
|
||||
opmsinput, sc);
|
||||
opmsinput, sc, sc->sc_dev.dv_xname);
|
||||
|
||||
/* no interrupts until enabled */
|
||||
cmd[0] = PMS_DEV_DISABLE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbc.c,v 1.2 2000/03/23 07:01:32 thorpej Exp $ */
|
||||
/* $NetBSD: pckbc.c,v 1.3 2000/06/05 22:20:54 sommerfeld Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
|
@ -47,6 +47,7 @@
|
|||
#include <dev/ic/i8042reg.h>
|
||||
#include <dev/ic/pckbcvar.h>
|
||||
|
||||
#include "rnd.h"
|
||||
#include "locators.h"
|
||||
|
||||
#ifdef __HAVE_NWSCONS /* XXX: this port uses sys/dev/pckbc */
|
||||
|
@ -57,6 +58,9 @@
|
|||
#if (NPCKBD > 0)
|
||||
#include <dev/pckbc/pckbdvar.h>
|
||||
#endif
|
||||
#if NRND > 0
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
/* descriptor for one device command */
|
||||
struct pckbc_devcmd {
|
||||
|
@ -77,6 +81,9 @@ struct pckbc_slotdata {
|
|||
TAILQ_HEAD(, pckbc_devcmd) freequeue; /* free commands */
|
||||
#define NCMD 5
|
||||
struct pckbc_devcmd cmds[NCMD];
|
||||
#if NRND > 0
|
||||
rndsource_element_t rnd_source;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define CMD_IN_QUEUE(q) (TAILQ_FIRST(&(q)->cmdqueue) != NULL)
|
||||
|
@ -285,6 +292,10 @@ pckbc_attach_slot(sc, slot)
|
|||
M_DEVBUF, M_NOWAIT);
|
||||
pckbc_init_slotdata(t->t_slotdata[slot]);
|
||||
}
|
||||
#if NRND > 0
|
||||
rnd_attach_source(&t->t_slotdata[slot]->rnd_source, sc->subname[slot],
|
||||
RND_TYPE_TTY, 0);
|
||||
#endif
|
||||
return (found);
|
||||
}
|
||||
|
||||
|
@ -853,11 +864,12 @@ pckbc_enqueue_cmd(self, slot, cmd, len, responselen, sync, respbuf)
|
|||
}
|
||||
|
||||
void
|
||||
pckbc_set_inputhandler(self, slot, func, arg)
|
||||
pckbc_set_inputhandler(self, slot, func, arg, name)
|
||||
pckbc_tag_t self;
|
||||
pckbc_slot_t slot;
|
||||
pckbc_inputfcn func;
|
||||
void *arg;
|
||||
char *name;
|
||||
{
|
||||
struct pckbc_internal *t = (struct pckbc_internal *)self;
|
||||
struct pckbc_softc *sc = t->t_sc;
|
||||
|
@ -869,6 +881,7 @@ pckbc_set_inputhandler(self, slot, func, arg)
|
|||
|
||||
sc->inputhandler[slot] = func;
|
||||
sc->inputarg[slot] = arg;
|
||||
sc->subname[slot] = name;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -907,6 +920,9 @@ pckbcintr(vsc)
|
|||
KBD_DELAY;
|
||||
data = bus_space_read_1(t->t_iot, t->t_ioh_d, 0);
|
||||
|
||||
#if NRND > 0
|
||||
rnd_add_uint32(&q->rnd_source, (stat<<8)|data);
|
||||
#endif
|
||||
if (CMD_IN_QUEUE(q) && pckbc_cmdresponse(t, slot, data))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbcvar.h,v 1.2 2000/03/23 07:01:32 thorpej Exp $ */
|
||||
/* $NetBSD: pckbcvar.h,v 1.3 2000/06/05 22:20:55 sommerfeld Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
|
@ -72,6 +72,7 @@ struct pckbc_softc {
|
|||
|
||||
pckbc_inputfcn inputhandler[PCKBC_NSLOTS];
|
||||
void *inputarg[PCKBC_NSLOTS];
|
||||
char *subname[PCKBC_NSLOTS];
|
||||
|
||||
void (*intr_establish) __P((struct pckbc_softc *, pckbc_slot_t));
|
||||
};
|
||||
|
@ -86,7 +87,7 @@ extern struct pckbc_internal pckbc_consdata;
|
|||
extern int pckbc_console_attached;
|
||||
|
||||
void pckbc_set_inputhandler __P((pckbc_tag_t, pckbc_slot_t,
|
||||
pckbc_inputfcn, void *));
|
||||
pckbc_inputfcn, void *, char *));
|
||||
|
||||
void pckbc_flush __P((pckbc_tag_t, pckbc_slot_t));
|
||||
int pckbc_poll_cmd __P((pckbc_tag_t, pckbc_slot_t, u_char *, int,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbd.c,v 1.23 2000/03/10 06:10:34 thorpej Exp $ */
|
||||
/* $NetBSD: pckbd.c,v 1.24 2000/06/05 22:20:57 sommerfeld Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -350,7 +350,7 @@ pckbdattach(parent, self, aux)
|
|||
sc->id->t_sc = sc;
|
||||
|
||||
pckbc_set_inputhandler(sc->id->t_kbctag, sc->id->t_kbcslot,
|
||||
pckbd_input, sc);
|
||||
pckbd_input, sc, sc->sc_dev.dv_xname);
|
||||
|
||||
a.console = isconsole;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: psm.c,v 1.10 2000/01/08 02:57:23 takemura Exp $ */
|
||||
/* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 Charles M. Hannum.
|
||||
|
@ -143,7 +143,7 @@ pmsattach(parent, self, aux)
|
|||
sc->oldbuttons = 0;
|
||||
|
||||
pckbc_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
|
||||
pmsinput, sc);
|
||||
pmsinput, sc, sc->sc_dev.dv_xname);
|
||||
|
||||
a.accessops = &pms_accessops;
|
||||
a.accesscookie = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: psm_intelli.c,v 1.7 2000/01/08 02:57:23 takemura Exp $ */
|
||||
/* $NetBSD: psm_intelli.c,v 1.8 2000/06/05 22:20:57 sommerfeld Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 Charles M. Hannum.
|
||||
|
@ -187,7 +187,7 @@ pmsiattach(parent, self, aux)
|
|||
sc->oldbuttons = 0;
|
||||
|
||||
pckbc_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
|
||||
pmsiinput, sc);
|
||||
pmsiinput, sc, sc->sc_dev.dv_xname);
|
||||
|
||||
a.accessops = &pmsi_accessops;
|
||||
a.accesscookie = sc;
|
||||
|
|
Loading…
Reference in New Issue