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