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