xref: /onnv-gate/usr/src/uts/common/sys/fdc.h (revision 8258:1bbdbab2965d)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*8258Sgdamore@opensolaris.org  * Common Development and Distribution License (the "License").
6*8258Sgdamore@opensolaris.org  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*8258Sgdamore@opensolaris.org  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_FDC_H
270Sstevel@tonic-gate #define	_SYS_FDC_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifndef	OTYPCNT
340Sstevel@tonic-gate #define	OTYPCNT	5
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate typedef struct xlate_tbl {
380Sstevel@tonic-gate 	int	value;
390Sstevel@tonic-gate 	uchar_t	code;
400Sstevel@tonic-gate } xlate_tbl_t;
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * the floppy disk minor device number is interpreted as follows:
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  *	 7 6 5 4 3 2 1 0
460Sstevel@tonic-gate  * 	+---------+-----+
470Sstevel@tonic-gate  * 	|  drive  | part|
480Sstevel@tonic-gate  * 	+---------+-----+
490Sstevel@tonic-gate  * where:
500Sstevel@tonic-gate  *		drive = instance
510Sstevel@tonic-gate  *		part = partition
520Sstevel@tonic-gate  */
530Sstevel@tonic-gate /*
540Sstevel@tonic-gate  * Macros for partition/drive from floppy device number,
550Sstevel@tonic-gate  * plus other manifest defines....
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #define	PARTITION(x)	(getminor(x) & 7)
590Sstevel@tonic-gate #define	DRIVE(x)	(getminor(x) >> 3)
600Sstevel@tonic-gate #define	FDUNIT(x)	((x) & 3)	/* unit on controller */
610Sstevel@tonic-gate #define	FDCTLR(x)	((x) >> 2)	/* controller instance */
620Sstevel@tonic-gate #define	NFDUN	4
630Sstevel@tonic-gate 
640Sstevel@tonic-gate 
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate  * Floppy drive / diskette type numbers.
670Sstevel@tonic-gate  */
680Sstevel@tonic-gate #define	FMT_5H	  0
690Sstevel@tonic-gate #define	FMT_5Q	  1
700Sstevel@tonic-gate #define	FMT_5D9	  2
710Sstevel@tonic-gate #define	FMT_5D8	  3
720Sstevel@tonic-gate #define	FMT_5D4	  4
730Sstevel@tonic-gate #define	FMT_5D16  5
740Sstevel@tonic-gate #define	FMT_3E	  6
750Sstevel@tonic-gate #define	FMT_3H	  7
760Sstevel@tonic-gate #define	FMT_3I	  8
770Sstevel@tonic-gate #define	FMT_3M	  9
780Sstevel@tonic-gate #define	FMT_3D	  10
790Sstevel@tonic-gate #define	FMT_AUTO  11
800Sstevel@tonic-gate #define	FMT_MAX	  11
810Sstevel@tonic-gate #define	FMT_UNKWN 11
820Sstevel@tonic-gate 
830Sstevel@tonic-gate 
840Sstevel@tonic-gate /*
850Sstevel@tonic-gate  * Mini- and Micro- Diskettes Attributes Structure
860Sstevel@tonic-gate  */
870Sstevel@tonic-gate struct fdattr {
880Sstevel@tonic-gate 	ushort_t fda_rotatespd;		/* rotational speed */
890Sstevel@tonic-gate 	ushort_t fda_intrlv;		/* interleave factor */
900Sstevel@tonic-gate 
910Sstevel@tonic-gate 	uchar_t fda_gapl;		/* gap 3 length */
920Sstevel@tonic-gate 	uchar_t fda_gapf;		/* gap 3 length for format */
930Sstevel@tonic-gate };
940Sstevel@tonic-gate 
950Sstevel@tonic-gate /*
960Sstevel@tonic-gate  * Miscellaneous
970Sstevel@tonic-gate  */
980Sstevel@tonic-gate #define	FDWRITE	0			/* for fdrw() flag */
990Sstevel@tonic-gate #define	FDREAD	1			/* for fdrw() flag */
1000Sstevel@tonic-gate #define	FDRDONE	86			/*  . read with no retries */
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate /*
1030Sstevel@tonic-gate  * Per floppy-drive / diskette state structure
1040Sstevel@tonic-gate  */
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate struct fdisk {
1070Sstevel@tonic-gate 	struct fcu_obj	*d_obj;
1080Sstevel@tonic-gate 	int		d_media;	/* drive media capacities */
1090Sstevel@tonic-gate 	struct kstat 	*d_iostat;	/* pointer to iostat statistics */
1100Sstevel@tonic-gate 	int		d_bpsshf;	/* shift count for bytes to sector */
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate 	ksema_t		d_ocsem;	/* sem for serializing opens/closes */
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate 	struct buf	*d_actf;	/* head of wait list */
1150Sstevel@tonic-gate 	struct buf	*d_actl;	/* tail of wait list */
1160Sstevel@tonic-gate 	struct buf	*d_current;	/* currently active buf */
1170Sstevel@tonic-gate 	struct partition d_part[NDKMAP];	/* partitions descriptions */
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	/*
1200Sstevel@tonic-gate 	 * Regular open type flags.
1210Sstevel@tonic-gate 	 * Open types BLK, MNT, CHR, SWP assumed to be values 0-3.
1220Sstevel@tonic-gate 	 */
1230Sstevel@tonic-gate 	ulong_t	d_regopen[OTYPCNT - 1];
1240Sstevel@tonic-gate 	ulong_t	d_lyropen[NDKMAP];	/* Layered open counters */
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate 	/*
1270Sstevel@tonic-gate 	 * Exclusive open flags (per partition).
1280Sstevel@tonic-gate 	 *
1290Sstevel@tonic-gate 	 * The rules are that in order to open a partition exclusively,
1300Sstevel@tonic-gate 	 * the partition must be completely closed already. Once any
1310Sstevel@tonic-gate 	 * partition of the device is opened exclusively, no other open
1320Sstevel@tonic-gate 	 * on that partition may succeed until the partition is closed.
1330Sstevel@tonic-gate 	 */
1340Sstevel@tonic-gate 	ulong_t		d_exclmask;	/* set to indicate exclusive open */
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate 	/*
1370Sstevel@tonic-gate 	 * Current drive characteristics type.
1380Sstevel@tonic-gate 	 * If -1, then it was set via an ioctl.  Note that a close
1390Sstevel@tonic-gate 	 * and then an open loses the ioctl set characteristics.
1400Sstevel@tonic-gate 	 */
1410Sstevel@tonic-gate 	signed char	d_curfdtype;
1420Sstevel@tonic-gate 	uchar_t		d_deffdtype;
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate 	uchar_t		d_bsec;		/* encoded bytes_per_sector */
1450Sstevel@tonic-gate 	uchar_t		d_drate;	/* encoded data_rate */
1460Sstevel@tonic-gate 	uchar_t		d_motor;	/* motor-on bit */
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate 	uchar_t		d_hutsrt;	/* encoded head unload & step_rate */
1490Sstevel@tonic-gate 	uchar_t		d_hlt;		/* encoded head load time */
1500Sstevel@tonic-gate 	uchar_t		d_dtl;		/* dtl code */
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate 	int	d_media_timeout;	/* media detection timeout */
1530Sstevel@tonic-gate 	timeout_id_t	d_media_timeout_id; /* media detection timeout id */
1540Sstevel@tonic-gate 	enum dkio_state d_media_state;	/* up-to-date media state */
1550Sstevel@tonic-gate 	int		d_ejected;
1560Sstevel@tonic-gate 	kcondvar_t	d_statecv;	/* condition var for media state */
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate 	ulong_t		d_vtoc_bootinfo[3];	/* from label */
1590Sstevel@tonic-gate 	ulong_t		d_vtoc_version;
1600Sstevel@tonic-gate 	time_t		d_vtoc_timestamp[NDKMAP];
1610Sstevel@tonic-gate 	char		d_vtoc_volume[LEN_DKL_VVOL];
1620Sstevel@tonic-gate 	char		d_vtoc_asciilabel[LEN_DKL_ASCII];
1630Sstevel@tonic-gate };
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate /* a place to keep some statistics on what's going on */
1670Sstevel@tonic-gate struct fdstat {
1680Sstevel@tonic-gate 	/* first operations */
1690Sstevel@tonic-gate 	int rd;		/* count reads */
1700Sstevel@tonic-gate 	int wr;		/* count writes */
1710Sstevel@tonic-gate 	int recal;	/* count recalibrates */
1720Sstevel@tonic-gate 	int form;	/* count format_tracks */
1730Sstevel@tonic-gate 	int other;	/* count other ops */
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate 	/* then errors */
1760Sstevel@tonic-gate 	int reset;	/* count resets */
1770Sstevel@tonic-gate 	int to;		/* count timeouts */
1780Sstevel@tonic-gate 	int run;	/* count overrun/underrun */
1790Sstevel@tonic-gate 	int de;		/* count data errors */
1800Sstevel@tonic-gate 	int bfmt;	/* count bad format errors */
1810Sstevel@tonic-gate };
1820Sstevel@tonic-gate 
1830Sstevel@tonic-gate /*
1840Sstevel@tonic-gate  * floppy disk command and status block.
1850Sstevel@tonic-gate  *
1860Sstevel@tonic-gate  * Needed to execute a command. Since the floppy chip is
1870Sstevel@tonic-gate  * single threaded with respect to having only one drive
1880Sstevel@tonic-gate  * active at a time, this block of information is only
1890Sstevel@tonic-gate  * valid for the length of a command and gets rewritten
1900Sstevel@tonic-gate  * for each command.
1910Sstevel@tonic-gate  */
1920Sstevel@tonic-gate 
1930Sstevel@tonic-gate enum fxstate {
1940Sstevel@tonic-gate 	FXS_START,
1950Sstevel@tonic-gate 	FXS_MTRON,
1960Sstevel@tonic-gate 	FXS_RCAL,
1970Sstevel@tonic-gate 	FXS_DKCHGX,
1980Sstevel@tonic-gate 	FXS_RESTART,
1990Sstevel@tonic-gate 	FXS_RESEEK,
2000Sstevel@tonic-gate 	FXS_SEEK,
2010Sstevel@tonic-gate 	FXS_HDST,
2020Sstevel@tonic-gate 	FXS_RDID,
2030Sstevel@tonic-gate 	FXS_DOIT,
2040Sstevel@tonic-gate 	FXS_DOWT,
2050Sstevel@tonic-gate 	FXS_KILL,
2060Sstevel@tonic-gate 	FXS_RESET,
2070Sstevel@tonic-gate 	FXS_END
2080Sstevel@tonic-gate };
2090Sstevel@tonic-gate 
2100Sstevel@tonic-gate enum fmtrstate {
2110Sstevel@tonic-gate 	FMS_OFF,
2120Sstevel@tonic-gate 	FMS_START,
2130Sstevel@tonic-gate 	FMS_KILLST,
2140Sstevel@tonic-gate 	FMS_ON,
2150Sstevel@tonic-gate 	FMS_DELAY,
2160Sstevel@tonic-gate 	FMS_IDLE
2170Sstevel@tonic-gate };
2180Sstevel@tonic-gate 
2190Sstevel@tonic-gate enum fmtrinput {
2200Sstevel@tonic-gate 	FMI_TIMER,
2210Sstevel@tonic-gate 	FMI_STARTCMD,
2220Sstevel@tonic-gate 	FMI_RSTARTCMD,
2230Sstevel@tonic-gate 	FMI_DELAYCMD,
2240Sstevel@tonic-gate 	FMI_IDLECMD
2250Sstevel@tonic-gate };
2260Sstevel@tonic-gate 
2270Sstevel@tonic-gate struct fdcsb {
2280Sstevel@tonic-gate 	struct buf *csb_bufp;	/* associated buf */
2290Sstevel@tonic-gate 	ddi_dma_handle_t csb_dmahandle;
2300Sstevel@tonic-gate 	int csb_handle_bound;		/* DMA handle has been bound */
2310Sstevel@tonic-gate 	uint_t csb_dmacookiecnt;	/* number of DMA cookies */
2320Sstevel@tonic-gate 	uint_t csb_dmacurrcookie;	/* current cookie number */
2330Sstevel@tonic-gate 	uint_t csb_dmawincnt;		/* number of DMA windows */
2340Sstevel@tonic-gate 	uint_t csb_dmacurrwin;		/* current DMA window */
2350Sstevel@tonic-gate 	ddi_dma_cookie_t csb_dmacookie;
2360Sstevel@tonic-gate 	enum fxstate csb_xstate;	/* Current execution state */
2370Sstevel@tonic-gate 	enum fxstate csb_oldxs;	/* old execution state */
2380Sstevel@tonic-gate 	uchar_t	csb_npcyl;	/* new physical cylinder number */
2390Sstevel@tonic-gate 	uchar_t	csb_drive;	/* floppy unit number */
2400Sstevel@tonic-gate 	uchar_t	csb_ncmds;	/* how many command bytes to send */
2410Sstevel@tonic-gate 	uchar_t	csb_nrslts;	/* number of result bytes gotten */
2420Sstevel@tonic-gate 	uchar_t	csb_opflags;	/* opflags, see below */
2430Sstevel@tonic-gate 	uchar_t	csb_timer;	/* op timer, in 0.1 sec */
2440Sstevel@tonic-gate 	uchar_t	csb_maxretry;	/* maximum retries this operation */
2450Sstevel@tonic-gate 	uchar_t	csb_retrys;	/* how may retrys done so far */
2460Sstevel@tonic-gate 	uchar_t	csb_ourtrys;	/* how may over/underrun retrys done so far */
2470Sstevel@tonic-gate 	uchar_t	csb_status;	/* status returned from hwintr */
2480Sstevel@tonic-gate 	uchar_t	csb_cmdstat;	/* if 0 then success, else failure */
2490Sstevel@tonic-gate 	uchar_t	csb_cmd[10];	/* command to send to chip */
2500Sstevel@tonic-gate 	uchar_t	csb_rslt[10];	/* results from chip */
2510Sstevel@tonic-gate };
2520Sstevel@tonic-gate 
2530Sstevel@tonic-gate /*
2540Sstevel@tonic-gate  * defines for csb_opflags
2550Sstevel@tonic-gate  */
2560Sstevel@tonic-gate #define	CSB_OFINRPT	0x01		/* generates an interrupt */
2570Sstevel@tonic-gate #define	CSB_OFDMARD	0x02		/* uses DMA for reading */
2580Sstevel@tonic-gate #define	CSB_OFDMAWT	0x04		/* uses DMA for writing */
2590Sstevel@tonic-gate #define	CSB_OFRESLT	0x08		/* generates results */
2600Sstevel@tonic-gate #define	CSB_OFRAWIOCTL	0x10		/* raw i/o control */
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate #define	CSB_CMDTO   0x01
2630Sstevel@tonic-gate #define	CSB_CMDDMA  0x03
2640Sstevel@tonic-gate #define	CSB_CMDNGNR 0x07
2650Sstevel@tonic-gate 
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate /*
2680Sstevel@tonic-gate  * 82077AA Controller modes
2690Sstevel@tonic-gate  */
2700Sstevel@tonic-gate enum fdcmode077 {
2710Sstevel@tonic-gate 	FDCMODE_AT,
2720Sstevel@tonic-gate 	FDCMODE_PS2,	/* not supported */
2730Sstevel@tonic-gate 	FDCMODE_30
2740Sstevel@tonic-gate };
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate /*
2770Sstevel@tonic-gate  * Per controller data
2780Sstevel@tonic-gate  */
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate struct fdcntlr {
2810Sstevel@tonic-gate 	kmutex_t	c_lock;		/* controller mutex */
2820Sstevel@tonic-gate 	kmutex_t	c_dorlock;	/* digital_output_register mutex */
2830Sstevel@tonic-gate 	kcondvar_t	c_iocv;		/* condition var for I/O done */
2840Sstevel@tonic-gate 	ksema_t		c_selsem;	/* sem for select unit */
285*8258Sgdamore@opensolaris.org 	boolean_t	c_suspended;	/* if DDI_SUSPENDed */
2860Sstevel@tonic-gate 
2870Sstevel@tonic-gate 	dev_info_t	*c_dip;
2880Sstevel@tonic-gate 	int		c_number;	/* logical controller number */
2890Sstevel@tonic-gate 	int		c_regbase;	/* base i/o address */
2900Sstevel@tonic-gate 	int		c_dmachan;	/* DMA channel number */
2910Sstevel@tonic-gate 	int		c_intprio;	/* interrupt priority */
2920Sstevel@tonic-gate 	int		c_intvec;	/* interrupt vector num */
2930Sstevel@tonic-gate 	int		c_chip;
2940Sstevel@tonic-gate 	enum fdcmode077	c_mode;		/* 82077 controller mode */
2950Sstevel@tonic-gate 
2960Sstevel@tonic-gate 	ulong_t		c_flags;	/* state information */
2970Sstevel@tonic-gate 	struct kstat	*c_intrstat;	/* interrupt stats pointer */
2980Sstevel@tonic-gate 	struct	fdstat	fdstats;	/* statistics */
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate 	ddi_iblock_cookie_t c_iblock;	/* returned from ddi_add_intr */
3010Sstevel@tonic-gate 	ddi_idevice_cookie_t c_idevice;	/* returned from ddi_add_intr */
3020Sstevel@tonic-gate 
3030Sstevel@tonic-gate 	int		c_curunit;	/* current/last selected unit */
3040Sstevel@tonic-gate 	timeout_id_t	c_timeid;	/* watchdog timer id */
3050Sstevel@tonic-gate 
3060Sstevel@tonic-gate 	struct	fcu_obj	*c_unit[NFDUN];	/* slave on controller */
3070Sstevel@tonic-gate 	timeout_id_t	c_motort[NFDUN]; /* motor timer id */
3080Sstevel@tonic-gate 	enum fmtrstate	c_mtrstate[NFDUN];
3090Sstevel@tonic-gate 	int		c_curpcyl[NFDUN]; /* current physical cylinder */
3100Sstevel@tonic-gate 	signed char	c_sekdir[NFDUN]; /* direction of last seek */
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate 	struct	fdcsb	c_csb;		/* current csb */
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate 	/*
3150Sstevel@tonic-gate 	 * floppy controller register values
3160Sstevel@tonic-gate 	 */
3170Sstevel@tonic-gate 	uchar_t		c_digout;
3180Sstevel@tonic-gate 	uchar_t		c_drate;	/* only 82072 and 82077AA controllers */
3190Sstevel@tonic-gate 	uchar_t		c_config;	/* DSR on PC/AT with 8272A */
3200Sstevel@tonic-gate 	uchar_t		c_mstat;
3210Sstevel@tonic-gate 	uchar_t		c_data;
3220Sstevel@tonic-gate 	uchar_t		c_digin;
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate 	uchar_t		c_bsec;		/* encoded bytes_per_sector */
3250Sstevel@tonic-gate 	uchar_t		c_hutsrt;	/* encoded head unload & step_rate */
3260Sstevel@tonic-gate 	uchar_t		c_hlt;		/* encoded head load time */
3270Sstevel@tonic-gate };
3280Sstevel@tonic-gate 
3290Sstevel@tonic-gate /*
3300Sstevel@tonic-gate  * Controller flags
3310Sstevel@tonic-gate  */
3320Sstevel@tonic-gate #define	FCFLG_BUSY	0x01	/* operation in progress */
3330Sstevel@tonic-gate #define	FCFLG_WANT	0x02	/* csb structure wanted */
3340Sstevel@tonic-gate #define	FCFLG_WAITMR	0x10	/* waiting for motor to start I/O */
3350Sstevel@tonic-gate #define	FCFLG_WAITING	0x20	/* waiting on I/O completion */
3360Sstevel@tonic-gate #define	FCFLG_TIMEOUT	0x80	/* the current operation just timed out */
3370Sstevel@tonic-gate #define	FCFLG_DSOUT	0x100	/* DENSEL ouput is in use for speed ctl */
3380Sstevel@tonic-gate #define	FCFLG_3DMODE	0x800	/* ctlr is 3D Mode capable */
3390Sstevel@tonic-gate 
3400Sstevel@tonic-gate 
3410Sstevel@tonic-gate /*
3420Sstevel@tonic-gate  * FDC operations
3430Sstevel@tonic-gate  */
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate struct fcobjops {
3460Sstevel@tonic-gate 	int	(*fco_abort)();		/* controller abort */
3470Sstevel@tonic-gate 	int	(*fco_dkinfo)();	/* get disk controller info */
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate 	int	(*fco_select)();	/* select / deselect unit */
3500Sstevel@tonic-gate 	int	(*fco_getchng)();	/* get media change */
3510Sstevel@tonic-gate 	int	(*fco_resetchng)();	/* reset media change */
3520Sstevel@tonic-gate 	int	(*fco_rcseek)();	/* recal / seek */
3530Sstevel@tonic-gate 	int	(*fco_rwbuf)();		/* read /write request */
3540Sstevel@tonic-gate 	int	(*fco_rw)();		/* read /write sector */
3550Sstevel@tonic-gate 	int	(*fco_format)();	/* format track */
3560Sstevel@tonic-gate 	int	(*fco_rwioctl)();	/* raw ioctl */
3570Sstevel@tonic-gate };
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate /*
3600Sstevel@tonic-gate  * FDC unit object
3610Sstevel@tonic-gate  */
3620Sstevel@tonic-gate 
3630Sstevel@tonic-gate struct fcu_obj {
3640Sstevel@tonic-gate 	ulong_t		fj_flags;	/* state information */
3650Sstevel@tonic-gate 	kmutex_t 	fj_lock;	/* unit mutex */
3660Sstevel@tonic-gate 	caddr_t		fj_data;
3670Sstevel@tonic-gate 	struct fd_drive *fj_drive;	/* pointer to drive characteristics */
3680Sstevel@tonic-gate 	struct fd_char	*fj_chars;	/* ptr to diskette characteristics */
3690Sstevel@tonic-gate 	struct fdattr	*fj_attr;	/* additional diskette attributes */
3700Sstevel@tonic-gate 	dev_info_t	*fj_dip;
3710Sstevel@tonic-gate 	ushort_t	fj_rotspd;	/* rotational speed */
3720Sstevel@tonic-gate 	ulong_t		fj_unit;
3730Sstevel@tonic-gate 	struct fcobjops *fj_ops;
3740Sstevel@tonic-gate 	struct fdcntlr	*fj_fdc;
3750Sstevel@tonic-gate 	ddi_iblock_cookie_t *fj_iblock;
3760Sstevel@tonic-gate };
3770Sstevel@tonic-gate 
3780Sstevel@tonic-gate /* unit flags (state info) */
3790Sstevel@tonic-gate #define	FUNIT_DRVATCH		0x001	/* this is drive present */
3800Sstevel@tonic-gate #define	FUNIT_WPROT		0x004	/* diskette is read only */
3810Sstevel@tonic-gate #define	FUNIT_CHAROK		0x010	/* characteristics are known */
3820Sstevel@tonic-gate #define	FUNIT_LABELOK		0x020	/* label was read from disk */
3830Sstevel@tonic-gate #define	FUNIT_UNLABELED		0x040	/* no label using default */
3840Sstevel@tonic-gate #define	FUNIT_CHANGED		0x100	/* diskette was changed after open */
3850Sstevel@tonic-gate #define	FUNIT_CHGDET		0x200	/* diskette removal was detected */
3860Sstevel@tonic-gate #define	FUNIT_3DMODE		0x4000	/* unit is in fast speed mode */
3870Sstevel@tonic-gate #define	FUNIT_BUSY		0x8000	/* unit is busy */
3880Sstevel@tonic-gate 
3890Sstevel@tonic-gate #ifdef _VPIX
3900Sstevel@tonic-gate #define	DRV_NONE	0x00
3910Sstevel@tonic-gate #define	DRV_DBL		0x01
3920Sstevel@tonic-gate #define	DRV_QUAD	0x02
3930Sstevel@tonic-gate #define	DRV_720		0x04	/* LOW_35 gets changed to this for or'ing */
3940Sstevel@tonic-gate #define	DRV_144		0x08	/* HI35 gets changed to this for or'ing */
3950Sstevel@tonic-gate 
3960Sstevel@tonic-gate /* ioctl numbers used by VPIX */
3970Sstevel@tonic-gate #define	FIOC		('F'<<8)
3980Sstevel@tonic-gate #define	F_DTYP		(FIOC|60)	/* returns fd_drvtype */
3990Sstevel@tonic-gate #define	F_FCR		(FIOC|61)	/* output to Floppy Control Register */
4000Sstevel@tonic-gate #define	F_DOR		(FIOC|62)	/* output to Digital Output Register */
4010Sstevel@tonic-gate #define	F_RAW		(FIOC|63)	/* general raw controller interface */
4020Sstevel@tonic-gate #endif
4030Sstevel@tonic-gate 
4040Sstevel@tonic-gate #ifdef	__cplusplus
4050Sstevel@tonic-gate }
4060Sstevel@tonic-gate #endif
4070Sstevel@tonic-gate 
4080Sstevel@tonic-gate #endif	/* !_SYS_FDC_H */
409