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