Home | History | Annotate | Line # | Download | only in dev
rdreg.h revision 1.13
      1 /*	$NetBSD: rdreg.h,v 1.13 2011/02/08 20:20:13 rmind Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1988 University of Utah.
      5  * Copyright (c) 1982, 1990, 1993
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * This code is derived from software contributed to Berkeley by
      9  * the Systems Programming Group of the University of Utah Computer
     10  * Science Department.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. Neither the name of the University nor the names of its contributors
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  * from: Utah $Hdr: rdreg.h 1.2 90/10/12$
     37  *
     38  *	@(#)rdreg.h	8.1 (Berkeley) 6/10/93
     39  */
     40 
     41 struct	rd_iocmd {
     42 	char	c_pad;
     43 	char	c_unit;
     44 	char	c_volume;
     45 	char	c_saddr;
     46 	short	c_hiaddr;
     47 	long	c_addr;
     48 	char	c_nop2;
     49 	char	c_slen;
     50 	long	c_len;
     51 	char	c_cmd;
     52 	char	c_pad2;
     53 } __attribute__((__packed__));
     54 
     55 struct	rd_rscmd {
     56 	char	c_unit;
     57 	char	c_sram;
     58 	char	c_ram;
     59 	char	c_cmd;
     60 } __attribute__((__packed__));
     61 
     62 struct	rd_stat {
     63 	char	c_vu;
     64 	char	c_pend;
     65 	short	c_ref;
     66 	short	c_fef;
     67 	short	c_aef;
     68 	short	c_ief;
     69 	union {
     70 		char cu_raw[10];
     71 		struct {
     72 			short	cu_msw;
     73 			long	cu_lsl;
     74 		} cu_sva;
     75 		struct {
     76 			long	cu_cyhd;
     77 			short	cu_sect;
     78 		} cu_tva;
     79 	} c_pf;
     80 } __attribute__((__packed__));
     81 #define c_raw	c_pf.cu_raw
     82 #define c_blk	c_pf.cu_sva.cu_lsl	/* for now */
     83 #define c_tva	c_pf.cu_tva
     84 
     85 struct	rd_ssmcmd {
     86 	char	c_unit;
     87 	char	c_cmd;
     88 	short	c_refm;
     89 	short	c_fefm;
     90 	short	c_aefm;
     91 	short	c_iefm;
     92 } __attribute__((__packed__));
     93 
     94 struct	rd_srcmd {
     95 	char	c_unit;
     96 	char	c_nop;
     97 	char	c_cmd;
     98 	char	c_param;
     99 } __attribute__((__packed__));
    100 
    101 struct	rd_clearcmd {
    102 	char	c_unit;
    103 	char	c_cmd;
    104 } __attribute__((__packed__));
    105 
    106 struct rd_describe {
    107 	u_int	d_iuw:16,	/* controller: installed unit word */
    108 		d_cmaxxfr:16,	/* controller: max transfer rate (Kb) */
    109 		d_ctype:8,	/* controller: controller type */
    110 		d_utype:8,	/* unit: unit type */
    111 		d_name:24,	/* unit: name (6 BCD digits) */
    112 		d_sectsize:16,	/* unit: # of bytes per block (sector) */
    113 		d_blkbuf:8,	/* unit: # of blocks which can be buffered */
    114 		d_burstsize:8,	/* unit: recommended burst size */
    115 		d_blocktime:16,	/* unit: block time (u-sec) */
    116 		d_uavexfr:16,	/* unit: average transfer rate (Kb) */
    117 		d_retry:16,	/* unit: optimal retry time (1/100-sec) */
    118 		d_access:16,	/* unit: access time param (1/100-sec) */
    119 		d_maxint:8,	/* unit: maximum interleave */
    120 		d_fvbyte:8,	/* unit: fixed volume byte */
    121 		d_rvbyte:8,	/* unit: removable volume byte */
    122 		d_maxcyl:24,	/* volume: maximum cylinder */
    123 		d_maxhead:8,	/* volume: maximum head */
    124 		d_maxsect:16,	/* volume: maximum sector on track */
    125 		d_maxvsecth:16,	/* volume: maximum sector on volume (MSW) */
    126 		d_maxvsectl:32,	/* volume: maximum sector on volume (LSWs) */
    127 		d_interleave:8;	/* volume: current interleave */
    128 } __attribute__((__packed__));
    129 
    130 /* HW ids */
    131 #define	RD7946AID	0x220	/* also 7945A */
    132 #define	RD9134DID	0x221	/* also 9122S */
    133 #define	RD9134LID	0x222	/* also 9122D */
    134 #define	RD7912PID	0x209
    135 #define RD7914CTID	0x20A
    136 #define	RD7914PID	0x20B
    137 #define	RD7958AID	0x22B
    138 #define RD7957AID	0x22A
    139 #define	RD7933HID	0x212
    140 #define	RD7936HID	0x213	/* just guessing -- as of yet unknown */
    141 #define	RD7937HID	0x214
    142 #define RD7957BID	0x22C	/* another guess based on 7958B */
    143 #define RD7958BID	0x22D
    144 #define RD7959BID	0x22E	/* another guess based on 7958B */
    145 #define RD2200AID	0x22F
    146 #define RD2203AID	0x230	/* yet another guess */
    147 
    148 /* SW ids -- indicies into rdidentinfo, order is arbitrary */
    149 #define	RD7945A		0
    150 #define	RD9134D		1
    151 #define	RD9122S		2
    152 #define	RD7912P		3
    153 #define	RD7914P		4
    154 #define	RD7958A		5
    155 #define RD7957A		6
    156 #define	RD7933H		7
    157 #define	RD9134L		8
    158 #define	RD7936H		9
    159 #define	RD7937H		10
    160 #define RD7914CT	11
    161 #define RD7946A		12
    162 #define RD9122D		13
    163 #define RD7957B		14
    164 #define RD7958B		15
    165 #define RD7959B		16
    166 
    167 #define	NRD7945ABPT	16
    168 #define	NRD7945ATRK	7
    169 #define	NRD9134DBPT	16
    170 #define	NRD9134DTRK	6
    171 #define	NRD9122SBPT	8
    172 #define	NRD9122STRK	2
    173 #define	NRD7912PBPT	32
    174 #define	NRD7912PTRK	7
    175 #define	NRD7914PBPT	32
    176 #define	NRD7914PTRK	7
    177 #define	NRD7933HBPT	46
    178 #define	NRD7933HTRK	13
    179 #define	NRD9134LBPT	16
    180 #define	NRD9134LTRK	5
    181 
    182 /*
    183  * Several HP drives have an odd number of 256 byte sectors per track.
    184  * This makes it rather difficult to break them into 512 and 1024 byte blocks.
    185  * So...we just do like HPUX and don't bother to respect hardware track/head
    186  * boundries -- we just mold the disk so that we use the entire capacity.
    187  * HPUX also sometimes doesn't abide by cylinder boundries, we attempt to
    188  * whenever possible.
    189  *
    190  * DISK		REAL (256 BPS)		HPUX (1024 BPS)		BSD (512 BPS)
    191  * 		SPT x HD x CYL		SPT x HD x CYL		SPT x HD x CYL
    192  * -----	---------------		---------------		--------------
    193  * 7936:	123 x  7 x 1396		 25 x  7 x 1716		123 x  7 x  698
    194  * 7937:	123 x 13 x 1396		 25 x 16 x 1395		123 x 13 x  698
    195  *
    196  * 7957A:	 63 x  5 x 1013		 11 x  7 x 1036		 22 x  7 x 1036
    197  * 7958A:	 63 x  8 x 1013		 21 x  6 x 1013		 36 x  7 x 1013
    198  *
    199  * 7957B:	 63 x  4 x 1269		  9 x  7 x 1269		 18 x  7 x 1269
    200  * 7958B:	 63 x  6 x 1572		 21 x  9 x  786		 42 x  9 x  786
    201  * 7959B:	 63 x 12 x 1572		 21 x  9 x 1572		 42 x  9 x 1572
    202  *
    203  * 2200A:	113 x  8 x 1449		113 x  2 x 1449		113 x  4 x 1449
    204  * 2203A:	113 x 16 x 1449		113 x  4 x 1449		113 x  8 x 1449
    205  */
    206 #define	NRD7936HBPT	123
    207 #define	NRD7936HTRK	7
    208 #define	NRD7937HBPT	123
    209 #define	NRD7937HTRK	13
    210 #define	NRD7957ABPT	22
    211 #define	NRD7957ATRK	7
    212 #define	NRD7958ABPT	36
    213 #define	NRD7958ATRK	7
    214 #define	NRD7957BBPT	18
    215 #define	NRD7957BTRK	7
    216 #define	NRD7958BBPT	42
    217 #define	NRD7958BTRK	9
    218 #define	NRD7959BBPT	42
    219 #define	NRD7959BTRK	9
    220 #define	NRD2200ABPT	113
    221 #define	NRD2200ATRK	4
    222 #define	NRD2203ABPT	113
    223 #define	NRD2203ATRK	8
    224 
    225 /* controller "unit" number */
    226 #define	RDCTLR		15
    227 
    228 /* convert 512 byte count into DEV_BSIZE count */
    229 #define RDSZ(x)		((x) >> (DEV_BSHIFT-9))
    230 
    231 /* convert block number into sector number and back */
    232 #define	RDBTOS(x)	((x) << (DEV_BSHIFT-8))
    233 #define RDSTOB(x)	((x) >> (DEV_BSHIFT-8))
    234 
    235 /* extract cyl/head/sect info from three-vector address */
    236 #define RDCYL(tva)	((u_long)(tva).cu_cyhd >> 8)
    237 #define RDHEAD(tva)	((tva).cu_cyhd & 0xFF)
    238 #define RDSECT(tva)	((tva).cu_sect)
    239 
    240 #define	REF_MASK	0x0
    241 #define	FEF_MASK	0x0
    242 #define	AEF_MASK	0x0
    243 #define	IEF_MASK	0xF970
    244 
    245 #define FEF_CU		0x4000	/* cross-unit */
    246 #define FEF_DR		0x0080	/* diagnostic result */
    247 #define FEF_IMR		0x0008	/* internal maintenance release */
    248 #define	FEF_PF		0x0002	/* power fail */
    249 #define	FEF_REXMT	0x0001	/* retransmit */
    250 #define AEF_UD		0x0040	/* unrecoverable data */
    251 #define IEF_RRMASK	0xe000	/* request release bits */
    252 #define IEF_MD		0x0020	/* marginal data */
    253 #define IEF_RD		0x0010	/* recoverable data */
    254 
    255 #define	C_READ		0x00
    256 #define	C_RAM		0x00	/* single vector (i.e. sector number) */
    257 #define	C_WRITE		0x02
    258 #define	C_CLEAR		0x08
    259 #define	C_STATUS	0x0d
    260 #define	C_SADDR		0x10
    261 #define	C_SLEN		0x18
    262 #define	C_SUNIT(x)	(0x20 | (x))
    263 #define C_SVOL(x)	(0x40 | (x))
    264 #define	C_NOP		0x34
    265 #define C_DESC		0x35
    266 #define	C_SREL		0x3b
    267 #define	C_SSM		0x3e
    268 #define	C_SRAM		0x48
    269 #define C_REL		0xc0
    270 
    271 #define	C_CMD		0x05
    272 #define	C_EXEC		0x0e
    273 #define	C_QSTAT		0x10
    274 #define	C_TCMD		0x12
    275