scsi.c revision 1.2.26.1 1 1.2.26.1 nathanw /* $NetBSD: scsi.c,v 1.2.26.1 2002/06/20 03:40:24 nathanw Exp $ */
2 1.1 dbj /*
3 1.1 dbj * Copyright (c) 1994, 1997 Rolf Grossmann
4 1.1 dbj * All rights reserved.
5 1.1 dbj *
6 1.1 dbj * Redistribution and use in source and binary forms, with or without
7 1.1 dbj * modification, are permitted provided that the following conditions
8 1.1 dbj * are met:
9 1.1 dbj * 1. Redistributions of source code must retain the above copyright
10 1.1 dbj * notice, this list of conditions and the following disclaimer.
11 1.1 dbj * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 dbj * notice, this list of conditions and the following disclaimer in the
13 1.1 dbj * documentation and/or other materials provided with the distribution.
14 1.1 dbj * 3. All advertising materials mentioning features or use of this software
15 1.1 dbj * must display the following acknowledgement:
16 1.1 dbj * This product includes software developed by Rolf Grossmann.
17 1.1 dbj * 4. The name of the author may not be used to endorse or promote products
18 1.1 dbj * derived from this software without specific prior written permission
19 1.1 dbj *
20 1.1 dbj * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 dbj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 dbj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 dbj * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 dbj * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 dbj * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 dbj * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 dbj * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 dbj * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 dbj * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 dbj */
31 1.1 dbj
32 1.1 dbj #include <sys/param.h>
33 1.1 dbj #include <next68k/dev/espreg.h>
34 1.2.26.1 nathanw #include <dev/ic/ncr53c9xreg.h>
35 1.1 dbj #include <dev/scsipi/scsi_message.h>
36 1.1 dbj #if 0
37 1.1 dbj #include <next/next/prominfo.h>
38 1.1 dbj #else
39 1.1 dbj #include <next68k/next68k/nextrom.h>
40 1.1 dbj #endif
41 1.1 dbj #include "scsireg.h"
42 1.1 dbj #include "dmareg.h"
43 1.1 dbj #include "scsivar.h"
44 1.1 dbj
45 1.1 dbj #include <lib/libsa/stand.h>
46 1.1 dbj
47 1.1 dbj struct scsi_softc scsi_softc, *sc = &scsi_softc;
48 1.1 dbj char the_dma_buffer[MAX_DMASIZE+DMA_ENDALIGNMENT], *dma_buffer;
49 1.1 dbj
50 1.1 dbj int scsi_msgin(void);
51 1.1 dbj int dma_start(char *addr, int len);
52 1.1 dbj int dma_done(void);
53 1.1 dbj
54 1.2 dbj void scsi_init(void);
55 1.2 dbj void scsierror(char *error);
56 1.2 dbj short scsi_getbyte(volatile caddr_t sr);
57 1.2 dbj int scsi_wait_for_intr(void);
58 1.2 dbj int scsiicmd(char target, char lun,
59 1.2 dbj u_char *cbuf, int clen, char *addr, int len);
60 1.2 dbj
61 1.1 dbj #ifdef SCSI_DEBUG
62 1.1 dbj #define DPRINTF(x) printf x;
63 1.1 dbj #else
64 1.1 dbj #define DPRINTF(x)
65 1.1 dbj #endif
66 1.1 dbj
67 1.1 dbj void
68 1.1 dbj scsi_init(void)
69 1.1 dbj {
70 1.1 dbj volatile caddr_t sr;
71 1.1 dbj struct dma_dev *dma;
72 1.1 dbj
73 1.1 dbj sr = P_SCSI;
74 1.1 dbj dma = (struct dma_dev *)P_SCSI_CSR;
75 1.1 dbj
76 1.1 dbj dma_buffer = DMA_ALIGN(char *, the_dma_buffer);
77 1.1 dbj
78 1.1 dbj P_FLOPPY[FLP_CTRL] &= ~FLC_82077_SEL; /* select SCSI chip */
79 1.1 dbj
80 1.1 dbj /* first reset dma */
81 1.1 dbj dma->dd_csr = DMACSR_RESET;
82 1.1 dbj DELAY(200);
83 1.1 dbj sr[ESP_DCTL] = ESPDCTL_20MHZ | ESPDCTL_INTENB | ESPDCTL_RESET;
84 1.1 dbj DELAY(10);
85 1.1 dbj sr[ESP_DCTL] = ESPDCTL_20MHZ | ESPDCTL_INTENB;
86 1.1 dbj DELAY(10);
87 1.1 dbj
88 1.1 dbj /* then reset the SCSI chip */
89 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_RSTCHIP;
90 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_NOP;
91 1.1 dbj DELAY(500);
92 1.1 dbj
93 1.1 dbj /* now reset the SCSI bus */
94 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_RSTSCSI;
95 1.1 dbj DELAY(18000000); /* XXX should be about 2-3 seconds at least */
96 1.1 dbj
97 1.1 dbj /* then reset the SCSI chip again and initialize it properly */
98 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_RSTCHIP;
99 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_NOP;
100 1.1 dbj DELAY(500);
101 1.2.26.1 nathanw sr[NCR_CFG1] = NCRCFG1_SLOW | NCRCFG1_BUSID;
102 1.2.26.1 nathanw sr[NCR_CFG2] = 0;
103 1.2.26.1 nathanw sr[NCR_CCF] = 4; /* S5RCLKCONV_FACTOR(20); */
104 1.2.26.1 nathanw sr[NCR_TIMEOUT] = 152; /* S5RSELECT_TIMEOUT(20,250); */
105 1.2.26.1 nathanw sr[NCR_SYNCOFF] = 0;
106 1.2.26.1 nathanw sr[NCR_SYNCTP] = 5;
107 1.1 dbj /*
108 1.1 dbj sc->sc_intrstatus = sr->s5r_intrstatus;
109 1.1 dbj sc->sc_intrstatus = sr->s5r_intrstatus;
110 1.1 dbj */
111 1.2.26.1 nathanw sr[NCR_CFG1] = NCRCFG1_PARENB | NCRCFG1_BUSID;
112 1.1 dbj
113 1.1 dbj sc->sc_state = SCSI_IDLE;
114 1.1 dbj }
115 1.1 dbj
116 1.1 dbj void
117 1.1 dbj scsierror(char *error)
118 1.1 dbj {
119 1.1 dbj printf("scsierror: %s.\n", error);
120 1.1 dbj }
121 1.1 dbj
122 1.1 dbj short
123 1.1 dbj scsi_getbyte(volatile caddr_t sr)
124 1.1 dbj {
125 1.2.26.1 nathanw if ((sr[NCR_FFLAG] & NCRFIFO_FF) == 0)
126 1.1 dbj {
127 1.1 dbj printf("getbyte: no data!\n");
128 1.1 dbj return -1;
129 1.1 dbj }
130 1.2.26.1 nathanw return sr[NCR_FIFO];
131 1.1 dbj }
132 1.1 dbj
133 1.1 dbj int
134 1.1 dbj scsi_wait_for_intr(void)
135 1.1 dbj {
136 1.1 dbj #if 0
137 1.1 dbj extern struct prominfo *pi;
138 1.1 dbj volitle int = pi->pi_intrstat; /* ### use constant? */
139 1.1 dbj #else
140 1.1 dbj extern char *mg;
141 1.1 dbj #define MON(type, off) (*(type *)((u_int) (mg) + off))
142 1.1 dbj volatile int *intrstat = MON(volatile int *,MG_intrstat);
143 1.2 dbj volatile int *intrmask = MON(volatile int *,MG_intrmask);
144 1.1 dbj #endif
145 1.1 dbj int count;
146 1.1 dbj
147 1.2 dbj for(count = 0; count < SCSI_TIMEOUT; count++) {
148 1.2 dbj DPRINTF((" *intrstat = 0x%x\t*intrmask = 0x%x\n",*intrstat,*intrmask));
149 1.2 dbj
150 1.1 dbj if (*intrstat & SCSI_INTR)
151 1.1 dbj return 0;
152 1.2 dbj }
153 1.1 dbj
154 1.1 dbj printf("scsiicmd: timed out.\n");
155 1.1 dbj return -1;
156 1.1 dbj }
157 1.1 dbj
158 1.1 dbj int
159 1.1 dbj scsiicmd(char target, char lun,
160 1.1 dbj u_char *cbuf, int clen,
161 1.1 dbj char *addr, int len)
162 1.1 dbj {
163 1.1 dbj volatile caddr_t sr;
164 1.1 dbj int i;
165 1.1 dbj
166 1.1 dbj DPRINTF(("scsiicmd: [%x, %d] -> %d (%lx, %d)\n",*cbuf, clen,
167 1.1 dbj target, (long)addr, len));
168 1.1 dbj sr = P_SCSI;
169 1.1 dbj
170 1.1 dbj if (sc->sc_state != SCSI_IDLE) {
171 1.1 dbj scsierror("scsiiscmd: bad state");
172 1.1 dbj return EIO;
173 1.1 dbj }
174 1.1 dbj sc->sc_result = 0;
175 1.1 dbj
176 1.1 dbj /* select target */
177 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_FLUSH;
178 1.1 dbj DELAY(10);
179 1.2.26.1 nathanw sr[NCR_SELID] = target;
180 1.2.26.1 nathanw sr[NCR_FIFO] = MSG_IDENTIFY(lun, 0);
181 1.1 dbj for (i=0; i<clen; i++)
182 1.2.26.1 nathanw sr[NCR_FIFO] = cbuf[i];
183 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_SELATN;
184 1.1 dbj sc->sc_state = SCSI_SELECTING;
185 1.1 dbj
186 1.1 dbj while(sc->sc_state != SCSI_DONE) {
187 1.1 dbj if (scsi_wait_for_intr()) /* maybe we'd better use real intrs ? */
188 1.1 dbj return EIO;
189 1.1 dbj
190 1.1 dbj if (sc->sc_state == SCSI_DMA)
191 1.1 dbj {
192 1.1 dbj /* registers are not valid on dma intr */
193 1.1 dbj sc->sc_status = sc->sc_seqstep = sc->sc_intrstatus = 0;
194 1.1 dbj DPRINTF(("scsiicmd: dma intr\n"));
195 1.1 dbj } else {
196 1.1 dbj /* scsi processing */
197 1.2.26.1 nathanw sc->sc_status = sr[NCR_STAT];
198 1.2.26.1 nathanw sc->sc_seqstep = sr[NCR_STEP];
199 1.2.26.1 nathanw sc->sc_intrstatus = sr[NCR_INTR];
200 1.1 dbj DPRINTF(("scsiicmd: regs[intr=%x, stat=%x, step=%x]\n",
201 1.1 dbj sc->sc_intrstatus, sc->sc_status, sc->sc_seqstep));
202 1.1 dbj }
203 1.1 dbj
204 1.2.26.1 nathanw if (sc->sc_intrstatus & NCRINTR_SBR) {
205 1.1 dbj scsierror("scsi bus reset");
206 1.1 dbj return EIO;
207 1.1 dbj }
208 1.1 dbj
209 1.2.26.1 nathanw if ((sc->sc_status & NCRSTAT_GE)
210 1.2.26.1 nathanw || (sc->sc_intrstatus & NCRINTR_ILL)) {
211 1.1 dbj scsierror("software error");
212 1.1 dbj return EIO;
213 1.1 dbj }
214 1.2.26.1 nathanw if (sc->sc_status & NCRSTAT_PE)
215 1.1 dbj {
216 1.1 dbj scsierror("parity error");
217 1.1 dbj return EIO;
218 1.1 dbj }
219 1.1 dbj
220 1.1 dbj switch(sc->sc_state)
221 1.1 dbj {
222 1.1 dbj case SCSI_SELECTING:
223 1.2.26.1 nathanw if (sc->sc_intrstatus & NCRINTR_DIS)
224 1.1 dbj {
225 1.1 dbj sc->sc_state = SCSI_IDLE;
226 1.1 dbj return EUNIT; /* device not present */
227 1.1 dbj }
228 1.1 dbj
229 1.2.26.1 nathanw #define NCRINTR_DONE (NCRINTR_BS | NCRINTR_FC)
230 1.2.26.1 nathanw if ((sc->sc_intrstatus & NCRINTR_DONE) != NCRINTR_DONE)
231 1.1 dbj {
232 1.1 dbj scsierror("selection failed");
233 1.1 dbj return EIO;
234 1.1 dbj }
235 1.1 dbj sc->sc_state = SCSI_HASBUS;
236 1.1 dbj break;
237 1.1 dbj case SCSI_HASBUS:
238 1.2.26.1 nathanw if (sc->sc_intrstatus & NCRINTR_DIS)
239 1.1 dbj {
240 1.1 dbj scsierror("target disconnected");
241 1.1 dbj return EIO;
242 1.1 dbj }
243 1.1 dbj break;
244 1.1 dbj case SCSI_DMA:
245 1.2.26.1 nathanw if (sc->sc_intrstatus & NCRINTR_DIS)
246 1.1 dbj {
247 1.1 dbj scsierror("target disconnected");
248 1.1 dbj return EIO;
249 1.1 dbj }
250 1.1 dbj if (dma_done() != 0)
251 1.1 dbj return EIO;
252 1.1 dbj continue;
253 1.1 dbj case SCSI_CLEANUP:
254 1.2.26.1 nathanw if (sc->sc_intrstatus & NCRINTR_DIS)
255 1.1 dbj {
256 1.1 dbj sc->sc_state = SCSI_DONE;
257 1.1 dbj continue;
258 1.1 dbj }
259 1.1 dbj DPRINTF(("hmm ... no disconnect on cleanup?\n"));
260 1.1 dbj sc->sc_state = SCSI_DONE; /* maybe ... */
261 1.1 dbj break;
262 1.1 dbj }
263 1.1 dbj
264 1.1 dbj /* transfer information now */
265 1.2.26.1 nathanw switch(sc->sc_status & NCRSTAT_PHASE)
266 1.1 dbj {
267 1.1 dbj case DATA_IN_PHASE:
268 1.1 dbj if (dma_start(addr, len) != 0)
269 1.1 dbj return EIO;
270 1.1 dbj break;
271 1.1 dbj case DATA_OUT_PHASE:
272 1.1 dbj scsierror("data out phase not implemented");
273 1.1 dbj return EIO;
274 1.1 dbj case STATUS_PHASE:
275 1.1 dbj DPRINTF(("status phase: "));
276 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_ICCS;
277 1.1 dbj sc->sc_result = scsi_getbyte(sr);
278 1.1 dbj DPRINTF(("status is 0x%x.\n", sc->sc_result));
279 1.1 dbj break;
280 1.1 dbj case MSG_IN_PHASE:
281 1.1 dbj if (scsi_msgin() != 0)
282 1.1 dbj return EIO;
283 1.1 dbj break;
284 1.1 dbj default:
285 1.1 dbj DPRINTF(("phase not implemented: 0x%x.\n",
286 1.2.26.1 nathanw sc->sc_status & NCRSTAT_PHASE));
287 1.1 dbj scsierror("bad phase");
288 1.1 dbj return EIO;
289 1.1 dbj }
290 1.1 dbj }
291 1.1 dbj
292 1.1 dbj sc->sc_state = SCSI_IDLE;
293 1.1 dbj return -sc->sc_result;
294 1.1 dbj }
295 1.1 dbj
296 1.1 dbj int
297 1.1 dbj scsi_msgin(void)
298 1.1 dbj {
299 1.1 dbj volatile caddr_t sr;
300 1.1 dbj u_char msg;
301 1.1 dbj
302 1.1 dbj sr = P_SCSI;
303 1.1 dbj
304 1.1 dbj msg = scsi_getbyte(sr);
305 1.1 dbj if (msg)
306 1.1 dbj {
307 1.1 dbj printf("unexpected msg: 0x%x.\n",msg);
308 1.1 dbj return -1;
309 1.1 dbj }
310 1.2.26.1 nathanw if ((sc->sc_intrstatus & NCRINTR_FC) == 0)
311 1.1 dbj {
312 1.1 dbj printf("not function complete.\n");
313 1.1 dbj return -1;
314 1.1 dbj }
315 1.1 dbj sc->sc_state = SCSI_CLEANUP;
316 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_MSGOK;
317 1.1 dbj return 0;
318 1.1 dbj }
319 1.1 dbj
320 1.1 dbj int
321 1.1 dbj dma_start(char *addr, int len)
322 1.1 dbj {
323 1.1 dbj volatile caddr_t sr;
324 1.1 dbj struct dma_dev *dma;
325 1.1 dbj
326 1.1 dbj
327 1.1 dbj sr = P_SCSI;
328 1.1 dbj dma = (struct dma_dev *)P_SCSI_CSR;
329 1.1 dbj
330 1.1 dbj if (len > MAX_DMASIZE)
331 1.1 dbj {
332 1.1 dbj scsierror("dma too long");
333 1.1 dbj return -1;
334 1.1 dbj }
335 1.1 dbj
336 1.1 dbj if (addr == NULL || len == 0)
337 1.1 dbj {
338 1.1 dbj #if 0 /* I'd take that as an error in my code */
339 1.1 dbj DPRINTF(("hmm ... no dma requested.\n"));
340 1.2.26.1 nathanw sr[NCR_TCL] = 0;
341 1.2.26.1 nathanw sr[NCR_TCM] = 1;
342 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_NOP;
343 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_DMA | NCRCMD_TRPAD;
344 1.1 dbj return 0;
345 1.1 dbj #else
346 1.1 dbj scsierror("unrequested dma");
347 1.1 dbj return -1;
348 1.1 dbj #endif
349 1.1 dbj }
350 1.1 dbj
351 1.1 dbj DPRINTF(("dma start: %lx, %d byte.\n", (long)addr, len));
352 1.2 dbj
353 1.2 dbj DPRINTF(("dma_bufffer: start: 0x%lx end: 0x%lx \n",
354 1.2 dbj (long)dma_buffer,(long)DMA_ENDALIGN(char *, dma_buffer+len)));
355 1.2 dbj
356 1.1 dbj sc->dma_addr = addr;
357 1.1 dbj sc->dma_len = len;
358 1.1 dbj
359 1.2.26.1 nathanw sr[NCR_TCL] = len & 0xff;
360 1.2.26.1 nathanw sr[NCR_TCM] = len >> 8;
361 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_DMA | NCRCMD_NOP;
362 1.2.26.1 nathanw sr[NCR_CMD] = NCRCMD_DMA | NCRCMD_TRANS;
363 1.2 dbj
364 1.2 dbj #if 0
365 1.1 dbj dma->dd_csr = DMACSR_READ | DMACSR_RESET;
366 1.1 dbj dma->dd_next_initbuf = dma_buffer;
367 1.1 dbj dma->dd_limit = DMA_ENDALIGN(char *, dma_buffer+len);
368 1.1 dbj dma->dd_csr = DMACSR_READ | DMACSR_SETENABLE;
369 1.2 dbj #else
370 1.2 dbj dma->dd_csr = 0;
371 1.2 dbj dma->dd_csr = DMACSR_INITBUF | DMACSR_READ | DMACSR_RESET;
372 1.2 dbj dma->dd_next_initbuf = dma_buffer;
373 1.2 dbj dma->dd_limit = DMA_ENDALIGN(char *, dma_buffer+len);
374 1.2 dbj dma->dd_csr = DMACSR_READ | DMACSR_SETENABLE;
375 1.2 dbj #endif
376 1.2 dbj
377 1.1 dbj sr[ESP_DCTL] = ESPDCTL_20MHZ|ESPDCTL_INTENB|ESPDCTL_DMAMOD|ESPDCTL_DMARD;
378 1.1 dbj
379 1.1 dbj sc->sc_state = SCSI_DMA;
380 1.1 dbj return 0;
381 1.1 dbj }
382 1.1 dbj
383 1.1 dbj int
384 1.1 dbj dma_done(void)
385 1.1 dbj {
386 1.1 dbj volatile caddr_t sr;
387 1.1 dbj struct dma_dev *dma;
388 1.1 dbj int count, state;
389 1.1 dbj
390 1.1 dbj sr = P_SCSI;
391 1.1 dbj dma = (struct dma_dev *)P_SCSI_CSR;
392 1.1 dbj
393 1.1 dbj state = dma->dd_csr & (DMACSR_BUSEXC | DMACSR_COMPLETE
394 1.1 dbj | DMACSR_SUPDATE | DMACSR_ENABLE);
395 1.1 dbj
396 1.2.26.1 nathanw count = sr[NCR_TCM]<<8 | sr[NCR_TCL];
397 1.1 dbj DPRINTF(("dma state = 0x%x, remain = %d.\n", state, count));
398 1.1 dbj
399 1.1 dbj if (state & DMACSR_ENABLE)
400 1.1 dbj {
401 1.2 dbj
402 1.2 dbj DPRINTF(("dma still enabled, flushing DCTL.\n"));
403 1.2 dbj
404 1.1 dbj sr[ESP_DCTL] = ESPDCTL_20MHZ | ESPDCTL_INTENB | ESPDCTL_DMAMOD
405 1.1 dbj | ESPDCTL_DMARD | ESPDCTL_FLUSH;
406 1.2 dbj /* DELAY(5); */
407 1.1 dbj sr[ESP_DCTL] = ESPDCTL_20MHZ | ESPDCTL_INTENB | ESPDCTL_DMAMOD
408 1.1 dbj | ESPDCTL_DMARD;
409 1.2 dbj /* DELAY(5); */
410 1.2 dbj
411 1.1 dbj return 0;
412 1.1 dbj }
413 1.1 dbj
414 1.1 dbj sr[ESP_DCTL] = ESPDCTL_20MHZ | ESPDCTL_INTENB;
415 1.2.26.1 nathanw count = sr[NCR_TCM]<<8 | sr[NCR_TCL];
416 1.1 dbj dma->dd_csr = DMACSR_RESET;
417 1.1 dbj
418 1.1 dbj DPRINTF(("dma done. remain = %d, state = 0x%x.\n", count, state));
419 1.1 dbj
420 1.1 dbj if (count != 0)
421 1.1 dbj {
422 1.1 dbj printf("WARNING: unexpected %d characters remain in dma\n",count);
423 1.1 dbj scsierror("dma transfer incomplete");
424 1.1 dbj #if 0
425 1.1 dbj return -1;
426 1.1 dbj #endif
427 1.1 dbj }
428 1.1 dbj
429 1.1 dbj if (state & DMACSR_COMPLETE)
430 1.1 dbj {
431 1.1 dbj bcopy(dma_buffer, sc->dma_addr, sc->dma_len);
432 1.1 dbj sc->sc_state = SCSI_HASBUS;
433 1.1 dbj return 0;
434 1.1 dbj }
435 1.1 dbj if (state & DMACSR_BUSEXC)
436 1.1 dbj {
437 1.1 dbj scsierror("dma failed");
438 1.1 dbj return -1;
439 1.1 dbj }
440 1.1 dbj scsierror("dma not completed\n");
441 1.1 dbj
442 1.1 dbj return -1;
443 1.1 dbj }
444