Line data Source code
1 : /* $OpenBSD: scsiconf.h,v 1.166 2017/05/29 07:47:13 krw Exp $ */
2 : /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
3 :
4 : /*
5 : * Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
6 : *
7 : * Redistribution and use in source and binary forms, with or without
8 : * modification, are permitted provided that the following conditions
9 : * are met:
10 : * 1. Redistributions of source code must retain the above copyright
11 : * notice, this list of conditions and the following disclaimer.
12 : * 2. Redistributions in binary form must reproduce the above copyright
13 : * notice, this list of conditions and the following disclaimer in the
14 : * documentation and/or other materials provided with the distribution.
15 : * 3. All advertising materials mentioning features or use of this software
16 : * must display the following acknowledgement:
17 : * This product includes software developed by Charles Hannum.
18 : * 4. The name of the author may not be used to endorse or promote products
19 : * derived from this software without specific prior written permission.
20 : *
21 : * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 : * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 : * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 : * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 : * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 : * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 : * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 : * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 : * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 : * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 : */
32 :
33 : /*
34 : * Originally written by Julian Elischer (julian@tfs.com)
35 : * for TRW Financial Systems for use under the MACH(2.5) operating system.
36 : *
37 : * TRW Financial Systems, in accordance with their agreement with Carnegie
38 : * Mellon University, makes this software available to CMU to distribute
39 : * or use in any manner that they see fit as long as this message is kept with
40 : * the software. For this reason TFS also grants any other persons or
41 : * organisations permission to use or modify this software.
42 : *
43 : * TFS supplies this software to be publicly redistributed
44 : * on the understanding that TFS is not responsible for the correct
45 : * functioning of this software in any circumstances.
46 : *
47 : * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
48 : */
49 :
50 : #ifndef SCSI_SCSICONF_H
51 : #define SCSI_SCSICONF_H
52 :
53 : #include <sys/queue.h>
54 : #include <sys/timeout.h>
55 : #include <sys/mutex.h>
56 : #include <scsi/scsi_debug.h>
57 :
58 : static __inline void _lto2b(u_int32_t val, u_int8_t *bytes);
59 : static __inline void _lto3b(u_int32_t val, u_int8_t *bytes);
60 : static __inline void _lto4b(u_int32_t val, u_int8_t *bytes);
61 : static __inline void _lto8b(u_int64_t val, u_int8_t *bytes);
62 : static __inline u_int32_t _2btol(u_int8_t *bytes);
63 : static __inline u_int32_t _3btol(u_int8_t *bytes);
64 : static __inline u_int32_t _4btol(u_int8_t *bytes);
65 : static __inline u_int64_t _5btol(u_int8_t *bytes);
66 : static __inline u_int64_t _8btol(u_int8_t *bytes);
67 :
68 : static __inline void
69 0 : _lto2b(u_int32_t val, u_int8_t *bytes)
70 : {
71 :
72 0 : bytes[0] = (val >> 8) & 0xff;
73 0 : bytes[1] = val & 0xff;
74 0 : }
75 :
76 : static __inline void
77 0 : _lto3b(u_int32_t val, u_int8_t *bytes)
78 : {
79 :
80 0 : bytes[0] = (val >> 16) & 0xff;
81 0 : bytes[1] = (val >> 8) & 0xff;
82 0 : bytes[2] = val & 0xff;
83 0 : }
84 :
85 : static __inline void
86 0 : _lto4b(u_int32_t val, u_int8_t *bytes)
87 : {
88 :
89 0 : bytes[0] = (val >> 24) & 0xff;
90 0 : bytes[1] = (val >> 16) & 0xff;
91 0 : bytes[2] = (val >> 8) & 0xff;
92 0 : bytes[3] = val & 0xff;
93 0 : }
94 :
95 : static __inline void
96 0 : _lto8b(u_int64_t val, u_int8_t *bytes)
97 : {
98 :
99 0 : bytes[0] = (val >> 56) & 0xff;
100 0 : bytes[1] = (val >> 48) & 0xff;
101 0 : bytes[2] = (val >> 40) & 0xff;
102 0 : bytes[3] = (val >> 32) & 0xff;
103 0 : bytes[4] = (val >> 24) & 0xff;
104 0 : bytes[5] = (val >> 16) & 0xff;
105 0 : bytes[6] = (val >> 8) & 0xff;
106 0 : bytes[7] = val & 0xff;
107 0 : }
108 :
109 : static __inline u_int32_t
110 0 : _2btol(u_int8_t *bytes)
111 : {
112 : u_int32_t rv;
113 :
114 0 : rv = (bytes[0] << 8) | bytes[1];
115 0 : return (rv);
116 : }
117 :
118 : static __inline u_int32_t
119 0 : _3btol(u_int8_t *bytes)
120 : {
121 : u_int32_t rv;
122 :
123 0 : rv = (bytes[0] << 16) | (bytes[1] << 8) | bytes[2];
124 0 : return (rv);
125 : }
126 :
127 : static __inline u_int32_t
128 0 : _4btol(u_int8_t *bytes)
129 : {
130 : u_int32_t rv;
131 :
132 0 : rv = (bytes[0] << 24) | (bytes[1] << 16) |
133 0 : (bytes[2] << 8) | bytes[3];
134 0 : return (rv);
135 : }
136 :
137 : static __inline u_int64_t
138 0 : _5btol(u_int8_t *bytes)
139 : {
140 : u_int64_t rv;
141 :
142 0 : rv = ((u_int64_t)bytes[0] << 32) |
143 0 : ((u_int64_t)bytes[1] << 24) |
144 0 : ((u_int64_t)bytes[2] << 16) |
145 0 : ((u_int64_t)bytes[3] << 8) |
146 0 : (u_int64_t)bytes[4];
147 0 : return (rv);
148 : }
149 :
150 : static __inline u_int64_t
151 0 : _8btol(u_int8_t *bytes)
152 : {
153 : u_int64_t rv;
154 :
155 0 : rv = (((u_int64_t)bytes[0]) << 56) |
156 0 : (((u_int64_t)bytes[1]) << 48) |
157 0 : (((u_int64_t)bytes[2]) << 40) |
158 0 : (((u_int64_t)bytes[3]) << 32) |
159 0 : (((u_int64_t)bytes[4]) << 24) |
160 0 : (((u_int64_t)bytes[5]) << 16) |
161 0 : (((u_int64_t)bytes[6]) << 8) |
162 0 : ((u_int64_t)bytes[7]);
163 0 : return (rv);
164 : }
165 :
166 : #ifdef _KERNEL
167 :
168 : #define DEVID_NONE 0
169 : #define DEVID_NAA 1
170 : #define DEVID_EUI 2
171 : #define DEVID_T10 3
172 : #define DEVID_SERIAL 4
173 : #define DEVID_WWN 5
174 :
175 : struct devid {
176 : u_int8_t d_type;
177 : u_int8_t d_flags;
178 : #define DEVID_F_PRINT (1<<0)
179 : u_int8_t d_refcount;
180 : u_int8_t d_len;
181 :
182 : /*
183 : * the devid struct is basically a header, the actual id is allocated
184 : * immediately after it.
185 : */
186 : };
187 :
188 : #define DEVID_CMP(_a, _b) ( \
189 : (_a) != NULL && (_b) != NULL && \
190 : ((_a) == (_b) || \
191 : ((_a)->d_type != DEVID_NONE && \
192 : (_a)->d_type == (_b)->d_type && \
193 : (_a)->d_len == (_b)->d_len && \
194 : bcmp((_a) + 1, (_b) + 1, (_a)->d_len) == 0)) \
195 : )
196 :
197 : struct devid * devid_alloc(u_int8_t, u_int8_t, u_int8_t, u_int8_t *);
198 : struct devid * devid_copy(struct devid *);
199 : void devid_free(struct devid *);
200 :
201 : /*
202 : * The following documentation tries to describe the relationship between the
203 : * various structures defined in this file:
204 : *
205 : * each adapter type has a scsi_adapter struct. This describes the adapter and
206 : * identifies routines that can be called to use the adapter.
207 : * each existing device position (scsibus + target + lun)
208 : * can be described by a scsi_link struct.
209 : * Only scsi positions that actually have devices, have a scsi_link
210 : * structure assigned. so in effect each device has scsi_link struct.
211 : * The scsi_link structure contains information identifying both the
212 : * device driver and the adapter driver for that position on that scsi bus,
213 : * and can be said to 'link' the two.
214 : * each individual scsi bus has an array that points to all the scsi_link
215 : * structs associated with that scsi bus. Slots with no device have
216 : * a NULL pointer.
217 : * each individual device also knows the address of its own scsi_link
218 : * structure.
219 : *
220 : * -------------
221 : *
222 : * The key to all this is the scsi_link structure which associates all the
223 : * other structures with each other in the correct configuration. The
224 : * scsi_link is the connecting information that allows each part of the
225 : * scsi system to find the associated other parts.
226 : */
227 :
228 : struct scsi_xfer;
229 : struct scsi_link;
230 : struct scsibus_softc;
231 :
232 : /*
233 : * Temporary hack
234 : */
235 : extern int scsi_autoconf;
236 :
237 : /*
238 : * These entrypoints are called by the high-end drivers to get services from
239 : * whatever low-end drivers they are attached to. Each adapter type has one
240 : * of these statically allocated.
241 : */
242 : struct scsi_adapter {
243 : void (*scsi_cmd)(struct scsi_xfer *);
244 : void (*scsi_minphys)(struct buf *, struct scsi_link *);
245 : int (*dev_probe)(struct scsi_link *);
246 : void (*dev_free)(struct scsi_link *);
247 : int (*ioctl)(struct scsi_link *, u_long, caddr_t, int);
248 : };
249 :
250 : struct scsi_iopool;
251 :
252 : struct scsi_iohandler {
253 : TAILQ_ENTRY(scsi_iohandler) q_entry;
254 : u_int q_state;
255 :
256 : struct scsi_iopool *pool;
257 : void (*handler)(void *, void *);
258 : void *cookie;
259 : };
260 : TAILQ_HEAD(scsi_runq, scsi_iohandler);
261 :
262 : struct scsi_iopool {
263 : /* access to the IOs */
264 : void *iocookie;
265 : /*
266 : * Get an IO. This must reserve all resources that are necessary
267 : * to send the transfer to the device. The resources must stay
268 : * reserved during the lifetime of the IO, as the IO may be re-used
269 : * without being io_put(), first.
270 : */
271 : void *(*io_get)(void *);
272 : void (*io_put)(void *, void *);
273 :
274 : /* the runqueue */
275 : struct scsi_runq queue;
276 : /* runqueue semaphore */
277 : u_int running;
278 : /* protection for the runqueue and its semaphore */
279 : struct mutex mtx;
280 : };
281 :
282 : struct scsi_xshandler {
283 : struct scsi_iohandler ioh; /* must be first */
284 :
285 : struct scsi_link *link;
286 : void (*handler)(struct scsi_xfer *);
287 : };
288 :
289 : /*
290 : * This structure describes the connection between an adapter driver and
291 : * a device driver, and is used by each to call services provided by
292 : * the other, and to allow generic scsi glue code to call these services
293 : * as well.
294 : */
295 : struct scsi_link {
296 : SLIST_ENTRY(scsi_link) bus_list;
297 :
298 : u_int state;
299 : #define SDEV_S_WAITING (1<<0)
300 : #define SDEV_S_DYING (1<<1)
301 :
302 : u_int8_t scsibus; /* the Nth scsibus */
303 : u_int8_t luns;
304 : u_int16_t target; /* targ of this dev */
305 : u_int16_t lun; /* lun of this dev */
306 : u_int16_t openings; /* available operations per lun */
307 : u_int64_t port_wwn; /* world wide name of port */
308 : u_int64_t node_wwn; /* world wide name of node */
309 : u_int16_t adapter_target; /* what are we on the scsi bus */
310 : u_int16_t adapter_buswidth; /* 8 (regular) or 16 (wide). (0 becomes 8) */
311 : u_int16_t flags; /* flags that all devices have */
312 : #define SDEV_REMOVABLE 0x0001 /* media is removable */
313 : #define SDEV_MEDIA_LOADED 0x0002 /* device figures are still valid */
314 : #define SDEV_READONLY 0x0004 /* device is read-only */
315 : #define SDEV_OPEN 0x0008 /* at least 1 open session */
316 : #define SDEV_DBX 0x00f0 /* debugging flags (scsi_debug.h) */
317 : #define SDEV_EJECTING 0x0100 /* eject on device close */
318 : #define SDEV_ATAPI 0x0200 /* device is ATAPI */
319 : #define SDEV_2NDBUS 0x0400 /* device is a 'second' bus device */
320 : #define SDEV_UMASS 0x0800 /* device is UMASS SCSI */
321 : #define SDEV_VIRTUAL 0x1000 /* device is virtualised on the hba */
322 : #define SDEV_OWN_IOPL 0x2000 /* scsibus */
323 : u_int16_t quirks; /* per-device oddities */
324 : #define SDEV_AUTOSAVE 0x0001 /* do implicit SAVEDATAPOINTER on disconnect */
325 : #define SDEV_NOSYNC 0x0002 /* does not grok SDTR */
326 : #define SDEV_NOWIDE 0x0004 /* does not grok WDTR */
327 : #define SDEV_NOTAGS 0x0008 /* lies about having tagged queueing */
328 : #define SDEV_NOSYNCCACHE 0x0100 /* no SYNCHRONIZE_CACHE */
329 : #define ADEV_NOSENSE 0x0200 /* No request sense - ATAPI */
330 : #define ADEV_LITTLETOC 0x0400 /* little-endian TOC - ATAPI */
331 : #define ADEV_NOCAPACITY 0x0800 /* no READ CD CAPACITY */
332 : #define ADEV_NODOORLOCK 0x2000 /* can't lock door */
333 : #define SDEV_ONLYBIG 0x4000 /* always use READ_BIG and WRITE_BIG */
334 : int (*interpret_sense)(struct scsi_xfer *);
335 : void *device_softc; /* needed for call to foo_start */
336 : struct scsi_adapter *adapter; /* adapter entry points etc. */
337 : void *adapter_softc; /* needed for call to foo_scsi_cmd */
338 : struct scsibus_softc *bus; /* link to the scsibus we're on */
339 : struct scsi_inquiry_data inqdata; /* copy of INQUIRY data from probe */
340 : struct devid *id;
341 :
342 : struct scsi_runq queue;
343 : u_int running;
344 : u_short pending;
345 :
346 : struct scsi_iopool *pool;
347 : };
348 :
349 : int scsiprint(void *, const char *);
350 :
351 : /*
352 : * This describes matching information for scsi_inqmatch(). The more things
353 : * match, the higher the configuration priority.
354 : */
355 : struct scsi_inquiry_pattern {
356 : u_int8_t type;
357 : int removable;
358 : char *vendor;
359 : char *product;
360 : char *revision;
361 : };
362 :
363 : struct scsibus_attach_args {
364 : struct scsi_link *saa_sc_link;
365 : };
366 :
367 : /*
368 : * One of these is allocated and filled in for each scsi bus.
369 : * It holds pointers to allow the scsi bus to get to the driver
370 : * that is running each LUN on the bus.
371 : * It also has a template entry which is the prototype struct
372 : * supplied by the adapter driver. This is used to initialise
373 : * the others, before they have the rest of the fields filled in.
374 : */
375 : struct scsibus_softc {
376 : struct device sc_dev;
377 : struct scsi_link *adapter_link; /* prototype supplied by adapter */
378 : SLIST_HEAD(, scsi_link) sc_link_list;
379 : u_int16_t sc_buswidth;
380 : };
381 :
382 : /*
383 : * This is used to pass information from the high-level configuration code
384 : * to the device-specific drivers.
385 : */
386 : struct scsi_attach_args {
387 : struct scsi_link *sa_sc_link;
388 : struct scsi_inquiry_data *sa_inqbuf;
389 : };
390 :
391 : /*
392 : * Each scsi transaction is fully described by one of these structures.
393 : * It includes information about the source of the command and also the
394 : * device and adapter for which the command is destined.
395 : * (via the scsi_link structure)
396 : */
397 : struct scsi_xfer {
398 : SIMPLEQ_ENTRY(scsi_xfer) xfer_list;
399 : int flags;
400 : struct scsi_link *sc_link; /* all about our device and adapter */
401 : int retries; /* the number of times to retry */
402 : int timeout; /* in milliseconds */
403 : struct scsi_generic *cmd; /* The scsi command to execute */
404 : int cmdlen; /* how long it is */
405 : u_char *data; /* dma address OR a uio address */
406 : int datalen; /* data len (blank if uio) */
407 : size_t resid; /* how much buffer was not touched */
408 : int error; /* an error value */
409 : struct buf *bp; /* If we need to associate with a buf */
410 : struct scsi_sense_data sense; /* 18 bytes*/
411 : u_int8_t status; /* SCSI status */
412 : struct scsi_generic cmdstore; /* stash the command in here */
413 : /*
414 : * timeout structure for hba's to use for a command
415 : */
416 : struct timeout stimeout;
417 : void *cookie;
418 : void (*done)(struct scsi_xfer *);
419 :
420 : void *io; /* adapter io resource */
421 : };
422 : SIMPLEQ_HEAD(scsi_xfer_list, scsi_xfer);
423 :
424 : /*
425 : * Per-request Flag values
426 : */
427 : #define SCSI_NOSLEEP 0x00001 /* don't sleep */
428 : #define SCSI_POLL 0x00002 /* poll for completion */
429 : #define SCSI_AUTOCONF 0x00003 /* shorthand for SCSI_POLL | SCSI_NOSLEEP */
430 : #define ITSDONE 0x00008 /* the transfer is as done as it gets */
431 : #define SCSI_SILENT 0x00020 /* don't announce NOT READY or MEDIA CHANGE */
432 : #define SCSI_IGNORE_NOT_READY 0x00040 /* ignore NOT READY */
433 : #define SCSI_IGNORE_MEDIA_CHANGE 0x00080 /* ignore MEDIA CHANGE */
434 : #define SCSI_IGNORE_ILLEGAL_REQUEST 0x00100 /* ignore ILLEGAL REQUEST */
435 : #define SCSI_RESET 0x00200 /* Reset the device in question */
436 : #define SCSI_DATA_IN 0x00800 /* expect data to come INTO memory */
437 : #define SCSI_DATA_OUT 0x01000 /* expect data to flow OUT of memory */
438 : #define SCSI_TARGET 0x02000 /* This defines a TARGET mode op. */
439 : #define SCSI_ESCAPE 0x04000 /* Escape operation */
440 : #define SCSI_PRIVATE 0xf0000 /* private to each HBA flags */
441 :
442 : /*
443 : * Escape op-codes. This provides an extensible setup for operations
444 : * that are not scsi commands. They are intended for modal operations.
445 : */
446 :
447 : #define SCSI_OP_TARGET 0x0001
448 : #define SCSI_OP_RESET 0x0002
449 : #define SCSI_OP_BDINFO 0x0003
450 :
451 : /*
452 : * Error values an adapter driver may return
453 : */
454 : #define XS_NOERROR 0 /* there is no error, (sense is invalid) */
455 : #define XS_SENSE 1 /* Check the returned sense for the error */
456 : #define XS_DRIVER_STUFFUP 2 /* Driver failed to perform operation */
457 : #define XS_SELTIMEOUT 3 /* The device timed out.. turned off? */
458 : #define XS_TIMEOUT 4 /* The Timeout reported was caught by SW */
459 : #define XS_BUSY 5 /* The device busy, try again later? */
460 : #define XS_SHORTSENSE 6 /* Check the ATAPI sense for the error */
461 : #define XS_RESET 8 /* bus was reset; possible retry command */
462 :
463 : /*
464 : * Possible retries for scsi_test_unit_ready()
465 : */
466 : #define TEST_READY_RETRIES 5
467 :
468 : /*
469 : * Possible retries for most SCSI commands.
470 : */
471 : #define SCSI_RETRIES 4
472 :
473 : const void *scsi_inqmatch(struct scsi_inquiry_data *, const void *, int,
474 : int, int *);
475 :
476 : void scsi_init(void);
477 : int scsi_test_unit_ready(struct scsi_link *, int, int);
478 : int scsi_inquire(struct scsi_link *, struct scsi_inquiry_data *, int);
479 : int scsi_inquire_vpd(struct scsi_link *, void *, u_int, u_int8_t, int);
480 : void scsi_init_inquiry(struct scsi_xfer *, u_int8_t, u_int8_t,
481 : void *, size_t);
482 : int scsi_prevent(struct scsi_link *, int, int);
483 : int scsi_start(struct scsi_link *, int, int);
484 : int scsi_mode_sense(struct scsi_link *, int, int, struct scsi_mode_header *,
485 : size_t, int, int);
486 : int scsi_mode_sense_big(struct scsi_link *, int, int,
487 : struct scsi_mode_header_big *, size_t, int, int);
488 : void * scsi_mode_sense_page(struct scsi_mode_header *, int);
489 : void * scsi_mode_sense_big_page(struct scsi_mode_header_big *, int);
490 : int scsi_do_mode_sense(struct scsi_link *, int,
491 : union scsi_mode_sense_buf *, void **, u_int32_t *, u_int64_t *,
492 : u_int32_t *, int, int, int *);
493 : int scsi_mode_select(struct scsi_link *, int, struct scsi_mode_header *,
494 : int, int);
495 : int scsi_mode_select_big(struct scsi_link *, int,
496 : struct scsi_mode_header_big *, int, int);
497 : void scsi_done(struct scsi_xfer *);
498 : int scsi_do_ioctl(struct scsi_link *, u_long, caddr_t, int);
499 : void sc_print_addr(struct scsi_link *);
500 : int scsi_report_luns(struct scsi_link *, int,
501 : struct scsi_report_luns_data *, u_int32_t, int, int);
502 : void scsi_minphys(struct buf *, struct scsi_link *);
503 : int scsi_interpret_sense(struct scsi_xfer *);
504 :
505 : void scsi_xs_show(struct scsi_xfer *);
506 : void scsi_print_sense(struct scsi_xfer *);
507 : void scsi_show_mem(u_char *, int);
508 : void scsi_strvis(u_char *, u_char *, int);
509 : int scsi_delay(struct scsi_xfer *, int);
510 :
511 : int scsi_probe(struct scsibus_softc *, int, int);
512 : int scsi_probe_bus(struct scsibus_softc *);
513 : int scsi_probe_target(struct scsibus_softc *, int);
514 : int scsi_probe_lun(struct scsibus_softc *, int, int);
515 :
516 : int scsi_detach(struct scsibus_softc *, int, int, int);
517 : int scsi_detach_bus(struct scsibus_softc *, int);
518 : int scsi_detach_target(struct scsibus_softc *, int, int);
519 : int scsi_detach_lun(struct scsibus_softc *, int, int, int);
520 :
521 : int scsi_req_probe(struct scsibus_softc *, int, int);
522 : int scsi_req_detach(struct scsibus_softc *, int, int, int);
523 :
524 : int scsi_activate(struct scsibus_softc *, int, int, int);
525 :
526 : struct scsi_link * scsi_get_link(struct scsibus_softc *, int, int);
527 : void scsi_add_link(struct scsibus_softc *,
528 : struct scsi_link *);
529 : void scsi_remove_link(struct scsibus_softc *,
530 : struct scsi_link *);
531 :
532 : extern const u_int8_t version_to_spc[];
533 : #define SCSISPC(x) (version_to_spc[(x) & SID_ANSII])
534 :
535 : struct scsi_xfer * scsi_xs_get(struct scsi_link *, int);
536 : void scsi_xs_exec(struct scsi_xfer *);
537 : int scsi_xs_sync(struct scsi_xfer *);
538 : void scsi_xs_put(struct scsi_xfer *);
539 : #ifdef SCSIDEBUG
540 : void scsi_sense_print_debug(struct scsi_xfer *);
541 : #endif
542 :
543 : /*
544 : * iopool stuff
545 : */
546 : void scsi_iopool_init(struct scsi_iopool *, void *,
547 : void *(*)(void *), void (*)(void *, void *));
548 : void scsi_iopool_run(struct scsi_iopool *);
549 : void scsi_iopool_destroy(struct scsi_iopool *);
550 : void scsi_link_shutdown(struct scsi_link *);
551 :
552 : void * scsi_io_get(struct scsi_iopool *, int);
553 : void scsi_io_put(struct scsi_iopool *, void *);
554 :
555 : /*
556 : * default io allocator.
557 : */
558 : #define SCSI_IOPOOL_POISON ((void *)0x5c5)
559 : void * scsi_default_get(void *);
560 : void scsi_default_put(void *, void *);
561 :
562 : /*
563 : * io handler interface
564 : */
565 : void scsi_ioh_set(struct scsi_iohandler *, struct scsi_iopool *,
566 : void (*)(void *, void *), void *);
567 : int scsi_ioh_add(struct scsi_iohandler *);
568 : int scsi_ioh_del(struct scsi_iohandler *);
569 :
570 : void scsi_xsh_set(struct scsi_xshandler *, struct scsi_link *,
571 : void (*)(struct scsi_xfer *));
572 : int scsi_xsh_add(struct scsi_xshandler *);
573 : int scsi_xsh_del(struct scsi_xshandler *);
574 :
575 : /*
576 : * utility functions
577 : */
578 : int scsi_pending_start(struct mutex *, u_int *);
579 : int scsi_pending_finish(struct mutex *, u_int *);
580 :
581 : /*
582 : * Utility functions for SCSI HBA emulation.
583 : */
584 : void scsi_cmd_rw_decode(struct scsi_generic *, u_int64_t *, u_int32_t *);
585 :
586 : #endif /* _KERNEL */
587 : #endif /* SCSI_SCSICONF_H */
|