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