Add hooks to insert timing info into the random system
This commit is contained in:
parent
86ecc45306
commit
735c351f71
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fd.c,v 1.109 1997/09/07 13:05:39 mycroft Exp $ */
|
||||
/* $NetBSD: fd.c,v 1.110 1997/10/10 01:49:12 explorer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994, 1995, 1996
|
||||
@ -73,6 +73,7 @@
|
||||
#include <sys/queue.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/fdio.h>
|
||||
#include <sys/rnd.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
@ -177,7 +178,7 @@ struct fd_type fd_types[] = {
|
||||
{ 15,2,30,2,0xff,0xdf,0x1b,0x54,80,2400,1,FDC_500KBPS,0xf6,1, "1.2MB" }, /* 1.2 MB AT-diskettes */
|
||||
{ 9,2,18,2,0xff,0xdf,0x23,0x50,40, 720,2,FDC_300KBPS,0xf6,1, "360KB/AT" }, /* 360kB in 1.2MB drive */
|
||||
{ 9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,1,FDC_250KBPS,0xf6,1, "360KB/PC" }, /* 360kB PC diskettes */
|
||||
{ 9,2,18,2,0xff,0xdf,0x2a,0x50,80,1440,1,FDC_250KBPS,0xf6,1, "720KB" }, /* 3.5" 720kB diskette */
|
||||
{ 9,2,18,2,0xff,0xdf,0x2a,0x50,80,1440,1,FDC_250KBPS,0xf6,1, "720KB" }, /* 3.5 inch 720kB diskette */
|
||||
{ 9,2,18,2,0xff,0xdf,0x23,0x50,80,1440,1,FDC_300KBPS,0xf6,1, "720KB/x" }, /* 720kB in 1.2MB drive */
|
||||
{ 9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,2,FDC_250KBPS,0xf6,1, "360KB/x" }, /* 360kB in 720kB drive */
|
||||
};
|
||||
@ -210,6 +211,8 @@ struct fd_softc {
|
||||
TAILQ_ENTRY(fd_softc) sc_drivechain;
|
||||
int sc_ops; /* I/O ops since last switch */
|
||||
struct buf sc_q; /* head of buf chain */
|
||||
|
||||
rndsource_element_t rnd_source;
|
||||
};
|
||||
|
||||
/* floppy driver configuration */
|
||||
@ -499,6 +502,8 @@ fdattach(parent, self, aux)
|
||||
|
||||
/* Needed to power off if the motor is on when we halt. */
|
||||
fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
|
||||
|
||||
rnd_attach_source(&fd->rnd_source, fd->sc_dev.dv_xname, RND_TYPE_DISK);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -657,6 +662,8 @@ fdfinish(fd, bp)
|
||||
fd->sc_skip = 0;
|
||||
fd->sc_q.b_actf = bp->b_actf;
|
||||
|
||||
rnd_add_uint32(&fd->rnd_source, bp->b_blkno);
|
||||
|
||||
biodone(bp);
|
||||
/* turn off motor 5s from now */
|
||||
timeout(fd_motor_off, fd, 5 * hz);
|
||||
|
Loading…
Reference in New Issue
Block a user