FreeBSD/Linux Kernel Cross Reference
sys/scsi/scsiconf.h
1 /*
2 * Written by Julian Elischer (julian@tfs.com)
3 * for TRW Financial Systems for use under the MACH(2.5) operating system.
4 *
5 * TRW Financial Systems, in accordance with their agreement with Carnegie
6 * Mellon University, makes this software available to CMU to distribute
7 * or use in any manner that they see fit as long as this message is kept with
8 * the software. For this reason TFS also grants any other persons or
9 * organisations permission to use or modify this software.
10 *
11 * TFS supplies this software to be publicly redistributed
12 * on the understanding that TFS is not responsible for the correct
13 * functioning of this software in any circumstances.
14 *
15 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
16 *
17 * $FreeBSD: src/sys/scsi/scsiconf.h,v 1.46.2.4 1999/09/05 08:21:47 peter Exp $
18 */
19 #ifndef SCSI_SCSICONF_H
20 #define SCSI_SCSICONF_H 1
21 typedef int boolean;
22 typedef int errval;
23
24 #include <scsi/scsi_debug.h>
25 #include <scsi/scsi_all.h>
26 #include <scsi/scsi_driver.h>
27
28 /*
29 * The following documentation tries to describe the relationship between the
30 * various structures defined in this file:
31 *
32 * each adapter type has a scsi_adapter struct. This describes the adapter and
33 * identifies routines that can be called to use the adapter.
34 * each device type has a scsi_device struct. This describes the device and
35 * identifies routines that can be called to use the device.
36 * each existing device position (scsibus + target + lun)
37 * can be described by a scsi_link struct.
38 * Only scsi positions that actually have devices, have a scsi_link
39 * structure assigned. so in effect each device has scsi_link struct.
40 * The scsi_link structure contains information identifying both the
41 * device driver and the adapter driver for that position on that scsi bus,
42 * and can be said to 'link' the two.
43 * each individual scsi bus has an array that points to all the scsi_link
44 * structs associated with that scsi bus. Slots with no device have
45 * a NULL pointer.
46 * each individual device also knows the address of it's own scsi_link
47 * structure.
48 *
49 * -------------
50 *
51 * The key to all this is the scsi_link structure which associates all the
52 * other structures with each other in the correct configuration. The
53 * scsi_link is the connecting information that allows each part of the
54 * scsi system to find the associated other parts.
55 */
56
57 struct buf;
58 struct scsi_xfer;
59 #ifdef PC98
60 struct cfdata;
61 #endif
62
63 /* Don't poke around inside of "scsi_data". Each low level
64 * driver has its own definition for it.
65 */
66 struct scsi_data;
67 struct scsi_link; /* scsi_link refers to scsi_device and vice-versa */
68
69 struct proc;
70
71 /*
72 * These entrypoints are called by the high-end drivers to get services from
73 * whatever low-end drivers they are attached to each adapter type has one of
74 * these statically allocated.
75 */
76 struct scsi_adapter
77 {
78 /* 04*/ int32_t (*scsi_cmd) __P((struct scsi_xfer *xs));
79 /* 08*/ void (*scsi_minphys) __P((struct buf *bp));
80 #ifdef PC98
81 /* 12*/ int32_t (*open_target_lu) __P((struct scsi_link *sc_link,
82 struct cfdata *cf));
83 #else
84 /* 12*/ int32_t (*open_target_lu) __P((void));
85 #endif
86 /* 16*/ int32_t (*close_target_lu) __P((void));
87 /* 20*/ u_int32_t (*adapter_info) __P((int unit)); /* see definitions below */
88 /* 24*/ char *name; /* name of scsi bus controller */
89 /* 32*/ u_long spare[2];
90 };
91
92 /*
93 * return values for scsi_cmd()
94 */
95 #define SUCCESSFULLY_QUEUED 0
96 #define TRY_AGAIN_LATER 1
97 #define COMPLETE 2
98 #define HAD_ERROR 3 /* do not use this, use COMPLETE */
99 #define ESCAPE_NOT_SUPPORTED 4
100
101 /*
102 * Return value from sense handler. IMHO, These ought to be merged
103 * in with the return codes above, all made negative to distinguish
104 * from valid errno values, and replace "try again later" with "do retry"
105 */
106 #define SCSIRET_CONTINUE -1 /* Continue with standard sense processing */
107 #define SCSIRET_DO_RETRY -2 /* Retry the command that got this sense */
108
109 /*
110 * Format of adapter_info() response data
111 * e.g. maximum number of entries queuable to a device by the adapter
112 */
113
114 /*
115 * These entry points are called by the low-end drivers to get services from
116 * whatever high-end drivers they are attached to. Each device type has one
117 * of these statically allocated.
118 *
119 * XXX dufault@hda.com: Each adapter driver has a scsi_device structure
120 * that I don't think should be there.
121 * This structure should be rearranged and cleaned up once the
122 * instance down in the adapter drivers is removed.
123 */
124
125 /*
126 * XXX this is so that everything that includes this bloated header doesn't
127 * also need to include <sys/conf.h>.
128 */
129 typedef int yet_another_d_open_t __P((dev_t, int, int, struct proc *));
130
131 struct scsi_device
132 {
133 /* 4*/ errval (*err_handler)(struct scsi_xfer *xs); /* return -1 to say
134 * err processing complete */
135 /* 8*/ void (*start)(u_int32_t unit, u_int32_t flags);
136 /* 12*/ int32_t (*async) __P((void));
137 /* 16*/ int32_t (*done) __P((struct scsi_xfer *xs)); /* returns -1 to say done processing complete */
138 /* 20*/ char *name; /* name of device type */
139 /* 24*/ u_int32_t flags; /* device type dependent flags */
140 /* 32*/ int32_t spare[2];
141
142 /* 36*/ int32_t link_flags; /* Flags OR'd into sc_link at attach time */
143 /* 40*/ errval (*attach)(struct scsi_link *sc_link);
144 /* 44*/ char *desc; /* Description of device */
145 /* 48*/ yet_another_d_open_t *open;
146 /* 52*/ int sizeof_scsi_data;
147 /* 56*/ int type; /* Type of device this supports */
148 /* 60*/ int (*getunit)(dev_t dev);
149 /* 64*/ dev_t (*setunit)(dev_t dev, int unit);
150
151 /* 68*/ int (*dev_open)(dev_t dev, int flags, int fmt, struct proc *p,
152 struct scsi_link *sc_link);
153 /* 72*/ int (*dev_ioctl)(dev_t dev, int cmd, caddr_t arg, int mode,
154 struct proc *p, struct scsi_link *sc_link);
155 /* 76*/ int (*dev_close)(dev_t dev, int flag, int fmt, struct proc *p,
156 struct scsi_link *sc_link);
157 /* 80*/ void (*dev_strategy)(struct buf *bp, struct scsi_link *sc_link);
158
159 /* Not initialized after this */
160
161 #define SCSI_LINK(DEV, UNIT) ( \
162 (struct scsi_link *)(extend_get((DEV)->links, (UNIT))) \
163 )
164
165 #define SCSI_DATA(DEV, UNIT) ( \
166 (SCSI_LINK((DEV), (UNIT)) ? \
167 (SCSI_LINK((DEV), (UNIT))->sd) : \
168 (struct scsi_data *)0) \
169 )
170
171 /* 80*/ struct extend_array *links;
172
173 /* 84*/ int free_unit;
174 /* 88*/ struct scsi_device *next; /* Next in list in the registry. */
175 };
176
177 /* SCSI_DEVICE_ENTRIES: A macro to generate all the entry points from the
178 * name.
179 */
180 #define SCSI_DEVICE_ENTRIES(NAME) \
181 static errval NAME##attach(struct scsi_link *sc_link); \
182 extern struct scsi_device NAME##_switch; /* XXX actually static */ \
183 void NAME##init(void) { \
184 scsi_device_register(&NAME##_switch); \
185 } \
186 static int NAME##open(dev_t dev, int flags, int fmt, struct proc *p) { \
187 return scsi_open(dev, flags, fmt, p, &NAME##_switch); \
188 } \
189 static int NAME##ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) { \
190 return scsi_ioctl(dev, cmd, addr, flag, p, &NAME##_switch); \
191 } \
192 static int NAME##close(dev_t dev, int flag, int fmt, struct proc *p) { \
193 return scsi_close(dev, flag, fmt, p, &NAME##_switch); \
194 } \
195 static void NAME##minphys(struct buf *bp) { \
196 scsi_minphys(bp, &NAME##_switch); \
197 } \
198 static void NAME##strategy(struct buf *bp) { \
199 scsi_strategy(bp, &NAME##_switch); \
200 }
201
202 #ifdef KERNEL
203 /* Configuration tables for config.
204 */
205 /* A unit, type, etc can be SCCONF_ANY to indicate it is a '?'
206 * in the config.
207 */
208 #define SCCONF_UNSPEC 255
209 #define SCCONF_ANY 254
210
211 struct isa_driver;
212 struct scsi_ctlr_config
213 {
214 int scbus;
215 char *driver;
216 int unit;
217 int bus;
218 };
219
220 struct scsi_device_config
221 {
222 char *name; /* SCSI device name (sd, st, etc) */
223 int unit; /* desired device unit */
224 int cunit; /* Controller unit */
225 int target; /* SCSI ID (target) */
226 int lun; /* SCSI lun */
227 int flags; /* Flags from config */
228 };
229
230 extern void (*scsi_tinit[])(void);
231 extern struct scsi_ctlr_config scsi_cinit[];
232 extern struct scsi_device_config scsi_dinit[];
233
234 #endif
235
236 /*
237 * Define various devices that we know mis-behave in some way,
238 * and note how they are bad, so we can correct for them
239 */
240 struct st_mode {
241 /* 4*/ u_int32_t blksiz;
242 /* 6*/ u_int16_t quirks; /* same definitions as in XXX */
243 /* 7*/ u_int8_t density;
244 /* 8*/ u_int8_t spare[1];
245 };
246
247 typedef struct st_mode st_modes[4];
248
249 /* define behaviour codes (quirks) */
250 /* common to all SCSI devices */
251 #define SCSI_Q_NO_SYNC 0x8000
252 #define SCSI_Q_NO_FAST 0x4000
253 #define SCSI_Q_NO_WIDE 0x2000
254
255 /* tape specific ST_Q_* */
256 #define ST_Q_NEEDS_PAGE_0 0x0001
257 #define ST_Q_FORCE_FIXED_MODE 0x0002
258 #define ST_Q_FORCE_VAR_MODE 0x0004
259 #define ST_Q_SNS_HLP 0x0008 /* must do READ for good MODE SENSE */
260 #define ST_Q_IGNORE_LOADS 0x0010
261 #define ST_Q_BLKSIZ 0x0020 /* variable-block media_blksiz > 0 */
262 #define ST_Q_CC_NOMSG 0x0040 /* no messages accepted in CC state */
263 #define ST_Q_NO_1024 0x0080 /* never ever use 1024-byte fix blk */
264
265 #define ST_Q_NO_SYNC SCSI_Q_NO_SYNC
266 #define ST_Q_NO_FAST SCSI_Q_NO_FAST
267 #define ST_Q_NO_WIDE SCSI_Q_NO_WIDE
268
269 /* disk specific SD_Q_* */
270 #define SD_Q_NO_TAGS 0x0001
271
272 #define SD_Q_NO_SYNC SCSI_Q_NO_SYNC
273 #define SD_Q_NO_FAST SCSI_Q_NO_FAST
274 #define SD_Q_NO_WIDE SCSI_Q_NO_WIDE
275
276 /* cd specific CD_Q_* */
277 #define CD_Q_NO_TOUCH 0x0001
278 #define CD_Q_BCD_TRACKS 0x0002
279
280
281 /*
282 * This structure describes the connection between an adapter driver and
283 * a device driver, and is used by each to call services provided by
284 * the other, and to allow generic scsi glue code to call these services
285 * as well.
286 */
287 struct scsi_link
288 {
289 u_int8_t target; /* targ of this dev */
290 u_int8_t lun; /* lun of this dev */
291 u_int8_t adapter_targ; /* what are we on the scsi bus */
292 u_int8_t adapter_unit; /* e.g. the 0 in aha0 */
293 u_int8_t adapter_bus; /* e.g. the 0 in bus0 */
294 u_int8_t scsibus; /* the Nth scsibus */
295 u_int8_t dev_unit; /* e.g. the 0 in sd0 */
296 u_int8_t opennings; /* available operations */
297 u_int8_t active; /* operations in progress */
298 u_int16_t flags; /* flags that all devices have */
299 u_int16_t quirks; /* device specific quirks */
300 struct scsi_adapter *adapter; /* adapter entry points etc. */
301 struct scsi_device *device; /* device entry points etc. */
302 struct scsi_xfer *active_xs; /* operations under way */
303 void * fordriver; /* for private use by the driver */
304 void * devmodes; /* device specific mode tables */
305 dev_t dev; /* Device major number (character) */
306 struct scsi_data *sd; /* Device data structure */
307 struct scsi_inquiry_data inqbuf; /* Inquiry data */
308 void *adapter_softc; /* needed for call to foo_scsi_cmd */
309 };
310
311 /* XXX-HA: dufault@hda.com: SDEV_BOUNCE is set down in the adapter drivers
312 * in an sc_link structure to indicate that this host adapter requires
313 * ISA DMA bounce buffers. I think the link structure should
314 * be associated only with the type drive and not the adapter driver,
315 * and the bounce flag should be in something associated with the
316 * adapter driver.
317 * XXX-HA And I added the "supports residuals properly" flag that ALSO goes
318 * in an adapter structure. I figure I'll fix both at once.
319 *
320 * XXX SDEV_OPEN is used for two things: To prevent more than one
321 * open and to make unit attentions errors be logged on the console.
322 * These should be split up; I'm adding SDEV_IS_OPEN to enforce one
323 * open only.
324 *
325 * XXX SDEV_UK is used to mark the "uk" device.
326 */
327
328 #define SDEV_MEDIA_LOADED 0x0001 /* device figures are still valid */
329 #define SDEV_WAITING 0x0002 /* a process is waiting for this */
330 #define SDEV_OPEN 0x0004 /* at least 1 open session */
331 #define SDEV_BOUNCE 0x0008 /* XXX-HA: unit needs DMA bounce buffer */
332 #define SDEV_DBX 0x00F0 /* debugging flags (scsi_debug.h) */
333 #define SDEV_ONCE_ONLY 0x0100 /* unit can only be opened once */
334 #define SDEV_BOOTVERBOSE 0x0200 /* be noisy during boot */
335 #define SDEV_RESIDS_WORK 0x0400 /* XXX-HA: Residuals work */
336 #define SDEV_TARGET_OPS 0x0800 /* XXX-HA: Supports target ops */
337 #define SDEV_IS_OPEN 0x1000 /* at least 1 open session */
338 #define SDEV_UK 0x2000 /* this is the "uk" device */
339
340 /*
341 * One of these is allocated and filled in for each scsi bus.
342 * it holds pointers to allow the scsi bus to get to the driver
343 * That is running each LUN on the bus
344 * it also has a template entry which is the prototype struct
345 * supplied by the adapter driver, this is used to initialise
346 * the others, before they have the rest of the fields filled in
347 */
348 struct scsibus_data {
349 u_char maxtarg;
350 u_char maxlun;
351 struct scsi_link *adapter_link; /* prototype supplied by adapter */
352 struct scsi_link *(*sc_link)[][8]; /* dynamically allocated */
353 };
354
355 /*
356 * Each scsi transaction is fully described by one of these structures
357 * It includes information about the source of the command and also the
358 * device and adapter for which the command is destined.
359 * (via the scsi_link structure) *
360 */
361 struct scsi_xfer
362 {
363 /*04*/ struct scsi_xfer *next; /* when free */
364 /*08*/ u_int32_t flags;
365 /*12*/ struct scsi_link *sc_link; /* all about our device and adapter */
366 /*13*/ u_int8_t retries; /* the number of times to retry */
367 /*16*/ u_int8_t spare[3];
368 /*20*/ int32_t timeout; /* in milliseconds */
369 /*24*/ struct scsi_generic *cmd; /* The scsi command to execute */
370 /*28*/ int32_t cmdlen; /* how long it is */
371 /*32*/ u_char *data; /* dma address OR a uio address */
372 /*36*/ int32_t datalen; /* data len (blank if uio) */
373 /*40*/ int32_t resid; /* how much buffer was not touched */
374 /*44*/ int32_t error; /* an error value */
375 /*48*/ struct buf *bp; /* If we need to associate with a buf */
376 /*80*/ struct scsi_sense_data sense; /* 32 bytes*/
377 /*
378 * Believe it or not, Some targets fall on the ground with
379 * anything but a certain sense length.
380 */
381 /*84*/ int32_t req_sense_length; /* Explicit request sense length */
382 /*88*/ int32_t status; /* SCSI status */
383 /*100*/ struct scsi_generic cmdstore; /* stash the command in here */
384 };
385
386 /*
387 * Per-request Flag values
388 */
389 #define SCSI_NOSLEEP 0x01 /* Not a user... don't sleep */
390 #define SCSI_NOMASK 0x02 /* dont allow interrupts.. booting */
391 #define SCSI_NOSTART 0x04 /* left over from ancient history */
392 #define SCSI_USER 0x08 /* Is a user cmd, call scsi_user_done */
393 #define SCSI_ITSDONE 0x10 /* the transfer is as done as it gets */
394 #define ITSDONE 0x10 /* the transfer is as done as it gets */
395 #define SCSI_INUSE 0x20 /* The scsi_xfer block is in use */
396 #define INUSE 0x20 /* The scsi_xfer block is in use */
397 #define SCSI_SILENT 0x40 /* Don't report errors to console */
398 #define SCSI_ERR_OK 0x80 /* An error on this operation is OK. */
399 #define SCSI_RESET 0x100 /* Reset the device in question */
400 #define SCSI_DATA_UIO 0x200 /* The data address refers to a UIO */
401 #define SCSI_DATA_IN 0x400 /* expect data to come INTO memory */
402 #define SCSI_DATA_OUT 0x800 /* expect data to flow OUT of memory */
403 #define SCSI_TARGET 0x1000 /* This defines a TARGET mode op. */
404 #define SCSI_ESCAPE 0x2000 /* Escape operation */
405 #define SCSI_EOF 0x4000 /* The operation should return EOF */
406 #define SCSI_RESID_VALID 0x8000 /* The resid field contains valid data */
407
408 /*
409 * Escape op codes. This provides an extensible setup for operations
410 * that are not scsi commands. They are intended for modal operations.
411 */
412
413 #define SCSI_OP_TARGET 0x0001
414 #define SCSI_OP_RESET 0x0002
415 #define SCSI_OP_BDINFO 0x0003
416
417 /*
418 * Error values an adapter driver may return
419 */
420 #define XS_NOERROR 0x0 /* there is no error, (sense is invalid) */
421 #define XS_SENSE 0x1 /* Check the returned sense for the error */
422 #define XS_DRIVER_STUFFUP 0x2 /* Driver failed to perform operation */
423 #define XS_TIMEOUT 0x03 /* The device timed out.. turned off? */
424 #define XS_SWTIMEOUT 0x04 /* The Timeout reported was caught by SW */
425 #define XS_BUSY 0x08 /* The device busy, try again later? */
426 #define XS_LENGTH 0x09 /* Illegal length (over/under run) */
427 #define XS_SELTIMEOUT 0x10 /* Device failed to respond to selection */
428
429 #ifdef KERNEL
430 void *extend_get(struct extend_array *ea, int index);
431 void scsi_attachdevs __P((struct scsibus_data *scbus));
432 u_int32_t scsi_read_capacity __P(( struct scsi_link *sc_link,
433 u_int32_t *blk_size, u_int32_t flags));
434 errval scsi_test_unit_ready __P(( struct scsi_link *sc_link, u_int32_t flags));
435 errval scsi_reset_target __P((struct scsi_link *));
436 errval scsi_target_mode __P((struct scsi_link *, int));
437 errval scsi_inquire( struct scsi_link *sc_link,
438 struct scsi_inquiry_data *inqbuf, u_int32_t flags);
439 errval scsi_prevent( struct scsi_link *sc_link, u_int32_t type,u_int32_t flags);
440 struct scsibus_data *scsi_alloc_bus __P((void));
441 errval scsi_probe_bus __P((int, int, int));
442 errval scsi_probe_busses __P(( int, int, int));
443 errval scsi_start_unit( struct scsi_link *sc_link, u_int32_t flags);
444 errval scsi_stop_unit(struct scsi_link *sc_link, u_int32_t eject, u_int32_t flags);
445 void scsi_done(struct scsi_xfer *xs);
446 void scsi_user_done(struct scsi_xfer *xs);
447 errval scsi_scsi_cmd __P(( struct scsi_link *, struct scsi_generic *,
448 u_int32_t, u_char *,
449 u_int32_t, u_int32_t,
450 u_int32_t, struct buf *,
451 u_int32_t));
452 int scsi_do_ioctl __P((dev_t dev, int cmd, caddr_t addr, int mode,
453 struct proc *p, struct scsi_link *sc_link));
454
455 struct scsi_link *scsi_link_get __P((int bus, int targ, int lun));
456 dev_t scsi_dev_lookup __P((int (*opener)(dev_t dev, int flags, int fmt,
457 struct proc *p)));
458
459 int scsi_opened_ok __P((dev_t dev, int flag, int type, struct scsi_link *sc_link));
460 errval scsi_set_bus __P((int, struct scsi_link *));
461
462 char *scsi_sense_desc __P((int, int));
463 void scsi_sense_print __P((struct scsi_xfer *));
464 void show_scsi_cmd __P((struct scsi_xfer *));
465
466 void scsi_uto3b __P((u_int32_t , u_char *));
467 u_int32_t scsi_3btou __P((u_char *));
468 int32_t scsi_3btoi __P((u_char *));
469 void scsi_uto4b __P((u_int32_t, u_char *));
470 u_int32_t scsi_4btou __P((u_char *));
471 void scsi_uto2b __P((u_int32_t, u_char *));
472 u_int32_t scsi_2btou __P((u_char *));
473
474 void sc_print_addr __P((struct scsi_link *));
475 void sc_print_start __P((struct scsi_link *));
476 void sc_print_finish __P((void));
477
478 void scsi_device_register __P((struct scsi_device *sd));
479
480 void scsi_configure_start __P((void));
481 void scsi_configure_finish __P((void));
482
483 void ukinit __P((void));
484
485 #ifdef SCSI_2_DEF
486 errval scsi_change_def( struct scsi_link *sc_link, u_int32_t flags);
487 #endif
488 #endif /* KERNEL */
489
490 #define SCSI_EXTERNALLEN (sizeof(struct scsi_link))
491
492
493 /* XXX This belongs in a tape file.
494 */
495
496 /**********************************************************************
497 from the scsi2 spec
498 Value Tracks Density(bpi) Code Type Reference Note
499 0x1 9 800 NRZI R X3.22-1983 2
500 0x2 9 1600 PE R X3.39-1986 2
501 0x3 9 6250 GCR R X3.54-1986 2
502 0x5 4/9 8000 GCR C X3.136-1986 1
503 0x6 9 3200 PE R X3.157-1987 2
504 0x7 4 6400 IMFM C X3.116-1986 1
505 0x8 4 8000 GCR CS X3.158-1986 1
506 0x9 18 37871 GCR C X3B5/87-099 2
507 0xA 22 6667 MFM C X3B5/86-199 1
508 0xB 4 1600 PE C X3.56-1986 1
509 0xC 24 12690 GCR C HI-TC1 1,5
510 0xD 24 25380 GCR C HI-TC2 1,5
511 0xF 15 10000 GCR C QIC-120 1,5
512 0x10 18 10000 GCR C QIC-150 1,5
513 0x11 26 16000 GCR C QIC-320(525?) 1,5
514 0x12 30 51667 RLL C QIC-1350 1,5
515 0x13 1 61000 DDS CS X3B5/88-185A 4
516 0x14 1 43245 RLL CS X3.202-1991 4
517 0x15 1 45434 RLL CS ECMA TC17 4
518 0x16 48 10000 MFM C X3.193-1990 1
519 0x17 48 42500 MFM C X3B5/91-174 1
520
521 where Code means:
522 NRZI Non Return to Zero, change on ones
523 GCR Group Code Recording
524 PE Phase Encoded
525 IMFM Inverted Modified Frequency Modulation
526 MFM Modified Frequency Modulation
527 DDS Dat Data Storage
528 RLL Run Length Encoding
529
530 where Type means:
531 R Real-to-Real
532 C Cartridge
533 CS cassette
534
535 where Notes means:
536 1 Serial Recorded
537 2 Parallel Recorded
538 3 Old format know as QIC-11
539 4 Helical Scan
540 5 Not ANSI standard, rather industry standard.
541
542 ********************************************************************/
543
544 #define HALFINCH_800 0x01
545 #define HALFINCH_1600 0x02
546 #define HALFINCH_6250 0x03
547 #define QIC_11 0x04 /* from Archive 150S Theory of Op. XXX */
548 #define QIC_24 0x05 /* may be bad, works for CIPHER ST150S XXX */
549 #define QIC_120 0x0f
550 #define QIC_150 0x10
551 #define QIC_320 0x11
552 #define QIC_525 0x11
553 #define QIC_1320 0x12
554 #define DDS 0x13
555 #define DAT_1 0x13
556 #define QIC_3080 0x29
557
558
559 /* XXX (dufault@hda.com) This is used only by "su" and "sctarg".
560 * The minor number field conflicts with the disk slice code,
561 * and so it is tough to access the disks through the "su" device.
562 */
563
564 /* Device number fields:
565 *
566 * NON-FIXED SCSI devices:
567 *
568 * ?FC? ???? ???? ???? MMMMMMMM mmmmmmmm
569 *
570 * F: Fixed device (nexus in number): must be 0.
571 * C: Control device; only user mode ioctl is supported.
572 * ?: Don't know; those bits didn't use to exist, currently always 0.
573 * M: Major device number.
574 * m: Old style minor device number.
575 *
576 * FIXED SCSI devices:
577 *
578 * XXX Conflicts with the slice code. Maybe the slice code can be
579 * changed to respect the F bit?
580 *
581 * ?FC? ?BBB TTTT ?LLL MMMMMMMM mmmmmmmm
582 *
583 * F: Fixed device (nexus in number); must be 1.
584 * C: Control device; only user mode ioctl is supported.
585 * B: SCSI bus
586 * T: SCSI target ID
587 * L: Logical unit
588 * M: Major device number
589 * m: Old style minor device number.
590 */
591
592 #define SCSI_FIXED_MASK 0x40000000
593 #define SCSI_FIXED(DEV) (((DEV) & SCSI_FIXED_MASK))
594 #define SCSI_CONTROL_MASK 0x20000000
595 #define SCSI_CONTROL(DEV) (((DEV) & SCSI_CONTROL_MASK))
596
597 #define SCSI_BUS(DEV) (((DEV) & 0x07000000) >> 24)
598 #define SCSI_ID(DEV) (((DEV) & 0x00F00000) >> 20)
599 #define SCSI_LUN(DEV) (((DEV) & 0x00070000) >> 16)
600
601 #define SCSI_MKFIXED(B, T, L, P) ( \
602 ((B) << 24) | \
603 ((T) << 20) | \
604 ((L) << 16) | \
605 (P) | \
606 SCSI_FIXED_MASK )
607
608 #endif /*SCSI_SCSICONF_H*/
609 /* END OF FILE */
Cache object: 351d01efcc7a17df295852767c37b8d5
|