xref: /onnv-gate/usr/src/uts/sun/sys/fdvar.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1989-1994,1997-1998,2000 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_FDVAR_H
28*0Sstevel@tonic-gate #define	_SYS_FDVAR_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #ifndef	OTYPCNT
37*0Sstevel@tonic-gate #define	OTYPCNT	5
38*0Sstevel@tonic-gate #endif
39*0Sstevel@tonic-gate #ifndef	NDKMAP
40*0Sstevel@tonic-gate #define	NDKMAP	8
41*0Sstevel@tonic-gate #endif
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate /*
44*0Sstevel@tonic-gate  * Compile with our without high level interrupt in trap window
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate /* #define	NO_TRAPWIN_INTR	*/
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /*
50*0Sstevel@tonic-gate  * Macros for partition/unit from floppy device number,
51*0Sstevel@tonic-gate  * plus other manifest defines....
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate #define	FDUNITSHIFT	(3)
55*0Sstevel@tonic-gate #define	FDINSTSHIFT	(2 + FDUNITSHIFT)
56*0Sstevel@tonic-gate #define	FDPARTITION(x)	(getminor(x) & 0x7)
57*0Sstevel@tonic-gate #define	FDUNIT(x)	((getminor(x) >> FDUNITSHIFT) & 0x3)
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate #define	FDCTLR(x)	(getminor(x) >> FDINSTSHIFT)	/* instance */
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate /*
62*0Sstevel@tonic-gate  * Structure definitions for the floppy driver.
63*0Sstevel@tonic-gate  */
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate /*
66*0Sstevel@tonic-gate  * floppy disk command and status block.
67*0Sstevel@tonic-gate  *
68*0Sstevel@tonic-gate  * Needed to execute a command. Since the floppy chip is
69*0Sstevel@tonic-gate  * single threaded with respect to having only one drive
70*0Sstevel@tonic-gate  * active at a time, this block of information is only
71*0Sstevel@tonic-gate  * valid for the length of a commnand and gets rewritten
72*0Sstevel@tonic-gate  * for each command.
73*0Sstevel@tonic-gate  */
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate #ifndef	_ASM
76*0Sstevel@tonic-gate struct fdcsb {
77*0Sstevel@tonic-gate 	caddr_t	csb_addr;	/* Data buffer address */
78*0Sstevel@tonic-gate 	uint_t	csb_len;	/* Data buffer Length */
79*0Sstevel@tonic-gate 	caddr_t	csb_raddr;	/* modified data buffer address */
80*0Sstevel@tonic-gate 	uint_t	csb_rlen;	/* modified data buffer len (resid) */
81*0Sstevel@tonic-gate 	uchar_t	csb_opmode;	/* Current operating mode */
82*0Sstevel@tonic-gate 	uchar_t	csb_unit;	/* floppy slave unit number */
83*0Sstevel@tonic-gate 	uchar_t	csb_ncmds;	/* how many command bytes to send */
84*0Sstevel@tonic-gate 	uchar_t	csb_nrslts;	/* number of result bytes gotten */
85*0Sstevel@tonic-gate 	uchar_t	csb_opflags;	/* opflags, see below */
86*0Sstevel@tonic-gate 	uchar_t	csb_maxretry;	/* maximum retries this opertion */
87*0Sstevel@tonic-gate 	uchar_t	csb_retrys;	/* how may retrys done so far */
88*0Sstevel@tonic-gate 	uchar_t	csb_status;	/* status returned from hwintr */
89*0Sstevel@tonic-gate 	uchar_t	csb_cmdstat;	/* if 0 then success, else failure */
90*0Sstevel@tonic-gate 	uchar_t	csb_cmds[10];	/* commands to send to chip */
91*0Sstevel@tonic-gate 	uchar_t	csb_rslt[10];	/* results from chip */
92*0Sstevel@tonic-gate 	uchar_t  csb_dcsr_rslt;  /* set to 1 if there's an error in the DCSR */
93*0Sstevel@tonic-gate 	uchar_t	csb_dma_rslt;	/* set to 1 if there's an error with the DMA */
94*0Sstevel@tonic-gate 	ddi_dma_cookie_t csb_dmacookie; /* DMA cookie */
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate 	uint_t	csb_ccount;	/* no. of DMA cookies for current window */
97*0Sstevel@tonic-gate 	uint_t	csb_nwin;	/* no. of DMA windows */
98*0Sstevel@tonic-gate 	uint_t	csb_windex;	/* DMA window currently in use */
99*0Sstevel@tonic-gate 	uint_t	csb_read;	/* indicates read or write */
100*0Sstevel@tonic-gate };
101*0Sstevel@tonic-gate #endif	/* !_ASM */
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate /*
104*0Sstevel@tonic-gate  * defines for csb_opflags
105*0Sstevel@tonic-gate  */
106*0Sstevel@tonic-gate #define	CSB_OFIMMEDIATE	0x01		/* grab results immediately */
107*0Sstevel@tonic-gate #define	CSB_OFSEEKOPS	0x02		/* seek/recal type cmd */
108*0Sstevel@tonic-gate #define	CSB_OFXFEROPS	0x04		/* read/write type cmd */
109*0Sstevel@tonic-gate #define	CSB_OFRAWIOCTL	0x10		/* raw ioctl - no recovery */
110*0Sstevel@tonic-gate #define	CSB_OFNORESULTS	0x20		/* no results at all */
111*0Sstevel@tonic-gate #define	CSB_OFTIMEIT	0x40		/* timeout (timer) */
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate #define	CSB_CMDTO 0x01
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate /*
116*0Sstevel@tonic-gate  * csb_read flags
117*0Sstevel@tonic-gate  */
118*0Sstevel@tonic-gate #define	CSB_NULL	0x0
119*0Sstevel@tonic-gate #define	CSB_READ	0x1
120*0Sstevel@tonic-gate #define	CSB_WRITE	0x2
121*0Sstevel@tonic-gate 
122*0Sstevel@tonic-gate #ifndef	_ASM
123*0Sstevel@tonic-gate #ifndef	_GENASSYM
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate /*
126*0Sstevel@tonic-gate  * Define a structure to hold the packed default labels,
127*0Sstevel@tonic-gate  * based on the real dk_label structure - but shorter
128*0Sstevel@tonic-gate  * than 512 bytes. Now only used to define default info
129*0Sstevel@tonic-gate  */
130*0Sstevel@tonic-gate struct packed_label {
131*0Sstevel@tonic-gate 	char		dkl_vname[128];	/* for ascii compatibility */
132*0Sstevel@tonic-gate 	unsigned short	dkl_rpm;	/* rotations per minute */
133*0Sstevel@tonic-gate 	unsigned short	dkl_pcyl;	/* # physical cylinders */
134*0Sstevel@tonic-gate 	unsigned short	dkl_apc;	/* alternates per cylinder */
135*0Sstevel@tonic-gate 	unsigned short	dkl_intrlv;	/* interleave factor */
136*0Sstevel@tonic-gate 	unsigned short	dkl_ncyl;	/* # of data cylinders */
137*0Sstevel@tonic-gate 	unsigned short	dkl_acyl;	/* # of alternate cylinders */
138*0Sstevel@tonic-gate 	unsigned short	dkl_nhead;	/* # of heads in this partition */
139*0Sstevel@tonic-gate 	unsigned short	dkl_nsect;	/* # of 512 byte sectors per track */
140*0Sstevel@tonic-gate 	struct dk_map32	dkl_map[NDKMAP]; /* partition map, see dkio.h */
141*0Sstevel@tonic-gate 	struct dk_vtoc  dkl_vtoc;	/* vtoc stuff from AT&T SVr4 */
142*0Sstevel@tonic-gate };
143*0Sstevel@tonic-gate 
144*0Sstevel@tonic-gate /*
145*0Sstevel@tonic-gate  * Per drive data
146*0Sstevel@tonic-gate  */
147*0Sstevel@tonic-gate struct fdunit {
148*0Sstevel@tonic-gate 
149*0Sstevel@tonic-gate 	/*
150*0Sstevel@tonic-gate 	 * Packed label for this unit
151*0Sstevel@tonic-gate 	 */
152*0Sstevel@tonic-gate 	struct	dk_label un_label;
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate 	/*
155*0Sstevel@tonic-gate 	 * Pointer to iostat statistics
156*0Sstevel@tonic-gate 	 */
157*0Sstevel@tonic-gate 	struct kstat *un_iostat;	/* iostat numbers */
158*0Sstevel@tonic-gate 
159*0Sstevel@tonic-gate 	/*
160*0Sstevel@tonic-gate 	 * Layered open counters
161*0Sstevel@tonic-gate 	 */
162*0Sstevel@tonic-gate 	uint_t	un_lyropen[NDKMAP];
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate 	/*
165*0Sstevel@tonic-gate 	 * Regular open type flags. If
166*0Sstevel@tonic-gate 	 * NDKMAP gets > 8, change the
167*0Sstevel@tonic-gate 	 * uchar_t type.
168*0Sstevel@tonic-gate 	 *
169*0Sstevel@tonic-gate 	 * Open types BLK, MNT, CHR, SWP
170*0Sstevel@tonic-gate 	 * assumed to be values 0-3.
171*0Sstevel@tonic-gate 	 */
172*0Sstevel@tonic-gate 	uchar_t	un_regopen[OTYPCNT - 1];
173*0Sstevel@tonic-gate 
174*0Sstevel@tonic-gate 	/*
175*0Sstevel@tonic-gate 	 * Exclusive open flags (per partition).
176*0Sstevel@tonic-gate 	 *
177*0Sstevel@tonic-gate 	 * The rules are that in order to open
178*0Sstevel@tonic-gate 	 * a partition exclusively, the partition
179*0Sstevel@tonic-gate 	 * must be completely closed already. Once
180*0Sstevel@tonic-gate 	 * any partition of the device is opened
181*0Sstevel@tonic-gate 	 * exclusively, no other open on that
182*0Sstevel@tonic-gate 	 * partition may succeed until the partition
183*0Sstevel@tonic-gate 	 * is closed.
184*0Sstevel@tonic-gate 	 *
185*0Sstevel@tonic-gate 	 * If NDKMAP gets > 8, this must change.
186*0Sstevel@tonic-gate 	 */
187*0Sstevel@tonic-gate 	uchar_t	un_exclmask;		/* set to indicate exclusive open */
188*0Sstevel@tonic-gate 
189*0Sstevel@tonic-gate 	struct	fd_char *un_chars;	/* ptr to diskette characteristics */
190*0Sstevel@tonic-gate 	char	un_curfdtype;		/* current driver characteristics */
191*0Sstevel@tonic-gate 					/* type. If -1, then it was set */
192*0Sstevel@tonic-gate 					/* via an ioctl. Note that a close */
193*0Sstevel@tonic-gate 					/* and then and open loses the */
194*0Sstevel@tonic-gate 					/* ioctl set characteristics. */
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate 	struct fd_drive *un_drive;	/* ptr to drive characteristics */
197*0Sstevel@tonic-gate 	int	un_unit_no;		/* drive id number */
198*0Sstevel@tonic-gate 	uchar_t	un_flags;		/* state information */
199*0Sstevel@tonic-gate 	clock_t	un_media_timeout;	/* media detection timeout */
200*0Sstevel@tonic-gate 	timeout_id_t un_media_timeout_id; /* media detection timeout id */
201*0Sstevel@tonic-gate 	enum dkio_state	un_media_state;	/* up-to-date media state */
202*0Sstevel@tonic-gate 	int	un_ejected;
203*0Sstevel@tonic-gate 	short	un_state;		/* Current power level of drive */
204*0Sstevel@tonic-gate };
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate /* unit flags (state info) */
207*0Sstevel@tonic-gate #define	FDUNIT_DRVCHECKED	0x01	/* this is drive present */
208*0Sstevel@tonic-gate #define	FDUNIT_DRVPRESENT	0x02	/* this is drive present */
209*0Sstevel@tonic-gate /* (the presence of a diskette is another matter) */
210*0Sstevel@tonic-gate #define	FDUNIT_CHAROK		0x04	/* characteristics are known */
211*0Sstevel@tonic-gate #define	FDUNIT_UNLABELED	0x10	/* no label using default */
212*0Sstevel@tonic-gate #define	FDUNIT_CHANGED		0x20	/* diskette was changed after open */
213*0Sstevel@tonic-gate #define	FDUNIT_MEDIUM		0x40	/* fd drive is in medium density */
214*0Sstevel@tonic-gate #define	FDUNIT_SET_SPEED	0x80	/* Flag to force updating the */
215*0Sstevel@tonic-gate 					/* registers with current speed */
216*0Sstevel@tonic-gate 
217*0Sstevel@tonic-gate #endif	/* !_GENASSYM */
218*0Sstevel@tonic-gate 
219*0Sstevel@tonic-gate /* unit flags for power (un_power) */
220*0Sstevel@tonic-gate #define	FD_STATE_NORMAL		0x0 /* Normal running state */
221*0Sstevel@tonic-gate #define	FD_STATE_SUSPENDED	0x1 /* Device suspended for cpr */
222*0Sstevel@tonic-gate #define	FD_STATE_STOPPED	0x2 /* Device is stopped, can be turned off */
223*0Sstevel@tonic-gate 
224*0Sstevel@tonic-gate /*
225*0Sstevel@tonic-gate  * --------|   fd_detach:DDI_SUSPEND ncmds may be != 0 |-----------|
226*0Sstevel@tonic-gate  * |running|------------------------------------------>|           |
227*0Sstevel@tonic-gate  * |NORMAL |  fd_attach:DDI_RESUME                     |           |
228*0Sstevel@tonic-gate  * |       |<------------------------------------------| SUSPENDED |
229*0Sstevel@tonic-gate  * |       |                                           |           |
230*0Sstevel@tonic-gate  * |       |                                           -------------
231*0Sstevel@tonic-gate  * |       |                                                ^
232*0Sstevel@tonic-gate  * |       |                                                |DDI_SUSPEND
233*0Sstevel@tonic-gate  * |       |                                                |
234*0Sstevel@tonic-gate  * |       | fd_power: PM_LEVEL_OFF, ncmds == 0         -------------
235*0Sstevel@tonic-gate  * |       |------------------------------------------->|STOPPED     |
236*0Sstevel@tonic-gate  * |       | fd_power: PM_LEVEL_ON                      |            |
237*0Sstevel@tonic-gate  * |       |<-------------------------------------------|            |
238*0Sstevel@tonic-gate  * --------                                              ------------|
239*0Sstevel@tonic-gate  *
240*0Sstevel@tonic-gate  * running => FD_STATE_NORMAL
241*0Sstevel@tonic-gate  *
242*0Sstevel@tonic-gate  */
243*0Sstevel@tonic-gate 
244*0Sstevel@tonic-gate /* flags for power levels for auto power management */
245*0Sstevel@tonic-gate #define	PM_LEVEL_ON	0x1   /* Changes the state to FD_STATE_STOPPED */
246*0Sstevel@tonic-gate #define	PM_LEVEL_OFF	0x0   /* Changes the state to FD_STATE_NORMAL */
247*0Sstevel@tonic-gate 
248*0Sstevel@tonic-gate /* a place to keep some statistics on what's going on */
249*0Sstevel@tonic-gate struct fdstat {
250*0Sstevel@tonic-gate 	/* first operations */
251*0Sstevel@tonic-gate 	int rd;		/* count reads */
252*0Sstevel@tonic-gate 	int wr;		/* count writes */
253*0Sstevel@tonic-gate 	int recal;	/* count recalibrates */
254*0Sstevel@tonic-gate 	int form;	/* count format_tracks */
255*0Sstevel@tonic-gate 	int other;	/* count other ops */
256*0Sstevel@tonic-gate 
257*0Sstevel@tonic-gate 	/* then errors */
258*0Sstevel@tonic-gate 	int reset;	/* count resets */
259*0Sstevel@tonic-gate 	int to;		/* count timeouts */
260*0Sstevel@tonic-gate 	int run;	/* count overrun/underrun */
261*0Sstevel@tonic-gate 	int de;		/* count data errors */
262*0Sstevel@tonic-gate 	int bfmt;	/* count bad format errors */
263*0Sstevel@tonic-gate };
264*0Sstevel@tonic-gate 
265*0Sstevel@tonic-gate /*
266*0Sstevel@tonic-gate  * Per controller data
267*0Sstevel@tonic-gate  */
268*0Sstevel@tonic-gate 
269*0Sstevel@tonic-gate struct fdctlr {
270*0Sstevel@tonic-gate 	struct	fdctlr	*c_next;	/* next in a linked list */
271*0Sstevel@tonic-gate 	union  fdcreg   *c_reg;		/* controller registers */
272*0Sstevel@tonic-gate 	volatile uchar_t *c_control; 	/* addr of c_reg->fdc_control */
273*0Sstevel@tonic-gate 	uchar_t		*c_fifo;	/* addr of c_reg->fdc_fifo */
274*0Sstevel@tonic-gate 	uchar_t		*c_dor;		/* addr of c_reg->fdc_dor (077) */
275*0Sstevel@tonic-gate 	uchar_t		*c_dir;		/* addr of c_reg->fdc_dir (077) */
276*0Sstevel@tonic-gate 	caddr_t		*c_dma_regs;	/* DMA engine registers */
277*0Sstevel@tonic-gate 	uint_t		c_fdtype;	/* type of ctlr */
278*0Sstevel@tonic-gate 	uint_t		*c_hiintct;	/* for convenience.. */
279*0Sstevel@tonic-gate 	uint_t		c_softic;	/* for use by hi level interrupt */
280*0Sstevel@tonic-gate 	uchar_t		c_fasttrap;	/* 1 if fast traps enabled, else 0 */
281*0Sstevel@tonic-gate 	struct	fdcsb	c_csb;		/* current csb */
282*0Sstevel@tonic-gate 	kmutex_t	c_hilock;	/* high level mutex */
283*0Sstevel@tonic-gate 	kmutex_t	c_lolock;	/* low level mutex */
284*0Sstevel@tonic-gate 	kcondvar_t	c_iocv;		/* condition var for I/O done */
285*0Sstevel@tonic-gate 	kcondvar_t	c_csbcv;	/* condition var for owning csb */
286*0Sstevel@tonic-gate 	kcondvar_t	c_motoncv;	/* condition var for motor on */
287*0Sstevel@tonic-gate 	kcondvar_t	c_statecv;	/* condition var for media state */
288*0Sstevel@tonic-gate 	kcondvar_t	c_suspend_cv;  /* Cond Var on power management */
289*0Sstevel@tonic-gate 	ksema_t		c_ocsem;	/* sem for serializing opens/closes */
290*0Sstevel@tonic-gate 	ddi_iblock_cookie_t c_block;	/* returned from ddi_add_fastintr */
291*0Sstevel@tonic-gate 	ddi_softintr_t	c_softid;	/* returned from ddi_add_softintr */
292*0Sstevel@tonic-gate 	dev_info_t	*c_dip;		/* controller's dev_info node */
293*0Sstevel@tonic-gate 	timeout_id_t	c_timeid;	/* watchdog timer id */
294*0Sstevel@tonic-gate 	timeout_id_t	c_mtimeid;	/* motor off timer id */
295*0Sstevel@tonic-gate 	struct	fdunit	*c_un;		/* unit on controller */
296*0Sstevel@tonic-gate 	struct	buf	*c_actf;	/* head of wait list */
297*0Sstevel@tonic-gate 	struct	buf	*c_actl;	/* tail of wait list */
298*0Sstevel@tonic-gate 	struct	buf	*c_current;	/* currently active buf */
299*0Sstevel@tonic-gate 	struct kstat	*c_intrstat;	/* interrupt stats pointer */
300*0Sstevel@tonic-gate 	struct	fdstat	fdstats;	/* statistics */
301*0Sstevel@tonic-gate 	uchar_t		c_flags;	/* state information */
302*0Sstevel@tonic-gate 	caddr_t		c_auxiova;	/* auxio virtual address */
303*0Sstevel@tonic-gate 	uchar_t		c_auxiodata;	/* auxio data to enable TC */
304*0Sstevel@tonic-gate 	uchar_t		c_auxiodata2;	/* auxio data to disable TC */
305*0Sstevel@tonic-gate 	ddi_acc_handle_t c_handlep_cont;
306*0Sstevel@tonic-gate 					/* data access handle for controller */
307*0Sstevel@tonic-gate 	ddi_acc_handle_t c_handlep_dma; /* data access handle for DMA engine */
308*0Sstevel@tonic-gate 	ddi_acc_handle_t c_handlep_aux;  /* data access handle for aux regs */
309*0Sstevel@tonic-gate 	ddi_dma_handle_t c_dmahandle; 	/* DMA handle */
310*0Sstevel@tonic-gate 	uint_t		 *c_auxio_reg; 	/* auxio registers */
311*0Sstevel@tonic-gate 	ddi_dma_attr_t 	c_fd_dma_lim;	/* DMA limit structure */
312*0Sstevel@tonic-gate 	caddr_t		dma_buf;	/* Temporary DMAble buffer */
313*0Sstevel@tonic-gate 	ddi_acc_handle_t c_dma_buf_handle; /* DMA handle for dma_buf */
314*0Sstevel@tonic-gate 	uint_t		sb_dma_channel; /* 8237 dma channel no. */
315*0Sstevel@tonic-gate 	uchar_t		sb_dma_lock;	/* Status of DMA lock by isadma */
316*0Sstevel@tonic-gate };
317*0Sstevel@tonic-gate #endif	/* !_ASM */
318*0Sstevel@tonic-gate 
319*0Sstevel@tonic-gate /* types of controllers supported by this driver */
320*0Sstevel@tonic-gate #define	FDCTYPE_82072	0x0001
321*0Sstevel@tonic-gate #define	FDCTYPE_82077   0x0002
322*0Sstevel@tonic-gate #define	FDCTYPE_CTRLMASK 0x000f
323*0Sstevel@tonic-gate 
324*0Sstevel@tonic-gate /* types of io chips which indicates the type of auxio register */
325*0Sstevel@tonic-gate #define	FDCTYPE_MACHIO		0x0010
326*0Sstevel@tonic-gate #define	FDCTYPE_SLAVIO		0x0020
327*0Sstevel@tonic-gate #define	FDCTYPE_CHEERIO		0x0040
328*0Sstevel@tonic-gate #define	FDCTYPE_SB		0x0080
329*0Sstevel@tonic-gate #define	FDCTYPE_AUXIOMASK 	0x00f0
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate /* Method used for transferring data */
332*0Sstevel@tonic-gate #define	FDCTYPE_DMA		0x1000	/* supports DMA for the floppy */
333*0Sstevel@tonic-gate #define	FDCTYPE_DMA8237		FDCTYPE_DMA	/* 8237 DMA controller */
334*0Sstevel@tonic-gate #define	FDCTYPE_TRNSFER_MASTK	0xf000
335*0Sstevel@tonic-gate 
336*0Sstevel@tonic-gate /*
337*0Sstevel@tonic-gate  * Early revs of the 82077 have a bug by which they
338*0Sstevel@tonic-gate  * will not respond to the TC (Terminal count) signal.
339*0Sstevel@tonic-gate  * Because this behavior is exhibited on the clone machines
340*0Sstevel@tonic-gate  * for which the 077 code has been targeted, special workaround
341*0Sstevel@tonic-gate  * logic has had to implemented for read/write commands.
342*0Sstevel@tonic-gate  */
343*0Sstevel@tonic-gate #define	FDCTYPE_TCBUG	0x0100
344*0Sstevel@tonic-gate #define	FDCTYPE_BUGMASK	0x0f00
345*0Sstevel@tonic-gate 
346*0Sstevel@tonic-gate /*
347*0Sstevel@tonic-gate  * Controller flags
348*0Sstevel@tonic-gate  */
349*0Sstevel@tonic-gate #define	FDCFLG_BUSY	0x01	/* operation in progress */
350*0Sstevel@tonic-gate #define	FDCFLG_WANT	0x02	/* csb structure wanted */
351*0Sstevel@tonic-gate #define	FDCFLG_WAITING	0x04	/* waiting on I/O completion */
352*0Sstevel@tonic-gate #define	FDCFLG_TIMEDOUT	0x08	/* the current operation just timed out */
353*0Sstevel@tonic-gate 
354*0Sstevel@tonic-gate 
355*0Sstevel@tonic-gate #ifndef	_ASM
356*0Sstevel@tonic-gate /*
357*0Sstevel@tonic-gate  * Miscellaneous
358*0Sstevel@tonic-gate  */
359*0Sstevel@tonic-gate #define	FDREAD	1			/* for fdrw() flag */
360*0Sstevel@tonic-gate #define	FDWRITE	2			/* for fdrw() flag */
361*0Sstevel@tonic-gate #define	FD_CRETRY 1000000		/* retry while sending comand */
362*0Sstevel@tonic-gate #define	FD_RRETRY 1000000		/* retry while getting results */
363*0Sstevel@tonic-gate #define	FDXC_SLEEP	0x1		/* tell fdexec to sleep 'till done */
364*0Sstevel@tonic-gate #define	FDXC_CHECKCHG	0x2		/* tell fdexec to check disk chnged */
365*0Sstevel@tonic-gate #define	FD_SB_DMA_ALIGN	0x10000		/* DMA alignment for South Bridge */
366*0Sstevel@tonic-gate 
367*0Sstevel@tonic-gate 
368*0Sstevel@tonic-gate /*
369*0Sstevel@tonic-gate  * flags/masks for error printing.
370*0Sstevel@tonic-gate  * the levels are for severity
371*0Sstevel@tonic-gate  */
372*0Sstevel@tonic-gate #define	FDEP_L0		0	/* chatty as can be - for debug! */
373*0Sstevel@tonic-gate #define	FDEP_L1		1	/* best for debug */
374*0Sstevel@tonic-gate #define	FDEP_L2		2	/* minor errors - retries, etc. */
375*0Sstevel@tonic-gate #define	FDEP_L3		3	/* major errors */
376*0Sstevel@tonic-gate #define	FDEP_L4		4	/* catastophic errors, don't mask! */
377*0Sstevel@tonic-gate #define	FDEP_LMAX	4	/* catastophic errors, don't mask! */
378*0Sstevel@tonic-gate #define	FDERRPRINT(l, m, args)	\
379*0Sstevel@tonic-gate 	{ if (((l) >= fderrlevel) && ((m) & fderrmask)) cmn_err args; }
380*0Sstevel@tonic-gate 
381*0Sstevel@tonic-gate /*
382*0Sstevel@tonic-gate  * for each function, we can mask off its printing by clearing its bit in
383*0Sstevel@tonic-gate  * the fderrmask.  Some functions (attach, ident) share a mask bit
384*0Sstevel@tonic-gate  */
385*0Sstevel@tonic-gate #define	FDEM_IDEN 0x00000001	/* fdidentify */
386*0Sstevel@tonic-gate #define	FDEM_ATTA 0x00000001	/* fdattach */
387*0Sstevel@tonic-gate #define	FDEM_SIZE 0x00000002	/* fdsize */
388*0Sstevel@tonic-gate #define	FDEM_OPEN 0x00000004	/* fdopen */
389*0Sstevel@tonic-gate #define	FDEM_GETL 0x00000008	/* fdgetlabel */
390*0Sstevel@tonic-gate #define	FDEM_CLOS 0x00000010	/* fdclose */
391*0Sstevel@tonic-gate #define	FDEM_STRA 0x00000020	/* fdstrategy */
392*0Sstevel@tonic-gate #define	FDEM_STRT 0x00000040	/* fdstart */
393*0Sstevel@tonic-gate #define	FDEM_RDWR 0x00000080	/* fdrdwr */
394*0Sstevel@tonic-gate #define	FDEM_CMD  0x00000100	/* fdcmd */
395*0Sstevel@tonic-gate #define	FDEM_EXEC 0x00000200	/* fdexec */
396*0Sstevel@tonic-gate #define	FDEM_RECO 0x00000400	/* fdrecover */
397*0Sstevel@tonic-gate #define	FDEM_INTR 0x00000800	/* fdintr */
398*0Sstevel@tonic-gate #define	FDEM_WATC 0x00001000	/* fdwatch */
399*0Sstevel@tonic-gate #define	FDEM_IOCT 0x00002000	/* fdioctl */
400*0Sstevel@tonic-gate #define	FDEM_RAWI 0x00004000	/* fdrawioctl */
401*0Sstevel@tonic-gate #define	FDEM_DUMP 0x00008000	/* fddump */
402*0Sstevel@tonic-gate #define	FDEM_GETC 0x00010000	/* fdgetcsb */
403*0Sstevel@tonic-gate #define	FDEM_RETC 0x00020000	/* fdretcsb */
404*0Sstevel@tonic-gate #define	FDEM_RESE 0x00040000	/* fdreset */
405*0Sstevel@tonic-gate #define	FDEM_RECA 0x00080000	/* fdrecalseek */
406*0Sstevel@tonic-gate #define	FDEM_FORM 0x00100000	/* fdformat */
407*0Sstevel@tonic-gate #define	FDEM_RW   0x00200000	/* fdrw */
408*0Sstevel@tonic-gate #define	FDEM_CHEK 0x00400000	/* fdcheckdisk */
409*0Sstevel@tonic-gate #define	FDEM_DSEL 0x00800000	/* fdselect */
410*0Sstevel@tonic-gate #define	FDEM_EJEC 0x01000000	/* fdeject */
411*0Sstevel@tonic-gate #define	FDEM_SCHG 0x02000000	/* fdsense_chng */
412*0Sstevel@tonic-gate #define	FDEM_PACK 0x04000000	/* fdpacklabel */
413*0Sstevel@tonic-gate #define	FDEM_MODS 0x08000000	/* _init, _info, _fini */
414*0Sstevel@tonic-gate #define	FDEM_MOFF 0x10000000	/* fdmotoff */
415*0Sstevel@tonic-gate #define	FDEM_SDMA 0x20000000    /* fdstart_dma */
416*0Sstevel@tonic-gate #define	FDEM_PWR  0x40000000	/* fd power management */
417*0Sstevel@tonic-gate #define	FDEM_ALL  0xFFFFFFFF	/* all */
418*0Sstevel@tonic-gate 
419*0Sstevel@tonic-gate #endif	/* !_ASM */
420*0Sstevel@tonic-gate 
421*0Sstevel@tonic-gate #ifdef	__cplusplus
422*0Sstevel@tonic-gate }
423*0Sstevel@tonic-gate #endif
424*0Sstevel@tonic-gate 
425*0Sstevel@tonic-gate #endif	/* !_SYS_FDVAR_H */
426