xref: /csrg-svn/sys/hp300/dev/rdreg.h (revision 41480)
1*41480Smckusick /*
2*41480Smckusick  * Copyright (c) 1988 University of Utah.
3*41480Smckusick  * Copyright (c) 1982, 1990 The Regents of the University of California.
4*41480Smckusick  * All rights reserved.
5*41480Smckusick  *
6*41480Smckusick  * This code is derived from software contributed to Berkeley by
7*41480Smckusick  * the Systems Programming Group of the University of Utah Computer
8*41480Smckusick  * Science Department.
9*41480Smckusick  *
10*41480Smckusick  * %sccs.include.redist.c%
11*41480Smckusick  *
12*41480Smckusick  * from: Utah $Hdr: rdreg.h 1.14 89/02/27$
13*41480Smckusick  *
14*41480Smckusick  *	@(#)rdreg.h	7.1 (Berkeley) 05/08/90
15*41480Smckusick  */
16*41480Smckusick 
17*41480Smckusick struct	rd_iocmd {
18*41480Smckusick 	char	c_pad;
19*41480Smckusick 	char	c_unit;
20*41480Smckusick 	char	c_volume;
21*41480Smckusick 	char	c_saddr;
22*41480Smckusick 	short	c_hiaddr;
23*41480Smckusick 	long	c_addr;
24*41480Smckusick 	char	c_nop2;
25*41480Smckusick 	char	c_slen;
26*41480Smckusick 	long	c_len;
27*41480Smckusick 	char	c_cmd;
28*41480Smckusick 	char	c_pad2;
29*41480Smckusick };
30*41480Smckusick 
31*41480Smckusick struct	rd_rscmd {
32*41480Smckusick 	char	c_unit;
33*41480Smckusick 	char	c_sram;
34*41480Smckusick 	char	c_ram;
35*41480Smckusick 	char	c_cmd;
36*41480Smckusick };
37*41480Smckusick 
38*41480Smckusick struct	rd_stat {
39*41480Smckusick 	char	c_vu;
40*41480Smckusick 	char	c_pend;
41*41480Smckusick 	short	c_ref;
42*41480Smckusick 	short	c_fef;
43*41480Smckusick 	short	c_aef;
44*41480Smckusick 	short	c_ief;
45*41480Smckusick 	union {
46*41480Smckusick 		char cu_raw[10];
47*41480Smckusick 		struct {
48*41480Smckusick 			short	cu_msw;
49*41480Smckusick 			long	cu_lsl;
50*41480Smckusick 		} cu_sva;
51*41480Smckusick 		struct {
52*41480Smckusick 			long	cu_cyhd;
53*41480Smckusick 			short	cu_sect;
54*41480Smckusick 		} cu_tva;
55*41480Smckusick 	} c_pf;
56*41480Smckusick };
57*41480Smckusick #define c_raw	c_pf.cu_raw
58*41480Smckusick #define c_blk	c_pf.cu_sva.cu_lsl	/* for now */
59*41480Smckusick #define c_tva	c_pf.cu_tva
60*41480Smckusick 
61*41480Smckusick struct	rd_ssmcmd {
62*41480Smckusick 	char	c_unit;
63*41480Smckusick 	char	c_cmd;
64*41480Smckusick 	short	c_refm;
65*41480Smckusick 	short	c_fefm;
66*41480Smckusick 	short	c_aefm;
67*41480Smckusick 	short	c_iefm;
68*41480Smckusick };
69*41480Smckusick 
70*41480Smckusick struct	rd_srcmd {
71*41480Smckusick 	char	c_unit;
72*41480Smckusick 	char	c_nop;
73*41480Smckusick 	char	c_cmd;
74*41480Smckusick 	char	c_param;
75*41480Smckusick };
76*41480Smckusick 
77*41480Smckusick struct	rd_clearcmd {
78*41480Smckusick 	char	c_unit;
79*41480Smckusick 	char	c_cmd;
80*41480Smckusick };
81*41480Smckusick 
82*41480Smckusick struct rd_describe {
83*41480Smckusick 	u_int	d_iuw:16,	/* controller: installed unit word */
84*41480Smckusick 		d_cmaxxfr:16,	/* controller: max transfer rate (Kb) */
85*41480Smckusick 		d_ctype:8,	/* controller: controller type */
86*41480Smckusick 		d_utype:8,	/* unit: unit type */
87*41480Smckusick 		d_name:24,	/* unit: name (6 BCD digits) */
88*41480Smckusick 		d_sectsize:16,	/* unit: # of bytes per block (sector) */
89*41480Smckusick 		d_blkbuf:8,	/* unit: # of blocks which can be buffered */
90*41480Smckusick 		d_burstsize:8,	/* unit: recommended burst size */
91*41480Smckusick 		d_blocktime:16,	/* unit: block time (u-sec) */
92*41480Smckusick 		d_uavexfr:16,	/* unit: average transfer rate (Kb) */
93*41480Smckusick 		d_retry:16,	/* unit: optimal retry time (1/100-sec) */
94*41480Smckusick 		d_access:16,	/* unit: access time param (1/100-sec) */
95*41480Smckusick 		d_maxint:8,	/* unit: maximum interleave */
96*41480Smckusick 		d_fvbyte:8,	/* unit: fixed volume byte */
97*41480Smckusick 		d_rvbyte:8,	/* unit: removeable volume byte */
98*41480Smckusick 		d_maxcyl:24,	/* volume: maximum cylinder */
99*41480Smckusick 		d_maxhead:8,	/* volume: maximum head */
100*41480Smckusick 		d_maxsect:16,	/* volume: maximum sector on track */
101*41480Smckusick 		d_maxvsecth:16,	/* volume: maximum sector on volume (MSW) */
102*41480Smckusick 		d_maxvsectl:32,	/* volume: maximum sector on volume (LSWs) */
103*41480Smckusick 		d_interleave:8;	/* volume: current interleave */
104*41480Smckusick  };
105*41480Smckusick 
106*41480Smckusick /* indicies into rdinfo -- order is arbitrary */
107*41480Smckusick #define	RD7945A		0
108*41480Smckusick #define	RD9134D		1
109*41480Smckusick #define	RD9122S		2
110*41480Smckusick #define	RD7912P		3
111*41480Smckusick #define	RD7914P		4
112*41480Smckusick #define	RD7958A		5
113*41480Smckusick #define RD7957A		6
114*41480Smckusick #define	RD7933H		7
115*41480Smckusick #define	RD9134L		8
116*41480Smckusick #define	RD7936H		9
117*41480Smckusick #define	RD7937H		10
118*41480Smckusick #define RD7914CT	11
119*41480Smckusick #define RD7946A		12
120*41480Smckusick #define RD9122D		13
121*41480Smckusick #define RD7957B		14
122*41480Smckusick #define RD7958B		15
123*41480Smckusick #define RD7959B		16
124*41480Smckusick 
125*41480Smckusick /* HW ids */
126*41480Smckusick #define	RD7946AID	0x220	/* also 7945A */
127*41480Smckusick #define	RD9134DID	0x221	/* also 9122S */
128*41480Smckusick #define	RD9134LID	0x222	/* also 9122D */
129*41480Smckusick #define	RD7912PID	0x209
130*41480Smckusick #define RD7914CTID	0x20A
131*41480Smckusick #define	RD7914PID	0x20B
132*41480Smckusick #define	RD7958AID	0x22B
133*41480Smckusick #define RD7957AID	0x22A
134*41480Smckusick #define	RD7933HID	0x212
135*41480Smckusick #define	RD7936HID	0x213	/* just guessing -- as of yet unknown */
136*41480Smckusick #define	RD7937HID	0x214
137*41480Smckusick #define RD7957BID	0x22C	/* another guess based on 7958B */
138*41480Smckusick #define RD7958BID	0x22D
139*41480Smckusick #define RD7959BID	0x22E	/* another guess based on 7958B */
140*41480Smckusick 
141*41480Smckusick #define	NRD7945ABPT	(32 >> (DEV_BSHIFT-8))
142*41480Smckusick #define	NRD7945ATRK	7
143*41480Smckusick #define	NRD9134DBPT	(32 >> (DEV_BSHIFT-8))
144*41480Smckusick #define	NRD9134DTRK	6
145*41480Smckusick #define	NRD9122SBPT	(16 >> (DEV_BSHIFT-8))
146*41480Smckusick #define	NRD9122STRK	2
147*41480Smckusick #define	NRD7912PBPT	(64 >> (DEV_BSHIFT-8))
148*41480Smckusick #define	NRD7912PTRK	7
149*41480Smckusick #define	NRD7914PBPT	(64 >> (DEV_BSHIFT-8))
150*41480Smckusick #define	NRD7914PTRK	7
151*41480Smckusick #define	NRD7933HBPT	(92 >> (DEV_BSHIFT-8))
152*41480Smckusick #define	NRD7933HTRK	13
153*41480Smckusick #define	NRD9134LBPT	(32 >> (DEV_BSHIFT-8))
154*41480Smckusick #define	NRD9134LTRK	5
155*41480Smckusick 
156*41480Smckusick /*
157*41480Smckusick  * Several HP drives have an odd number of 256 byte sectors per track.
158*41480Smckusick  * This makes it rather difficult to break them into 512 and 1024 byte blocks.
159*41480Smckusick  * So...we just do like HPUX and don't bother to respect hardware track/head
160*41480Smckusick  * boundries -- we just mold the disk so that we use the entire capacity.
161*41480Smckusick  * HPUX also sometimes doen't abide by cylinder boundries, we attempt to
162*41480Smckusick  * whenever possible.
163*41480Smckusick  *
164*41480Smckusick  * DISK		REAL (256 BPS)		HPUX (1024 BPS)		BSD (512 BPS)
165*41480Smckusick  * 		SPT x HD x CYL		SPT x HD x CYL		SPT x HD x CYL
166*41480Smckusick  * -----	---------------		---------------		--------------
167*41480Smckusick  * 7936:	123 x  7 x 1396		25 x  7 x 1716		123 x  7 x  698
168*41480Smckusick  * 7937:	123 x 13 x 1396		25 x 16 x 1395		123 x 13 x  698
169*41480Smckusick  *
170*41480Smckusick  * 7957A:	 63 x  5 x 1013		11 x  7 x 1036		 22 x  7 x 1036
171*41480Smckusick  * 7958A:	 63 x  8 x 1013		21 x  6 x 1013		 36 x  7 x 1013
172*41480Smckusick  *
173*41480Smckusick  * 7957B:	 63 x  4 x 1269		 9 x  7 x 1269		 18 x  7 x 1269
174*41480Smckusick  * 7958B:	 63 x  6 x 1572		21 x  9 x  786		 42 x  9 x  786
175*41480Smckusick  * 7959B:	 63 x 12 x 1572		21 x  9 x 1572		 42 x  9 x 1572
176*41480Smckusick  */
177*41480Smckusick #if DEV_BSIZE == 512
178*41480Smckusick #	define	NRD7936HBPT	123
179*41480Smckusick #	define	NRD7936HTRK	7
180*41480Smckusick #	define	NRD7937HBPT	123
181*41480Smckusick #	define	NRD7937HTRK	13
182*41480Smckusick #	define	NRD7957ABPT	22
183*41480Smckusick #	define	NRD7957ATRK	7
184*41480Smckusick #	define	NRD7958ABPT	36
185*41480Smckusick #	define	NRD7958ATRK	7
186*41480Smckusick #	define	NRD7957BBPT	18
187*41480Smckusick #	define	NRD7957BTRK	7
188*41480Smckusick #	define	NRD7958BBPT	42
189*41480Smckusick #	define	NRD7958BTRK	9
190*41480Smckusick #	define	NRD7959BBPT	42
191*41480Smckusick #	define	NRD7959BTRK	9
192*41480Smckusick #endif
193*41480Smckusick #if DEV_BSIZE == 1024
194*41480Smckusick #	define	NRD7957ABPT	11
195*41480Smckusick #	define	NRD7957ATRK	7
196*41480Smckusick #	define	NRD7958ABPT	21
197*41480Smckusick #	define	NRD7958ATRK	6
198*41480Smckusick #	define	NRD7957BBPT	9
199*41480Smckusick #	define	NRD7957BTRK	7
200*41480Smckusick #	define	NRD7958BBPT	21
201*41480Smckusick #	define	NRD7958BTRK	9
202*41480Smckusick #	define	NRD7959BBPT	21
203*41480Smckusick #	define	NRD7959BTRK	9
204*41480Smckusick #endif
205*41480Smckusick 
206*41480Smckusick /* controller "unit" number */
207*41480Smckusick #define	RDCTLR		15
208*41480Smckusick 
209*41480Smckusick /* convert 512 byte count into DEV_BSIZE count */
210*41480Smckusick #define RDSZ(x)		((x) >> (DEV_BSHIFT-9))
211*41480Smckusick 
212*41480Smckusick /* convert block number into sector number and back */
213*41480Smckusick #define	RDBTOS(x)	((x) << (DEV_BSHIFT-8))
214*41480Smckusick #define RDSTOB(x)	((x) >> (DEV_BSHIFT-8))
215*41480Smckusick 
216*41480Smckusick /* extract cyl/head/sect info from three-vector address */
217*41480Smckusick #define RDCYL(tva)	((u_long)(tva).cu_cyhd >> 8)
218*41480Smckusick #define RDHEAD(tva)	((tva).cu_cyhd & 0xFF)
219*41480Smckusick #define RDSECT(tva)	((tva).cu_sect)
220*41480Smckusick 
221*41480Smckusick #define	REF_MASK	0x0
222*41480Smckusick #define	FEF_MASK	0x0
223*41480Smckusick #define	AEF_MASK	0x0
224*41480Smckusick #define	IEF_MASK	0xF970
225*41480Smckusick 
226*41480Smckusick #define FEF_CU		0x4000	/* cross-unit */
227*41480Smckusick #define FEF_DR		0x0080	/* diagnostic result */
228*41480Smckusick #define FEF_IMR		0x0008	/* internal maintenance release */
229*41480Smckusick #define	FEF_PF		0x0002	/* power fail */
230*41480Smckusick #define	FEF_REXMT	0x0001	/* retransmit */
231*41480Smckusick #define AEF_UD		0x0040	/* unrecoverable data */
232*41480Smckusick #define IEF_RRMASK	0xe000	/* request release bits */
233*41480Smckusick #define IEF_MD		0x0020	/* marginal data */
234*41480Smckusick #define IEF_RD		0x0010	/* recoverable data */
235*41480Smckusick 
236*41480Smckusick #define	C_READ		0x00
237*41480Smckusick #define	C_RAM		0x00	/* single vector (i.e. sector number) */
238*41480Smckusick #define	C_WRITE		0x02
239*41480Smckusick #define	C_CLEAR		0x08
240*41480Smckusick #define	C_STATUS	0x0d
241*41480Smckusick #define	C_SADDR		0x10
242*41480Smckusick #define	C_SLEN		0x18
243*41480Smckusick #define	C_SUNIT(x)	(0x20 | (x))
244*41480Smckusick #define C_SVOL(x)	(0x40 | (x))
245*41480Smckusick #define	C_NOP		0x34
246*41480Smckusick #define C_DESC		0x35
247*41480Smckusick #define	C_SREL		0x3b
248*41480Smckusick #define	C_SSM		0x3e
249*41480Smckusick #define	C_SRAM		0x48
250*41480Smckusick #define	C_REL		0x140
251*41480Smckusick 
252*41480Smckusick #define	C_CMD		0x05
253*41480Smckusick #define	C_EXEC		0x0e
254*41480Smckusick #define	C_QSTAT		0x10
255*41480Smckusick #define	C_TCMD		0x12
256