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