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