Home | History | Annotate | Line # | Download | only in dev
siopvar.h revision 1.3
      1 /*
      2  * Copyright (c) 1990 The Regents of the University of California.
      3  * All rights reserved.
      4  *
      5  * This code is derived from software contributed to Berkeley by
      6  * Van Jacobson of Lawrence Berkeley Laboratory.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by the University of
     19  *	California, Berkeley and its contributors.
     20  * 4. Neither the name of the University nor the names of its contributors
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  *	@(#)siopvar.h	7.1 (Berkeley) 5/8/90
     37  *	$Id: siopvar.h,v 1.3 1994/05/12 05:57:25 chopps Exp $
     38  */
     39 #ifndef _SIOPVAR_H_
     40 #define _SIOPVAR_H_
     41 
     42 /*
     43  * The largest single request will be MAXPHYS bytes which will require
     44  * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
     45  * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
     46  * buffer is not page aligned (+1).
     47  */
     48 #define	DMAMAXIO	(MAXPHYS/NBPG+1)
     49 
     50 struct	siop_pending {
     51 	TAILQ_ENTRY(siop_pending) link;
     52 	struct scsi_xfer *xs;
     53 };
     54 
     55 struct siop_ds {			/* Data Structure for SCRIPTS */
     56 	long	scsi_addr;		/* SCSI ID & sync */
     57 	long	idlen;			/* Identify message */
     58 	char	*idbuf;
     59 	long	cmdlen;			/* SCSI command */
     60 	char	*cmdbuf;
     61 	long	stslen;			/* Status */
     62 	char	*stsbuf;
     63 	long	msglen;			/* Message */
     64 	char	*msgbuf;
     65 	long	sdtrolen;		/* Sync Data Transfer Request out */
     66 	char	*sdtrobuf;
     67 	long	sdtrilen;		/* Sync Data Transfer Request in */
     68 	char	*sdtribuf;
     69 	struct {
     70 		long datalen;
     71 		char *databuf;
     72 	} chain[DMAMAXIO];
     73 };
     74 
     75 struct	siop_softc {
     76 	struct	device sc_dev;
     77 
     78 	/* should have one for each target? */
     79 	u_char	sc_istat;
     80 	u_char	sc_dstat;
     81 	u_char	sc_sstat0;
     82 	u_char	sc_sstat1;
     83 	struct siop_ds sc_ds;
     84 	struct	scsi_link sc_link;	/* proto for sub devices */
     85 	siop_regmap_p	sc_siopp;	/* the SIOP */
     86 	volatile void 	*sc_cregs;	/* driver specific regs */
     87 	TAILQ_HEAD(,siop_pending) sc_xslist;	/* LIFO */
     88 	struct	siop_pending sc_xsstore[8][8];	/* one for every unit */
     89 	struct	scsi_xfer *sc_xs;	/* transfer from high level code */
     90 	u_char	sc_flags;
     91 	u_char	sc_lun;
     92 	u_long	sc_clock_freq;
     93 	/* one for each target */
     94 	struct syncpar {
     95 	  u_char state;
     96 	  u_char period, offset;
     97 	} sc_sync[8];
     98 	u_char	sc_slave;
     99 	u_char	sc_scsi_addr;
    100 	u_char	sc_stat[2];
    101 	u_char	sc_msg[8];
    102 };
    103 
    104 /* sc_flags */
    105 #define	SIOP_DMA	0x80	/* DMA I/O in progress */
    106 #define	SIOP_ALIVE	0x01	/* controller initialized */
    107 #define SIOP_SELECTED	0x04	/* bus is in selected state. Needed for
    108 				   correct abort procedure. */
    109 
    110 /* sync states */
    111 #define SYNC_START	0	/* no sync handshake started */
    112 #define SYNC_SENT	1	/* we sent sync request, no answer yet */
    113 #define SYNC_DONE	2	/* target accepted our (or inferior) settings,
    114 				   or it rejected the request and we stay async */
    115 
    116 #define	MSG_CMD_COMPLETE	0x00
    117 #define MSG_EXT_MESSAGE		0x01
    118 #define	MSG_SAVE_DATA_PTR	0x02
    119 #define	MSG_RESTORE_PTR		0x03
    120 #define	MSG_DISCONNECT		0x04
    121 #define	MSG_INIT_DETECT_ERROR	0x05
    122 #define	MSG_ABORT		0x06
    123 #define	MSG_REJECT		0x07
    124 #define	MSG_NOOP		0x08
    125 #define	MSG_PARITY_ERROR	0x09
    126 #define	MSG_BUS_DEVICE_RESET	0x0C
    127 #define	MSG_IDENTIFY		0x80
    128 #define	MSG_IDENTIFY_DR		0xc0	/* (disconnect/reconnect allowed) */
    129 #define	MSG_SYNC_REQ 		0x01
    130 
    131 #define	STS_CHECKCOND	0x02	/* Check Condition (ie., read sense) */
    132 #define	STS_CONDMET	0x04	/* Condition Met (ie., search worked) */
    133 #define	STS_BUSY	0x08
    134 #define	STS_INTERMED	0x10	/* Intermediate status sent */
    135 #define	STS_EXT		0x80	/* Extended status valid */
    136 
    137 void siop_minphys __P((struct buf *bp));
    138 u_int siop_adinfo __P((void));
    139 int siop_scsicmd __P((struct scsi_xfer *));
    140 
    141 #endif /* _SIOPVAR_H */
    142