fdvar.h revision 1.5 1 1.5 cube /* $NetBSD: fdvar.h,v 1.5 2008/03/16 00:58:56 cube 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 * 3. All advertising materials mentioning features or use of this software
19 1.1 jmcneill * must display the following acknowledgement:
20 1.1 jmcneill * This product includes software developed by the NetBSD
21 1.1 jmcneill * Foundation, Inc. and its contributors.
22 1.1 jmcneill * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 jmcneill * contributors may be used to endorse or promote products derived
24 1.1 jmcneill * from this software without specific prior written permission.
25 1.1 jmcneill *
26 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 jmcneill * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 jmcneill * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 jmcneill * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 jmcneill * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 jmcneill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 jmcneill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 jmcneill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 jmcneill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 jmcneill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 jmcneill * POSSIBILITY OF SUCH DAMAGE.
37 1.1 jmcneill */
38 1.1 jmcneill
39 1.1 jmcneill #include "rnd.h"
40 1.1 jmcneill
41 1.1 jmcneill #if NRND > 0
42 1.1 jmcneill #include <sys/rnd.h>
43 1.1 jmcneill #endif
44 1.1 jmcneill
45 1.1 jmcneill /*
46 1.1 jmcneill * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
47 1.1 jmcneill * we tell them apart.
48 1.1 jmcneill */
49 1.1 jmcneill struct fd_type {
50 1.1 jmcneill int sectrac; /* sectors per track */
51 1.1 jmcneill int heads; /* number of heads */
52 1.1 jmcneill int seccyl; /* sectors per cylinder */
53 1.1 jmcneill int secsize; /* size code for sectors */
54 1.1 jmcneill int datalen; /* data len when secsize = 0 */
55 1.1 jmcneill int steprate; /* step rate and head unload time */
56 1.1 jmcneill int gap1; /* gap len between sectors */
57 1.1 jmcneill int gap2; /* formatting gap */
58 1.1 jmcneill int cyls; /* total num of cylinders */
59 1.1 jmcneill int size; /* size of disk in sectors */
60 1.1 jmcneill int step; /* steps per cylinder */
61 1.1 jmcneill int rate; /* transfer speed code */
62 1.1 jmcneill u_char fillbyte; /* format fill byte */
63 1.1 jmcneill u_char interleave; /* interleave factor (formatting) */
64 1.1 jmcneill const char *name;
65 1.1 jmcneill };
66 1.1 jmcneill
67 1.1 jmcneill /* software state, per disk (with up to 4 disks per ctlr) */
68 1.1 jmcneill struct fd_softc {
69 1.5 cube device_t sc_dev;
70 1.1 jmcneill struct disk sc_dk;
71 1.1 jmcneill
72 1.1 jmcneill const struct fd_type *sc_deftype; /* default type descriptor */
73 1.1 jmcneill struct fd_type *sc_type; /* current type descriptor */
74 1.1 jmcneill struct fd_type sc_type_copy; /* copy for fiddling when formatting */
75 1.1 jmcneill
76 1.1 jmcneill struct callout sc_motoron_ch;
77 1.1 jmcneill struct callout sc_motoroff_ch;
78 1.1 jmcneill
79 1.1 jmcneill daddr_t sc_blkno; /* starting block number */
80 1.1 jmcneill int sc_bcount; /* byte count left */
81 1.1 jmcneill int sc_opts; /* user-set options */
82 1.1 jmcneill int sc_skip; /* bytes already transferred */
83 1.1 jmcneill int sc_nblks; /* number of blocks currently transferring */
84 1.1 jmcneill int sc_nbytes; /* number of bytes currently transferring */
85 1.1 jmcneill
86 1.1 jmcneill int sc_drive; /* physical unit number */
87 1.1 jmcneill int sc_flags;
88 1.1 jmcneill #define FD_OPEN 0x01 /* it's open */
89 1.1 jmcneill #define FD_MOTOR 0x02 /* motor should be on */
90 1.1 jmcneill #define FD_MOTOR_WAIT 0x04 /* motor coming up */
91 1.1 jmcneill int sc_cylin; /* where we think the head is */
92 1.1 jmcneill
93 1.4 dyoung void *sc_roothook; /* mountroot hook */
94 1.1 jmcneill
95 1.1 jmcneill TAILQ_ENTRY(fd_softc) sc_drivechain;
96 1.1 jmcneill int sc_ops; /* I/O ops since last switch */
97 1.2 yamt struct bufq_state *sc_q;/* pending I/O requests */
98 1.1 jmcneill int sc_active; /* number of active I/O operations */
99 1.1 jmcneill
100 1.1 jmcneill #if NRND > 0
101 1.1 jmcneill rndsource_element_t rnd_source;
102 1.1 jmcneill #endif
103 1.1 jmcneill };
104