1 /* $NetBSD: siopvar.h,v 1.25 2005/12/11 12:16:28 christos Exp $ */
4 * Copyright (c) 1990 The Regents of the University of California.
7 * This code is derived from software contributed to Berkeley by
8 * Van Jacobson of Lawrence Berkeley Laboratory.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * @(#)siopvar.h 7.1 (Berkeley) 5/8/90
40 * The largest single request will be MAXPHYS bytes which will require
41 * at most MAXPHYS/PAGE_SIZE+1 chain elements to describe, i.e. if none of
42 * the buffer pages are physically contiguous (MAXPHYS/PAGE_SIZE) and the
43 * buffer is not page aligned (+1).
45 #define DMAMAXIO (MAXPHYS/PAGE_SIZE+1)
48 * Data Structure for SCRIPTS program
51 long scsi_addr
; /* SCSI ID & sync */
52 long idlen
; /* Identify message */
54 long cmdlen
; /* SCSI command */
56 long stslen
; /* Status */
58 long msglen
; /* Message */
60 long msginlen
; /* Message in */
62 long extmsglen
; /* Extended message in */
64 long synmsglen
; /* Sync transfer request */
73 * ACB. Holds additional information for each SCSI command Comments: We
74 * need a separate scsi command block because we may need to overwrite it
75 * with a request sense command. Basicly, we refrain from fiddling with
76 * the scsi_xfer struct (except do the expected updating of return values).
77 * We'll generally update: xs->{flags,resid,error,sense,status} and
78 * occasionally xs->retries.
81 TAILQ_ENTRY(siop_acb
) chain
;
82 struct scsipi_xfer
*xs
; /* SCSI xfer ctrl block from above */
83 int flags
; /* Status */
85 #define ACB_ACTIVE 0x01
87 struct scsipi_generic cmd
; /* SCSI command block */
91 u_long iob_len
, iob_curlen
;
98 char *daddr
; /* Saved data pointer */
99 int dleft
; /* Residue */
103 * Some info about each (possible) target on the SCSI bus. This should
104 * probably have been a "per target+lunit" structure, but we'll leave it at
105 * this for now. Is there a way to reliably hook it up to sc->fordriver??
108 int cmds
; /* #commands processed */
109 int dconns
; /* #disconnects */
110 int touts
; /* #timeouts */
111 int perrs
; /* #parity errors */
112 ushort lubusy
; /* What local units/subr. are busy? */
114 u_char period
; /* Period suggestion */
115 u_char offset
; /* Offset suggestion */
119 struct device sc_dev
;
133 struct scsipi_adapter sc_adapter
;
134 struct scsipi_channel sc_channel
;
135 u_long sc_scriptspa
; /* physical address of scripts */
136 siop_regmap_p sc_siopp
; /* the SIOP */
137 u_long sc_active
; /* number of active I/O's */
139 /* Lists of command blocks */
140 TAILQ_HEAD(acb_list
, siop_acb
) free_list
,
144 struct siop_acb
*sc_nexus
; /* current command */
146 struct siop_acb
*sc_acb
; /* the real command blocks */
148 struct siop_tinfo sc_tinfo
[8];
150 struct siop_tinfo sc_tinfo
[16];
153 u_short sc_clock_freq
;
165 /* one for each target */
178 #define SIOP_INTSOFF 0x80 /* Interrupts turned off */
179 #define SIOP_INTDEFER 0x40 /* Level 6 interrupt has been deferred */
180 #define SIOP_ALIVE 0x01 /* controller initialized */
181 #define SIOP_SELECTED 0x04 /* bus is in selected state. Needed for
182 correct abort procedure. */
184 /* negotiation states */
185 #define NEG_WIDE 0 /* Negotiate wide transfers */
186 #define NEG_WAITW 1 /* Waiting for wide negotation response */
187 #define NEG_SYNC 2 /* Negotiate synch transfers */
188 #define NEG_WAITS 3 /* Waiting for synch negoation response */
189 #define NEG_DONE 4 /* Wide and/or sync negotation done */
191 #define MSG_CMD_COMPLETE 0x00
192 #define MSG_EXT_MESSAGE 0x01
193 #define MSG_SAVE_DATA_PTR 0x02
194 #define MSG_RESTORE_PTR 0x03
195 #define MSG_DISCONNECT 0x04
196 #define MSG_INIT_DETECT_ERROR 0x05
197 #define MSG_ABORT 0x06
198 #define MSG_REJECT 0x07
199 #define MSG_NOOP 0x08
200 #define MSG_PARITY_ERROR 0x09
201 #define MSG_BUS_DEVICE_RESET 0x0C
202 #define MSG_IDENTIFY 0x80
203 #define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
204 #define MSG_SYNC_REQ 0x01
205 #define MSG_WIDE_REQ 0x03
207 #define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
208 #define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
209 #define STS_BUSY 0x08
210 #define STS_INTERMED 0x10 /* Intermediate status sent */
211 #define STS_EXT 0x80 /* Extended status valid */
214 void siopng_minphys(struct buf
*bp
);
215 void siopng_scsipi_request(struct scsipi_channel
*,
216 scsipi_adapter_req_t
, void *);
217 void siopnginitialize(struct siop_softc
*);
218 void siopngintr(struct siop_softc
*);
219 void siopng_dump_registers(struct siop_softc
*);
221 void siopng_dump(struct siop_softc
*);
226 void siop_minphys(struct buf
*bp
);
227 void siop_scsipi_request(struct scsipi_channel
*,
228 scsipi_adapter_req_t
, void *);
229 void siopinitialize(struct siop_softc
*);
230 void siopintr(struct siop_softc
*);
231 void siop_dump_registers(struct siop_softc
*);
233 void siop_dump(struct siop_softc
*);
237 #endif /* _SIOPVAR_H */