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