rdreg.h revision 1.1
11.1Sgmcgarry/*	$NetBSD: rdreg.h,v 1.1 2003/06/02 03:53:02 gmcgarry Exp $	*/
21.1Sgmcgarry
31.1Sgmcgarry/*
41.1Sgmcgarry * Copyright (c) 1988 University of Utah.
51.1Sgmcgarry * Copyright (c) 1982, 1990, 1993
61.1Sgmcgarry *	The Regents of the University of California.  All rights reserved.
71.1Sgmcgarry *
81.1Sgmcgarry * This code is derived from software contributed to Berkeley by
91.1Sgmcgarry * the Systems Programming Group of the University of Utah Computer
101.1Sgmcgarry * Science Department.
111.1Sgmcgarry *
121.1Sgmcgarry * Redistribution and use in source and binary forms, with or without
131.1Sgmcgarry * modification, are permitted provided that the following conditions
141.1Sgmcgarry * are met:
151.1Sgmcgarry * 1. Redistributions of source code must retain the above copyright
161.1Sgmcgarry *    notice, this list of conditions and the following disclaimer.
171.1Sgmcgarry * 2. Redistributions in binary form must reproduce the above copyright
181.1Sgmcgarry *    notice, this list of conditions and the following disclaimer in the
191.1Sgmcgarry *    documentation and/or other materials provided with the distribution.
201.1Sgmcgarry * 3. All advertising materials mentioning features or use of this software
211.1Sgmcgarry *    must display the following acknowledgement:
221.1Sgmcgarry *	This product includes software developed by the University of
231.1Sgmcgarry *	California, Berkeley and its contributors.
241.1Sgmcgarry * 4. Neither the name of the University nor the names of its contributors
251.1Sgmcgarry *    may be used to endorse or promote products derived from this software
261.1Sgmcgarry *    without specific prior written permission.
271.1Sgmcgarry *
281.1Sgmcgarry * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
291.1Sgmcgarry * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
301.1Sgmcgarry * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
311.1Sgmcgarry * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
321.1Sgmcgarry * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331.1Sgmcgarry * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341.1Sgmcgarry * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351.1Sgmcgarry * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
361.1Sgmcgarry * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
371.1Sgmcgarry * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
381.1Sgmcgarry * SUCH DAMAGE.
391.1Sgmcgarry *
401.1Sgmcgarry * from: Utah $Hdr: rdreg.h 1.2 90/10/12$
411.1Sgmcgarry *
421.1Sgmcgarry *	@(#)rdreg.h	8.1 (Berkeley) 6/10/93
431.1Sgmcgarry */
441.1Sgmcgarry
451.1Sgmcgarrystruct	rd_iocmd {
461.1Sgmcgarry	u_int8_t	c_pad;		/* alignment */
471.1Sgmcgarry	u_int8_t	c_unit;		/* punit */
481.1Sgmcgarry	u_int8_t	c_volume;	/* CS80CMD_SVOL(0) */
491.1Sgmcgarry	u_int8_t	c_saddr;	/* CS80CMD_SADDR */
501.1Sgmcgarry	u_int16_t	c_hiaddr;	/* always 0 */
511.1Sgmcgarry	u_int32_t	c_addr;		/* blkno */
521.1Sgmcgarry	u_int8_t	c_nop2;		/* CS80CMD_NOP - 32-bit alignment */
531.1Sgmcgarry	u_int8_t	c_slen;		/* CS80CMD_SLEN */
541.1Sgmcgarry	u_int32_t	c_len;		/* number of sectors */
551.1Sgmcgarry	u_int8_t	c_cmd;		/* CS80CMD_READ/CS80CMD_WRITE */
561.1Sgmcgarry} __attribute__((__packed__));
571.1Sgmcgarry
581.1Sgmcgarrystruct	rd_rscmd {		/* different */
591.1Sgmcgarry	u_int8_t	c_unit;
601.1Sgmcgarry	u_int8_t	c_sram;
611.1Sgmcgarry	u_int8_t	c_ram;
621.1Sgmcgarry	u_int8_t	c_cmd;
631.1Sgmcgarry} __attribute__((__packed__));
641.1Sgmcgarry
651.1Sgmcgarry/* HW ids */
661.1Sgmcgarry#define	RD7946AID	0x220	/* also 7945A */
671.1Sgmcgarry#define	RD9134DID	0x221	/* also 9122S */
681.1Sgmcgarry#define	RD9134LID	0x222	/* also 9122D */
691.1Sgmcgarry#define	RD7912PID	0x209
701.1Sgmcgarry#define RD7914CTID	0x20A
711.1Sgmcgarry#define	RD7914PID	0x20B
721.1Sgmcgarry#define	RD7958AID	0x22B
731.1Sgmcgarry#define RD7957AID	0x22A
741.1Sgmcgarry#define	RD7933HID	0x212
751.1Sgmcgarry#define	RD7936HID	0x213	/* just guessing -- as of yet unknown */
761.1Sgmcgarry#define	RD7937HID	0x214
771.1Sgmcgarry#define RD7957BID	0x22C	/* another guess based on 7958B */
781.1Sgmcgarry#define RD7958BID	0x22D
791.1Sgmcgarry#define RD7959BID	0x22E	/* another guess based on 7958B */
801.1Sgmcgarry#define RD2200AID	0x22F
811.1Sgmcgarry#define RD2203AID	0x230	/* yet another guess */
821.1Sgmcgarry
831.1Sgmcgarry/* SW ids -- indicies into rdidentinfo, order is arbitrary */
841.1Sgmcgarry#define	RD7945A		0
851.1Sgmcgarry#define	RD9134D		1
861.1Sgmcgarry#define	RD9122S		2
871.1Sgmcgarry#define	RD7912P		3
881.1Sgmcgarry#define	RD7914P		4
891.1Sgmcgarry#define	RD7958A		5
901.1Sgmcgarry#define RD7957A		6
911.1Sgmcgarry#define	RD7933H		7
921.1Sgmcgarry#define	RD9134L		8
931.1Sgmcgarry#define	RD7936H		9
941.1Sgmcgarry#define	RD7937H		10
951.1Sgmcgarry#define RD7914CT	11
961.1Sgmcgarry#define RD7946A		12
971.1Sgmcgarry#define RD9122D		13
981.1Sgmcgarry#define RD7957B		14
991.1Sgmcgarry#define RD7958B		15
1001.1Sgmcgarry#define RD7959B		16
1011.1Sgmcgarry
1021.1Sgmcgarry#define	NRD7945ABPT	16
1031.1Sgmcgarry#define	NRD7945ATRK	7
1041.1Sgmcgarry#define	NRD9134DBPT	16
1051.1Sgmcgarry#define	NRD9134DTRK	6
1061.1Sgmcgarry#define	NRD9122SBPT	8
1071.1Sgmcgarry#define	NRD9122STRK	2
1081.1Sgmcgarry#define	NRD7912PBPT	32
1091.1Sgmcgarry#define	NRD7912PTRK	7
1101.1Sgmcgarry#define	NRD7914PBPT	32
1111.1Sgmcgarry#define	NRD7914PTRK	7
1121.1Sgmcgarry#define	NRD7933HBPT	46
1131.1Sgmcgarry#define	NRD7933HTRK	13
1141.1Sgmcgarry#define	NRD9134LBPT	16
1151.1Sgmcgarry#define	NRD9134LTRK	5
1161.1Sgmcgarry
1171.1Sgmcgarry/*
1181.1Sgmcgarry * Several HP drives have an odd number of 256 byte sectors per track.
1191.1Sgmcgarry * This makes it rather difficult to break them into 512 and 1024 byte blocks.
1201.1Sgmcgarry * So...we just do like HPUX and don't bother to respect hardware track/head
1211.1Sgmcgarry * boundries -- we just mold the disk so that we use the entire capacity.
1221.1Sgmcgarry * HPUX also sometimes doesn't abide by cylinder boundries, we attempt to
1231.1Sgmcgarry * whenever possible.
1241.1Sgmcgarry *
1251.1Sgmcgarry * DISK		REAL (256 BPS)		HPUX (1024 BPS)		BSD (512 BPS)
1261.1Sgmcgarry * 		SPT x HD x CYL		SPT x HD x CYL		SPT x HD x CYL
1271.1Sgmcgarry * -----	---------------		---------------		--------------
1281.1Sgmcgarry * 7936:	123 x  7 x 1396		 25 x  7 x 1716		123 x  7 x  698
1291.1Sgmcgarry * 7937:	123 x 13 x 1396		 25 x 16 x 1395		123 x 13 x  698
1301.1Sgmcgarry *
1311.1Sgmcgarry * 7957A:	 63 x  5 x 1013		 11 x  7 x 1036		 22 x  7 x 1036
1321.1Sgmcgarry * 7958A:	 63 x  8 x 1013		 21 x  6 x 1013		 36 x  7 x 1013
1331.1Sgmcgarry *
1341.1Sgmcgarry * 7957B:	 63 x  4 x 1269		  9 x  7 x 1269		 18 x  7 x 1269
1351.1Sgmcgarry * 7958B:	 63 x  6 x 1572		 21 x  9 x  786		 42 x  9 x  786
1361.1Sgmcgarry * 7959B:	 63 x 12 x 1572		 21 x  9 x 1572		 42 x  9 x 1572
1371.1Sgmcgarry *
1381.1Sgmcgarry * 2200A:	113 x  8 x 1449		113 x  2 x 1449		113 x  4 x 1449
1391.1Sgmcgarry * 2203A:	113 x 16 x 1449		113 x  4 x 1449		113 x  8 x 1449
1401.1Sgmcgarry */
1411.1Sgmcgarry#define	NRD7936HBPT	123
1421.1Sgmcgarry#define	NRD7936HTRK	7
1431.1Sgmcgarry#define	NRD7937HBPT	123
1441.1Sgmcgarry#define	NRD7937HTRK	13
1451.1Sgmcgarry#define	NRD7957ABPT	22
1461.1Sgmcgarry#define	NRD7957ATRK	7
1471.1Sgmcgarry#define	NRD7958ABPT	36
1481.1Sgmcgarry#define	NRD7958ATRK	7
1491.1Sgmcgarry#define	NRD7957BBPT	18
1501.1Sgmcgarry#define	NRD7957BTRK	7
1511.1Sgmcgarry#define	NRD7958BBPT	42
1521.1Sgmcgarry#define	NRD7958BTRK	9
1531.1Sgmcgarry#define	NRD7959BBPT	42
1541.1Sgmcgarry#define	NRD7959BTRK	9
1551.1Sgmcgarry#define	NRD2200ABPT	113
1561.1Sgmcgarry#define	NRD2200ATRK	4
1571.1Sgmcgarry#define	NRD2203ABPT	113
1581.1Sgmcgarry#define	NRD2203ATRK	8
1591.1Sgmcgarry
1601.1Sgmcgarry/* convert 512 byte count into DEV_BSIZE count */
1611.1Sgmcgarry#define RDSZ(x)		((x) >> (DEV_BSHIFT-9))
1621.1Sgmcgarry
1631.1Sgmcgarry/* convert block number into sector number and back */
1641.1Sgmcgarry#define	RDBTOS(x)	((x) << (DEV_BSHIFT-8))
1651.1Sgmcgarry#define RDSTOB(x)	((x) >> (DEV_BSHIFT-8))
1661.1Sgmcgarry
1671.1Sgmcgarry/* extract cyl/head/sect info from three-vector address */
1681.1Sgmcgarry#define RDCYL(tva)	((u_int32_t)(tva).cu_cyhd >> 8)
1691.1Sgmcgarry#define RDHEAD(tva)	((tva).cu_cyhd & 0xFF)
1701.1Sgmcgarry#define RDSECT(tva)	((tva).cu_sect)
171