fdvar.h revision 1.7 1 1.7 tls /* $NetBSD: fdvar.h,v 1.7 2011/11/19 22:51:22 tls 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.1 jmcneill #include "rnd.h"
33 1.1 jmcneill
34 1.1 jmcneill #if NRND > 0
35 1.1 jmcneill #include <sys/rnd.h>
36 1.1 jmcneill #endif
37 1.1 jmcneill
38 1.1 jmcneill /*
39 1.1 jmcneill * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
40 1.1 jmcneill * we tell them apart.
41 1.1 jmcneill */
42 1.1 jmcneill struct fd_type {
43 1.1 jmcneill int sectrac; /* sectors per track */
44 1.1 jmcneill int heads; /* number of heads */
45 1.1 jmcneill int seccyl; /* sectors per cylinder */
46 1.1 jmcneill int secsize; /* size code for sectors */
47 1.1 jmcneill int datalen; /* data len when secsize = 0 */
48 1.1 jmcneill int steprate; /* step rate and head unload time */
49 1.1 jmcneill int gap1; /* gap len between sectors */
50 1.1 jmcneill int gap2; /* formatting gap */
51 1.1 jmcneill int cyls; /* total num of cylinders */
52 1.1 jmcneill int size; /* size of disk in sectors */
53 1.1 jmcneill int step; /* steps per cylinder */
54 1.1 jmcneill int rate; /* transfer speed code */
55 1.1 jmcneill u_char fillbyte; /* format fill byte */
56 1.1 jmcneill u_char interleave; /* interleave factor (formatting) */
57 1.1 jmcneill const char *name;
58 1.1 jmcneill };
59 1.1 jmcneill
60 1.1 jmcneill /* software state, per disk (with up to 4 disks per ctlr) */
61 1.1 jmcneill struct fd_softc {
62 1.5 cube device_t sc_dev;
63 1.1 jmcneill struct disk sc_dk;
64 1.1 jmcneill
65 1.1 jmcneill const struct fd_type *sc_deftype; /* default type descriptor */
66 1.1 jmcneill struct fd_type *sc_type; /* current type descriptor */
67 1.1 jmcneill struct fd_type sc_type_copy; /* copy for fiddling when formatting */
68 1.1 jmcneill
69 1.1 jmcneill struct callout sc_motoron_ch;
70 1.1 jmcneill struct callout sc_motoroff_ch;
71 1.1 jmcneill
72 1.1 jmcneill daddr_t sc_blkno; /* starting block number */
73 1.1 jmcneill int sc_bcount; /* byte count left */
74 1.1 jmcneill int sc_opts; /* user-set options */
75 1.1 jmcneill int sc_skip; /* bytes already transferred */
76 1.1 jmcneill int sc_nblks; /* number of blocks currently transferring */
77 1.1 jmcneill int sc_nbytes; /* number of bytes currently transferring */
78 1.1 jmcneill
79 1.1 jmcneill int sc_drive; /* physical unit number */
80 1.1 jmcneill int sc_flags;
81 1.1 jmcneill #define FD_OPEN 0x01 /* it's open */
82 1.1 jmcneill #define FD_MOTOR 0x02 /* motor should be on */
83 1.1 jmcneill #define FD_MOTOR_WAIT 0x04 /* motor coming up */
84 1.1 jmcneill int sc_cylin; /* where we think the head is */
85 1.1 jmcneill
86 1.4 dyoung void *sc_roothook; /* mountroot hook */
87 1.1 jmcneill
88 1.1 jmcneill TAILQ_ENTRY(fd_softc) sc_drivechain;
89 1.1 jmcneill int sc_ops; /* I/O ops since last switch */
90 1.2 yamt struct bufq_state *sc_q;/* pending I/O requests */
91 1.1 jmcneill int sc_active; /* number of active I/O operations */
92 1.1 jmcneill
93 1.1 jmcneill #if NRND > 0
94 1.7 tls krndsource_t rnd_source;
95 1.1 jmcneill #endif
96 1.1 jmcneill };
97