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