umass_scsipi.c revision 1.2 1 /* $NetBSD: umass_scsipi.c,v 1.2 2001/12/29 13:46:23 augustss Exp $ */
2
3 /*
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (lennart (at) augustsson.net) at
9 * Carlstedt Research & Technology.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 #include <sys/cdefs.h>
41 __KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.2 2001/12/29 13:46:23 augustss Exp $");
42
43 #include "atapibus.h"
44 #include "scsibus.h"
45
46 #include <sys/param.h>
47 #include <sys/systm.h>
48 #include <sys/kernel.h>
49 #include <sys/conf.h>
50 #include <sys/buf.h>
51 #include <sys/device.h>
52 #include <sys/ioctl.h>
53 #include <sys/malloc.h>
54
55 /* SCSI & ATAPI */
56 #include <sys/scsiio.h>
57 #include <dev/scsipi/scsi_all.h>
58 #include <dev/scsipi/scsipi_all.h>
59 #include <dev/scsipi/scsiconf.h>
60
61 #include <dev/scsipi/atapiconf.h>
62
63 #include <dev/scsipi/scsipi_disk.h>
64 #include <dev/scsipi/scsi_disk.h>
65 #include <dev/scsipi/scsi_changer.h>
66
67 #include <dev/scsipi/atapi_disk.h>
68
69 #include <sys/disk.h> /* XXX */
70 #include <dev/scsipi/sdvar.h> /* XXX */
71
72 /* USB */
73 #include <dev/usb/usb.h>
74 #include <dev/usb/usbdi.h>
75 #include <dev/usb/usbdi_util.h>
76 #include <dev/usb/usbdevs.h>
77
78 #include <dev/usb/umassvar.h>
79 #include <dev/usb/umass_scsipi.h>
80
81 struct umass_scsipi_softc {
82 struct umassbus_softc base;
83
84 struct atapi_adapter sc_atapi_adapter;
85 #define sc_adapter sc_atapi_adapter._generic
86 struct scsipi_channel sc_channel;
87 usbd_status sc_sync_status;
88 struct scsipi_sense sc_sense_cmd;
89 };
90
91
92 #define SHORT_INQUIRY_LENGTH 36 /* XXX */
93
94 #define UMASS_SCSIID_HOST 0x00
95 #define UMASS_SCSIID_DEVICE 0x01
96
97 #define UMASS_ATAPI_DRIVE 0
98
99 Static void umass_scsipi_request(struct scsipi_channel *,
100 scsipi_adapter_req_t, void *);
101 Static void umass_scsipi_minphys(struct buf *bp);
102 Static int umass_scsipi_ioctl(struct scsipi_channel *, u_long,
103 caddr_t, int, struct proc *);
104 Static int umass_scsipi_getgeom(struct scsipi_periph *periph,
105 struct disk_parms *, u_long sectors);
106
107 Static void umass_scsipi_cb(struct umass_softc *sc, void *priv,
108 int residue, int status);
109 Static void umass_scsipi_sense_cb(struct umass_softc *sc, void *priv,
110 int residue, int status);
111
112 Static struct umass_scsipi_softc *umass_scsipi_setup(struct umass_softc *sc);
113
114 Static int scsipiprint(void *aux, const char *pnp);
115
116 #if NATAPIBUS > 0
117 Static void umass_atapi_probe_device(struct atapibus_softc *, int);
118
119 const struct scsipi_bustype umass_atapi_bustype = {
120 SCSIPI_BUSTYPE_ATAPI,
121 atapi_scsipi_cmd,
122 atapi_interpret_sense,
123 atapi_print_addr,
124 scsi_kill_pending,
125 };
126 #endif
127
128
129 #if NSCSIBUS > 0
130 int
131 umass_scsi_attach(struct umass_softc *sc)
132 {
133 struct umass_scsipi_softc *scbus;
134
135 scbus = umass_scsipi_setup(sc);
136
137 scbus->sc_channel.chan_bustype = &scsi_bustype;
138 scbus->sc_channel.chan_ntargets = UMASS_SCSIID_DEVICE + 1;
139 scbus->sc_channel.chan_nluns = sc->maxlun + 1;
140 scbus->sc_channel.chan_id = UMASS_SCSIID_HOST;
141 DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: SCSI\n",
142 USBDEVNAME(sc->sc_dev)));
143 scbus->base.sc_child =
144 config_found(&sc->sc_dev, &scbus->sc_channel, scsipiprint);
145
146 return (0);
147 }
148 #endif
149
150 #if NATAPIBUS > 0
151 int
152 umass_atapi_attach(struct umass_softc *sc)
153 {
154 struct umass_scsipi_softc *scbus;
155
156 scbus = umass_scsipi_setup(sc);
157 scbus->sc_atapi_adapter.atapi_probe_device = umass_atapi_probe_device;
158
159 scbus->sc_channel.chan_bustype = &umass_atapi_bustype;
160 scbus->sc_channel.chan_ntargets = 2;
161 scbus->sc_channel.chan_nluns = 1;
162
163 scbus->sc_channel.chan_defquirks |= sc->sc_busquirks;
164 DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n",
165 USBDEVNAME(sc->sc_dev)));
166 scbus->base.sc_child =
167 config_found(&sc->sc_dev, &scbus->sc_channel, scsipiprint);
168
169 return (0);
170 }
171 #endif
172
173 Static struct umass_scsipi_softc *
174 umass_scsipi_setup(struct umass_softc *sc)
175 {
176 struct umass_scsipi_softc *scbus;
177
178 scbus = malloc(sizeof *scbus, M_DEVBUF, M_WAITOK | M_ZERO);
179 sc->bus = &scbus->base;
180
181 /* Fill in the adapter. */
182 memset(&scbus->sc_adapter, 0, sizeof(scbus->sc_adapter));
183 scbus->sc_adapter.adapt_dev = &sc->sc_dev;
184 scbus->sc_adapter.adapt_nchannels = 1;
185 scbus->sc_adapter.adapt_request = umass_scsipi_request;
186 scbus->sc_adapter.adapt_minphys = umass_scsipi_minphys;
187 scbus->sc_adapter.adapt_ioctl = umass_scsipi_ioctl;
188 scbus->sc_adapter.adapt_getgeom = umass_scsipi_getgeom;
189
190 /* Fill in the channel. */
191 memset(&scbus->sc_channel, 0, sizeof(scbus->sc_channel));
192 scbus->sc_channel.chan_adapter = &scbus->sc_adapter;
193 scbus->sc_channel.chan_channel = 0;
194 scbus->sc_channel.chan_flags = SCSIPI_CHAN_OPENINGS;
195 scbus->sc_channel.chan_openings = 1;
196 scbus->sc_channel.chan_max_periph = 1;
197 scbus->sc_channel.chan_defquirks |= sc->sc_busquirks;
198
199 return (scbus);
200 }
201
202 Static int
203 scsipiprint(void *aux, const char *pnp)
204 {
205 struct scsipi_channel *chan = aux;
206
207 if (chan->chan_bustype->bustype_type == SCSIPI_BUSTYPE_SCSI) {
208 #if NSCSIBUS > 0
209 return (scsiprint(aux, pnp));
210 #else
211 if (pnp)
212 printf("scsibus at %s", pnp);
213 return (UNCONF);
214 #endif
215 } else {
216 #if NATAPIBUS > 0
217 return (atapiprint(aux, pnp));
218 #else
219 if (pnp)
220 printf("atapibus at %s", pnp);
221 return (UNCONF);
222 #endif
223 }
224 }
225
226 Static void
227 umass_scsipi_request(struct scsipi_channel *chan,
228 scsipi_adapter_req_t req, void *arg)
229 {
230 struct scsipi_adapter *adapt = chan->chan_adapter;
231 struct scsipi_periph *periph;
232 struct scsipi_xfer *xs;
233 struct umass_softc *sc = (void *)adapt->adapt_dev;
234 struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
235 struct scsipi_generic *cmd, trcmd;
236 int cmdlen;
237 int dir;
238 #ifdef UMASS_DEBUG
239 microtime(&sc->tv);
240 #endif
241 switch(req) {
242 case ADAPTER_REQ_RUN_XFER:
243 xs = arg;
244 periph = xs->xs_periph;
245 DIF(UDMASS_UPPER, periph->periph_dbflags |= SCSIPI_DEBUG_FLAGS);
246
247 DPRINTF(UDMASS_CMD, ("%s: umass_scsi_cmd: at %lu.%06lu: %d:%d "
248 "xs=%p cmd=0x%02x datalen=%d (quirks=0x%x, poll=%d)\n",
249 USBDEVNAME(sc->sc_dev), sc->tv.tv_sec, sc->tv.tv_usec,
250 periph->periph_target, periph->periph_lun,
251 xs, xs->cmd->opcode, xs->datalen,
252 periph->periph_quirks, xs->xs_control & XS_CTL_POLL));
253 #if defined(USB_DEBUG) && defined(SCSIPI_DEBUG)
254 if (umassdebug & UDMASS_SCSI)
255 show_scsipi_xs(xs);
256 else if (umassdebug & ~UDMASS_CMD)
257 show_scsipi_cmd(xs);
258 #endif
259
260 if (sc->sc_dying) {
261 xs->error = XS_DRIVER_STUFFUP;
262 goto done;
263 }
264
265 #ifdef UMASS_DEBUG
266 if (chan->chan_bustype->bustype_type == SCSIPI_BUSTYPE_ATAPI ?
267 periph->periph_target != UMASS_ATAPI_DRIVE :
268 periph->periph_target != UMASS_SCSIID_DEVICE) {
269 DPRINTF(UDMASS_SCSI, ("%s: wrong SCSI ID %d\n",
270 USBDEVNAME(sc->sc_dev),
271 periph->periph_target));
272 xs->error = XS_DRIVER_STUFFUP;
273 goto done;
274 }
275 #endif
276
277 cmd = xs->cmd;
278 cmdlen = xs->cmdlen;
279
280 /* XXX should use transform */
281
282 if (cmd->opcode == START_STOP &&
283 (sc->sc_quirks & UMASS_QUIRK_NO_START_STOP)) {
284 /*printf("%s: START_STOP\n", USBDEVNAME(sc->sc_dev));*/
285 xs->error = XS_NOERROR;
286 goto done;
287 }
288
289 if (cmd->opcode == INQUIRY &&
290 (sc->sc_quirks & UMASS_QUIRK_FORCE_SHORT_INQUIRY)) {
291 /*
292 * some drives wedge when asked for full inquiry
293 * information.
294 */
295 memcpy(&trcmd, cmd, sizeof trcmd);
296 trcmd.bytes[4] = SHORT_INQUIRY_LENGTH;
297 cmd = &trcmd;
298 }
299
300 dir = DIR_NONE;
301 if (xs->datalen) {
302 switch (xs->xs_control &
303 (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
304 case XS_CTL_DATA_IN:
305 dir = DIR_IN;
306 break;
307 case XS_CTL_DATA_OUT:
308 dir = DIR_OUT;
309 break;
310 }
311 }
312
313 if (xs->datalen > UMASS_MAX_TRANSFER_SIZE) {
314 printf("umass_cmd: large datalen, %d\n", xs->datalen);
315 xs->error = XS_DRIVER_STUFFUP;
316 goto done;
317 }
318
319 if (xs->xs_control & XS_CTL_POLL) {
320 /* Use sync transfer. XXX Broken! */
321 DPRINTF(UDMASS_SCSI,
322 ("umass_scsi_cmd: sync dir=%d\n", dir));
323 sc->sc_xfer_flags = USBD_SYNCHRONOUS;
324 scbus->sc_sync_status = USBD_INVAL;
325 sc->sc_methods->wire_xfer(sc, periph->periph_lun, cmd,
326 cmdlen, xs->data,
327 xs->datalen, dir,
328 xs->timeout, 0, xs);
329 sc->sc_xfer_flags = 0;
330 DPRINTF(UDMASS_SCSI, ("umass_scsi_cmd: done err=%d\n",
331 scbus->sc_sync_status));
332 switch (scbus->sc_sync_status) {
333 case USBD_NORMAL_COMPLETION:
334 xs->error = XS_NOERROR;
335 break;
336 case USBD_TIMEOUT:
337 xs->error = XS_TIMEOUT;
338 break;
339 default:
340 xs->error = XS_DRIVER_STUFFUP;
341 break;
342 }
343 goto done;
344 } else {
345 DPRINTF(UDMASS_SCSI,
346 ("umass_scsi_cmd: async dir=%d, cmdlen=%d"
347 " datalen=%d\n",
348 dir, cmdlen, xs->datalen));
349 sc->sc_methods->wire_xfer(sc, periph->periph_lun, cmd,
350 cmdlen, xs->data,
351 xs->datalen, dir,
352 xs->timeout,
353 umass_scsipi_cb, xs);
354 return;
355 }
356
357 /* Return if command finishes early. */
358 done:
359 scsipi_done(xs);
360 return;
361 default:
362 /* Not supported, nothing to do. */
363 ;
364 }
365 }
366
367 Static void
368 umass_scsipi_minphys(struct buf *bp)
369 {
370 #ifdef DIAGNOSTIC
371 if (bp->b_bcount <= 0) {
372 printf("umass_scsipi_minphys count(%ld) <= 0\n",
373 bp->b_bcount);
374 bp->b_bcount = UMASS_MAX_TRANSFER_SIZE;
375 }
376 #endif
377 if (bp->b_bcount > UMASS_MAX_TRANSFER_SIZE)
378 bp->b_bcount = UMASS_MAX_TRANSFER_SIZE;
379 minphys(bp);
380 }
381
382 int
383 umass_scsipi_ioctl(struct scsipi_channel *chan, u_long cmd, caddr_t arg,
384 int flag, struct proc *p)
385 {
386 /*struct umass_softc *sc = link->adapter_softc;*/
387 /*struct umass_scsipi_softc *scbus = sc->bus;*/
388
389 switch (cmd) {
390 #if 0
391 case SCBUSIORESET:
392 ccb->ccb_h.status = CAM_REQ_INPROG;
393 umass_reset(sc, umass_cam_cb, (void *) ccb);
394 return (0);
395 #endif
396 default:
397 return (ENOTTY);
398 }
399 }
400
401 Static int
402 umass_scsipi_getgeom(struct scsipi_periph *periph, struct disk_parms *dp,
403 u_long sectors)
404 {
405 struct umass_softc *sc =
406 (void *)periph->periph_channel->chan_adapter->adapt_dev;
407
408 /* If it's not a floppy, we don't know what to do. */
409 if (sc->sc_cmd != UMASS_CPROTO_UFI)
410 return (0);
411
412 switch (sectors) {
413 case 1440:
414 /* Most likely a single density 3.5" floppy. */
415 dp->heads = 2;
416 dp->sectors = 9;
417 dp->cyls = 80;
418 return (1);
419 case 2880:
420 /* Most likely a double density 3.5" floppy. */
421 dp->heads = 2;
422 dp->sectors = 18;
423 dp->cyls = 80;
424 return (1);
425 default:
426 return (0);
427 }
428 }
429
430 Static void
431 umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status)
432 {
433 struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
434 struct scsipi_xfer *xs = priv;
435 struct scsipi_periph *periph = xs->xs_periph;
436 int cmdlen;
437 int s;
438 #ifdef UMASS_DEBUG
439 struct timeval tv;
440 u_int delta;
441 microtime(&tv);
442 delta = (tv.tv_sec - sc->tv.tv_sec) * 1000000 + tv.tv_usec - sc->tv.tv_usec;
443 #endif
444
445 DPRINTF(UDMASS_CMD,("umass_scsipi_cb: at %lu.%06lu, delta=%u: xs=%p residue=%d"
446 " status=%d\n", tv.tv_sec, tv.tv_usec, delta, xs, residue, status));
447
448 xs->resid = residue;
449
450 switch (status) {
451 case STATUS_CMD_OK:
452 xs->error = XS_NOERROR;
453 break;
454
455 case STATUS_CMD_UNKNOWN:
456 /* we can't issue REQUEST SENSE */
457 if (xs->xs_periph->periph_quirks & PQUIRK_NOSENSE) {
458 /*
459 * If no residue and no other USB error,
460 * command succeeded.
461 */
462 if (residue == 0) {
463 xs->error = XS_NOERROR;
464 break;
465 }
466
467 /*
468 * Some devices return a short INQUIRY
469 * response, omitting response data from the
470 * "vendor specific data" on...
471 */
472 if (xs->cmd->opcode == INQUIRY &&
473 residue < xs->datalen) {
474 xs->error = XS_NOERROR;
475 break;
476 }
477
478 xs->error = XS_DRIVER_STUFFUP;
479 break;
480 }
481 /* FALLTHROUGH */
482 case STATUS_CMD_FAILED:
483 /* fetch sense data */
484 memset(&scbus->sc_sense_cmd, 0, sizeof(scbus->sc_sense_cmd));
485 scbus->sc_sense_cmd.opcode = REQUEST_SENSE;
486 scbus->sc_sense_cmd.byte2 = periph->periph_lun <<
487 SCSI_CMD_LUN_SHIFT;
488 scbus->sc_sense_cmd.length = sizeof(xs->sense);
489
490 cmdlen = sizeof(scbus->sc_sense_cmd);
491 if (sc->sc_cmd == UMASS_CPROTO_UFI) /* XXX */
492 cmdlen = UFI_COMMAND_LENGTH;
493 sc->sc_methods->wire_xfer(sc, periph->periph_lun,
494 &scbus->sc_sense_cmd, cmdlen,
495 &xs->sense, sizeof(xs->sense),
496 DIR_IN, xs->timeout,
497 umass_scsipi_sense_cb, xs);
498 return;
499
500 case STATUS_WIRE_FAILED:
501 xs->error = XS_RESET;
502 break;
503
504 default:
505 panic("%s: Unknown status %d in umass_scsipi_cb\n",
506 USBDEVNAME(sc->sc_dev), status);
507 }
508
509 DPRINTF(UDMASS_CMD,("umass_scsipi_cb: at %lu.%06lu: return xs->error="
510 "%d, xs->xs_status=0x%x xs->resid=%d\n",
511 tv.tv_sec, tv.tv_usec,
512 xs->error, xs->xs_status, xs->resid));
513
514 s = splbio();
515 scsipi_done(xs);
516 splx(s);
517 }
518
519 /*
520 * Finalise a completed autosense operation
521 */
522 Static void
523 umass_scsipi_sense_cb(struct umass_softc *sc, void *priv, int residue,
524 int status)
525 {
526 struct scsipi_xfer *xs = priv;
527 int s;
528
529 DPRINTF(UDMASS_CMD,("umass_scsipi_sense_cb: xs=%p residue=%d "
530 "status=%d\n", xs, residue, status));
531
532 switch (status) {
533 case STATUS_CMD_OK:
534 case STATUS_CMD_UNKNOWN:
535 /* getting sense data succeeded */
536 if (xs->cmd->opcode == INQUIRY && (xs->resid < xs->datalen ||
537 (sc->sc_quirks & UMASS_QUIRK_RS_NO_CLEAR_UA /* XXX */))) {
538 /*
539 * Some drivers return SENSE errors even after INQUIRY.
540 * The upper layer doesn't like that.
541 */
542 xs->error = XS_NOERROR;
543 break;
544 }
545 /* XXX look at residue */
546 if (residue == 0 || residue == 14)/* XXX */
547 xs->error = XS_SENSE;
548 else
549 xs->error = XS_SHORTSENSE;
550 break;
551 default:
552 DPRINTF(UDMASS_SCSI, ("%s: Autosense failed, status %d\n",
553 USBDEVNAME(sc->sc_dev), status));
554 xs->error = XS_DRIVER_STUFFUP;
555 break;
556 }
557
558 xs->xs_status |= XS_STS_DONE;
559
560 DPRINTF(UDMASS_CMD,("umass_scsipi_sense_cb: return xs->error=%d, "
561 "xs->xs_status=0x%x xs->resid=%d\n", xs->error, xs->xs_status,
562 xs->resid));
563
564 s = splbio();
565 scsipi_done(xs);
566 splx(s);
567 }
568
569 #if NATAPIBUS > 0
570 Static void
571 umass_atapi_probe_device(struct atapibus_softc *atapi, int target)
572 {
573 struct scsipi_channel *chan = atapi->sc_channel;
574 struct scsipi_periph *periph;
575 struct scsipibus_attach_args sa;
576 char vendor[33], product[65], revision[17];
577 struct scsipi_inquiry_data inqbuf;
578
579 DPRINTF(UDMASS_SCSI,("umass_atapi_probe_device: atapi=%p target=%d\n",
580 atapi, target));
581
582 if (target != UMASS_ATAPI_DRIVE) /* only probe drive 0 */
583 return;
584
585 /* skip if already attached */
586 if (scsipi_lookup_periph(chan, target, 0) != NULL)
587 return;
588
589 periph = scsipi_alloc_periph(M_NOWAIT);
590 if (periph == NULL) {
591 printf("%s: can't allocate link for drive %d\n",
592 atapi->sc_dev.dv_xname, target);
593 return;
594 }
595
596 DIF(UDMASS_UPPER, periph->periph_dbflags |= 1); /* XXX 1 */
597 periph->periph_channel = chan;
598 periph->periph_switch = &atapi_probe_periphsw;
599 periph->periph_target = target;
600 periph->periph_quirks = chan->chan_defquirks;
601
602 DPRINTF(UDMASS_SCSI, ("umass_atapi_probe_device: doing inquiry\n"));
603 /* Now go ask the device all about itself. */
604 memset(&inqbuf, 0, sizeof(inqbuf));
605 if (scsipi_inquire(periph, &inqbuf,
606 XS_CTL_DISCOVERY | XS_CTL_DATA_ONSTACK) != 0) {
607 DPRINTF(UDMASS_SCSI, ("umass_atapi_probe_device: "
608 "scsipi_inquire failed\n"));
609 free(periph, M_DEVBUF);
610 return;
611 }
612
613 scsipi_strvis(vendor, 33, inqbuf.vendor, 8);
614 scsipi_strvis(product, 65, inqbuf.product, 16);
615 scsipi_strvis(revision, 17, inqbuf.revision, 4);
616
617 sa.sa_periph = periph;
618 sa.sa_inqbuf.type = inqbuf.device;
619 sa.sa_inqbuf.removable = inqbuf.dev_qual2 & SID_REMOVABLE ?
620 T_REMOV : T_FIXED;
621 if (sa.sa_inqbuf.removable)
622 periph->periph_flags |= PERIPH_REMOVABLE;
623 sa.sa_inqbuf.vendor = vendor;
624 sa.sa_inqbuf.product = product;
625 sa.sa_inqbuf.revision = revision;
626 sa.sa_inqptr = NULL;
627
628 DPRINTF(UDMASS_SCSI, ("umass_atapi_probedev: doing atapi_probedev on "
629 "'%s' '%s' '%s'\n", vendor, product, revision));
630 atapi_probe_device(atapi, target, periph, &sa);
631 /* atapi_probe_device() frees the periph when there is no device.*/
632 }
633 #endif
634