umass_scsipi.c revision 1.11 1 /* $NetBSD: umass_scsipi.c,v 1.11 2003/09/10 02:49:19 mycroft 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.11 2003/09/10 02:49:19 mycroft 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, usb_proc_ptr );
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
144 sc->sc_refcnt++;
145 scbus->base.sc_child =
146 config_found(&sc->sc_dev, &scbus->sc_channel, scsipiprint);
147 if (--sc->sc_refcnt < 0)
148 usb_detach_wakeup(USBDEV(sc->sc_dev));
149
150 return (0);
151 }
152 #endif
153
154 #if NATAPIBUS > 0
155 int
156 umass_atapi_attach(struct umass_softc *sc)
157 {
158 struct umass_scsipi_softc *scbus;
159
160 scbus = umass_scsipi_setup(sc);
161 scbus->sc_atapi_adapter.atapi_probe_device = umass_atapi_probe_device;
162
163 scbus->sc_channel.chan_bustype = &umass_atapi_bustype;
164 scbus->sc_channel.chan_ntargets = 2;
165 scbus->sc_channel.chan_nluns = 1;
166
167 scbus->sc_channel.chan_defquirks |= sc->sc_busquirks;
168 DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n",
169 USBDEVNAME(sc->sc_dev)));
170
171 sc->sc_refcnt++;
172 scbus->base.sc_child =
173 config_found(&sc->sc_dev, &scbus->sc_channel, scsipiprint);
174 if (--sc->sc_refcnt < 0)
175 usb_detach_wakeup(USBDEV(sc->sc_dev));
176
177 return (0);
178 }
179 #endif
180
181 Static struct umass_scsipi_softc *
182 umass_scsipi_setup(struct umass_softc *sc)
183 {
184 struct umass_scsipi_softc *scbus;
185
186 scbus = malloc(sizeof *scbus, M_DEVBUF, M_WAITOK | M_ZERO);
187 sc->bus = &scbus->base;
188
189 /* Only use big commands for USB SCSI devices. */
190 sc->sc_busquirks |= PQUIRK_ONLYBIG;
191
192 /* Fill in the adapter. */
193 memset(&scbus->sc_adapter, 0, sizeof(scbus->sc_adapter));
194 scbus->sc_adapter.adapt_dev = &sc->sc_dev;
195 scbus->sc_adapter.adapt_nchannels = 1;
196 scbus->sc_adapter.adapt_request = umass_scsipi_request;
197 scbus->sc_adapter.adapt_minphys = umass_scsipi_minphys;
198 scbus->sc_adapter.adapt_ioctl = umass_scsipi_ioctl;
199 scbus->sc_adapter.adapt_getgeom = umass_scsipi_getgeom;
200
201 /* Fill in the channel. */
202 memset(&scbus->sc_channel, 0, sizeof(scbus->sc_channel));
203 scbus->sc_channel.chan_adapter = &scbus->sc_adapter;
204 scbus->sc_channel.chan_channel = 0;
205 scbus->sc_channel.chan_flags = SCSIPI_CHAN_OPENINGS;
206 scbus->sc_channel.chan_openings = 1;
207 scbus->sc_channel.chan_max_periph = 1;
208 scbus->sc_channel.chan_defquirks |= sc->sc_busquirks;
209
210 return (scbus);
211 }
212
213 Static int
214 scsipiprint(void *aux, const char *pnp)
215 {
216 struct scsipi_channel *chan = aux;
217
218 if (chan->chan_bustype->bustype_type == SCSIPI_BUSTYPE_SCSI) {
219 #if NSCSIBUS > 0
220 return (scsiprint(aux, pnp));
221 #else
222 if (pnp)
223 aprint_normal("scsibus at %s", pnp);
224 return (UNCONF);
225 #endif
226 } else {
227 #if NATAPIBUS > 0
228 return (atapiprint(aux, pnp));
229 #else
230 if (pnp)
231 aprint_normal("atapibus at %s", pnp);
232 return (UNCONF);
233 #endif
234 }
235 }
236
237 Static void
238 umass_scsipi_request(struct scsipi_channel *chan,
239 scsipi_adapter_req_t req, void *arg)
240 {
241 struct scsipi_adapter *adapt = chan->chan_adapter;
242 struct scsipi_periph *periph;
243 struct scsipi_xfer *xs;
244 struct umass_softc *sc = (void *)adapt->adapt_dev;
245 struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
246 struct scsipi_generic *cmd, trcmd;
247 int cmdlen;
248 int dir;
249 #ifdef UMASS_DEBUG
250 microtime(&sc->tv);
251 #endif
252 switch(req) {
253 case ADAPTER_REQ_RUN_XFER:
254 xs = arg;
255 periph = xs->xs_periph;
256 DIF(UDMASS_UPPER, periph->periph_dbflags |= SCSIPI_DEBUG_FLAGS);
257
258 DPRINTF(UDMASS_CMD, ("%s: umass_scsi_cmd: at %lu.%06lu: %d:%d "
259 "xs=%p cmd=0x%02x datalen=%d (quirks=0x%x, poll=%d)\n",
260 USBDEVNAME(sc->sc_dev), sc->tv.tv_sec, sc->tv.tv_usec,
261 periph->periph_target, periph->periph_lun,
262 xs, xs->cmd->opcode, xs->datalen,
263 periph->periph_quirks, xs->xs_control & XS_CTL_POLL));
264 #if defined(USB_DEBUG) && defined(SCSIPI_DEBUG)
265 if (umassdebug & UDMASS_SCSI)
266 show_scsipi_xs(xs);
267 else if (umassdebug & ~UDMASS_CMD)
268 show_scsipi_cmd(xs);
269 #endif
270
271 if (sc->sc_dying) {
272 xs->error = XS_DRIVER_STUFFUP;
273 goto done;
274 }
275
276 #ifdef UMASS_DEBUG
277 if (chan->chan_bustype->bustype_type == SCSIPI_BUSTYPE_ATAPI ?
278 periph->periph_target != UMASS_ATAPI_DRIVE :
279 periph->periph_target != UMASS_SCSIID_DEVICE) {
280 DPRINTF(UDMASS_SCSI, ("%s: wrong SCSI ID %d\n",
281 USBDEVNAME(sc->sc_dev),
282 periph->periph_target));
283 xs->error = XS_DRIVER_STUFFUP;
284 goto done;
285 }
286 #endif
287
288 cmd = xs->cmd;
289 cmdlen = xs->cmdlen;
290
291 /* XXX should use transform */
292
293 if (cmd->opcode == INQUIRY &&
294 (sc->sc_quirks & UMASS_QUIRK_FORCE_SHORT_INQUIRY)) {
295 /*
296 * Some drives wedge when asked for full inquiry
297 * information.
298 */
299 memcpy(&trcmd, cmd, sizeof trcmd);
300 trcmd.bytes[4] = SHORT_INQUIRY_LENGTH;
301 cmd = &trcmd;
302 xs->datalen = SHORT_INQUIRY_LENGTH;
303 }
304
305 dir = DIR_NONE;
306 if (xs->datalen) {
307 switch (xs->xs_control &
308 (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
309 case XS_CTL_DATA_IN:
310 dir = DIR_IN;
311 break;
312 case XS_CTL_DATA_OUT:
313 dir = DIR_OUT;
314 break;
315 }
316 }
317
318 if (xs->datalen > UMASS_MAX_TRANSFER_SIZE) {
319 printf("umass_cmd: large datalen, %d\n", xs->datalen);
320 xs->error = XS_DRIVER_STUFFUP;
321 goto done;
322 }
323
324 if (xs->xs_control & XS_CTL_POLL) {
325 /* Use sync transfer. XXX Broken! */
326 DPRINTF(UDMASS_SCSI,
327 ("umass_scsi_cmd: sync dir=%d\n", dir));
328 sc->sc_xfer_flags = USBD_SYNCHRONOUS;
329 scbus->sc_sync_status = USBD_INVAL;
330 sc->sc_methods->wire_xfer(sc, periph->periph_lun, cmd,
331 cmdlen, xs->data,
332 xs->datalen, dir,
333 xs->timeout, 0, xs);
334 sc->sc_xfer_flags = 0;
335 DPRINTF(UDMASS_SCSI, ("umass_scsi_cmd: done err=%d\n",
336 scbus->sc_sync_status));
337 switch (scbus->sc_sync_status) {
338 case USBD_NORMAL_COMPLETION:
339 xs->error = XS_NOERROR;
340 break;
341 case USBD_TIMEOUT:
342 xs->error = XS_TIMEOUT;
343 break;
344 default:
345 xs->error = XS_DRIVER_STUFFUP;
346 break;
347 }
348 goto done;
349 } else {
350 DPRINTF(UDMASS_SCSI,
351 ("umass_scsi_cmd: async dir=%d, cmdlen=%d"
352 " datalen=%d\n",
353 dir, cmdlen, xs->datalen));
354 sc->sc_methods->wire_xfer(sc, periph->periph_lun, cmd,
355 cmdlen, xs->data,
356 xs->datalen, dir,
357 xs->timeout,
358 umass_scsipi_cb, xs);
359 return;
360 }
361
362 /* Return if command finishes early. */
363 done:
364 scsipi_done(xs);
365 return;
366 default:
367 /* Not supported, nothing to do. */
368 ;
369 }
370 }
371
372 Static void
373 umass_scsipi_minphys(struct buf *bp)
374 {
375 #ifdef DIAGNOSTIC
376 if (bp->b_bcount <= 0) {
377 printf("umass_scsipi_minphys count(%ld) <= 0\n",
378 bp->b_bcount);
379 bp->b_bcount = UMASS_MAX_TRANSFER_SIZE;
380 }
381 #endif
382 if (bp->b_bcount > UMASS_MAX_TRANSFER_SIZE)
383 bp->b_bcount = UMASS_MAX_TRANSFER_SIZE;
384 minphys(bp);
385 }
386
387 int
388 umass_scsipi_ioctl(struct scsipi_channel *chan, u_long cmd, caddr_t arg,
389 int flag, usb_proc_ptr p)
390 {
391 /*struct umass_softc *sc = link->adapter_softc;*/
392 /*struct umass_scsipi_softc *scbus = sc->bus;*/
393
394 switch (cmd) {
395 #if 0
396 case SCBUSIORESET:
397 ccb->ccb_h.status = CAM_REQ_INPROG;
398 umass_reset(sc, umass_cam_cb, (void *) ccb);
399 return (0);
400 #endif
401 default:
402 return (ENOTTY);
403 }
404 }
405
406 Static int
407 umass_scsipi_getgeom(struct scsipi_periph *periph, struct disk_parms *dp,
408 u_long sectors)
409 {
410 struct umass_softc *sc =
411 (void *)periph->periph_channel->chan_adapter->adapt_dev;
412
413 /* If it's not a floppy, we don't know what to do. */
414 if (sc->sc_cmd != UMASS_CPROTO_UFI)
415 return (0);
416
417 switch (sectors) {
418 case 1440:
419 /* Most likely a single density 3.5" floppy. */
420 dp->heads = 2;
421 dp->sectors = 9;
422 dp->cyls = 80;
423 return (1);
424 case 2880:
425 /* Most likely a double density 3.5" floppy. */
426 dp->heads = 2;
427 dp->sectors = 18;
428 dp->cyls = 80;
429 return (1);
430 default:
431 return (0);
432 }
433 }
434
435 Static void
436 umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status)
437 {
438 struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
439 struct scsipi_xfer *xs = priv;
440 struct scsipi_periph *periph = xs->xs_periph;
441 int cmdlen;
442 int s;
443 #ifdef UMASS_DEBUG
444 struct timeval tv;
445 u_int delta;
446 microtime(&tv);
447 delta = (tv.tv_sec - sc->tv.tv_sec) * 1000000 + tv.tv_usec - sc->tv.tv_usec;
448 #endif
449
450 DPRINTF(UDMASS_CMD,("umass_scsipi_cb: at %lu.%06lu, delta=%u: xs=%p residue=%d"
451 " status=%d\n", tv.tv_sec, tv.tv_usec, delta, xs, residue, status));
452
453 xs->resid = residue;
454
455 switch (status) {
456 case STATUS_CMD_OK:
457 xs->error = XS_NOERROR;
458 break;
459
460 case STATUS_CMD_UNKNOWN:
461 /* we can't issue REQUEST SENSE */
462 if (xs->xs_periph->periph_quirks & PQUIRK_NOSENSE) {
463 /*
464 * If no residue and no other USB error,
465 * command succeeded.
466 */
467 if (residue == 0) {
468 xs->error = XS_NOERROR;
469 break;
470 }
471
472 /*
473 * Some devices return a short INQUIRY
474 * response, omitting response data from the
475 * "vendor specific data" on...
476 */
477 if (xs->cmd->opcode == INQUIRY &&
478 residue < xs->datalen) {
479 xs->error = XS_NOERROR;
480 break;
481 }
482
483 xs->error = XS_DRIVER_STUFFUP;
484 break;
485 }
486 /* FALLTHROUGH */
487 case STATUS_CMD_FAILED:
488 /* fetch sense data */
489 sc->sc_sense = 1;
490 memset(&scbus->sc_sense_cmd, 0, sizeof(scbus->sc_sense_cmd));
491 scbus->sc_sense_cmd.opcode = REQUEST_SENSE;
492 scbus->sc_sense_cmd.byte2 = periph->periph_lun <<
493 SCSI_CMD_LUN_SHIFT;
494 scbus->sc_sense_cmd.length = sizeof(xs->sense);
495
496 cmdlen = sizeof(scbus->sc_sense_cmd);
497 if (sc->sc_cmd == UMASS_CPROTO_UFI) /* XXX */
498 cmdlen = UFI_COMMAND_LENGTH;
499 sc->sc_methods->wire_xfer(sc, periph->periph_lun,
500 &scbus->sc_sense_cmd, cmdlen,
501 &xs->sense, sizeof(xs->sense),
502 DIR_IN, xs->timeout,
503 umass_scsipi_sense_cb, xs);
504 return;
505
506 case STATUS_WIRE_FAILED:
507 xs->error = XS_RESET;
508 break;
509
510 default:
511 panic("%s: Unknown status %d in umass_scsipi_cb",
512 USBDEVNAME(sc->sc_dev), status);
513 }
514
515 DPRINTF(UDMASS_CMD,("umass_scsipi_cb: at %lu.%06lu: return xs->error="
516 "%d, xs->xs_status=0x%x xs->resid=%d\n",
517 tv.tv_sec, tv.tv_usec,
518 xs->error, xs->xs_status, xs->resid));
519
520 s = splbio();
521 scsipi_done(xs);
522 splx(s);
523 }
524
525 /*
526 * Finalise a completed autosense operation
527 */
528 Static void
529 umass_scsipi_sense_cb(struct umass_softc *sc, void *priv, int residue,
530 int status)
531 {
532 struct scsipi_xfer *xs = priv;
533 int s;
534
535 DPRINTF(UDMASS_CMD,("umass_scsipi_sense_cb: xs=%p residue=%d "
536 "status=%d\n", xs, residue, status));
537
538 sc->sc_sense = 0;
539 switch (status) {
540 case STATUS_CMD_OK:
541 case STATUS_CMD_UNKNOWN:
542 /* getting sense data succeeded */
543 if (residue == 0 || residue == 14)/* XXX */
544 xs->error = XS_SENSE;
545 else
546 xs->error = XS_SHORTSENSE;
547 break;
548 default:
549 DPRINTF(UDMASS_SCSI, ("%s: Autosense failed, status %d\n",
550 USBDEVNAME(sc->sc_dev), status));
551 xs->error = XS_DRIVER_STUFFUP;
552 break;
553 }
554
555 xs->xs_status |= XS_STS_DONE;
556
557 DPRINTF(UDMASS_CMD,("umass_scsipi_sense_cb: return xs->error=%d, "
558 "xs->xs_status=0x%x xs->resid=%d\n", xs->error, xs->xs_status,
559 xs->resid));
560
561 s = splbio();
562 scsipi_done(xs);
563 splx(s);
564 }
565
566 #if NATAPIBUS > 0
567 Static void
568 umass_atapi_probe_device(struct atapibus_softc *atapi, int target)
569 {
570 struct scsipi_channel *chan = atapi->sc_channel;
571 struct scsipi_periph *periph;
572 struct scsipibus_attach_args sa;
573 char vendor[33], product[65], revision[17];
574 struct scsipi_inquiry_data inqbuf;
575
576 DPRINTF(UDMASS_SCSI,("umass_atapi_probe_device: atapi=%p target=%d\n",
577 atapi, target));
578
579 if (target != UMASS_ATAPI_DRIVE) /* only probe drive 0 */
580 return;
581
582 /* skip if already attached */
583 if (scsipi_lookup_periph(chan, target, 0) != NULL)
584 return;
585
586 periph = scsipi_alloc_periph(M_NOWAIT);
587 if (periph == NULL) {
588 printf("%s: can't allocate link for drive %d\n",
589 atapi->sc_dev.dv_xname, target);
590 return;
591 }
592
593 DIF(UDMASS_UPPER, periph->periph_dbflags |= 1); /* XXX 1 */
594 periph->periph_channel = chan;
595 periph->periph_switch = &atapi_probe_periphsw;
596 periph->periph_target = target;
597 periph->periph_quirks = chan->chan_defquirks;
598
599 DPRINTF(UDMASS_SCSI, ("umass_atapi_probe_device: doing inquiry\n"));
600 /* Now go ask the device all about itself. */
601 memset(&inqbuf, 0, sizeof(inqbuf));
602 if (scsipi_inquire(periph, &inqbuf,
603 XS_CTL_DISCOVERY | XS_CTL_DATA_ONSTACK) != 0) {
604 DPRINTF(UDMASS_SCSI, ("umass_atapi_probe_device: "
605 "scsipi_inquire failed\n"));
606 free(periph, M_DEVBUF);
607 return;
608 }
609
610 scsipi_strvis(vendor, 33, inqbuf.vendor, 8);
611 scsipi_strvis(product, 65, inqbuf.product, 16);
612 scsipi_strvis(revision, 17, inqbuf.revision, 4);
613
614 sa.sa_periph = periph;
615 sa.sa_inqbuf.type = inqbuf.device;
616 sa.sa_inqbuf.removable = inqbuf.dev_qual2 & SID_REMOVABLE ?
617 T_REMOV : T_FIXED;
618 if (sa.sa_inqbuf.removable)
619 periph->periph_flags |= PERIPH_REMOVABLE;
620 sa.sa_inqbuf.vendor = vendor;
621 sa.sa_inqbuf.product = product;
622 sa.sa_inqbuf.revision = revision;
623 sa.sa_inqptr = NULL;
624
625 DPRINTF(UDMASS_SCSI, ("umass_atapi_probedev: doing atapi_probedev on "
626 "'%s' '%s' '%s'\n", vendor, product, revision));
627 atapi_probe_device(atapi, target, periph, &sa);
628 /* atapi_probe_device() frees the periph when there is no device.*/
629 }
630 #endif
631