scsiconf.c revision 1.102.2.2 1 1.102.2.2 eeh /* $NetBSD: scsiconf.c,v 1.102.2.2 1998/08/08 03:06:51 eeh Exp $ */
2 1.102.2.2 eeh
3 1.102.2.2 eeh /*
4 1.102.2.2 eeh * Copyright (c) 1994 Charles Hannum. All rights reserved.
5 1.102.2.2 eeh *
6 1.102.2.2 eeh * Redistribution and use in source and binary forms, with or without
7 1.102.2.2 eeh * modification, are permitted provided that the following conditions
8 1.102.2.2 eeh * are met:
9 1.102.2.2 eeh * 1. Redistributions of source code must retain the above copyright
10 1.102.2.2 eeh * notice, this list of conditions and the following disclaimer.
11 1.102.2.2 eeh * 2. Redistributions in binary form must reproduce the above copyright
12 1.102.2.2 eeh * notice, this list of conditions and the following disclaimer in the
13 1.102.2.2 eeh * documentation and/or other materials provided with the distribution.
14 1.102.2.2 eeh * 3. All advertising materials mentioning features or use of this software
15 1.102.2.2 eeh * must display the following acknowledgement:
16 1.102.2.2 eeh * This product includes software developed by Charles Hannum.
17 1.102.2.2 eeh * 4. The name of the author may not be used to endorse or promote products
18 1.102.2.2 eeh * derived from this software without specific prior written permission.
19 1.102.2.2 eeh *
20 1.102.2.2 eeh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.102.2.2 eeh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.102.2.2 eeh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.102.2.2 eeh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.102.2.2 eeh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.102.2.2 eeh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.102.2.2 eeh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.102.2.2 eeh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.102.2.2 eeh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.102.2.2 eeh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.102.2.2 eeh */
31 1.102.2.2 eeh
32 1.102.2.2 eeh /*
33 1.102.2.2 eeh * Originally written by Julian Elischer (julian (at) tfs.com)
34 1.102.2.2 eeh * for TRW Financial Systems for use under the MACH(2.5) operating system.
35 1.102.2.2 eeh *
36 1.102.2.2 eeh * TRW Financial Systems, in accordance with their agreement with Carnegie
37 1.102.2.2 eeh * Mellon University, makes this software available to CMU to distribute
38 1.102.2.2 eeh * or use in any manner that they see fit as long as this message is kept with
39 1.102.2.2 eeh * the software. For this reason TFS also grants any other persons or
40 1.102.2.2 eeh * organisations permission to use or modify this software.
41 1.102.2.2 eeh *
42 1.102.2.2 eeh * TFS supplies this software to be publicly redistributed
43 1.102.2.2 eeh * on the understanding that TFS is not responsible for the correct
44 1.102.2.2 eeh * functioning of this software in any circumstances.
45 1.102.2.2 eeh *
46 1.102.2.2 eeh * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
47 1.102.2.2 eeh */
48 1.102.2.2 eeh
49 1.102.2.2 eeh #include <sys/types.h>
50 1.102.2.2 eeh #include <sys/param.h>
51 1.102.2.2 eeh #include <sys/systm.h>
52 1.102.2.2 eeh #include <sys/malloc.h>
53 1.102.2.2 eeh #include <sys/device.h>
54 1.102.2.2 eeh
55 1.102.2.2 eeh #include <dev/scsipi/scsi_all.h>
56 1.102.2.2 eeh #include <dev/scsipi/scsipi_all.h>
57 1.102.2.2 eeh #include <dev/scsipi/scsiconf.h>
58 1.102.2.2 eeh
59 1.102.2.2 eeh #include "locators.h"
60 1.102.2.2 eeh
61 1.102.2.2 eeh #if 0
62 1.102.2.2 eeh #if NCALS > 0
63 1.102.2.2 eeh { T_PROCESSOR, T_FIXED, 1,
64 1.102.2.2 eeh 0, 0, 0 },
65 1.102.2.2 eeh #endif /* NCALS */
66 1.102.2.2 eeh #if NBLL > 0
67 1.102.2.2 eeh { T_PROCESSOR, T_FIXED, 1,
68 1.102.2.2 eeh "AEG ", "READER ", "V1.0" },
69 1.102.2.2 eeh #endif /* NBLL */
70 1.102.2.2 eeh #if NKIL > 0
71 1.102.2.2 eeh { T_SCANNER, T_FIXED, 0,
72 1.102.2.2 eeh "KODAK ", "IL Scanner 900 ", 0 },
73 1.102.2.2 eeh #endif /* NKIL */
74 1.102.2.2 eeh #endif
75 1.102.2.2 eeh
76 1.102.2.2 eeh /*
77 1.102.2.2 eeh * Declarations
78 1.102.2.2 eeh */
79 1.102.2.2 eeh void scsi_probedev __P((struct scsibus_softc *, int, int));
80 1.102.2.2 eeh int scsi_probe_bus __P((int bus, int target, int lun));
81 1.102.2.2 eeh
82 1.102.2.2 eeh struct scsipi_device probe_switch = {
83 1.102.2.2 eeh NULL,
84 1.102.2.2 eeh NULL,
85 1.102.2.2 eeh NULL,
86 1.102.2.2 eeh NULL,
87 1.102.2.2 eeh };
88 1.102.2.2 eeh
89 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
90 1.102.2.2 eeh int scsibusmatch __P((struct device *, void *, void *));
91 1.102.2.2 eeh #else
92 1.102.2.2 eeh int scsibusmatch __P((struct device *, struct cfdata *, void *));
93 1.102.2.2 eeh #endif
94 1.102.2.2 eeh void scsibusattach __P((struct device *, struct device *, void *));
95 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
96 1.102.2.2 eeh int scsibussubmatch __P((struct device *, void *, void *));
97 1.102.2.2 eeh #else
98 1.102.2.2 eeh int scsibussubmatch __P((struct device *, struct cfdata *, void *));
99 1.102.2.2 eeh #endif
100 1.102.2.2 eeh
101 1.102.2.2 eeh struct cfattach scsibus_ca = {
102 1.102.2.2 eeh sizeof(struct scsibus_softc), scsibusmatch, scsibusattach
103 1.102.2.2 eeh };
104 1.102.2.2 eeh
105 1.102.2.2 eeh extern struct cfdriver scsibus_cd;
106 1.102.2.2 eeh
107 1.102.2.2 eeh int scsibusprint __P((void *, const char *));
108 1.102.2.2 eeh
109 1.102.2.2 eeh
110 1.102.2.2 eeh int
111 1.102.2.2 eeh scsiprint(aux, pnp)
112 1.102.2.2 eeh void *aux;
113 1.102.2.2 eeh const char *pnp;
114 1.102.2.2 eeh {
115 1.102.2.2 eeh struct scsipi_link *l = aux;
116 1.102.2.2 eeh
117 1.102.2.2 eeh /* only "scsibus"es can attach to "scsi"s; easy. */
118 1.102.2.2 eeh if (pnp)
119 1.102.2.2 eeh printf("scsibus at %s", pnp);
120 1.102.2.2 eeh
121 1.102.2.2 eeh /* don't print channel if the controller says there can be only one. */
122 1.102.2.2 eeh if (l->scsipi_scsi.channel != SCSI_CHANNEL_ONLY_ONE)
123 1.102.2.2 eeh printf(" channel %d", l->scsipi_scsi.channel);
124 1.102.2.2 eeh
125 1.102.2.2 eeh return (UNCONF);
126 1.102.2.2 eeh }
127 1.102.2.2 eeh
128 1.102.2.2 eeh int
129 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
130 1.102.2.2 eeh scsibusmatch(parent, match, aux)
131 1.102.2.2 eeh #else
132 1.102.2.2 eeh scsibusmatch(parent, cf, aux)
133 1.102.2.2 eeh #endif
134 1.102.2.2 eeh struct device *parent;
135 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
136 1.102.2.2 eeh void *match;
137 1.102.2.2 eeh #else
138 1.102.2.2 eeh struct cfdata *cf;
139 1.102.2.2 eeh #endif
140 1.102.2.2 eeh void *aux;
141 1.102.2.2 eeh {
142 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
143 1.102.2.2 eeh struct cfdata *cf = match;
144 1.102.2.2 eeh #endif
145 1.102.2.2 eeh struct scsipi_link *l = aux;
146 1.102.2.2 eeh int channel;
147 1.102.2.2 eeh
148 1.102.2.2 eeh /*
149 1.102.2.2 eeh * Allow single-channel controllers to specify their channel
150 1.102.2.2 eeh * in a special way, so that it's not printed.
151 1.102.2.2 eeh */
152 1.102.2.2 eeh channel = (l->scsipi_scsi.channel != SCSI_CHANNEL_ONLY_ONE) ?
153 1.102.2.2 eeh l->scsipi_scsi.channel : 0;
154 1.102.2.2 eeh
155 1.102.2.2 eeh if (cf->cf_loc[SCSICF_CHANNEL] != channel &&
156 1.102.2.2 eeh cf->cf_loc[SCSICF_CHANNEL] != SCSICF_CHANNEL_DEFAULT)
157 1.102.2.2 eeh return (0);
158 1.102.2.2 eeh
159 1.102.2.2 eeh return (1);
160 1.102.2.2 eeh }
161 1.102.2.2 eeh
162 1.102.2.2 eeh /*
163 1.102.2.2 eeh * The routine called by the adapter boards to get all their
164 1.102.2.2 eeh * devices configured in.
165 1.102.2.2 eeh */
166 1.102.2.2 eeh void
167 1.102.2.2 eeh scsibusattach(parent, self, aux)
168 1.102.2.2 eeh struct device *parent, *self;
169 1.102.2.2 eeh void *aux;
170 1.102.2.2 eeh {
171 1.102.2.2 eeh struct scsibus_softc *sb = (struct scsibus_softc *)self;
172 1.102.2.2 eeh struct scsipi_link *sc_link_proto = aux;
173 1.102.2.2 eeh size_t nbytes;
174 1.102.2.2 eeh int i;
175 1.102.2.2 eeh
176 1.102.2.2 eeh sc_link_proto->scsipi_scsi.scsibus = sb->sc_dev.dv_unit;
177 1.102.2.2 eeh sc_link_proto->scsipi_cmd = scsi_scsipi_cmd;
178 1.102.2.2 eeh sc_link_proto->scsipi_interpret_sense = scsi_interpret_sense;
179 1.102.2.2 eeh sc_link_proto->sc_print_addr = scsi_print_addr;
180 1.102.2.2 eeh
181 1.102.2.2 eeh sb->adapter_link = sc_link_proto;
182 1.102.2.2 eeh sb->sc_maxtarget = sc_link_proto->scsipi_scsi.max_target;
183 1.102.2.2 eeh printf(": %d targets\n", sb->sc_maxtarget + 1);
184 1.102.2.2 eeh
185 1.102.2.2 eeh /* Initialize shared data. */
186 1.102.2.2 eeh scsipi_init();
187 1.102.2.2 eeh
188 1.102.2.2 eeh nbytes = sb->sc_maxtarget * sizeof(struct scsipi_link **);
189 1.102.2.2 eeh sb->sc_link = (struct scsipi_link ***)malloc(nbytes, M_DEVBUF,
190 1.102.2.2 eeh M_NOWAIT);
191 1.102.2.2 eeh if (sb->sc_link == NULL)
192 1.102.2.2 eeh panic("scsibusattach: can't allocate target links");
193 1.102.2.2 eeh
194 1.102.2.2 eeh nbytes = 8 * sizeof(struct scsipi_link *);
195 1.102.2.2 eeh for (i = 0; i <= sb->sc_maxtarget; i++) {
196 1.102.2.2 eeh sb->sc_link[i] = (struct scsipi_link **)malloc(nbytes,
197 1.102.2.2 eeh M_DEVBUF, M_NOWAIT);
198 1.102.2.2 eeh if (sb->sc_link[i] == NULL)
199 1.102.2.2 eeh panic("scsibusattach: can't allocate lun links");
200 1.102.2.2 eeh bzero(sb->sc_link[i], nbytes);
201 1.102.2.2 eeh }
202 1.102.2.2 eeh
203 1.102.2.2 eeh #if defined(SCSI_DELAY) && SCSI_DELAY > 2
204 1.102.2.2 eeh printf("%s: waiting for scsi devices to settle\n",
205 1.102.2.2 eeh sb->sc_dev.dv_xname);
206 1.102.2.2 eeh #else /* SCSI_DELAY > 2 */
207 1.102.2.2 eeh #undef SCSI_DELAY
208 1.102.2.2 eeh #define SCSI_DELAY 2
209 1.102.2.2 eeh #endif /* SCSI_DELAY */
210 1.102.2.2 eeh delay(1000000 * SCSI_DELAY);
211 1.102.2.2 eeh
212 1.102.2.2 eeh scsi_probe_bus(sb->sc_dev.dv_unit, -1, -1);
213 1.102.2.2 eeh }
214 1.102.2.2 eeh
215 1.102.2.2 eeh int
216 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
217 1.102.2.2 eeh scsibussubmatch(parent, match, aux)
218 1.102.2.2 eeh #else
219 1.102.2.2 eeh scsibussubmatch(parent, cf, aux)
220 1.102.2.2 eeh #endif
221 1.102.2.2 eeh struct device *parent;
222 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
223 1.102.2.2 eeh void *match;
224 1.102.2.2 eeh #else
225 1.102.2.2 eeh struct cfdata *cf;
226 1.102.2.2 eeh #endif
227 1.102.2.2 eeh void *aux;
228 1.102.2.2 eeh {
229 1.102.2.2 eeh #ifdef __BROKEN_INDIRECT_CONFIG
230 1.102.2.2 eeh struct cfdata *cf = match;
231 1.102.2.2 eeh #endif
232 1.102.2.2 eeh struct scsipibus_attach_args *sa = aux;
233 1.102.2.2 eeh struct scsipi_link *sc_link = sa->sa_sc_link;
234 1.102.2.2 eeh
235 1.102.2.2 eeh if (cf->cf_loc[SCSIBUSCF_TARGET] != SCSIBUSCF_TARGET_DEFAULT &&
236 1.102.2.2 eeh cf->cf_loc[SCSIBUSCF_TARGET] != sc_link->scsipi_scsi.target)
237 1.102.2.2 eeh return (0);
238 1.102.2.2 eeh if (cf->cf_loc[SCSIBUSCF_LUN] != SCSIBUSCF_LUN_DEFAULT &&
239 1.102.2.2 eeh cf->cf_loc[SCSIBUSCF_LUN] != sc_link->scsipi_scsi.lun)
240 1.102.2.2 eeh return (0);
241 1.102.2.2 eeh return ((*cf->cf_attach->ca_match)(parent, cf, aux));
242 1.102.2.2 eeh }
243 1.102.2.2 eeh
244 1.102.2.2 eeh /*
245 1.102.2.2 eeh * Probe the requested scsi bus. It must be already set up.
246 1.102.2.2 eeh * -1 requests all set up scsi busses.
247 1.102.2.2 eeh * target and lun optionally narrow the search if not -1
248 1.102.2.2 eeh */
249 1.102.2.2 eeh int
250 1.102.2.2 eeh scsi_probe_busses(bus, target, lun)
251 1.102.2.2 eeh int bus, target, lun;
252 1.102.2.2 eeh {
253 1.102.2.2 eeh
254 1.102.2.2 eeh if (bus == -1) {
255 1.102.2.2 eeh for (bus = 0; bus < scsibus_cd.cd_ndevs; bus++)
256 1.102.2.2 eeh if (scsibus_cd.cd_devs[bus])
257 1.102.2.2 eeh scsi_probe_bus(bus, target, lun);
258 1.102.2.2 eeh return (0);
259 1.102.2.2 eeh } else
260 1.102.2.2 eeh return (scsi_probe_bus(bus, target, lun));
261 1.102.2.2 eeh }
262 1.102.2.2 eeh
263 1.102.2.2 eeh /*
264 1.102.2.2 eeh * Probe the requested scsi bus. It must be already set up.
265 1.102.2.2 eeh * target and lun optionally narrow the search if not -1
266 1.102.2.2 eeh */
267 1.102.2.2 eeh int
268 1.102.2.2 eeh scsi_probe_bus(bus, target, lun)
269 1.102.2.2 eeh int bus, target, lun;
270 1.102.2.2 eeh {
271 1.102.2.2 eeh struct scsibus_softc *scsi;
272 1.102.2.2 eeh int maxtarget, mintarget, maxlun, minlun;
273 1.102.2.2 eeh u_int8_t scsi_addr;
274 1.102.2.2 eeh
275 1.102.2.2 eeh if (bus < 0 || bus >= scsibus_cd.cd_ndevs)
276 1.102.2.2 eeh return (ENXIO);
277 1.102.2.2 eeh scsi = scsibus_cd.cd_devs[bus];
278 1.102.2.2 eeh if (scsi == NULL)
279 1.102.2.2 eeh return (ENXIO);
280 1.102.2.2 eeh
281 1.102.2.2 eeh scsi_addr = scsi->adapter_link->scsipi_scsi.adapter_target;
282 1.102.2.2 eeh
283 1.102.2.2 eeh if (target == -1) {
284 1.102.2.2 eeh maxtarget = scsi->sc_maxtarget;
285 1.102.2.2 eeh mintarget = 0;
286 1.102.2.2 eeh } else {
287 1.102.2.2 eeh if (target < 0 || target > scsi->sc_maxtarget)
288 1.102.2.2 eeh return (EINVAL);
289 1.102.2.2 eeh maxtarget = mintarget = target;
290 1.102.2.2 eeh }
291 1.102.2.2 eeh
292 1.102.2.2 eeh if (lun == -1) {
293 1.102.2.2 eeh maxlun = 7;
294 1.102.2.2 eeh minlun = 0;
295 1.102.2.2 eeh } else {
296 1.102.2.2 eeh if (lun < 0 || lun > 7)
297 1.102.2.2 eeh return (EINVAL);
298 1.102.2.2 eeh maxlun = minlun = lun;
299 1.102.2.2 eeh }
300 1.102.2.2 eeh
301 1.102.2.2 eeh for (target = mintarget; target <= maxtarget; target++) {
302 1.102.2.2 eeh if (target == scsi_addr)
303 1.102.2.2 eeh continue;
304 1.102.2.2 eeh for (lun = minlun; lun <= maxlun; lun++) {
305 1.102.2.2 eeh /*
306 1.102.2.2 eeh * See if there's a device present, and configure it.
307 1.102.2.2 eeh */
308 1.102.2.2 eeh scsi_probedev(scsi, target, lun);
309 1.102.2.2 eeh if ((scsi->moreluns & (1 << target)) == 0)
310 1.102.2.2 eeh break;
311 1.102.2.2 eeh /* otherwise something says we should look further */
312 1.102.2.2 eeh }
313 1.102.2.2 eeh }
314 1.102.2.2 eeh return (0);
315 1.102.2.2 eeh }
316 1.102.2.2 eeh
317 1.102.2.2 eeh /*
318 1.102.2.2 eeh * Print out autoconfiguration information for a subdevice.
319 1.102.2.2 eeh *
320 1.102.2.2 eeh * This is a slight abuse of 'standard' autoconfiguration semantics,
321 1.102.2.2 eeh * because 'print' functions don't normally print the colon and
322 1.102.2.2 eeh * device information. However, in this case that's better than
323 1.102.2.2 eeh * either printing redundant information before the attach message,
324 1.102.2.2 eeh * or having the device driver call a special function to print out
325 1.102.2.2 eeh * the standard device information.
326 1.102.2.2 eeh */
327 1.102.2.2 eeh int
328 1.102.2.2 eeh scsibusprint(aux, pnp)
329 1.102.2.2 eeh void *aux;
330 1.102.2.2 eeh const char *pnp;
331 1.102.2.2 eeh {
332 1.102.2.2 eeh struct scsipibus_attach_args *sa = aux;
333 1.102.2.2 eeh struct scsipi_inquiry_pattern *inqbuf;
334 1.102.2.2 eeh u_int8_t type;
335 1.102.2.2 eeh char *dtype, *qtype;
336 1.102.2.2 eeh char vendor[33], product[65], revision[17];
337 1.102.2.2 eeh int target, lun;
338 1.102.2.2 eeh
339 1.102.2.2 eeh if (pnp != NULL)
340 1.102.2.2 eeh printf("%s", pnp);
341 1.102.2.2 eeh
342 1.102.2.2 eeh inqbuf = &sa->sa_inqbuf;
343 1.102.2.2 eeh
344 1.102.2.2 eeh target = sa->sa_sc_link->scsipi_scsi.target;
345 1.102.2.2 eeh lun = sa->sa_sc_link->scsipi_scsi.lun;
346 1.102.2.2 eeh
347 1.102.2.2 eeh type = inqbuf->type & SID_TYPE;
348 1.102.2.2 eeh
349 1.102.2.2 eeh /*
350 1.102.2.2 eeh * Figure out basic device type and qualifier.
351 1.102.2.2 eeh */
352 1.102.2.2 eeh dtype = 0;
353 1.102.2.2 eeh switch (inqbuf->type & SID_QUAL) {
354 1.102.2.2 eeh case SID_QUAL_LU_OK:
355 1.102.2.2 eeh qtype = "";
356 1.102.2.2 eeh break;
357 1.102.2.2 eeh
358 1.102.2.2 eeh case SID_QUAL_LU_OFFLINE:
359 1.102.2.2 eeh qtype = " offline";
360 1.102.2.2 eeh break;
361 1.102.2.2 eeh
362 1.102.2.2 eeh case SID_QUAL_RSVD:
363 1.102.2.2 eeh case SID_QUAL_BAD_LU:
364 1.102.2.2 eeh panic("scsibusprint: impossible qualifier");
365 1.102.2.2 eeh
366 1.102.2.2 eeh default:
367 1.102.2.2 eeh qtype = "";
368 1.102.2.2 eeh dtype = "vendor-unique";
369 1.102.2.2 eeh break;
370 1.102.2.2 eeh }
371 1.102.2.2 eeh if (dtype == 0)
372 1.102.2.2 eeh dtype = scsipi_dtype(type);
373 1.102.2.2 eeh
374 1.102.2.2 eeh scsipi_strvis(vendor, inqbuf->vendor, 8);
375 1.102.2.2 eeh scsipi_strvis(product, inqbuf->product, 16);
376 1.102.2.2 eeh scsipi_strvis(revision, inqbuf->revision, 4);
377 1.102.2.2 eeh
378 1.102.2.2 eeh printf(" targ %d lun %d: <%s, %s, %s> SCSI%d %d/%s %s%s",
379 1.102.2.2 eeh target, lun, vendor, product, revision,
380 1.102.2.2 eeh sa->scsipi_info.scsi_version & SID_ANSII, type, dtype,
381 1.102.2.2 eeh inqbuf->removable ? "removable" : "fixed", qtype);
382 1.102.2.2 eeh
383 1.102.2.2 eeh return (UNCONF);
384 1.102.2.2 eeh }
385 1.102.2.2 eeh
386 1.102.2.2 eeh struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
387 1.102.2.2 eeh {{T_CDROM, T_REMOV,
388 1.102.2.2 eeh "CHINON ", "CD-ROM CDS-431 ", ""}, SDEV_NOLUNS},
389 1.102.2.2 eeh {{T_CDROM, T_REMOV,
390 1.102.2.2 eeh "Chinon ", "CD-ROM CDS-525 ", ""}, SDEV_NOLUNS},
391 1.102.2.2 eeh {{T_CDROM, T_REMOV,
392 1.102.2.2 eeh "CHINON ", "CD-ROM CDS-535 ", ""}, SDEV_NOLUNS},
393 1.102.2.2 eeh {{T_CDROM, T_REMOV,
394 1.102.2.2 eeh "DEC ", "RRD42 (C) DEC ", ""}, SDEV_NOLUNS},
395 1.102.2.2 eeh {{T_CDROM, T_REMOV,
396 1.102.2.2 eeh "DENON ", "DRD-25X ", "V"}, SDEV_NOLUNS},
397 1.102.2.2 eeh {{T_CDROM, T_REMOV,
398 1.102.2.2 eeh "HP ", "C4324/C4325 ", ""}, SDEV_NOLUNS},
399 1.102.2.2 eeh {{T_CDROM, T_REMOV,
400 1.102.2.2 eeh "IMS ", "CDD521/10 ", "2.06"}, SDEV_NOLUNS},
401 1.102.2.2 eeh {{T_CDROM, T_REMOV,
402 1.102.2.2 eeh "MATSHITA", "CD-ROM CR-5XX ", "1.0b"}, SDEV_NOLUNS},
403 1.102.2.2 eeh {{T_CDROM, T_REMOV,
404 1.102.2.2 eeh "MEDAVIS ", "RENO CD-ROMX2A ", ""}, SDEV_NOLUNS},
405 1.102.2.2 eeh {{T_CDROM, T_REMOV,
406 1.102.2.2 eeh "MEDIAVIS", "CDR-H93MV ", "1.3"}, SDEV_NOLUNS},
407 1.102.2.2 eeh {{T_CDROM, T_REMOV,
408 1.102.2.2 eeh "NEC ", "CD-ROM DRIVE:55 ", ""}, SDEV_NOLUNS},
409 1.102.2.2 eeh {{T_CDROM, T_REMOV,
410 1.102.2.2 eeh "NEC ", "CD-ROM DRIVE:83 ", ""}, SDEV_NOLUNS},
411 1.102.2.2 eeh {{T_CDROM, T_REMOV,
412 1.102.2.2 eeh "NEC ", "CD-ROM DRIVE:84 ", ""}, SDEV_NOLUNS},
413 1.102.2.2 eeh {{T_CDROM, T_REMOV,
414 1.102.2.2 eeh "NEC ", "CD-ROM DRIVE:841", ""}, SDEV_NOLUNS},
415 1.102.2.2 eeh {{T_CDROM, T_REMOV,
416 1.102.2.2 eeh "PIONEER ", "CD-ROM DR-124X ", "1.01"}, SDEV_NOLUNS},
417 1.102.2.2 eeh {{T_CDROM, T_REMOV,
418 1.102.2.2 eeh "SONY ", "CD-ROM CDU-541 ", ""}, SDEV_NOLUNS},
419 1.102.2.2 eeh {{T_CDROM, T_REMOV,
420 1.102.2.2 eeh "SONY ", "CD-ROM CDU-55S ", ""}, SDEV_NOLUNS},
421 1.102.2.2 eeh {{T_CDROM, T_REMOV,
422 1.102.2.2 eeh "SONY ", "CD-ROM CDU-8003A", ""}, SDEV_NOLUNS},
423 1.102.2.2 eeh {{T_CDROM, T_REMOV,
424 1.102.2.2 eeh "SONY ", "CD-ROM CDU-8012 ", ""}, SDEV_NOLUNS},
425 1.102.2.2 eeh {{T_CDROM, T_REMOV,
426 1.102.2.2 eeh "TEAC ", "CD-ROM ", "1.06"}, SDEV_NOLUNS},
427 1.102.2.2 eeh {{T_CDROM, T_REMOV,
428 1.102.2.2 eeh "TEAC ", "CD-ROM CD-56S ", "1.0B"}, SDEV_NOLUNS},
429 1.102.2.2 eeh {{T_CDROM, T_REMOV,
430 1.102.2.2 eeh "TEXEL ", "CD-ROM ", "1.06"}, SDEV_NOLUNS},
431 1.102.2.2 eeh {{T_CDROM, T_REMOV,
432 1.102.2.2 eeh "TEXEL ", "CD-ROM DM-XX24 K", "1.10"}, SDEV_NOLUNS},
433 1.102.2.2 eeh {{T_CDROM, T_REMOV,
434 1.102.2.2 eeh "TOSHIBA ", "XM-4101TASUNSLCD", "1755"}, SDEV_NOLUNS},
435 1.102.2.2 eeh {{T_CDROM, T_REMOV,
436 1.102.2.2 eeh "ShinaKen", "CD-ROM DM-3x1S", "1.04"}, SDEV_NOLUNS},
437 1.102.2.2 eeh {{T_CDROM, T_REMOV,
438 1.102.2.2 eeh "JVC ", "R2626 ", "1.55"}, SDEV_NOLUNS},
439 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
440 1.102.2.2 eeh "MICROP ", "1588-15MBSUN0669", ""}, SDEV_AUTOSAVE},
441 1.102.2.2 eeh {{T_OPTICAL, T_REMOV,
442 1.102.2.2 eeh "EPSON ", "OMD-5010 ", "3.08"}, SDEV_NOLUNS},
443 1.102.2.2 eeh
444 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
445 1.102.2.2 eeh "DEC ", "RZ55 (C) DEC", ""}, SDEV_AUTOSAVE},
446 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
447 1.102.2.2 eeh "EMULEX ", "MD21/S2 ESDI", "A00"}, SDEV_FORCELUNS|SDEV_AUTOSAVE},
448 1.102.2.2 eeh /* Gives non-media hardware failure in response to start-unit command */
449 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
450 1.102.2.2 eeh "HITACHI", "DK515C", "CP16"}, SDEV_NOSTARTUNIT},
451 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
452 1.102.2.2 eeh "HITACHI", "DK515C", "CP15"}, SDEV_NOSTARTUNIT},
453 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
454 1.102.2.2 eeh "IBMRAID ", "0662S", ""}, SDEV_AUTOSAVE},
455 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
456 1.102.2.2 eeh "IBM ", "0663H", ""}, SDEV_AUTOSAVE},
457 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
458 1.102.2.2 eeh "IBM", "0664", ""}, SDEV_AUTOSAVE},
459 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
460 1.102.2.2 eeh "IBM ", "H3171-S2", ""}, SDEV_NOLUNS|SDEV_AUTOSAVE},
461 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
462 1.102.2.2 eeh "IBM ", "KZ-C", ""}, SDEV_AUTOSAVE},
463 1.102.2.2 eeh /* Broken IBM disk */
464 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
465 1.102.2.2 eeh "" , "DFRSS2F", ""}, SDEV_AUTOSAVE},
466 1.102.2.2 eeh {{T_DIRECT, T_REMOV,
467 1.102.2.2 eeh "MPL ", "MC-DISK- ", ""}, SDEV_NOLUNS},
468 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
469 1.102.2.2 eeh "MAXTOR ", "XT-3280 ", ""}, SDEV_NOLUNS},
470 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
471 1.102.2.2 eeh "MAXTOR ", "XT-4380S ", ""}, SDEV_NOLUNS},
472 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
473 1.102.2.2 eeh "MAXTOR ", "MXT-1240S ", ""}, SDEV_NOLUNS},
474 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
475 1.102.2.2 eeh "MAXTOR ", "XT-4170S ", ""}, SDEV_NOLUNS},
476 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
477 1.102.2.2 eeh "MAXTOR ", "XT-8760S", ""}, SDEV_NOLUNS},
478 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
479 1.102.2.2 eeh "MAXTOR ", "LXT-213S ", ""}, SDEV_NOLUNS},
480 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
481 1.102.2.2 eeh "MAXTOR ", "LXT-213S SUN0207", ""}, SDEV_NOLUNS},
482 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
483 1.102.2.2 eeh "MAXTOR ", "LXT-200S ", ""}, SDEV_NOLUNS},
484 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
485 1.102.2.2 eeh "MEGADRV ", "EV1000", ""}, SDEV_NOMODESENSE},
486 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
487 1.102.2.2 eeh "MST ", "SnapLink ", ""}, SDEV_NOLUNS},
488 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
489 1.102.2.2 eeh "NEC ", "D3847 ", "0307"}, SDEV_NOLUNS},
490 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
491 1.102.2.2 eeh "QUANTUM ", "ELS85S ", ""}, SDEV_AUTOSAVE},
492 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
493 1.102.2.2 eeh "QUANTUM ", "LPS525S ", ""}, SDEV_NOLUNS},
494 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
495 1.102.2.2 eeh "QUANTUM ", "P105S 910-10-94x", ""}, SDEV_NOLUNS},
496 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
497 1.102.2.2 eeh "QUANTUM ", "PD1225S ", ""}, SDEV_NOLUNS},
498 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
499 1.102.2.2 eeh "QUANTUM ", "PD210S SUN0207", ""}, SDEV_NOLUNS},
500 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
501 1.102.2.2 eeh "RODIME ", "RO3000S ", ""}, SDEV_NOLUNS},
502 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
503 1.102.2.2 eeh "SEAGATE ", "ST125N ", ""}, SDEV_NOLUNS},
504 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
505 1.102.2.2 eeh "SEAGATE ", "ST157N ", ""}, SDEV_NOLUNS},
506 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
507 1.102.2.2 eeh "SEAGATE ", "ST296 ", ""}, SDEV_NOLUNS},
508 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
509 1.102.2.2 eeh "SEAGATE ", "ST296N ", ""}, SDEV_NOLUNS},
510 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
511 1.102.2.2 eeh "SEAGATE ", "ST19171FC", ""}, SDEV_NOMODESENSE},
512 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
513 1.102.2.2 eeh "SEAGATE ", "ST34501FC ", ""}, SDEV_NOMODESENSE},
514 1.102.2.2 eeh {{T_DIRECT, T_FIXED,
515 1.102.2.2 eeh "TOSHIBA ", "MK538FB ", "6027"}, SDEV_NOLUNS},
516 1.102.2.2 eeh {{T_DIRECT, T_REMOV,
517 1.102.2.2 eeh "iomega", "jaz 1GB", ""}, SDEV_NOMODESENSE},
518 1.102.2.2 eeh {{T_DIRECT, T_REMOV,
519 1.102.2.2 eeh "IOMEGA", "ZIP 100", ""}, SDEV_NOMODESENSE},
520 1.102.2.2 eeh /* Letting the motor run kills floppy drives and disks quite fast. */
521 1.102.2.2 eeh {{T_DIRECT, T_REMOV,
522 1.102.2.2 eeh "TEAC", "FC-1", ""}, SDEV_NOSTARTUNIT},
523 1.102.2.2 eeh
524 1.102.2.2 eeh /* XXX: QIC-36 tape behind Emulex adapter. Very broken. */
525 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
526 1.102.2.2 eeh " ", " ", " "}, SDEV_NOLUNS},
527 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
528 1.102.2.2 eeh "CALIPER ", "CP150 ", ""}, SDEV_NOLUNS},
529 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
530 1.102.2.2 eeh "EXABYTE ", "EXB-8200 ", ""}, SDEV_NOLUNS},
531 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
532 1.102.2.2 eeh "SONY ", "GY-10C ", ""}, SDEV_NOLUNS},
533 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
534 1.102.2.2 eeh "SONY ", "SDT-2000 ", "2.09"}, SDEV_NOLUNS},
535 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
536 1.102.2.2 eeh "SONY ", "SDT-5000 ", "3."}, SDEV_NOSYNCWIDE},
537 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
538 1.102.2.2 eeh "SONY ", "SDT-5200 ", "3."}, SDEV_NOLUNS},
539 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
540 1.102.2.2 eeh "TANDBERG", " TDC 3600 ", ""}, SDEV_NOLUNS},
541 1.102.2.2 eeh /* Following entry reported as a Tandberg 3600; ref. PR1933 */
542 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
543 1.102.2.2 eeh "ARCHIVE ", "VIPER 150 21247", ""}, SDEV_NOLUNS},
544 1.102.2.2 eeh /* Following entry for a Cipher ST150S; ref. PR4171 */
545 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
546 1.102.2.2 eeh "ARCHIVE ", "VIPER 1500 21247", "2.2G"}, SDEV_NOLUNS},
547 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
548 1.102.2.2 eeh "ARCHIVE ", "Python 28454-XXX", ""}, SDEV_NOLUNS},
549 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
550 1.102.2.2 eeh "WANGTEK ", "5099ES SCSI", ""}, SDEV_NOLUNS},
551 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
552 1.102.2.2 eeh "WANGTEK ", "5150ES SCSI", ""}, SDEV_NOLUNS},
553 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
554 1.102.2.2 eeh "WangDAT ", "Model 1300 ", "02.4"}, SDEV_NOSYNCWIDE},
555 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
556 1.102.2.2 eeh "WangDAT ", "Model 2600 ", "01.7"}, SDEV_NOSYNCWIDE},
557 1.102.2.2 eeh {{T_SEQUENTIAL, T_REMOV,
558 1.102.2.2 eeh "WangDAT ", "Model 3200 ", "02.2"}, SDEV_NOSYNCWIDE},
559 1.102.2.2 eeh
560 1.102.2.2 eeh {{T_SCANNER, T_FIXED,
561 1.102.2.2 eeh "RICOH ", "IS60 ", "1R08"}, SDEV_NOLUNS},
562 1.102.2.2 eeh {{T_SCANNER, T_FIXED,
563 1.102.2.2 eeh "UMAX ", "Astra 1200S ", "V2.9"}, SDEV_NOLUNS},
564 1.102.2.2 eeh {{T_SCANNER, T_FIXED,
565 1.102.2.2 eeh "UMAX ", "Astra 1220S ", "V1.2"}, SDEV_NOLUNS},
566 1.102.2.2 eeh {{T_SCANNER, T_FIXED,
567 1.102.2.2 eeh "UMAX ", "UMAX S-6E ", "V2.0"}, SDEV_NOLUNS},
568 1.102.2.2 eeh {{T_SCANNER, T_FIXED,
569 1.102.2.2 eeh "UMAX ", "UMAX S-12 ", "V2.1"}, SDEV_NOLUNS},
570 1.102.2.2 eeh
571 1.102.2.2 eeh {{T_PROCESSOR, T_FIXED,
572 1.102.2.2 eeh "LITRONIC", "PCMCIA ", ""}, SDEV_NOLUNS},
573 1.102.2.2 eeh };
574 1.102.2.2 eeh
575 1.102.2.2 eeh /*
576 1.102.2.2 eeh * given a target and lun, ask the device what
577 1.102.2.2 eeh * it is, and find the correct driver table
578 1.102.2.2 eeh * entry.
579 1.102.2.2 eeh */
580 1.102.2.2 eeh void
581 1.102.2.2 eeh scsi_probedev(scsi, target, lun)
582 1.102.2.2 eeh struct scsibus_softc *scsi;
583 1.102.2.2 eeh int target, lun;
584 1.102.2.2 eeh {
585 1.102.2.2 eeh struct scsipi_link *sc_link;
586 1.102.2.2 eeh static struct scsipi_inquiry_data inqbuf;
587 1.102.2.2 eeh struct scsi_quirk_inquiry_pattern *finger;
588 1.102.2.2 eeh int checkdtype, priority;
589 1.102.2.2 eeh struct scsipibus_attach_args sa;
590 1.102.2.2 eeh struct cfdata *cf;
591 1.102.2.2 eeh
592 1.102.2.2 eeh /* Skip this slot if it is already attached. */
593 1.102.2.2 eeh if (scsi->sc_link[target][lun] != NULL)
594 1.102.2.2 eeh return;
595 1.102.2.2 eeh
596 1.102.2.2 eeh sc_link = malloc(sizeof(*sc_link), M_DEVBUF, M_NOWAIT);
597 1.102.2.2 eeh *sc_link = *scsi->adapter_link;
598 1.102.2.2 eeh sc_link->scsipi_scsi.target = target;
599 1.102.2.2 eeh sc_link->scsipi_scsi.lun = lun;
600 1.102.2.2 eeh sc_link->device = &probe_switch;
601 1.102.2.2 eeh
602 1.102.2.2 eeh /*
603 1.102.2.2 eeh * Ask the device what it is
604 1.102.2.2 eeh */
605 1.102.2.2 eeh #if defined(SCSIDEBUG) && DEBUGTYPE == BUS_SCSI
606 1.102.2.2 eeh if (target == DEBUGTARGET && lun == DEBUGLUN)
607 1.102.2.2 eeh sc_link->flags |= DEBUGLEVEL;
608 1.102.2.2 eeh #endif /* SCSIDEBUG */
609 1.102.2.2 eeh
610 1.102.2.2 eeh (void) scsipi_test_unit_ready(sc_link,
611 1.102.2.2 eeh SCSI_AUTOCONF | SCSI_IGNORE_ILLEGAL_REQUEST |
612 1.102.2.2 eeh SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);
613 1.102.2.2 eeh
614 1.102.2.2 eeh #ifdef SCSI_2_DEF
615 1.102.2.2 eeh /* some devices need to be told to go to SCSI2 */
616 1.102.2.2 eeh /* However some just explode if you tell them this.. leave it out */
617 1.102.2.2 eeh scsi_change_def(sc_link, SCSI_AUTOCONF | SCSI_SILENT);
618 1.102.2.2 eeh #endif /* SCSI_2_DEF */
619 1.102.2.2 eeh
620 1.102.2.2 eeh /* Now go ask the device all about itself. */
621 1.102.2.2 eeh bzero(&inqbuf, sizeof(inqbuf));
622 1.102.2.2 eeh if (scsipi_inquire(sc_link, &inqbuf, SCSI_AUTOCONF) != 0)
623 1.102.2.2 eeh goto bad;
624 1.102.2.2 eeh
625 1.102.2.2 eeh {
626 1.102.2.2 eeh int len = inqbuf.additional_length;
627 1.102.2.2 eeh while (len < 3)
628 1.102.2.2 eeh inqbuf.unused[len++] = '\0';
629 1.102.2.2 eeh while (len < 3 + 28)
630 1.102.2.2 eeh inqbuf.unused[len++] = ' ';
631 1.102.2.2 eeh }
632 1.102.2.2 eeh
633 1.102.2.2 eeh sa.sa_sc_link = sc_link;
634 1.102.2.2 eeh sa.sa_inqbuf.type = inqbuf.device;
635 1.102.2.2 eeh sa.sa_inqbuf.removable = inqbuf.dev_qual2 & SID_REMOVABLE ?
636 1.102.2.2 eeh T_REMOV : T_FIXED;
637 1.102.2.2 eeh sa.sa_inqbuf.vendor = inqbuf.vendor;
638 1.102.2.2 eeh sa.sa_inqbuf.product = inqbuf.product;
639 1.102.2.2 eeh sa.sa_inqbuf.revision = inqbuf.revision;
640 1.102.2.2 eeh sa.scsipi_info.scsi_version = inqbuf.version;
641 1.102.2.2 eeh
642 1.102.2.2 eeh finger = (struct scsi_quirk_inquiry_pattern *)scsipi_inqmatch(
643 1.102.2.2 eeh &sa.sa_inqbuf, (caddr_t)scsi_quirk_patterns,
644 1.102.2.2 eeh sizeof(scsi_quirk_patterns)/sizeof(scsi_quirk_patterns[0]),
645 1.102.2.2 eeh sizeof(scsi_quirk_patterns[0]), &priority);
646 1.102.2.2 eeh if (priority != 0)
647 1.102.2.2 eeh sc_link->quirks |= finger->quirks;
648 1.102.2.2 eeh if ((inqbuf.version & SID_ANSII) == 0 &&
649 1.102.2.2 eeh (sc_link->quirks & SDEV_FORCELUNS) == 0)
650 1.102.2.2 eeh sc_link->quirks |= SDEV_NOLUNS;
651 1.102.2.2 eeh sc_link->scsipi_scsi.scsi_version = inqbuf.version;
652 1.102.2.2 eeh
653 1.102.2.2 eeh if ((sc_link->quirks & SDEV_NOLUNS) == 0)
654 1.102.2.2 eeh scsi->moreluns |= (1 << target);
655 1.102.2.2 eeh
656 1.102.2.2 eeh /*
657 1.102.2.2 eeh * note what BASIC type of device it is
658 1.102.2.2 eeh */
659 1.102.2.2 eeh if ((inqbuf.dev_qual2 & SID_REMOVABLE) != 0)
660 1.102.2.2 eeh sc_link->flags |= SDEV_REMOVABLE;
661 1.102.2.2 eeh
662 1.102.2.2 eeh /*
663 1.102.2.2 eeh * Any device qualifier that has the top bit set (qualifier&4 != 0)
664 1.102.2.2 eeh * is vendor specific and won't match in this switch.
665 1.102.2.2 eeh * All we do here is throw out bad/negative responses.
666 1.102.2.2 eeh */
667 1.102.2.2 eeh checkdtype = 0;
668 1.102.2.2 eeh switch (inqbuf.device & SID_QUAL) {
669 1.102.2.2 eeh case SID_QUAL_LU_OK:
670 1.102.2.2 eeh case SID_QUAL_LU_OFFLINE:
671 1.102.2.2 eeh checkdtype = 1;
672 1.102.2.2 eeh break;
673 1.102.2.2 eeh
674 1.102.2.2 eeh case SID_QUAL_RSVD:
675 1.102.2.2 eeh case SID_QUAL_BAD_LU:
676 1.102.2.2 eeh goto bad;
677 1.102.2.2 eeh
678 1.102.2.2 eeh default:
679 1.102.2.2 eeh break;
680 1.102.2.2 eeh }
681 1.102.2.2 eeh if (checkdtype)
682 1.102.2.2 eeh switch (inqbuf.device & SID_TYPE) {
683 1.102.2.2 eeh case T_DIRECT:
684 1.102.2.2 eeh case T_SEQUENTIAL:
685 1.102.2.2 eeh case T_PRINTER:
686 1.102.2.2 eeh case T_PROCESSOR:
687 1.102.2.2 eeh case T_WORM:
688 1.102.2.2 eeh case T_CDROM:
689 1.102.2.2 eeh case T_SCANNER:
690 1.102.2.2 eeh case T_OPTICAL:
691 1.102.2.2 eeh case T_CHANGER:
692 1.102.2.2 eeh case T_COMM:
693 1.102.2.2 eeh case T_IT8_1:
694 1.102.2.2 eeh case T_IT8_2:
695 1.102.2.2 eeh case T_STORARRAY:
696 1.102.2.2 eeh case T_ENCLOSURE:
697 1.102.2.2 eeh default:
698 1.102.2.2 eeh break;
699 1.102.2.2 eeh case T_NODEVICE:
700 1.102.2.2 eeh goto bad;
701 1.102.2.2 eeh }
702 1.102.2.2 eeh
703 1.102.2.2 eeh if ((cf = config_search(scsibussubmatch, (struct device *)scsi,
704 1.102.2.2 eeh &sa)) != NULL) {
705 1.102.2.2 eeh scsi->sc_link[target][lun] = sc_link;
706 1.102.2.2 eeh config_attach((struct device *)scsi, cf, &sa, scsibusprint);
707 1.102.2.2 eeh } else {
708 1.102.2.2 eeh scsibusprint(&sa, scsi->sc_dev.dv_xname);
709 1.102.2.2 eeh printf(" not configured\n");
710 1.102.2.2 eeh goto bad;
711 1.102.2.2 eeh }
712 1.102.2.2 eeh
713 1.102.2.2 eeh return;
714 1.102.2.2 eeh
715 1.102.2.2 eeh bad:
716 1.102.2.2 eeh free(sc_link, M_DEVBUF);
717 1.102.2.2 eeh return;
718 1.102.2.2 eeh }
719