Home | History | Annotate | Line # | Download | only in ibus
siivar.h revision 1.1.28.1
      1  1.1.28.1  rpaulo /*	$NetBSD: siivar.h,v 1.1.28.1 2006/09/09 02:42:22 rpaulo Exp $	*/
      2  1.1.28.1  rpaulo 
      3  1.1.28.1  rpaulo #ifndef _SIIVAR_H
      4  1.1.28.1  rpaulo #define _SIIVAR_H
      5  1.1.28.1  rpaulo 
      6  1.1.28.1  rpaulo /*
      7  1.1.28.1  rpaulo  * This structure contains information that a SCSI interface controller
      8  1.1.28.1  rpaulo  * needs to execute a SCSI command.
      9  1.1.28.1  rpaulo  */
     10  1.1.28.1  rpaulo typedef struct ScsiCmd {
     11  1.1.28.1  rpaulo 	int	unit;		/* unit number passed to device done routine */
     12  1.1.28.1  rpaulo 	int	flags;		/* control flags for this command (see below) */
     13  1.1.28.1  rpaulo 	int	buflen;		/* length of the data buffer in bytes */
     14  1.1.28.1  rpaulo 	char	*buf;		/* pointer to data buffer for this command */
     15  1.1.28.1  rpaulo 	int	cmdlen;		/* length of data in cmdbuf */
     16  1.1.28.1  rpaulo 	u_char	*cmd;		/* buffer for the SCSI command */
     17  1.1.28.1  rpaulo 	int	error;		/* compatibility hack for new scsi */
     18  1.1.28.1  rpaulo 	int	lun;		/* LUN for MI SCSI */
     19  1.1.28.1  rpaulo 	struct callout timo_ch;	/* timeout callout handle */
     20  1.1.28.1  rpaulo } ScsiCmd;
     21  1.1.28.1  rpaulo 
     22  1.1.28.1  rpaulo typedef struct scsi_state {
     23  1.1.28.1  rpaulo 	int	statusByte;	/* status byte returned during STATUS_PHASE */
     24  1.1.28.1  rpaulo 	int	dmaDataPhase;	/* which data phase to expect */
     25  1.1.28.1  rpaulo 	int	dmaCurPhase;	/* SCSI phase if DMA is in progress */
     26  1.1.28.1  rpaulo 	int	dmaPrevPhase;	/* SCSI phase of DMA suspended by disconnect */
     27  1.1.28.1  rpaulo 	u_short	*dmaAddr[2];	/* DMA buffer memory address */
     28  1.1.28.1  rpaulo 	int	dmaBufIndex;	/* which of the above is currently in use */
     29  1.1.28.1  rpaulo 	int	dmalen;		/* amount to transfer in this chunk */
     30  1.1.28.1  rpaulo 	int	cmdlen;		/* total remaining amount of cmd to transfer */
     31  1.1.28.1  rpaulo 	u_char	*cmd;		/* current pointer within scsicmd->cmd */
     32  1.1.28.1  rpaulo 	int	buflen;		/* total remaining amount of data to transfer */
     33  1.1.28.1  rpaulo 	char	*buf;		/* current pointer within scsicmd->buf */
     34  1.1.28.1  rpaulo 	u_short	flags;		/* see below */
     35  1.1.28.1  rpaulo 	u_short	prevComm;	/* command reg before disconnect */
     36  1.1.28.1  rpaulo 	u_short	dmaCtrl;	/* DMA control register if disconnect */
     37  1.1.28.1  rpaulo 	u_short	dmaAddrL;	/* DMA address register if disconnect */
     38  1.1.28.1  rpaulo 	u_short	dmaAddrH;	/* DMA address register if disconnect */
     39  1.1.28.1  rpaulo 	u_short	dmaCnt;		/* DMA count if disconnect */
     40  1.1.28.1  rpaulo 	u_short	dmaByte;	/* DMA byte if disconnect on odd boundary */
     41  1.1.28.1  rpaulo 	u_short	dmaReqAck;	/* DMA synchronous xfer offset or 0 if async */
     42  1.1.28.1  rpaulo } State;
     43  1.1.28.1  rpaulo 
     44  1.1.28.1  rpaulo /* state flags */
     45  1.1.28.1  rpaulo #define FIRST_DMA	0x01	/* true if no data DMA started yet */
     46  1.1.28.1  rpaulo #define PARITY_ERR	0x02	/* true if parity error seen */
     47  1.1.28.1  rpaulo 
     48  1.1.28.1  rpaulo #define SII_NCMD	8
     49  1.1.28.1  rpaulo struct siisoftc {
     50  1.1.28.1  rpaulo 	struct device sc_dev;		/* us as a device */
     51  1.1.28.1  rpaulo 	struct scsipi_channel sc_channel;
     52  1.1.28.1  rpaulo 	struct scsipi_adapter sc_adapter;	/* scsipi adapter glue */
     53  1.1.28.1  rpaulo 	ScsiCmd sc_cmd_fake[SII_NCMD];		/* XXX - hack!!! */
     54  1.1.28.1  rpaulo 	struct scsipi_xfer *sc_xs[SII_NCMD];	/* XXX - hack!!! */
     55  1.1.28.1  rpaulo 	void *sc_buf;			/* DMA buffer (may be special mem) */
     56  1.1.28.1  rpaulo 	SIIRegs	*sc_regs;		/* HW address of SII controller chip */
     57  1.1.28.1  rpaulo 	int	sc_flags;
     58  1.1.28.1  rpaulo 	int	sc_target;		/* target SCSI ID if connected */
     59  1.1.28.1  rpaulo 	ScsiCmd	*sc_cmd[SII_NCMD];	/* active command indexed by ID */
     60  1.1.28.1  rpaulo  	void  (*sii_copytobuf) __P((u_short *src, volatile u_short *dst, int ln));
     61  1.1.28.1  rpaulo 	void (*sii_copyfrombuf) __P((volatile u_short *src, char *dst, int len));
     62  1.1.28.1  rpaulo 
     63  1.1.28.1  rpaulo 	State	sc_st[SII_NCMD];	/* state info for each active command */
     64  1.1.28.1  rpaulo };
     65  1.1.28.1  rpaulo 
     66  1.1.28.1  rpaulo int	siiintr __P((void *sc));
     67  1.1.28.1  rpaulo 
     68  1.1.28.1  rpaulo /* Machine-indepedent back-end attach entry point */
     69  1.1.28.1  rpaulo 
     70  1.1.28.1  rpaulo void	sii_scsi_request __P((struct scsipi_channel *,
     71  1.1.28.1  rpaulo 				scsipi_adapter_req_t, void *));
     72  1.1.28.1  rpaulo void	siiattach __P((struct siisoftc *));
     73  1.1.28.1  rpaulo 
     74  1.1.28.1  rpaulo #endif	/* _SIIVAR_H */
     75