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_FDIO_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_FDIO_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 /* 37*7c478bd9Sstevel@tonic-gate * Floppy Disk Characteristic Structure 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate struct fd_char { 40*7c478bd9Sstevel@tonic-gate uchar_t fdc_medium; /* medium type. */ 41*7c478bd9Sstevel@tonic-gate int fdc_transfer_rate; /* transfer rate */ 42*7c478bd9Sstevel@tonic-gate int fdc_ncyl; /* number of cylinders */ 43*7c478bd9Sstevel@tonic-gate int fdc_nhead; /* number of heads */ 44*7c478bd9Sstevel@tonic-gate int fdc_sec_size; /* sector size */ 45*7c478bd9Sstevel@tonic-gate int fdc_secptrack; /* sectors per track */ 46*7c478bd9Sstevel@tonic-gate int fdc_steps; /* number of steps per */ 47*7c478bd9Sstevel@tonic-gate }; 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate /* 50*7c478bd9Sstevel@tonic-gate * Floppy State Structure 51*7c478bd9Sstevel@tonic-gate */ 52*7c478bd9Sstevel@tonic-gate struct fd_state { 53*7c478bd9Sstevel@tonic-gate int fds_bsec; /* bytes per sector */ 54*7c478bd9Sstevel@tonic-gate int fds_strack; /* sectors per track */ 55*7c478bd9Sstevel@tonic-gate int fds_step; /* step rate */ 56*7c478bd9Sstevel@tonic-gate int fds_rate; /* data rate */ 57*7c478bd9Sstevel@tonic-gate int fds_error; /* error returned by controller */ 58*7c478bd9Sstevel@tonic-gate }; 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate /* 61*7c478bd9Sstevel@tonic-gate * Used by FDGETCHANGE, return state of the sense disk change bit. 62*7c478bd9Sstevel@tonic-gate */ 63*7c478bd9Sstevel@tonic-gate #define FDGC_HISTORY 0x01 /* disk has changed since last i/o */ 64*7c478bd9Sstevel@tonic-gate #define FDGC_CURRENT 0x02 /* current state of disk change */ 65*7c478bd9Sstevel@tonic-gate #define FDGC_CURWPROT 0x10 /* current state of write protect */ 66*7c478bd9Sstevel@tonic-gate #define FDGC_DETECTED 0x20 /* previous state of DISK CHANGE */ 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Used by FD{G, S}ETDRIVECHAR 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate struct fd_drive { 72*7c478bd9Sstevel@tonic-gate int fdd_ejectable; /* does the drive support eject? */ 73*7c478bd9Sstevel@tonic-gate int fdd_maxsearch; /* size of per-unit search table */ 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate int fdd_writeprecomp; /* cyl to start write prcompensation */ 76*7c478bd9Sstevel@tonic-gate int fdd_writereduce; /* cyl to start recucing write current */ 77*7c478bd9Sstevel@tonic-gate int fdd_stepwidth; /* width of step pulse in 1 us units */ 78*7c478bd9Sstevel@tonic-gate int fdd_steprate; /* step rate in 100 us units */ 79*7c478bd9Sstevel@tonic-gate int fdd_headsettle; /* delay, in 100 us units */ 80*7c478bd9Sstevel@tonic-gate int fdd_headload; /* delay, in 100 us units */ 81*7c478bd9Sstevel@tonic-gate int fdd_headunload; /* delay, in 100 us units */ 82*7c478bd9Sstevel@tonic-gate int fdd_motoron; /* delay, in 100 ms units */ 83*7c478bd9Sstevel@tonic-gate int fdd_motoroff; /* delay, in 100 ms units */ 84*7c478bd9Sstevel@tonic-gate int fdd_precomplevel; /* bit shift, in nano-secs */ 85*7c478bd9Sstevel@tonic-gate int fdd_pins; /* defines meaning of pin 1, 2, 4, and 34 */ 86*7c478bd9Sstevel@tonic-gate int fdd_flags; /* TRUE READY, Starting Sector #, & Motor On */ 87*7c478bd9Sstevel@tonic-gate }; 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate /* 90*7c478bd9Sstevel@tonic-gate * fdd_flags: 91*7c478bd9Sstevel@tonic-gate */ 92*7c478bd9Sstevel@tonic-gate #define FDD_READY 0x1 93*7c478bd9Sstevel@tonic-gate #define FDD_MOTON 0x2 94*7c478bd9Sstevel@tonic-gate #define FDD_POLLABLE 0x4 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate /* 97*7c478bd9Sstevel@tonic-gate * Used by FD{G, S}ETSEARCH 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate struct fd_search { 100*7c478bd9Sstevel@tonic-gate int fds_numentries; /* number of elements in the table */ 101*7c478bd9Sstevel@tonic-gate struct fd_char *fds_search; 102*7c478bd9Sstevel@tonic-gate }; 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate /* 105*7c478bd9Sstevel@tonic-gate * Used by FDIOCMD 106*7c478bd9Sstevel@tonic-gate */ 107*7c478bd9Sstevel@tonic-gate struct fd_cmd { 108*7c478bd9Sstevel@tonic-gate ushort_t fdc_cmd; /* command to be executed */ 109*7c478bd9Sstevel@tonic-gate int fdc_flags; /* execution flags */ 110*7c478bd9Sstevel@tonic-gate daddr_t fdc_blkno; /* disk address for command */ 111*7c478bd9Sstevel@tonic-gate int fdc_secnt; /* sector count for command */ 112*7c478bd9Sstevel@tonic-gate caddr_t fdc_bufaddr; /* user's buffer address */ 113*7c478bd9Sstevel@tonic-gate uint_t fdc_buflen; /* size of user's buffer */ 114*7c478bd9Sstevel@tonic-gate }; 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 117*7c478bd9Sstevel@tonic-gate struct fd_cmd32 { 118*7c478bd9Sstevel@tonic-gate ushort_t fdc_cmd; /* command to be executed */ 119*7c478bd9Sstevel@tonic-gate int fdc_flags; /* execution flags */ 120*7c478bd9Sstevel@tonic-gate daddr32_t fdc_blkno; /* disk address for command */ 121*7c478bd9Sstevel@tonic-gate int fdc_secnt; /* sector count for command */ 122*7c478bd9Sstevel@tonic-gate caddr32_t fdc_bufaddr; /* user's buffer address */ 123*7c478bd9Sstevel@tonic-gate uint_t fdc_buflen; /* size of user's buffer */ 124*7c478bd9Sstevel@tonic-gate }; 125*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate /* 128*7c478bd9Sstevel@tonic-gate * Floppy commands 129*7c478bd9Sstevel@tonic-gate */ 130*7c478bd9Sstevel@tonic-gate #define FDCMD_WRITE 1 131*7c478bd9Sstevel@tonic-gate #define FDCMD_READ 2 132*7c478bd9Sstevel@tonic-gate #define FDCMD_SEEK 3 133*7c478bd9Sstevel@tonic-gate #define FDCMD_REZERO 4 134*7c478bd9Sstevel@tonic-gate #define FDCMD_FORMAT_UNIT 5 135*7c478bd9Sstevel@tonic-gate #define FDCMD_FORMAT_TRACK 6 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate /* 138*7c478bd9Sstevel@tonic-gate * Execution flags. 139*7c478bd9Sstevel@tonic-gate */ 140*7c478bd9Sstevel@tonic-gate #define FD_SILENT 0x01 /* no error messages */ 141*7c478bd9Sstevel@tonic-gate #define FD_DIAGNOSE 0x02 /* fail if any error occurs */ 142*7c478bd9Sstevel@tonic-gate #define FD_ISOLATE 0x04 /* isolate from normal commands */ 143*7c478bd9Sstevel@tonic-gate #define FD_READ 0x08 /* read from device */ 144*7c478bd9Sstevel@tonic-gate #define FD_WRITE 0x10 /* write to device */ 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate /* 147*7c478bd9Sstevel@tonic-gate * Used by FDRAW 148*7c478bd9Sstevel@tonic-gate */ 149*7c478bd9Sstevel@tonic-gate struct fd_raw { 150*7c478bd9Sstevel@tonic-gate char fdr_cmd[10]; /* user-supplied command bytes */ 151*7c478bd9Sstevel@tonic-gate short fdr_cnum; /* number of command bytes */ 152*7c478bd9Sstevel@tonic-gate char fdr_result[10]; /* controller-supplied result bytes */ 153*7c478bd9Sstevel@tonic-gate ushort_t fdr_nbytes; /* number to transfer if read/write command */ 154*7c478bd9Sstevel@tonic-gate caddr_t fdr_addr; /* where to transfer if read/write command */ 155*7c478bd9Sstevel@tonic-gate }; 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate struct fd_raw32 { 160*7c478bd9Sstevel@tonic-gate char fdr_cmd[10]; /* user-supplied command bytes */ 161*7c478bd9Sstevel@tonic-gate short fdr_cnum; /* number of command bytes */ 162*7c478bd9Sstevel@tonic-gate char fdr_result[10]; /* controller-supplied result bytes */ 163*7c478bd9Sstevel@tonic-gate ushort_t fdr_nbytes; /* number to transfer if read/write command */ 164*7c478bd9Sstevel@tonic-gate caddr32_t fdr_addr; /* where to transfer if read/write command */ 165*7c478bd9Sstevel@tonic-gate }; 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate /* 171*7c478bd9Sstevel@tonic-gate * Floppy raw commands 172*7c478bd9Sstevel@tonic-gate */ 173*7c478bd9Sstevel@tonic-gate #define FDRAW_SPECIFY 0x03 174*7c478bd9Sstevel@tonic-gate #define FDRAW_READID 0x0a 175*7c478bd9Sstevel@tonic-gate #define FDRAW_SENSE_DRV 0x04 176*7c478bd9Sstevel@tonic-gate #define FDRAW_REZERO 0x07 177*7c478bd9Sstevel@tonic-gate #define FDRAW_SEEK 0x0f 178*7c478bd9Sstevel@tonic-gate #define FDRAW_SENSE_INT 0x08 179*7c478bd9Sstevel@tonic-gate #define FDRAW_FORMAT 0x0d 180*7c478bd9Sstevel@tonic-gate #define FDRAW_READTRACK 0x02 181*7c478bd9Sstevel@tonic-gate #define FDRAW_WRCMD 0x05 182*7c478bd9Sstevel@tonic-gate #define FDRAW_RDCMD 0x06 183*7c478bd9Sstevel@tonic-gate #define FDRAW_WRITEDEL 0x09 184*7c478bd9Sstevel@tonic-gate #define FDRAW_READDEL 0x0c 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate /* 188*7c478bd9Sstevel@tonic-gate * Disk io control commands 189*7c478bd9Sstevel@tonic-gate */ 190*7c478bd9Sstevel@tonic-gate #define FDIOC (0x04 << 8) 191*7c478bd9Sstevel@tonic-gate #define FDIOGCHAR (FDIOC|51) /* GetCharacteristics */ 192*7c478bd9Sstevel@tonic-gate #define FDIOSCHAR (FDIOC|52) /* SetCharacteristics */ 193*7c478bd9Sstevel@tonic-gate #define FDEJECT (FDIOC|53) /* Eject floppy disk */ 194*7c478bd9Sstevel@tonic-gate #define FDGETCHANGE (FDIOC|54) /* Get diskchng stat */ 195*7c478bd9Sstevel@tonic-gate #define FDGETDRIVECHAR (FDIOC|55) /* Get drivechar */ 196*7c478bd9Sstevel@tonic-gate #define FDSETDRIVECHAR (FDIOC|56) /* Set drivechar */ 197*7c478bd9Sstevel@tonic-gate #define FDGETSEARCH (FDIOC|57) /* Get search tbl */ 198*7c478bd9Sstevel@tonic-gate #define FDSETSEARCH (FDIOC|58) /* Set search tbl */ 199*7c478bd9Sstevel@tonic-gate #define FDIOCMD (FDIOC|59) /* Floppy command */ 200*7c478bd9Sstevel@tonic-gate #define FDRAW (FDIOC|70) /* ECDstyle genericcmd */ 201*7c478bd9Sstevel@tonic-gate #define FDDEFGEOCHAR (FDIOC|86) /* restore default geometry */ 202*7c478bd9Sstevel@tonic-gate /* & characteristics */ 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 205*7c478bd9Sstevel@tonic-gate } 206*7c478bd9Sstevel@tonic-gate #endif 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate #endif /* _SYS_FDIO_H */ 209