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