Home | History | Annotate | Line # | Download | only in dev
rdvar.h revision 1.12
      1 /*	$NetBSD: rdvar.h,v 1.12 2003/08/07 16:27:34 agc Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1982, 1990, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * This code is derived from software contributed to Berkeley by
      8  * the Systems Programming Group of the University of Utah Computer
      9  * Science Department.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  * 3. Neither the name of the University nor the names of its contributors
     20  *    may be used to endorse or promote products derived from this software
     21  *    without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  *
     35  * from: Utah $Hdr: rdvar.h 1.1 92/12/21$
     36  *
     37  *	@(#)rdvar.h	8.1 (Berkeley) 6/10/93
     38  */
     39 /*
     40  * Copyright (c) 1988 University of Utah.
     41  *
     42  * This code is derived from software contributed to Berkeley by
     43  * the Systems Programming Group of the University of Utah Computer
     44  * Science Department.
     45  *
     46  * Redistribution and use in source and binary forms, with or without
     47  * modification, are permitted provided that the following conditions
     48  * are met:
     49  * 1. Redistributions of source code must retain the above copyright
     50  *    notice, this list of conditions and the following disclaimer.
     51  * 2. Redistributions in binary form must reproduce the above copyright
     52  *    notice, this list of conditions and the following disclaimer in the
     53  *    documentation and/or other materials provided with the distribution.
     54  * 3. All advertising materials mentioning features or use of this software
     55  *    must display the following acknowledgement:
     56  *	This product includes software developed by the University of
     57  *	California, Berkeley and its contributors.
     58  * 4. Neither the name of the University nor the names of its contributors
     59  *    may be used to endorse or promote products derived from this software
     60  *    without specific prior written permission.
     61  *
     62  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     63  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     66  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72  * SUCH DAMAGE.
     73  *
     74  * from: Utah $Hdr: rdvar.h 1.1 92/12/21$
     75  *
     76  *	@(#)rdvar.h	8.1 (Berkeley) 6/10/93
     77  */
     78 
     79 #include <sys/callout.h>
     80 
     81 struct	rdidentinfo {
     82 	short	ri_hwid;		/* 2 byte HW id */
     83 	short	ri_maxunum;		/* maximum allowed unit number */
     84 	char	*ri_desc;		/* drive type description */
     85 	int	ri_nbpt;		/* DEV_BSIZE blocks per track */
     86 	int	ri_ntpc;		/* tracks per cylinder */
     87 	int	ri_ncyl;		/* cylinders per unit */
     88 	int	ri_nblocks;		/* DEV_BSIZE blocks on disk */
     89 };
     90 
     91 struct rdstats {
     92 	long	rdretries;
     93 	long	rdresets;
     94 	long	rdtimeouts;
     95 	long	rdpolltries;
     96 	long	rdpollwaits;
     97 };
     98 
     99 struct	rd_softc {
    100 	struct	device sc_dev;
    101 	struct	disk sc_dkdev;
    102 	struct	callout sc_restart_ch;
    103 	int	sc_slave;		/* HP-IB slave */
    104 	int	sc_punit;		/* physical unit on slave */
    105 	int	sc_flags;
    106 	short	sc_type;
    107 	char	*sc_addr;
    108 	int	sc_resid;
    109 	struct	rd_describe sc_rddesc;
    110 	struct	hpibqueue sc_hq;	/* hpib job queue entry */
    111 	struct	rd_iocmd sc_ioc;
    112 	struct	rd_rscmd sc_rsc;
    113 	struct	rd_stat sc_stat;
    114 	struct	rd_ssmcmd sc_ssmc;
    115 	struct	rd_srcmd sc_src;
    116 	struct	rd_clearcmd sc_clear;
    117 	struct	bufq_state sc_tab;
    118 	int	sc_active;
    119 	int	sc_errcnt;
    120 	struct	rdstats sc_stats;
    121 #if NRND > 0
    122 	rndsource_element_t rnd_source;
    123 #endif
    124 };
    125 
    126 /* sc_flags values */
    127 #define	RDF_ALIVE	0x01
    128 #define	RDF_SEEK	0x02
    129 #define RDF_SWAIT	0x04
    130 #define RDF_OPENING	0x08
    131 #define RDF_CLOSING	0x10
    132 #define RDF_WANTED	0x20
    133 #define RDF_WLABEL	0x40
    134 
    135 #define	rdunit(x)	(minor(x) >> 3)
    136 #define rdpart(x)	(minor(x) & 0x7)
    137 #define	rdpunit(x)	((x) & 7)
    138 #define rdlabdev(d)	(dev_t)(((int)(d)&~7)|2)	/* rd?c */
    139 
    140 #define	RDRETRY		5
    141 #define RDWAITC		1	/* min time for timeout in seconds */
    142 
    143 #ifdef _KERNEL
    144 extern	struct rdidentinfo rdidentinfo[];
    145 
    146 /* rd_subr.c */
    147 void	rdmakedisklabel __P((int, struct disklabel *));
    148 #endif
    149