Home | History | Annotate | Line # | Download | only in mba
mbavar.h revision 1.6
      1  1.6     matt /*	$NetBSD: mbavar.h,v 1.6 2000/06/04 06:16:55 matt Exp $ */
      2  1.1    ragge /*
      3  1.1    ragge  * Copyright (c) 1994 Ludd, University of Lule}, Sweden
      4  1.1    ragge  * All rights reserved.
      5  1.1    ragge  *
      6  1.1    ragge  * Redistribution and use in source and binary forms, with or without
      7  1.1    ragge  * modification, are permitted provided that the following conditions
      8  1.1    ragge  * are met:
      9  1.1    ragge  * 1. Redistributions of source code must retain the above copyright
     10  1.1    ragge  *    notice, this list of conditions and the following disclaimer.
     11  1.1    ragge  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1    ragge  *    notice, this list of conditions and the following disclaimer in the
     13  1.1    ragge  *    documentation and/or other materials provided with the distribution.
     14  1.1    ragge  * 3. All advertising materials mentioning features or use of this software
     15  1.1    ragge  *    must display the following acknowledgement:
     16  1.1    ragge  *      This product includes software developed at Ludd, University of Lule}.
     17  1.1    ragge  * 4. The name of the author may not be used to endorse or promote products
     18  1.1    ragge  *    derived from this software without specific prior written permission
     19  1.1    ragge  *
     20  1.1    ragge  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.1    ragge  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.1    ragge  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.1    ragge  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.1    ragge  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.1    ragge  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.1    ragge  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.1    ragge  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.1    ragge  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.1    ragge  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.1    ragge  */
     31  1.1    ragge 
     32  1.2    ragge #include <sys/device.h>
     33  1.6     matt #include <machine/scb.h>
     34  1.1    ragge 
     35  1.1    ragge #define MBCR_INIT	1
     36  1.1    ragge #define	MBCR_IE		(1<<2)
     37  1.1    ragge #define	MBDS_DPR	(1<<8)
     38  1.1    ragge #define	MBSR_NED	(1<<18)
     39  1.1    ragge #define	MBDT_MOH	(1<<13)
     40  1.1    ragge #define	MBDT_TYPE	511
     41  1.1    ragge #define MBDT_TAP	(1<<14)
     42  1.1    ragge 
     43  1.1    ragge #define	CLOSED		0
     44  1.1    ragge #define	WANTOPEN	1
     45  1.1    ragge #define	RDLABEL		2
     46  1.1    ragge #define	OPEN		3
     47  1.1    ragge #define	OPENRAW		4
     48  1.1    ragge 
     49  1.2    ragge #define	MAXMBADEV	8	/* Max units per MBA */
     50  1.2    ragge 
     51  1.2    ragge /*
     52  1.2    ragge  * Devices that have different device drivers.
     53  1.2    ragge  */
     54  1.2    ragge enum	mb_devices {
     55  1.2    ragge 	MB_RP,	/* RM/RP disk */
     56  1.2    ragge 	MB_TU,	/* TM03 based tape, ex. TU45 or TU77 */
     57  1.2    ragge 	MB_MT	/* TU78 tape */
     58  1.1    ragge };
     59  1.2    ragge 
     60  1.2    ragge /*
     61  1.2    ragge  * Current state of the adapter.
     62  1.2    ragge  */
     63  1.2    ragge enum    sc_state {
     64  1.2    ragge 	SC_AUTOCONF,
     65  1.2    ragge 	SC_ACTIVE,
     66  1.2    ragge 	SC_IDLE
     67  1.2    ragge };
     68  1.2    ragge 
     69  1.2    ragge /*
     70  1.2    ragge  * Return value after a finished data transfer, from device driver.
     71  1.2    ragge  */
     72  1.2    ragge enum	xfer_action {
     73  1.2    ragge 	XFER_RESTART,
     74  1.2    ragge 	XFER_FINISH
     75  1.2    ragge };
     76  1.2    ragge 
     77  1.2    ragge /*
     78  1.2    ragge  * Info passed do unit device driver during autoconfig.
     79  1.2    ragge  */
     80  1.2    ragge struct	mba_attach_args {
     81  1.2    ragge 	int	unit;
     82  1.2    ragge         int	type;
     83  1.2    ragge 	char	*name;
     84  1.2    ragge 	enum	mb_devices devtyp;
     85  1.2    ragge };
     86  1.2    ragge 
     87  1.2    ragge /*
     88  1.2    ragge  * Common struct used to communicate between the mba device driver
     89  1.2    ragge  * and the unit device driver.
     90  1.2    ragge  */
     91  1.2    ragge struct	mba_device {
     92  1.2    ragge 	struct	mba_device *md_back;	/* linked list of runnable devices */
     93  1.2    ragge 	    /* Start routine to be called by mbastart. */
     94  1.2    ragge 	void	(*md_start) __P((struct mba_device *));
     95  1.2    ragge 	    /* Routine to be called after attn intr */
     96  1.2    ragge 	int	(*md_attn)__P((struct mba_device *));
     97  1.2    ragge 	    /* Call after xfer finish */
     98  1.2    ragge 	enum	xfer_action (*md_finish) __P((struct mba_device *, int, int *));
     99  1.2    ragge 	void	*md_softc;	/* Backpointer to this units softc. */
    100  1.2    ragge 	struct	mba_softc *md_mba;
    101  1.5  thorpej 	struct	buf_queue md_q;	/* queue of I/O requests */
    102  1.2    ragge };
    103  1.2    ragge 
    104  1.2    ragge struct	mba_softc {
    105  1.2    ragge 	struct  device sc_dev;
    106  1.6     matt 	struct	evcnt sc_intrcnt;
    107  1.3    ragge 	struct  ivec_dsp sc_dsp;	/* Interrupt catch routine */
    108  1.2    ragge 	struct  mba_regs *sc_mbareg;
    109  1.2    ragge 	struct	mba_device *sc_first, *sc_last;
    110  1.2    ragge 	enum    sc_state sc_state;
    111  1.3    ragge 	int	sc_physnr;		/* Physical number of this mba */
    112  1.2    ragge 	struct	mba_device *sc_md[MAXMBADEV];
    113  1.2    ragge };
    114  1.2    ragge 
    115  1.2    ragge struct  mbaunit {
    116  1.2    ragge 	int     nr;
    117  1.2    ragge 	char    *name;
    118  1.2    ragge 	enum	mb_devices devtyp;
    119  1.2    ragge };
    120  1.4    ragge 
    121  1.4    ragge /* Common prototypes */
    122  1.4    ragge void	mbaqueue __P((struct mba_device *));
    123  1.2    ragge 
    124