1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_FDC_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_FDC_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifndef OTYPCNT 37*7c478bd9Sstevel@tonic-gate #define OTYPCNT 5 38*7c478bd9Sstevel@tonic-gate #endif 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate typedef struct xlate_tbl { 41*7c478bd9Sstevel@tonic-gate int value; 42*7c478bd9Sstevel@tonic-gate uchar_t code; 43*7c478bd9Sstevel@tonic-gate } xlate_tbl_t; 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate /* 46*7c478bd9Sstevel@tonic-gate * the floppy disk minor device number is interpreted as follows: 47*7c478bd9Sstevel@tonic-gate * 48*7c478bd9Sstevel@tonic-gate * 7 6 5 4 3 2 1 0 49*7c478bd9Sstevel@tonic-gate * +---------+-----+ 50*7c478bd9Sstevel@tonic-gate * | drive | part| 51*7c478bd9Sstevel@tonic-gate * +---------+-----+ 52*7c478bd9Sstevel@tonic-gate * where: 53*7c478bd9Sstevel@tonic-gate * drive = instance 54*7c478bd9Sstevel@tonic-gate * part = partition 55*7c478bd9Sstevel@tonic-gate */ 56*7c478bd9Sstevel@tonic-gate /* 57*7c478bd9Sstevel@tonic-gate * Macros for partition/drive from floppy device number, 58*7c478bd9Sstevel@tonic-gate * plus other manifest defines.... 59*7c478bd9Sstevel@tonic-gate */ 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate #define PARTITION(x) (getminor(x) & 7) 62*7c478bd9Sstevel@tonic-gate #define DRIVE(x) (getminor(x) >> 3) 63*7c478bd9Sstevel@tonic-gate #define FDUNIT(x) ((x) & 3) /* unit on controller */ 64*7c478bd9Sstevel@tonic-gate #define FDCTLR(x) ((x) >> 2) /* controller instance */ 65*7c478bd9Sstevel@tonic-gate #define NFDUN 4 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Floppy drive / diskette type numbers. 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate #define FMT_5H 0 72*7c478bd9Sstevel@tonic-gate #define FMT_5Q 1 73*7c478bd9Sstevel@tonic-gate #define FMT_5D9 2 74*7c478bd9Sstevel@tonic-gate #define FMT_5D8 3 75*7c478bd9Sstevel@tonic-gate #define FMT_5D4 4 76*7c478bd9Sstevel@tonic-gate #define FMT_5D16 5 77*7c478bd9Sstevel@tonic-gate #define FMT_3E 6 78*7c478bd9Sstevel@tonic-gate #define FMT_3H 7 79*7c478bd9Sstevel@tonic-gate #define FMT_3I 8 80*7c478bd9Sstevel@tonic-gate #define FMT_3M 9 81*7c478bd9Sstevel@tonic-gate #define FMT_3D 10 82*7c478bd9Sstevel@tonic-gate #define FMT_AUTO 11 83*7c478bd9Sstevel@tonic-gate #define FMT_MAX 11 84*7c478bd9Sstevel@tonic-gate #define FMT_UNKWN 11 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate /* 88*7c478bd9Sstevel@tonic-gate * Mini- and Micro- Diskettes Attributes Structure 89*7c478bd9Sstevel@tonic-gate */ 90*7c478bd9Sstevel@tonic-gate struct fdattr { 91*7c478bd9Sstevel@tonic-gate ushort_t fda_rotatespd; /* rotational speed */ 92*7c478bd9Sstevel@tonic-gate ushort_t fda_intrlv; /* interleave factor */ 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate uchar_t fda_gapl; /* gap 3 length */ 95*7c478bd9Sstevel@tonic-gate uchar_t fda_gapf; /* gap 3 length for format */ 96*7c478bd9Sstevel@tonic-gate }; 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate /* 99*7c478bd9Sstevel@tonic-gate * Miscellaneous 100*7c478bd9Sstevel@tonic-gate */ 101*7c478bd9Sstevel@tonic-gate #define FDWRITE 0 /* for fdrw() flag */ 102*7c478bd9Sstevel@tonic-gate #define FDREAD 1 /* for fdrw() flag */ 103*7c478bd9Sstevel@tonic-gate #define FDRDONE 86 /* . read with no retries */ 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* 106*7c478bd9Sstevel@tonic-gate * Per floppy-drive / diskette state structure 107*7c478bd9Sstevel@tonic-gate */ 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate struct fdisk { 110*7c478bd9Sstevel@tonic-gate struct fcu_obj *d_obj; 111*7c478bd9Sstevel@tonic-gate int d_media; /* drive media capacities */ 112*7c478bd9Sstevel@tonic-gate struct kstat *d_iostat; /* pointer to iostat statistics */ 113*7c478bd9Sstevel@tonic-gate int d_bpsshf; /* shift count for bytes to sector */ 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate ksema_t d_ocsem; /* sem for serializing opens/closes */ 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate struct buf *d_actf; /* head of wait list */ 118*7c478bd9Sstevel@tonic-gate struct buf *d_actl; /* tail of wait list */ 119*7c478bd9Sstevel@tonic-gate struct buf *d_current; /* currently active buf */ 120*7c478bd9Sstevel@tonic-gate struct partition d_part[NDKMAP]; /* partitions descriptions */ 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate /* 123*7c478bd9Sstevel@tonic-gate * Regular open type flags. 124*7c478bd9Sstevel@tonic-gate * Open types BLK, MNT, CHR, SWP assumed to be values 0-3. 125*7c478bd9Sstevel@tonic-gate */ 126*7c478bd9Sstevel@tonic-gate ulong_t d_regopen[OTYPCNT - 1]; 127*7c478bd9Sstevel@tonic-gate ulong_t d_lyropen[NDKMAP]; /* Layered open counters */ 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate /* 130*7c478bd9Sstevel@tonic-gate * Exclusive open flags (per partition). 131*7c478bd9Sstevel@tonic-gate * 132*7c478bd9Sstevel@tonic-gate * The rules are that in order to open a partition exclusively, 133*7c478bd9Sstevel@tonic-gate * the partition must be completely closed already. Once any 134*7c478bd9Sstevel@tonic-gate * partition of the device is opened exclusively, no other open 135*7c478bd9Sstevel@tonic-gate * on that partition may succeed until the partition is closed. 136*7c478bd9Sstevel@tonic-gate */ 137*7c478bd9Sstevel@tonic-gate ulong_t d_exclmask; /* set to indicate exclusive open */ 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate /* 140*7c478bd9Sstevel@tonic-gate * Current drive characteristics type. 141*7c478bd9Sstevel@tonic-gate * If -1, then it was set via an ioctl. Note that a close 142*7c478bd9Sstevel@tonic-gate * and then an open loses the ioctl set characteristics. 143*7c478bd9Sstevel@tonic-gate */ 144*7c478bd9Sstevel@tonic-gate signed char d_curfdtype; 145*7c478bd9Sstevel@tonic-gate uchar_t d_deffdtype; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate uchar_t d_bsec; /* encoded bytes_per_sector */ 148*7c478bd9Sstevel@tonic-gate uchar_t d_drate; /* encoded data_rate */ 149*7c478bd9Sstevel@tonic-gate uchar_t d_motor; /* motor-on bit */ 150*7c478bd9Sstevel@tonic-gate 151*7c478bd9Sstevel@tonic-gate uchar_t d_hutsrt; /* encoded head unload & step_rate */ 152*7c478bd9Sstevel@tonic-gate uchar_t d_hlt; /* encoded head load time */ 153*7c478bd9Sstevel@tonic-gate uchar_t d_dtl; /* dtl code */ 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate int d_media_timeout; /* media detection timeout */ 156*7c478bd9Sstevel@tonic-gate timeout_id_t d_media_timeout_id; /* media detection timeout id */ 157*7c478bd9Sstevel@tonic-gate enum dkio_state d_media_state; /* up-to-date media state */ 158*7c478bd9Sstevel@tonic-gate int d_ejected; 159*7c478bd9Sstevel@tonic-gate kcondvar_t d_statecv; /* condition var for media state */ 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate ulong_t d_vtoc_bootinfo[3]; /* from label */ 162*7c478bd9Sstevel@tonic-gate ulong_t d_vtoc_version; 163*7c478bd9Sstevel@tonic-gate time_t d_vtoc_timestamp[NDKMAP]; 164*7c478bd9Sstevel@tonic-gate char d_vtoc_volume[LEN_DKL_VVOL]; 165*7c478bd9Sstevel@tonic-gate char d_vtoc_asciilabel[LEN_DKL_ASCII]; 166*7c478bd9Sstevel@tonic-gate }; 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate /* a place to keep some statistics on what's going on */ 170*7c478bd9Sstevel@tonic-gate struct fdstat { 171*7c478bd9Sstevel@tonic-gate /* first operations */ 172*7c478bd9Sstevel@tonic-gate int rd; /* count reads */ 173*7c478bd9Sstevel@tonic-gate int wr; /* count writes */ 174*7c478bd9Sstevel@tonic-gate int recal; /* count recalibrates */ 175*7c478bd9Sstevel@tonic-gate int form; /* count format_tracks */ 176*7c478bd9Sstevel@tonic-gate int other; /* count other ops */ 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate /* then errors */ 179*7c478bd9Sstevel@tonic-gate int reset; /* count resets */ 180*7c478bd9Sstevel@tonic-gate int to; /* count timeouts */ 181*7c478bd9Sstevel@tonic-gate int run; /* count overrun/underrun */ 182*7c478bd9Sstevel@tonic-gate int de; /* count data errors */ 183*7c478bd9Sstevel@tonic-gate int bfmt; /* count bad format errors */ 184*7c478bd9Sstevel@tonic-gate }; 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate /* 187*7c478bd9Sstevel@tonic-gate * floppy disk command and status block. 188*7c478bd9Sstevel@tonic-gate * 189*7c478bd9Sstevel@tonic-gate * Needed to execute a command. Since the floppy chip is 190*7c478bd9Sstevel@tonic-gate * single threaded with respect to having only one drive 191*7c478bd9Sstevel@tonic-gate * active at a time, this block of information is only 192*7c478bd9Sstevel@tonic-gate * valid for the length of a command and gets rewritten 193*7c478bd9Sstevel@tonic-gate * for each command. 194*7c478bd9Sstevel@tonic-gate */ 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate enum fxstate { 197*7c478bd9Sstevel@tonic-gate FXS_START, 198*7c478bd9Sstevel@tonic-gate FXS_MTRON, 199*7c478bd9Sstevel@tonic-gate FXS_RCAL, 200*7c478bd9Sstevel@tonic-gate FXS_DKCHGX, 201*7c478bd9Sstevel@tonic-gate FXS_RESTART, 202*7c478bd9Sstevel@tonic-gate FXS_RESEEK, 203*7c478bd9Sstevel@tonic-gate FXS_SEEK, 204*7c478bd9Sstevel@tonic-gate FXS_HDST, 205*7c478bd9Sstevel@tonic-gate FXS_RDID, 206*7c478bd9Sstevel@tonic-gate FXS_DOIT, 207*7c478bd9Sstevel@tonic-gate FXS_DOWT, 208*7c478bd9Sstevel@tonic-gate FXS_KILL, 209*7c478bd9Sstevel@tonic-gate FXS_RESET, 210*7c478bd9Sstevel@tonic-gate FXS_END 211*7c478bd9Sstevel@tonic-gate }; 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate enum fmtrstate { 214*7c478bd9Sstevel@tonic-gate FMS_OFF, 215*7c478bd9Sstevel@tonic-gate FMS_START, 216*7c478bd9Sstevel@tonic-gate FMS_KILLST, 217*7c478bd9Sstevel@tonic-gate FMS_ON, 218*7c478bd9Sstevel@tonic-gate FMS_DELAY, 219*7c478bd9Sstevel@tonic-gate FMS_IDLE 220*7c478bd9Sstevel@tonic-gate }; 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate enum fmtrinput { 223*7c478bd9Sstevel@tonic-gate FMI_TIMER, 224*7c478bd9Sstevel@tonic-gate FMI_STARTCMD, 225*7c478bd9Sstevel@tonic-gate FMI_RSTARTCMD, 226*7c478bd9Sstevel@tonic-gate FMI_DELAYCMD, 227*7c478bd9Sstevel@tonic-gate FMI_IDLECMD 228*7c478bd9Sstevel@tonic-gate }; 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate struct fdcsb { 231*7c478bd9Sstevel@tonic-gate struct buf *csb_bufp; /* associated buf */ 232*7c478bd9Sstevel@tonic-gate ddi_dma_handle_t csb_dmahandle; 233*7c478bd9Sstevel@tonic-gate int csb_handle_bound; /* DMA handle has been bound */ 234*7c478bd9Sstevel@tonic-gate uint_t csb_dmacookiecnt; /* number of DMA cookies */ 235*7c478bd9Sstevel@tonic-gate uint_t csb_dmacurrcookie; /* current cookie number */ 236*7c478bd9Sstevel@tonic-gate uint_t csb_dmawincnt; /* number of DMA windows */ 237*7c478bd9Sstevel@tonic-gate uint_t csb_dmacurrwin; /* current DMA window */ 238*7c478bd9Sstevel@tonic-gate ddi_dma_cookie_t csb_dmacookie; 239*7c478bd9Sstevel@tonic-gate enum fxstate csb_xstate; /* Current execution state */ 240*7c478bd9Sstevel@tonic-gate enum fxstate csb_oldxs; /* old execution state */ 241*7c478bd9Sstevel@tonic-gate uchar_t csb_npcyl; /* new physical cylinder number */ 242*7c478bd9Sstevel@tonic-gate uchar_t csb_drive; /* floppy unit number */ 243*7c478bd9Sstevel@tonic-gate uchar_t csb_ncmds; /* how many command bytes to send */ 244*7c478bd9Sstevel@tonic-gate uchar_t csb_nrslts; /* number of result bytes gotten */ 245*7c478bd9Sstevel@tonic-gate uchar_t csb_opflags; /* opflags, see below */ 246*7c478bd9Sstevel@tonic-gate uchar_t csb_timer; /* op timer, in 0.1 sec */ 247*7c478bd9Sstevel@tonic-gate uchar_t csb_maxretry; /* maximum retries this operation */ 248*7c478bd9Sstevel@tonic-gate uchar_t csb_retrys; /* how may retrys done so far */ 249*7c478bd9Sstevel@tonic-gate uchar_t csb_ourtrys; /* how may over/underrun retrys done so far */ 250*7c478bd9Sstevel@tonic-gate uchar_t csb_status; /* status returned from hwintr */ 251*7c478bd9Sstevel@tonic-gate uchar_t csb_cmdstat; /* if 0 then success, else failure */ 252*7c478bd9Sstevel@tonic-gate uchar_t csb_cmd[10]; /* command to send to chip */ 253*7c478bd9Sstevel@tonic-gate uchar_t csb_rslt[10]; /* results from chip */ 254*7c478bd9Sstevel@tonic-gate }; 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate /* 257*7c478bd9Sstevel@tonic-gate * defines for csb_opflags 258*7c478bd9Sstevel@tonic-gate */ 259*7c478bd9Sstevel@tonic-gate #define CSB_OFINRPT 0x01 /* generates an interrupt */ 260*7c478bd9Sstevel@tonic-gate #define CSB_OFDMARD 0x02 /* uses DMA for reading */ 261*7c478bd9Sstevel@tonic-gate #define CSB_OFDMAWT 0x04 /* uses DMA for writing */ 262*7c478bd9Sstevel@tonic-gate #define CSB_OFRESLT 0x08 /* generates results */ 263*7c478bd9Sstevel@tonic-gate #define CSB_OFRAWIOCTL 0x10 /* raw i/o control */ 264*7c478bd9Sstevel@tonic-gate 265*7c478bd9Sstevel@tonic-gate #define CSB_CMDTO 0x01 266*7c478bd9Sstevel@tonic-gate #define CSB_CMDDMA 0x03 267*7c478bd9Sstevel@tonic-gate #define CSB_CMDNGNR 0x07 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate /* 271*7c478bd9Sstevel@tonic-gate * 82077AA Controller modes 272*7c478bd9Sstevel@tonic-gate */ 273*7c478bd9Sstevel@tonic-gate enum fdcmode077 { 274*7c478bd9Sstevel@tonic-gate FDCMODE_AT, 275*7c478bd9Sstevel@tonic-gate FDCMODE_PS2, /* not supported */ 276*7c478bd9Sstevel@tonic-gate FDCMODE_30 277*7c478bd9Sstevel@tonic-gate }; 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate /* 280*7c478bd9Sstevel@tonic-gate * Per controller data 281*7c478bd9Sstevel@tonic-gate */ 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate struct fdcntlr { 284*7c478bd9Sstevel@tonic-gate kmutex_t c_lock; /* controller mutex */ 285*7c478bd9Sstevel@tonic-gate kmutex_t c_dorlock; /* digital_output_register mutex */ 286*7c478bd9Sstevel@tonic-gate kcondvar_t c_iocv; /* condition var for I/O done */ 287*7c478bd9Sstevel@tonic-gate ksema_t c_selsem; /* sem for select unit */ 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate dev_info_t *c_dip; 290*7c478bd9Sstevel@tonic-gate int c_number; /* logical controller number */ 291*7c478bd9Sstevel@tonic-gate int c_regbase; /* base i/o address */ 292*7c478bd9Sstevel@tonic-gate int c_dmachan; /* DMA channel number */ 293*7c478bd9Sstevel@tonic-gate int c_intprio; /* interrupt priority */ 294*7c478bd9Sstevel@tonic-gate int c_intvec; /* interrupt vector num */ 295*7c478bd9Sstevel@tonic-gate int c_chip; 296*7c478bd9Sstevel@tonic-gate enum fdcmode077 c_mode; /* 82077 controller mode */ 297*7c478bd9Sstevel@tonic-gate 298*7c478bd9Sstevel@tonic-gate ulong_t c_flags; /* state information */ 299*7c478bd9Sstevel@tonic-gate struct kstat *c_intrstat; /* interrupt stats pointer */ 300*7c478bd9Sstevel@tonic-gate struct fdstat fdstats; /* statistics */ 301*7c478bd9Sstevel@tonic-gate 302*7c478bd9Sstevel@tonic-gate ddi_iblock_cookie_t c_iblock; /* returned from ddi_add_intr */ 303*7c478bd9Sstevel@tonic-gate ddi_idevice_cookie_t c_idevice; /* returned from ddi_add_intr */ 304*7c478bd9Sstevel@tonic-gate 305*7c478bd9Sstevel@tonic-gate int c_curunit; /* current/last selected unit */ 306*7c478bd9Sstevel@tonic-gate timeout_id_t c_timeid; /* watchdog timer id */ 307*7c478bd9Sstevel@tonic-gate 308*7c478bd9Sstevel@tonic-gate struct fcu_obj *c_unit[NFDUN]; /* slave on controller */ 309*7c478bd9Sstevel@tonic-gate timeout_id_t c_motort[NFDUN]; /* motor timer id */ 310*7c478bd9Sstevel@tonic-gate enum fmtrstate c_mtrstate[NFDUN]; 311*7c478bd9Sstevel@tonic-gate int c_curpcyl[NFDUN]; /* current physical cylinder */ 312*7c478bd9Sstevel@tonic-gate signed char c_sekdir[NFDUN]; /* direction of last seek */ 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate struct fdcsb c_csb; /* current csb */ 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate /* 317*7c478bd9Sstevel@tonic-gate * floppy controller register values 318*7c478bd9Sstevel@tonic-gate */ 319*7c478bd9Sstevel@tonic-gate uchar_t c_digout; 320*7c478bd9Sstevel@tonic-gate uchar_t c_drate; /* only 82072 and 82077AA controllers */ 321*7c478bd9Sstevel@tonic-gate uchar_t c_config; /* DSR on PC/AT with 8272A */ 322*7c478bd9Sstevel@tonic-gate uchar_t c_mstat; 323*7c478bd9Sstevel@tonic-gate uchar_t c_data; 324*7c478bd9Sstevel@tonic-gate uchar_t c_digin; 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate uchar_t c_bsec; /* encoded bytes_per_sector */ 327*7c478bd9Sstevel@tonic-gate uchar_t c_hutsrt; /* encoded head unload & step_rate */ 328*7c478bd9Sstevel@tonic-gate uchar_t c_hlt; /* encoded head load time */ 329*7c478bd9Sstevel@tonic-gate }; 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate /* 332*7c478bd9Sstevel@tonic-gate * Controller flags 333*7c478bd9Sstevel@tonic-gate */ 334*7c478bd9Sstevel@tonic-gate #define FCFLG_BUSY 0x01 /* operation in progress */ 335*7c478bd9Sstevel@tonic-gate #define FCFLG_WANT 0x02 /* csb structure wanted */ 336*7c478bd9Sstevel@tonic-gate #define FCFLG_WAITMR 0x10 /* waiting for motor to start I/O */ 337*7c478bd9Sstevel@tonic-gate #define FCFLG_WAITING 0x20 /* waiting on I/O completion */ 338*7c478bd9Sstevel@tonic-gate #define FCFLG_TIMEOUT 0x80 /* the current operation just timed out */ 339*7c478bd9Sstevel@tonic-gate #define FCFLG_DSOUT 0x100 /* DENSEL ouput is in use for speed ctl */ 340*7c478bd9Sstevel@tonic-gate #define FCFLG_3DMODE 0x800 /* ctlr is 3D Mode capable */ 341*7c478bd9Sstevel@tonic-gate 342*7c478bd9Sstevel@tonic-gate 343*7c478bd9Sstevel@tonic-gate /* 344*7c478bd9Sstevel@tonic-gate * FDC operations 345*7c478bd9Sstevel@tonic-gate */ 346*7c478bd9Sstevel@tonic-gate 347*7c478bd9Sstevel@tonic-gate struct fcobjops { 348*7c478bd9Sstevel@tonic-gate int (*fco_start)(); /* controller start */ 349*7c478bd9Sstevel@tonic-gate int (*fco_abort)(); /* controller abort */ 350*7c478bd9Sstevel@tonic-gate int (*fco_getcap)(); /* capability retrieval */ 351*7c478bd9Sstevel@tonic-gate int (*fco_setcap)(); /* capability establishment */ 352*7c478bd9Sstevel@tonic-gate int (*fco_dkinfo)(); /* get disk controller info */ 353*7c478bd9Sstevel@tonic-gate 354*7c478bd9Sstevel@tonic-gate int (*fco_select)(); /* select / deselect unit */ 355*7c478bd9Sstevel@tonic-gate int (*fco_getchng)(); /* get media change */ 356*7c478bd9Sstevel@tonic-gate int (*fco_resetchng)(); /* reset media change */ 357*7c478bd9Sstevel@tonic-gate int (*fco_rcseek)(); /* recal / seek */ 358*7c478bd9Sstevel@tonic-gate int (*fco_rwbuf)(); /* read /write request */ 359*7c478bd9Sstevel@tonic-gate int (*fco_rw)(); /* read /write sector */ 360*7c478bd9Sstevel@tonic-gate int (*fco_format)(); /* format track */ 361*7c478bd9Sstevel@tonic-gate int (*fco_rwioctl)(); /* raw ioctl */ 362*7c478bd9Sstevel@tonic-gate }; 363*7c478bd9Sstevel@tonic-gate 364*7c478bd9Sstevel@tonic-gate /* 365*7c478bd9Sstevel@tonic-gate * FDC unit object 366*7c478bd9Sstevel@tonic-gate */ 367*7c478bd9Sstevel@tonic-gate 368*7c478bd9Sstevel@tonic-gate struct fcu_obj { 369*7c478bd9Sstevel@tonic-gate ulong_t fj_flags; /* state information */ 370*7c478bd9Sstevel@tonic-gate kmutex_t fj_lock; /* unit mutex */ 371*7c478bd9Sstevel@tonic-gate caddr_t fj_data; 372*7c478bd9Sstevel@tonic-gate struct fd_drive *fj_drive; /* pointer to drive characteristics */ 373*7c478bd9Sstevel@tonic-gate struct fd_char *fj_chars; /* ptr to diskette characteristics */ 374*7c478bd9Sstevel@tonic-gate struct fdattr *fj_attr; /* additional diskette attributes */ 375*7c478bd9Sstevel@tonic-gate dev_info_t *fj_dip; 376*7c478bd9Sstevel@tonic-gate ushort_t fj_rotspd; /* rotational speed */ 377*7c478bd9Sstevel@tonic-gate ulong_t fj_unit; 378*7c478bd9Sstevel@tonic-gate struct fcobjops *fj_ops; 379*7c478bd9Sstevel@tonic-gate struct fdcntlr *fj_fdc; 380*7c478bd9Sstevel@tonic-gate ddi_iblock_cookie_t *fj_iblock; 381*7c478bd9Sstevel@tonic-gate }; 382*7c478bd9Sstevel@tonic-gate 383*7c478bd9Sstevel@tonic-gate /* unit flags (state info) */ 384*7c478bd9Sstevel@tonic-gate #define FUNIT_DRVATCH 0x001 /* this is drive present */ 385*7c478bd9Sstevel@tonic-gate #define FUNIT_WPROT 0x004 /* diskette is read only */ 386*7c478bd9Sstevel@tonic-gate #define FUNIT_CHAROK 0x010 /* characteristics are known */ 387*7c478bd9Sstevel@tonic-gate #define FUNIT_LABELOK 0x020 /* label was read from disk */ 388*7c478bd9Sstevel@tonic-gate #define FUNIT_UNLABELED 0x040 /* no label using default */ 389*7c478bd9Sstevel@tonic-gate #define FUNIT_CHANGED 0x100 /* diskette was changed after open */ 390*7c478bd9Sstevel@tonic-gate #define FUNIT_CHGDET 0x200 /* diskette removal was detected */ 391*7c478bd9Sstevel@tonic-gate #define FUNIT_3DMODE 0x4000 /* unit is in fast speed mode */ 392*7c478bd9Sstevel@tonic-gate #define FUNIT_BUSY 0x8000 /* unit is busy */ 393*7c478bd9Sstevel@tonic-gate 394*7c478bd9Sstevel@tonic-gate #ifdef _VPIX 395*7c478bd9Sstevel@tonic-gate #define DRV_NONE 0x00 396*7c478bd9Sstevel@tonic-gate #define DRV_DBL 0x01 397*7c478bd9Sstevel@tonic-gate #define DRV_QUAD 0x02 398*7c478bd9Sstevel@tonic-gate #define DRV_720 0x04 /* LOW_35 gets changed to this for or'ing */ 399*7c478bd9Sstevel@tonic-gate #define DRV_144 0x08 /* HI35 gets changed to this for or'ing */ 400*7c478bd9Sstevel@tonic-gate 401*7c478bd9Sstevel@tonic-gate /* ioctl numbers used by VPIX */ 402*7c478bd9Sstevel@tonic-gate #define FIOC ('F'<<8) 403*7c478bd9Sstevel@tonic-gate #define F_DTYP (FIOC|60) /* returns fd_drvtype */ 404*7c478bd9Sstevel@tonic-gate #define F_FCR (FIOC|61) /* output to Floppy Control Register */ 405*7c478bd9Sstevel@tonic-gate #define F_DOR (FIOC|62) /* output to Digital Output Register */ 406*7c478bd9Sstevel@tonic-gate #define F_RAW (FIOC|63) /* general raw controller interface */ 407*7c478bd9Sstevel@tonic-gate #endif 408*7c478bd9Sstevel@tonic-gate 409*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 410*7c478bd9Sstevel@tonic-gate } 411*7c478bd9Sstevel@tonic-gate #endif 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gate #endif /* !_SYS_FDC_H */ 414