Home | History | Annotate | Line # | Download | only in dev
scivar.h revision 1.12
      1  1.12  thorpej /*	$NetBSD: scivar.h,v 1.12 1998/11/19 21:44:37 thorpej Exp $	*/
      2   1.4      cgd 
      3   1.1   chopps /*
      4   1.1   chopps  * Copyright (c) 1990 The Regents of the University of California.
      5   1.1   chopps  * All rights reserved.
      6   1.1   chopps  *
      7   1.1   chopps  * This code is derived from software contributed to Berkeley by
      8   1.1   chopps  * Van Jacobson of Lawrence Berkeley Laboratory.
      9   1.1   chopps  *
     10   1.1   chopps  * Redistribution and use in source and binary forms, with or without
     11   1.1   chopps  * modification, are permitted provided that the following conditions
     12   1.1   chopps  * are met:
     13   1.1   chopps  * 1. Redistributions of source code must retain the above copyright
     14   1.1   chopps  *    notice, this list of conditions and the following disclaimer.
     15   1.1   chopps  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1   chopps  *    notice, this list of conditions and the following disclaimer in the
     17   1.1   chopps  *    documentation and/or other materials provided with the distribution.
     18   1.1   chopps  * 3. All advertising materials mentioning features or use of this software
     19   1.1   chopps  *    must display the following acknowledgement:
     20   1.1   chopps  *	This product includes software developed by the University of
     21   1.1   chopps  *	California, Berkeley and its contributors.
     22   1.1   chopps  * 4. Neither the name of the University nor the names of its contributors
     23   1.1   chopps  *    may be used to endorse or promote products derived from this software
     24   1.1   chopps  *    without specific prior written permission.
     25   1.1   chopps  *
     26   1.1   chopps  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27   1.1   chopps  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28   1.1   chopps  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29   1.1   chopps  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30   1.1   chopps  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31   1.1   chopps  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32   1.1   chopps  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33   1.1   chopps  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34   1.1   chopps  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35   1.1   chopps  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36   1.1   chopps  * SUCH DAMAGE.
     37   1.1   chopps  *
     38   1.1   chopps  *	@(#)scivar.h	7.1 (Berkeley) 5/8/90
     39   1.1   chopps  */
     40   1.3   chopps #ifndef _SCIVAR_H_
     41   1.3   chopps #define _SCIVAR_H_
     42   1.3   chopps 
     43   1.3   chopps struct	sci_pending {
     44   1.3   chopps 	TAILQ_ENTRY(sci_pending) link;
     45  1.11   bouyer 	struct scsipi_xfer *xs;
     46   1.3   chopps };
     47   1.3   chopps 
     48   1.9    veego struct sci_softc;
     49   1.1   chopps 
     50   1.1   chopps struct	sci_softc {
     51   1.3   chopps 	struct	device sc_dev;
     52   1.6   chopps 	struct	isr sc_isr;
     53  1.11   bouyer 	struct	scsipi_link sc_link;	/* proto for sub devices */
     54  1.12  thorpej 	struct	scsipi_adapter sc_adapter;
     55   1.3   chopps 	TAILQ_HEAD(,sci_pending) sc_xslist;
     56   1.3   chopps 	struct	sci_pending sc_xsstore[8][8];
     57  1.11   bouyer 	struct	scsipi_xfer *sc_xs;	/* transfer from high level code */
     58   1.1   chopps 
     59   1.2   chopps 	volatile u_char	*sci_data;	/* r: Current data */
     60   1.2   chopps 	volatile u_char	*sci_odata;	/* w: Out data */
     61   1.2   chopps 	volatile u_char	*sci_icmd;	/* rw: Initiator command */
     62   1.2   chopps 	volatile u_char	*sci_mode;	/* rw: Mode */
     63   1.2   chopps 	volatile u_char	*sci_tcmd;	/* rw: Target command */
     64   1.2   chopps 	volatile u_char	*sci_bus_csr;	/* r: Bus Status */
     65   1.2   chopps 	volatile u_char	*sci_sel_enb;	/* w: Select enable */
     66   1.2   chopps 	volatile u_char	*sci_csr;	/* r: Status */
     67   1.2   chopps 	volatile u_char	*sci_dma_send;	/* w: Start dma send data */
     68   1.2   chopps 	volatile u_char	*sci_idata;	/* r: Input data */
     69   1.2   chopps 	volatile u_char	*sci_trecv;	/* w: Start dma receive, target */
     70   1.2   chopps 	volatile u_char	*sci_iack;	/* r: Interrupt Acknowledge */
     71   1.2   chopps 	volatile u_char	*sci_irecv;	/* w: Start dma receive, initiator */
     72   1.1   chopps 
     73   1.9    veego 	/* psuedo DMA transfer */
     74  1.10   mhitch 	int	(*dma_xfer_in) __P((struct sci_softc *, int, u_char *, int));
     75   1.9    veego 	/* psuedo DMA transfer */
     76  1.10   mhitch 	int	(*dma_xfer_out) __P((struct sci_softc *, int, u_char *, int));
     77   1.1   chopps 	u_char	sc_flags;
     78   1.1   chopps 	u_char	sc_lun;
     79   1.1   chopps 	/* one for each target */
     80   1.1   chopps 	struct syncpar {
     81   1.1   chopps 	  u_char state;
     82   1.1   chopps 	  u_char period, offset;
     83   1.1   chopps 	} sc_sync[8];
     84   1.1   chopps 	u_char	sc_slave;
     85   1.1   chopps 	u_char	sc_scsi_addr;
     86   1.1   chopps 	u_char	sc_stat[2];
     87   1.1   chopps 	u_char	sc_msg[8];
     88   1.1   chopps };
     89   1.1   chopps 
     90   1.1   chopps /* sc_flags */
     91   1.1   chopps #define	SCI_IO		0x80	/* DMA I/O in progress */
     92   1.1   chopps #define	SCI_ALIVE	0x01	/* controller initialized */
     93   1.1   chopps #define SCI_SELECTED	0x04	/* bus is in selected state. Needed for
     94   1.1   chopps 				   correct abort procedure. */
     95   1.1   chopps 
     96   1.1   chopps /* sync states */
     97   1.1   chopps #define SYNC_START	0	/* no sync handshake started */
     98   1.1   chopps #define SYNC_SENT	1	/* we sent sync request, no answer yet */
     99   1.1   chopps #define SYNC_DONE	2	/* target accepted our (or inferior) settings,
    100   1.9    veego 				   or it rejected the request and we stay async */
    101   1.3   chopps 
    102   1.3   chopps #define	PHASE		0x07		/* mask for psns/pctl phase */
    103   1.3   chopps #define	DATA_OUT_PHASE	0x00
    104   1.3   chopps #define	DATA_IN_PHASE	0x01
    105   1.3   chopps #define	CMD_PHASE	0x02
    106   1.3   chopps #define	STATUS_PHASE	0x03
    107   1.3   chopps #define	BUS_FREE_PHASE	0x04
    108   1.3   chopps #define	ARB_SEL_PHASE	0x05	/* Fuji chip combines arbitration with sel. */
    109   1.3   chopps #define	MESG_OUT_PHASE	0x06
    110   1.3   chopps #define	MESG_IN_PHASE	0x07
    111   1.3   chopps 
    112   1.3   chopps #define	MSG_CMD_COMPLETE	0x00
    113   1.3   chopps #define MSG_EXT_MESSAGE		0x01
    114   1.3   chopps #define	MSG_SAVE_DATA_PTR	0x02
    115   1.3   chopps #define	MSG_RESTORE_PTR		0x03
    116   1.3   chopps #define	MSG_DISCONNECT		0x04
    117   1.3   chopps #define	MSG_INIT_DETECT_ERROR	0x05
    118   1.3   chopps #define	MSG_ABORT		0x06
    119   1.3   chopps #define	MSG_REJECT		0x07
    120   1.3   chopps #define	MSG_NOOP		0x08
    121   1.3   chopps #define	MSG_PARITY_ERROR	0x09
    122   1.3   chopps #define	MSG_BUS_DEVICE_RESET	0x0C
    123   1.3   chopps #define	MSG_IDENTIFY		0x80
    124   1.3   chopps #define	MSG_IDENTIFY_DR		0xc0	/* (disconnect/reconnect allowed) */
    125   1.3   chopps #define	MSG_SYNC_REQ 		0x01
    126   1.3   chopps 
    127   1.3   chopps 
    128   1.3   chopps #define	STS_CHECKCOND	0x02	/* Check Condition (ie., read sense) */
    129   1.3   chopps #define	STS_CONDMET	0x04	/* Condition Met (ie., search worked) */
    130   1.3   chopps #define	STS_BUSY	0x08
    131   1.3   chopps #define	STS_INTERMED	0x10	/* Intermediate status sent */
    132   1.3   chopps #define	STS_EXT		0x80	/* Extended status valid */
    133   1.3   chopps 
    134   1.3   chopps /*
    135   1.8  mycroft  * XXXX
    136   1.3   chopps  */
    137   1.3   chopps struct scsi_fmt_cdb {
    138   1.3   chopps 	int len;		/* cdb length (in bytes) */
    139   1.3   chopps 	u_char cdb[28];		/* cdb to use on next read/write */
    140   1.3   chopps };
    141   1.3   chopps 
    142   1.3   chopps struct buf;
    143  1.11   bouyer struct scsipi_xfer;
    144   1.3   chopps 
    145   1.9    veego void sci_minphys __P((struct buf *));
    146  1.11   bouyer int sci_scsicmd __P((struct scsipi_xfer *));
    147   1.9    veego void scireset __P((struct sci_softc *));
    148   1.3   chopps 
    149   1.3   chopps #endif /* _SCIVAR_H_ */
    150