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