1 1.9 riastrad /* $NetBSD: fdvar.h,v 1.9 2015/04/13 16:33:24 riastradh Exp $ */ 2 1.1 jmcneill 3 1.1 jmcneill /*- 4 1.1 jmcneill * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 1.1 jmcneill * All rights reserved. 6 1.1 jmcneill * 7 1.1 jmcneill * This code is derived from software contributed to The NetBSD Foundation 8 1.1 jmcneill * by Charles M. Hannum. 9 1.1 jmcneill * 10 1.1 jmcneill * Redistribution and use in source and binary forms, with or without 11 1.1 jmcneill * modification, are permitted provided that the following conditions 12 1.1 jmcneill * are met: 13 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright 14 1.1 jmcneill * notice, this list of conditions and the following disclaimer. 15 1.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright 16 1.1 jmcneill * notice, this list of conditions and the following disclaimer in the 17 1.1 jmcneill * documentation and/or other materials provided with the distribution. 18 1.1 jmcneill * 19 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.1 jmcneill * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.1 jmcneill * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.1 jmcneill * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.1 jmcneill * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.1 jmcneill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.1 jmcneill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.1 jmcneill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.1 jmcneill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.1 jmcneill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.1 jmcneill * POSSIBILITY OF SUCH DAMAGE. 30 1.1 jmcneill */ 31 1.1 jmcneill 32 1.9 riastrad #include <sys/rndsource.h> 33 1.1 jmcneill 34 1.1 jmcneill /* 35 1.1 jmcneill * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how 36 1.1 jmcneill * we tell them apart. 37 1.1 jmcneill */ 38 1.1 jmcneill struct fd_type { 39 1.1 jmcneill int sectrac; /* sectors per track */ 40 1.1 jmcneill int heads; /* number of heads */ 41 1.1 jmcneill int seccyl; /* sectors per cylinder */ 42 1.1 jmcneill int secsize; /* size code for sectors */ 43 1.1 jmcneill int datalen; /* data len when secsize = 0 */ 44 1.1 jmcneill int steprate; /* step rate and head unload time */ 45 1.1 jmcneill int gap1; /* gap len between sectors */ 46 1.1 jmcneill int gap2; /* formatting gap */ 47 1.1 jmcneill int cyls; /* total num of cylinders */ 48 1.1 jmcneill int size; /* size of disk in sectors */ 49 1.1 jmcneill int step; /* steps per cylinder */ 50 1.1 jmcneill int rate; /* transfer speed code */ 51 1.1 jmcneill u_char fillbyte; /* format fill byte */ 52 1.1 jmcneill u_char interleave; /* interleave factor (formatting) */ 53 1.1 jmcneill const char *name; 54 1.1 jmcneill }; 55 1.1 jmcneill 56 1.1 jmcneill /* software state, per disk (with up to 4 disks per ctlr) */ 57 1.1 jmcneill struct fd_softc { 58 1.5 cube device_t sc_dev; 59 1.1 jmcneill struct disk sc_dk; 60 1.1 jmcneill 61 1.1 jmcneill const struct fd_type *sc_deftype; /* default type descriptor */ 62 1.1 jmcneill struct fd_type *sc_type; /* current type descriptor */ 63 1.1 jmcneill struct fd_type sc_type_copy; /* copy for fiddling when formatting */ 64 1.1 jmcneill 65 1.1 jmcneill struct callout sc_motoron_ch; 66 1.1 jmcneill struct callout sc_motoroff_ch; 67 1.1 jmcneill 68 1.1 jmcneill daddr_t sc_blkno; /* starting block number */ 69 1.1 jmcneill int sc_bcount; /* byte count left */ 70 1.1 jmcneill int sc_opts; /* user-set options */ 71 1.1 jmcneill int sc_skip; /* bytes already transferred */ 72 1.1 jmcneill int sc_nblks; /* number of blocks currently transferring */ 73 1.1 jmcneill int sc_nbytes; /* number of bytes currently transferring */ 74 1.1 jmcneill 75 1.1 jmcneill int sc_drive; /* physical unit number */ 76 1.1 jmcneill int sc_flags; 77 1.1 jmcneill #define FD_OPEN 0x01 /* it's open */ 78 1.1 jmcneill #define FD_MOTOR 0x02 /* motor should be on */ 79 1.1 jmcneill #define FD_MOTOR_WAIT 0x04 /* motor coming up */ 80 1.1 jmcneill int sc_cylin; /* where we think the head is */ 81 1.1 jmcneill 82 1.4 dyoung void *sc_roothook; /* mountroot hook */ 83 1.1 jmcneill 84 1.1 jmcneill TAILQ_ENTRY(fd_softc) sc_drivechain; 85 1.1 jmcneill int sc_ops; /* I/O ops since last switch */ 86 1.2 yamt struct bufq_state *sc_q;/* pending I/O requests */ 87 1.1 jmcneill int sc_active; /* number of active I/O operations */ 88 1.1 jmcneill 89 1.7 tls krndsource_t rnd_source; 90 1.1 jmcneill }; 91