6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / fdio.h
blob8b69e84d1948f69298da0b8d8e3a9d6b845ac8ad
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_FDIO_H
28 #define _SYS_FDIO_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
37 * Floppy Disk Characteristic Structure
39 struct fd_char {
40 uchar_t fdc_medium; /* medium type. */
41 int fdc_transfer_rate; /* transfer rate */
42 int fdc_ncyl; /* number of cylinders */
43 int fdc_nhead; /* number of heads */
44 int fdc_sec_size; /* sector size */
45 int fdc_secptrack; /* sectors per track */
46 int fdc_steps; /* number of steps per */
50 * Floppy State Structure
52 struct fd_state {
53 int fds_bsec; /* bytes per sector */
54 int fds_strack; /* sectors per track */
55 int fds_step; /* step rate */
56 int fds_rate; /* data rate */
57 int fds_error; /* error returned by controller */
61 * Used by FDGETCHANGE, return state of the sense disk change bit.
63 #define FDGC_HISTORY 0x01 /* disk has changed since last i/o */
64 #define FDGC_CURRENT 0x02 /* current state of disk change */
65 #define FDGC_CURWPROT 0x10 /* current state of write protect */
66 #define FDGC_DETECTED 0x20 /* previous state of DISK CHANGE */
69 * Used by FD{G, S}ETDRIVECHAR
71 struct fd_drive {
72 int fdd_ejectable; /* does the drive support eject? */
73 int fdd_maxsearch; /* size of per-unit search table */
75 int fdd_writeprecomp; /* cyl to start write prcompensation */
76 int fdd_writereduce; /* cyl to start recucing write current */
77 int fdd_stepwidth; /* width of step pulse in 1 us units */
78 int fdd_steprate; /* step rate in 100 us units */
79 int fdd_headsettle; /* delay, in 100 us units */
80 int fdd_headload; /* delay, in 100 us units */
81 int fdd_headunload; /* delay, in 100 us units */
82 int fdd_motoron; /* delay, in 100 ms units */
83 int fdd_motoroff; /* delay, in 100 ms units */
84 int fdd_precomplevel; /* bit shift, in nano-secs */
85 int fdd_pins; /* defines meaning of pin 1, 2, 4, and 34 */
86 int fdd_flags; /* TRUE READY, Starting Sector #, & Motor On */
90 * fdd_flags:
92 #define FDD_READY 0x1
93 #define FDD_MOTON 0x2
94 #define FDD_POLLABLE 0x4
97 * Used by FD{G, S}ETSEARCH
99 struct fd_search {
100 int fds_numentries; /* number of elements in the table */
101 struct fd_char *fds_search;
105 * Used by FDIOCMD
107 struct fd_cmd {
108 ushort_t fdc_cmd; /* command to be executed */
109 int fdc_flags; /* execution flags */
110 daddr_t fdc_blkno; /* disk address for command */
111 int fdc_secnt; /* sector count for command */
112 caddr_t fdc_bufaddr; /* user's buffer address */
113 uint_t fdc_buflen; /* size of user's buffer */
116 #if defined(_SYSCALL32)
117 struct fd_cmd32 {
118 ushort_t fdc_cmd; /* command to be executed */
119 int fdc_flags; /* execution flags */
120 daddr32_t fdc_blkno; /* disk address for command */
121 int fdc_secnt; /* sector count for command */
122 caddr32_t fdc_bufaddr; /* user's buffer address */
123 uint_t fdc_buflen; /* size of user's buffer */
125 #endif /* _SYSCALL32 */
128 * Floppy commands
130 #define FDCMD_WRITE 1
131 #define FDCMD_READ 2
132 #define FDCMD_SEEK 3
133 #define FDCMD_REZERO 4
134 #define FDCMD_FORMAT_UNIT 5
135 #define FDCMD_FORMAT_TRACK 6
138 * Execution flags.
140 #define FD_SILENT 0x01 /* no error messages */
141 #define FD_DIAGNOSE 0x02 /* fail if any error occurs */
142 #define FD_ISOLATE 0x04 /* isolate from normal commands */
143 #define FD_READ 0x08 /* read from device */
144 #define FD_WRITE 0x10 /* write to device */
147 * Used by FDRAW
149 struct fd_raw {
150 char fdr_cmd[10]; /* user-supplied command bytes */
151 short fdr_cnum; /* number of command bytes */
152 char fdr_result[10]; /* controller-supplied result bytes */
153 ushort_t fdr_nbytes; /* number to transfer if read/write command */
154 caddr_t fdr_addr; /* where to transfer if read/write command */
157 #ifdef _SYSCALL32
159 struct fd_raw32 {
160 char fdr_cmd[10]; /* user-supplied command bytes */
161 short fdr_cnum; /* number of command bytes */
162 char fdr_result[10]; /* controller-supplied result bytes */
163 ushort_t fdr_nbytes; /* number to transfer if read/write command */
164 caddr32_t fdr_addr; /* where to transfer if read/write command */
167 #endif /* _SYSCALL32 */
171 * Floppy raw commands
173 #define FDRAW_SPECIFY 0x03
174 #define FDRAW_READID 0x0a
175 #define FDRAW_SENSE_DRV 0x04
176 #define FDRAW_REZERO 0x07
177 #define FDRAW_SEEK 0x0f
178 #define FDRAW_SENSE_INT 0x08
179 #define FDRAW_FORMAT 0x0d
180 #define FDRAW_READTRACK 0x02
181 #define FDRAW_WRCMD 0x05
182 #define FDRAW_RDCMD 0x06
183 #define FDRAW_WRITEDEL 0x09
184 #define FDRAW_READDEL 0x0c
188 * Disk io control commands
190 #define FDIOC (0x04 << 8)
191 #define FDIOGCHAR (FDIOC|51) /* GetCharacteristics */
192 #define FDIOSCHAR (FDIOC|52) /* SetCharacteristics */
193 #define FDEJECT (FDIOC|53) /* Eject floppy disk */
194 #define FDGETCHANGE (FDIOC|54) /* Get diskchng stat */
195 #define FDGETDRIVECHAR (FDIOC|55) /* Get drivechar */
196 #define FDSETDRIVECHAR (FDIOC|56) /* Set drivechar */
197 #define FDGETSEARCH (FDIOC|57) /* Get search tbl */
198 #define FDSETSEARCH (FDIOC|58) /* Set search tbl */
199 #define FDIOCMD (FDIOC|59) /* Floppy command */
200 #define FDRAW (FDIOC|70) /* ECDstyle genericcmd */
201 #define FDDEFGEOCHAR (FDIOC|86) /* restore default geometry */
202 /* & characteristics */
204 #ifdef __cplusplus
206 #endif
208 #endif /* _SYS_FDIO_H */