1 /* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc. 7 * 8 * %sccs.include.redist.c% 9 * 10 * from: $Hdr: sdreg.h,v 4.300 91/06/09 06:38:28 root Rel41 $ SONY 11 * 12 * @(#)sdreg.h 8.1 (Berkeley) 06/11/93 13 */ 14 15 /* 16 * Copyright (c) 1989- by SONY Corporation. 17 */ 18 /* 19 * sdreg.h 20 */ 21 22 #ifndef __SDREG__ 23 #define __SDREG__ 1 24 25 #define MAXSLAVE 8 26 #define PNUM 8 27 #define RSEN_CNT 32 28 29 /******************************************************/ 30 /* 31 * software control structure / controller 32 */ 33 struct sdc_softc { 34 /*00*/ int sdc_wticks; 35 /*04*/ int sdc_state; 36 #define SDCS_NORMAL 0x0 37 #define SDCS_RSENSE 0x1 38 #define SDCS_ECC 0x2 39 #define SDCS_RASREAD 0x4 40 #define SDCS_RASBLK 0x8 41 #define SDCS_RASWRITE 0x10 42 #define SDCS_RETRY 0x20 43 #define SDCS_PREVRMB 0x40 44 #define SDCS_LOSTDATA 0x1000 45 #define SDCS_ECC_HOLD 0x100000 46 #define SDCS_ECCOFF 0x200000 47 #define SDCS_REZERO 0x400000 48 #define SDCS_OPEN_WAIT 0x20000000 49 #define SDCS_SCUNLOCK 0x40000000 50 #define SDCS_IOCTL 0x80000000 51 /*08*/ int sdc_nhrderr; 52 /*0c*/ int sdc_retrycnt; 53 /*10*/ int sdc_softas; 54 /*14*/ int sdc_timeo; 55 /*18*/ int sdc_countcc; 56 /*1c*/ int sdc_firmware; 57 #define SDCFW_DEFMODE 0x1 58 #define SDCFW_CACHE 0x2 59 #define SDCFW_AWRE 0x4 60 #define SDCFW_ARRE 0x8 61 #define SDCFW_OLDWREN3 0x10 62 #define SDCFW_WANTED 0x20 63 #define SDCFW_BUSY 0x40 64 #define SDCFW_RMB 0x80 65 #define SDCFW_CDBUGS 0x100 66 #define SDCFW_CONTR 0x200 67 #define SDCFW_DEVMASK 0xf0000000 68 #define SDCFW_HD 0x10000000 69 #define SDCFW_MO 0x20000000 70 #define SDCFW_CD 0x40000000 71 /*20*/ 72 }; 73 74 /* 75 * software control structure / drive 76 */ 77 struct sdd_softc { 78 /*00*/ int sdd_sectsize; 79 /*04*/ int sdd_nsect; 80 /*08*/ int sdd_badsect; 81 /*0c*/ int sdd_flags; 82 #define SDDF_DSKCHGD 0x0 83 #define SDDF_SAMEDSK 0x1 84 #define SDDF_WPROTECT 0x2 85 #define SDDF_XUSE 0x4 86 #define SDDF_NONFMT 0x8 87 #define SDDF_FMTDONE 0x10 88 #define SDDF_REQ_EJECT 0x20 89 #define SDDF_ERASEOFF 0x40 90 #define SDDF_VBADSECT 0x80 91 #define SDDF_SKIPCHECK 0x100 92 #define SDDF_SYNCTR 0x200 93 #define SDDF_INHRMV 0x400 94 #define SDDF_GETTMP 0x800 95 #define SDDF_AUDIO_START 0x80000000 96 /*10*/ int sdd_start; /* for removable disk */ 97 /*14*/ int sdd_stoptime; /* for removable disk */ 98 daddr_t sdd_lastblk; 99 }; 100 101 struct sdst { 102 /*00*/ short nsect; /* # sectors / track */ 103 /*02*/ short ntrak; /* # tracks / cylinder */ 104 /*04*/ short nspc; /* # sectors / cylinder */ 105 /*06*/ short ncyl; /* # cylinders */ 106 /*08*/ short rps; /* # revolutions / second */ 107 /*0a*/ short xxxx; /* reserved */ 108 /*0c*/ struct size *sizes; /* partition table */ 109 /*10*/ 110 }; 111 112 struct size { 113 /*00*/ daddr_t sd_nblocks; 114 /*04*/ daddr_t sd_blkoff; 115 /*08*/ 116 }; 117 118 /* 119 * Device configuration table. 120 */ 121 struct sddevinfo { 122 /*00*/ int id_len; /* identify length */ 123 /*04*/ char *id_name; /* vendor & product ID */ 124 /*08*/ char *revs; /* revision */ 125 /*0c*/ int capacity; /* drive capacity */ 126 /*10*/ char *call_name; /* device nickname */ 127 /*14*/ int type; /* device type code */ 128 #define UNKNOWN_DISK 0 129 /**/ 130 #define WREN3_101 110 131 #define WREN3_182 111 132 #define WREN3_101_HH 112 133 #define WREN4_286 120 134 #define WREN5_170_HH 130 135 #define WREN6_415_HH 141 136 #define ST1480N 171 137 /**/ 138 #define DK515C_78 210 139 #define DK516C_16 211 140 #define DK312C_25 220 141 #define DK312C_20 221 142 /**/ 143 #define SRD_2040Z 310 144 #define SMO_S501 330 /* format mode 2 */ 145 #define SMO_S501_ISO 331 /* format mode 3 (spare band 1024) */ 146 #define SMO_S501_ISO2 332 /* format mode 3 (spare band 2048) */ 147 /**/ 148 #define XT_8760S 810 149 /**/ 150 /*18*/ int firm_flags; /* firmware spec */ 151 # define FIRM_CACHE_ON 0x01 152 # define FIRM_CACHE_OFF 0x02 153 # define FIRM_SYNCTR 0x04 154 # define FIRM_AWRE 0x08 155 # define FIRM_ARRE 0x10 156 /*1c*/ int tr_period; /* synchronous transfer period */ 157 /*20*/ int tr_offset; /* synchronous transfer offset */ 158 /*24*/ struct sc_ureq **setup_cmds; /* device setup commands */ 159 /*28*/ struct sdst *sdstp; /* device specifications */ 160 #define calc_disk_sizes NULL 161 /*2c*/ char *ERP_page; /* normal Error Recovery Parameters */ 162 /*30*/ char *max_ERP_page; /* max Error Recovery Parameters */ 163 /*34*/ char **other_pages; /* Other Parameters */ 164 /*38*/ int fmt_opts; /* Format options */ 165 # define FMT_DLFMT 0x07 /* Defect list format */ 166 # define FMT_DLF_BLK 0x00 /* block format */ 167 # define FMT_DLF_IDX 0x04 /* bytes from index format */ 168 # define FMT_DLF_PHYS 0x05 /* physical sector format */ 169 # define FMT_DCRT 0x20 /* Disable Certification */ 170 /*3c*/ 171 }; 172 173 #ifdef news1800 174 # define SYNC_TR_OFS 4 175 #else 176 # define SYNC_TR_OFS 0 177 #endif 178 179 /*********************************************************/ 180 181 /* 182 * MODE SELECT/SENSE bit assign 183 */ 184 #define SDM_PG_NULL 0x00 /* product unique not used */ 185 #define SDM_PG_ERR 0x01 /* error recovery parameters */ 186 #define SDM_PG_CNCT 0x02 /* disconnect/reconnect control parameters */ 187 #define SDM_PG_FMT1 0x03 /* direct access device format parameters */ 188 #define SDM_PG_GEOM 0x04 /* rigid disk drive geometry parameters */ 189 190 #define SDM_PG_CACHE1 0x08 /* cache control parameters */ 191 192 #define SDM_PG_CACHE2 0x38 /* cache control parameters */ 193 194 #define SDM_PG_FMT2 0x20 /* format parameters */ 195 196 #define SDM_PG_MODIFY 0x20 /* modification parameters */ 197 198 #define SDM_PAGE 0x00 /* page cache mode */ 199 #define SDM_RING 0x10 /* ring cache mode */ 200 #define SDM_RCD 0x01 /* Read Cache Disable */ 201 202 #define SDM_STOD 0x08 /* SCSI Time Out Delay*/ 203 #define SDM_ESDT 0x04 /* enable SCSI data timeout */ 204 205 #define SDM_PF 0x10 /* page format */ 206 207 #define SDM_PC_CUR 0x00 /* page control field (current value) */ 208 #define SDM_PC_CHG 0x40 /* page control field (changeable value) */ 209 #define SDM_PC_DEF 0x80 /* page control field (default value) */ 210 #define SDM_PC_SAVE 0xc0 /* page control field (saved value) */ 211 212 #define SDM_PCODE_ER SDM_PG_ERR 213 #define SDM_PCODE_CON SDM_PG_CNCT 214 #define SDM_PCODE_FMT SDM_PG_FMT2 215 #define SDM_PCODE_ALL 0x3f 216 217 #define SDM_DCR 0x01 /* Disable Correction */ 218 #define SDM_DTE 0x02 /* Disable Transfer on Error */ 219 #define SDM_PER 0x04 /* Post Error */ 220 #define SDM_EEC 0x08 /* Enable Early Correction */ 221 #define SDM_RC 0x10 /* Read Continuous */ 222 #define SDM_TB 0x20 /* Transfer Block */ 223 #define SDM_ARRE 0x40 /* automatic read reallocate enable */ 224 #define SDM_AWRE 0x80 /* automatic write reallocate enable */ 225 226 /* 227 * READ DEFECT LIST bit assign 228 */ 229 #define SDDL_PLIST 0x10 /* primary defect list */ 230 #define SDDL_GLIST 0x08 /* grown defect list */ 231 #define SDDL_PHYSFMT 0x05 /* physical sector format */ 232 233 /* 234 * FORMAT UNIT bit assign 235 */ 236 #define SDF_FMTDAT 0x10 /* format data */ 237 #define SDF_CMPLST 0x08 /* complete list */ 238 239 #define SDF_BLKFMT 0x10 /* block format */ 240 #define SDF_PHYSFMT 0x15 /* physical sector format */ 241 #define SDF_MKCDA 0x02 /* make controll data area */ 242 #define SDF_MKPLST 0x01 /* make P list */ 243 244 /* 245 * PREVENT/ALLOW MEDIUM REMOVAL bit assign 246 */ 247 #define SDRMV_PREV 0x01 /* prevent medium removal */ 248 #define SDRMV_ALLOW 0x00 /* allow medium removal */ 249 250 /* 251 * START/STOP UNIT bit assign 252 */ 253 #define SDSS_STOP 0x00 /* stop unit */ 254 #define SDSS_START 0x01 /* start unit */ 255 #define SDSS_EJECT 0x02 /* eject */ 256 257 /*********************************************************/ 258 /* 259 * IOCTL DEFINES 260 */ 261 #define SDIOC_PRVRMV _IO('D', 0) /* prevent medium removal */ 262 #define SDIOC_ALWRMV _IO('D', 1) /* allow medium removal */ 263 #define SDIOC_FORMAT _IOWR('D', 2, struct fmt_data) /* format unit */ 264 struct fmt_data { 265 /*00*/ int noglist; /* ignore G-list flag */ 266 /*04*/ u_char *dlh; /* defect list header */ 267 /*08*/ 268 }; 269 270 #define SDIOC_GSTOPT _IOR('D', 3, int) /* get stop time */ 271 #define SDIOC_SSTOPT _IOW('D', 4, int) /* set stop time */ 272 273 #define SDIOC_SEJECT _IO('D', 5) /* set medium eject request */ 274 275 #define SDIOC_SXUSE _IO('D', 6) /* set exclusive use */ 276 #define SDIOC_RXUSE _IO('D', 7) /* reset exclusive use */ 277 #define SDIOC_ERSOFF _IO('D', 8) /* no erase before write */ 278 #define SDIOC_ERSON _IO('D', 9) /* erase before write */ 279 280 #define SDIOC_INQUIRY _IOR('D', 10, struct sc_inq) 281 #define SDIOC_RCAP _IOR('D', 11, int) 282 283 #define SDIOC_ECODE _IOW('D', 14, int) /* extend ecode on/off */ 284 285 #define SDIOC_GFLAGS _IOR('D', 15, int) /* get ii->ii_flags */ 286 #define SDIOC_SFLAGS _IOW('D', 16, int) /* set ii->ii_flags */ 287 288 /* 289 * ii->ii_flags bits assign 290 */ 291 #define SD_F_ENW 0x01 /* enable write open */ 292 #define SD_F_ECODE 0x02 /* enable extend code */ 293 #define SD_F_WRTVRFY 0x04 /* execute write & verify */ 294 #define SD_F_IGNLABEL 0x08 /* ignore disklabel/diskinfo */ 295 #define SD_F_EOLBA 0x10 /* error if outside LBA */ 296 297 #define SDIOC_RASBLK _IOW('D', 17, int) /* reassign block */ 298 #define SDIOC_GNICKNAME _IOW('D', 18, char *) /* get device nickname */ 299 #define SDIOC_GTYPINDEX _IOR('D', 19, int) /* get ii->ii_type */ 300 301 #define SDIOC_SSYNCPARAM _IOW('D', 20, struct sync_param) 302 /* set sync tr param */ 303 #define SDIOC_GSYNCPARAM _IOR('D', 21, struct sync_param) 304 /* get sync tr param */ 305 struct sync_param { 306 int tr_period; 307 int tr_offset; 308 }; 309 310 #define SDIOC_FORMAT2 _IOWR('D', 22, struct sc_ureq) /* format unit */ 311 312 #endif /* !__SDREG__ */ 313