2 * Copyright (c) 1998,1999,2000
3 * Traakan, Inc., Los Altos, CA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice unmodified, this list of conditions, and the following
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * 17.1 Medium-changer device model
41 * Medium changer devices mechanize the movement of media to and from
42 * primary devices (such as disk or tape drives) and other locations
43 * within the range of the medium changer. The medium changer command set
44 * is based on a physical model of this functionality.
46 * This command set supports varied physical implementations of the medium
47 * changer function. Most of these variations are hidden from the
48 * initiator by the high level of function provided by the MOVE MEDIUM and
49 * EXCHANGE MEDIUM commands and by the generalized nature of the element
50 * addressing scheme. However, initiators may need to be aware of the
51 * capabilities of the particular medium changer device. These
52 * characteristics and capabilities are conveyed via MODE SENSE pages.
54 * 17.1.1 Medium-changer elements
56 * The medium-changer command set uses as its address space the set of
57 * physical locations and mechanisms within the scope of a medium changer
58 * device. The term element is used throughout this clause to refer to one
59 * member of the medium changer address space. Each element is a discrete
60 * physical entity that may hold zero or one physical unit of media - one
61 * disk cartridge, one spool of tape, etc. Element addresses do not extend
62 * across multiple physical units of media. Likewise, element addresses
63 * are independent of any logical partitioning that the primary device may
64 * support within a physical unit of media.
66 * A medium changer is viewed as a set of addressable elements, each of
67 * which may contain a unit of media or be used to move a unit of media.
68 * Each medium changer element has a unique 16 bit element address. Each
69 * element is an instance of one of four classes or element types.
71 * a) MEDIUM TRANSPORT ELEMENT
73 * c) IMPORT EXPORT ELEMENT
74 * d) DATA TRANSFER ELEMENT
76 * Units of media (cartridges, cassettes, caddies, etc.) are referred to
77 * only indirectly by this device model. Units of media can be moved to
78 * or from any of the elements of the medium changer device. The presence
79 * of media at the various elements in a medium changer can be sensed. In
80 * order to ensure exclusive access to a unit of media, the element where
81 * the unit of media is located (the element address) must be reserved.
83 * Elements of the medium transport, import export and (rarely) data
84 * transport types may not provide independent storage for medium. The
85 * capabilities of a particular medium changer in this respect can be
86 * sensed via the device capabilities page of the mode sense data. The
87 * following hypothetical medium changer implementation illustrates one
88 * case of an element not providing independent storage for medium.
89 * Consider a medium changer which has a carousel style storage for
90 * medium. The import export function could be provided by a port which
91 * allows operator access to one of the storage elements. In such a
92 * device, the MOVE ELEMENT command from storage element to import export
93 * element would rotate the carousel to align the addressed storage
94 * element to the import export position. In this case the import export
95 * element does not provide independent storage but rather access to one
96 * of the storage elements.
98 * 17.1.1.1 Medium transport elements
100 * Medium transport elements address the functions of the medium changer
101 * device that perform the movement of units of media. Where a medium
102 * transport element can serve (even temporarily) as a storage location
103 * for medium, the location of each unit of media must have a separate
106 * In larger medium changer devices, the medium movement functions may be
107 * performed by multiple independent robotics subsystems. Each of these
108 * may have a number of medium transport element addresses. The element
109 * addresses within each subsystem shall be contiguous. Any of the element
110 * addresses within a subsystem may be used interchangeably in the medium
111 * transport element address field of MOVE MEDIUM and EXCHANGE MEDIUM
112 * commands. An initiator may determine the capabilities of the medium
113 * movement facilities of a medium changer device via the transport
114 * geometry MODE SENSE page, see 17.3.3.3.
116 * Element address zero is reserved for use in the medium transport
117 * element address field of MOVE MEDIUM and EXCHANGE MEDIUM commands to
118 * direct the medium changer to use a default or medium changer selected
119 * medium transport element.
121 * In some implementations, medium transport elements may be source and/or
122 * destination addresses in MOVE MEDIUM and EXCHANGE MEDIUM commands.
123 * They may or may not provide independent storage of a unit of media.
124 * See the device capabilities MODE SENSE page, see 17.3.3.
126 * 17.1.1.2 Storage elements
128 * Storage elements are locations of units of media while not in some
129 * other element type. Medium in storage elements is available for access
130 * by medium transport elements.
132 * Storage elements may be source and/or destination addresses in MOVE
133 * MEDIUM and EXCHANGE MEDIUM commands.
135 * 17.1.1.3 Import export elements
137 * Import export elements are locations of units of media which are being
138 * inserted into or withdrawn from the medium changer device. Medium in
139 * these elements is accessible by both medium transport elements, by the
140 * operator, or by another independent medium changer device.
142 * Import export elements may be source and/or destination addresses in
143 * MOVE MEDIUM and EXCHANGE MEDIUM commands. They may or may not provide
144 * independent storage of a unit of media, see the device capabilities
145 * MODE SENSE page, see 17.3.3.
147 * Particular import export elements may be capable of either import
148 * actions, export actions, both or neither (if an element is not
151 * 17.1.1.4 Data transfer element
153 * Data transfer elements are locations of the primary devices which are
154 * capable of reading or writing the medium. Data transfer elements may
155 * also be viewed as medium changer element addresses of units of media
156 * loaded in or available for loading in or removal from primary devices
157 * such as disk or tape drives. Note that the medium changer function
158 * specified in this clause does not control the primary device. That is
159 * the responsibility of the system.
161 * Data transfer elements may be source and/or destination addresses in
162 * MOVE MEDIUM and EXCHANGE MEDIUM commands. They may or may not provide
163 * independent storage of a unit of media, see the device capabilities
164 * MODE SENSE page, see 17.3.3.
168 * Table 333 - Element type code
169 * +=============-===================================================+
170 * | Code | Description |
171 * |-------------+---------------------------------------------------|
172 * | 0h | All element types reported, (valid in CDB only) |
173 * | 1h | Medium transport element |
174 * | 2h | Storage element |
175 * | 3h | Import export element |
176 * | 4h | Data transfer element |
177 * | 5h - Fh | Reserved |
178 * +=================================================================+
181 #define SMC_ELEM_TYPE_ALL 0
182 #define SMC_ELEM_TYPE_MTE 1
183 #define SMC_ELEM_TYPE_SE 2
184 #define SMC_ELEM_TYPE_IEE 3
185 #define SMC_ELEM_TYPE_DTE 4
192 * The read element status descriptor format for all element types
193 * includes two sets of fields that contain volume tag information. These
194 * optional fields are used to report media identification information
195 * that the medium changer has acquired either by reading an external
196 * label (e.g. bar code labels), by a SEND VOLUME TAG command or by other
197 * means which may be vendor unique. The same volume tag information shall
198 * be available to all initiators whether assigned by that initiator, by
199 * some other initiator or by the media changer itself.
201 * Volume tag information provides a means to confirm the identity of a
202 * unit of media that resides in a medium changer element. This command
203 * set does not define any direct addressing of units of media based on
204 * these fields. However, commands are defined that provide translation
205 * between volume tag information and the element address where that unit
206 * of media currently resides.
208 * The medium changer command set definition does not impose the
209 * requirement that volume tag information be unique over the units of
210 * media within the scope of the changer device.
212 * The following commands support the optional volume tag functionality:
213 * a) SEND VOLUME TAG - either as a translation request or to associate
214 * a volume tag with the unit of media currently residing at an
216 * b) REQUEST VOLUME ELEMENT ADDRESS - return the element address
217 * currently associated with the volume tag information transferred
218 * with the last send volume tag command.
219 * c) READ ELEMENT STATUS - optionally reports volume tag information
220 * for all element types.
221 * d) MOVE MEDIUM and EXCHANGE MEDIUM commands - if volume tags are
222 * implemented, these commands must retain the association between
223 * volume tag information and units of media as they are moved from
224 * element to element.
226 * 17.1.5.1 Volume tag format
228 * Volume tag information consists of a volume identifier field of 32
229 * bytes plus a volume sequence number field of 2 bytes. The volume
230 * identifier shall consist of a left justified sequence of ASCII
231 * characters. Unused positions shall be blank (20h) filled. In order for
232 * the SEND VOLUME TAG translate with template to work the characters '*'
233 * and'?' (2Ah and 3Fh) must not appear in volume identification data and
234 * there must be no blanks (20h) within the significant part of the volume
235 * identifier. If volume tag information for a particular element is
236 * undefined, the volume identifier field shall be zero.
238 * The volume sequence number is a 2 byte integer field. If the volume
239 * sequence number is not used this field shall be zero. The volume tag
240 * contents are independent of the volume identification information
241 * recorded on the media.
243 * NOTE 199 For compatibility with the volume identifier defined by volume
244 * and file structure standards, it is recommended that the characters in the
245 * significant non-blank portion of the volume identifier field be restricted
246 * to the set: '0'..'9', 'A'..'Z', and '_' (30h .. 39h, 41h .. 5Ah, 5Fh).
247 * Specific systems may have differing requirements that may take precedence
248 * over this recommendation.
250 * Table 326 defines the fields within the 36 byte primary and alternate
251 * volume tag information fields found in READ ELEMENT STATUS descriptors
252 * and in the data format for the SEND VOLUME TAG command.
254 * Table 326 - Volume tag information format
255 * +=====-=======-=======-=======-========-========-========-=======-========+
256 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
257 * |Byte | | | | | | | | |
258 * |=====+===================================================================|
260 * |- - -+--- Volume identification field ---|
262 * |-----+-------------------------------------------------------------------|
264 * |- - -+--- Reserved ---|
266 * |-----+-------------------------------------------------------------------|
268 * |-----+--- Volume sequence number ---|
270 * +=========================================================================+
273 * 17.1.5.2 Primary and alternate volume tag information
275 * Element status descriptors as reported by the READ ELEMENT STATUS
276 * command define a primary volume tag and an alternate volume tag.
277 * Alternate volume tag information provides a means for a system to use
278 * different volume identification information for each side of double
279 * sided media. In such a system, the primary volume tag information
280 * refers to the logical medium accessible via a MOVE MEDIUM command
281 * without the invert bit set. The alternate volume tag information refers
282 * to the other side of the media, i.e. the side that would be accessed
283 * via a MOVE MEDIUM command with the invert bit set.
286 #define SMC_VOL_TAG_LEN 36
288 struct smc_raw_volume_tag {
289 unsigned char volume_id[32];
290 unsigned char resv32[2];
291 unsigned char volume_seq[2];
298 * 17.1.4 Element status maintenance requirements
300 * If the medium changer device chooses to implement the READ ELEMENT
301 * STATUS command, the medium changer device must be capable of reporting
302 * the various data (i.e. full, error, etc.) required by each page type.
303 * The medium changer may maintain this information at all times or
304 * regenerate it in response to the READ ELEMENT STATUS command. The
305 * INITIALIZE ELEMENT STATUS command can be used to force regeneration of
310 * 17.2.5 READ ELEMENT STATUS command
312 * The READ ELEMENT STATUS command (see table 332) requests that the
313 * target report the status of its internal elements to the initiator.
315 * Table 332 - READ ELEMENT STATUS command
316 * +====-=======-========-========-========-========-========-========-=======+
317 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
318 * |Byte| | | | | | | | |
319 * |====+=====================================================================|
320 * | 0 | Operation code (B8h) |
321 * |----+---------------------------------------------------------------------|
322 * | 1 |Logical unit number | VolTag | Element type code |
323 * |----+---------------------------------------------------------------------|
325 * |----+-- Starting element address --|
327 * |----+---------------------------------------------------------------------|
329 * |----+-- Number of elements --|
331 * |----+---------------------------------------------------------------------|
333 * |----+---------------------------------------------------------------------|
336 * | 8 | Allocation length |
339 * |----+---------------------------------------------------------------------|
341 * |----+---------------------------------------------------------------------|
343 * +==========================================================================+
346 * A volume tag (VolTag) bit of one indicates that the target shall report
347 * volume tag information if this feature is supported. A value of zero
348 * indicates that volume tag information shall not be reported. If the
349 * volume tag feature is not supported this field shall be treated as
352 * The element type code field specifies the particular element type(s)
353 * selected for reporting by this command. A value of zero specifies that
354 * status for all element types shall be reported. The element type codes
355 * are defined in table 333.
357 * Table 333 - Element type code
360 * The starting element address specifies the minimum element address to
361 * report. Only elements with an element type code permitted by the
362 * element type code specification, and an element address greater than or
363 * equal to the starting element address shall be reported. Element
364 * descriptor blocks are not generated for undefined element addresses.
366 * The number of elements specifies the maximum number of element
367 * descriptors to be created by the target for this command. The value
368 * specified by this field is not the range of element addresses to be
369 * considered for reporting but rather the number of defined elements to
370 * report. If the allocation length is not sufficient to transfer all the
371 * element descriptors, the target shall transfer all those descriptors
372 * that can be completely transferred and this shall not be considered an
375 * 17.2.5.1 Element status data
377 * The data returned by the READ ELEMENT STATUS command is defined in
378 * table 334 and 17.2.5.3 through 17.2.5.6. Element status data consists
379 * of an eight-byte header, (see table 334) followed by one or more
380 * element status pages.
382 * Table 334 - Element status data
383 * +====-=======-========-========-========-========-========-========-=======+
384 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
385 * |Byte| | | | | | | | |
386 * |====+=====================================================================|
388 * |----+-- First element address reported --|
390 * |----+---------------------------------------------------------------------|
392 * |----+-- Number of elements available --|
394 * |----+---------------------------------------------------------------------|
396 * |----+---------------------------------------------------------------------|
399 * | 6 | Byte count of report available |
400 * |----+-- (all pages, n - 7 ) --|
402 * |====+=====================================================================|
404 * |- - +-- Element status page(s) --|
406 * +==========================================================================+
409 * The first element address reported field indicates the element address
410 * of the element with the smallest element address found to meet the CDB
413 * The number of elements available field indicates the number of elements
414 * meeting the request in the command descriptor block. The status for
415 * these elements is returned if sufficient allocation length was
418 * The byte count of report available field indicates the number of bytes
419 * of element status page data available for all elements meeting the
420 * request in the command descriptor block. This value shall not be
421 * adjusted to match the allocation length available.
423 * NOTE 202 - The READ ELEMENT STATUS command can be issued with an
424 * allocation length of eight bytes in order to determine the allocation
425 * length required to transfer all the element status data specified by the
428 * Figure 28 provides an illustration of the element status data
431 * Figure 28 - Illustration of element status data structure
434 * 17.2.5.2 Element status page
436 * The element status page is defined in table 335. Each element status
437 * page includes an eight-byte header followed by one or more element
438 * descriptor blocks. The header includes the element type code, the
439 * length of each descriptor block and the number of bytes of element
440 * descriptor information that follow the header for this element type.
442 * Table 335 - Element status page
443 * +====-=======-========-========-========-========-========-========-=======+
444 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
445 * |Byte| | | | | | | | |
446 * |====+=====================================================================|
447 * | 0 | Element type code |
448 * |----+---------------------------------------------------------------------|
449 * | 1 |PVolTag| AVolTag| Reserved |
450 * |----+---------------------------------------------------------------------|
452 * |----+-- Element descriptor length --|
454 * |----+---------------------------------------------------------------------|
456 * |----+---------------------------------------------------------------------|
459 * | 6 | Byte count of descriptor data available |
460 * |----+-- (this page, n - 7) --|
462 * |====+=====================================================================|
464 * |- - +-- Element descriptor(s) --|
466 * +==========================================================================+
469 * The element type code field indicates the element type reported by this
472 * A primary volume tag (PVolTag) bit of one indicates that the primary
473 * volume tag information field is present in each of the following
474 * element descriptor blocks. A value of zero indicates that these bytes
475 * are omitted from the element descriptors that follow.
477 * An alternate volume tag (AVolTag) bit of one indicates that the
478 * alternate volume tag information field is present in each of the
479 * following element descriptor blocks. A value of zero indicates that
480 * these bytes are omitted from the element descriptors that follow.
482 * The element descriptor length field indicates the number of bytes in
483 * each element descriptor.
485 * The byte count of descriptor data available field indicates the number
486 * of bytes of element descriptor data available for elements of this
487 * element type meeting the request in the CDB. This value shall not be
488 * adjusted to match the allocation length available.
490 * Each element descriptor includes the element address and status flags;
491 * it may also contain sense code information as well as other information
492 * depending on the element type (see 17.2.5.3 through 17.2.5.6).
494 * 17.2.5.3 Medium transport element descriptor
496 * Table 336 defines the medium transport element descriptor.
498 * Table 336 - Medium transport element descriptor
499 * +====-======-========-========-========-========-========-========-=======+
500 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
501 * |Byte| | | | | | | | |
502 * |====+====================================================================|
504 * |----+-- Element address --|
506 * |----+--------------------------------------------------------------------|
507 * | 2 | Reserved | Except |Reserved| Full |
508 * |----+--------------------------------------------------------------------|
510 * |----+--------------------------------------------------------------------|
511 * | 4 | Additional sense code |
512 * |----+--------------------------------------------------------------------|
513 * | 5 | Additional sense code qualifier |
514 * |----+--------------------------------------------------------------------|
516 * | - -+-- Reserved --|
518 * |----+--------------------------------------------------------------------|
519 * | 9 |SValid| Invert | Reserved |
520 * |----+--------------------------------------------------------------------|
522 * |----+-- Source storage element address --|
524 * |----+--------------------------------------------------------------------|
526 * | - -+-- Primary volume tag information --|
527 * |47 | (Field omitted if PVolTag = 0) |
528 * |----+--------------------------------------------------------------------|
530 * | - -+-- Alternate volume tag information --|
531 * |83 | (Field omitted if AVolTag = 0) |
532 * |----+--------------------------------------------------------------------|
534 * | - -+-- Reserved --|
535 * |87 | (Field moved up if volume tag information field(s) are omitted.) |
536 * |----+--------------------------------------------------------------------|
538 * | - -+-- Vendor-specific --|
539 * |z-1 | (Field moved up if volume tag information field(s) are omitted.) |
540 * +=========================================================================+
543 * The element address field gives the address of the medium changer
544 * element whose status is reported by this element descriptor block.
546 * An exception (Except) bit of one indicates the element is in an
547 * abnormal state. An exception bit of zero indicates the element is in a
548 * normal state. If this bit is one, information on the abnormal state
549 * may be available in the additional sense code and additional sense code
552 * A full bit value of one indicates that the element contains a unit of
553 * media. A value of zero indicates that the element does not contain a
556 * The additional sense code field may provide specific information on an
557 * abnormal element state. The values in this field are as defined for
558 * the additional sense code of the REQUEST SENSE data (see 8.2.14.3).
560 * The additional sense code qualifier field may provide more detailed
561 * information on an abnormal element state. The values in this field are
562 * as defined for the additional sense code qualifier of the REQUEST SENSE
563 * data (see 8.2.14.4).
565 * A source valid (SValid) bit value of one indicates that the source
566 * storage element address field and the invert bit information are valid.
567 * A value of zero indicates that the values in these fields are not
570 * An invert bit value of one indicates that the unit of media now in this
571 * element was inverted by MOVE MEDIUM or EXCHANGE MEDIUM operations since
572 * it was last in the source storage element. A value of zero indicates
573 * that no inversion occurred during the operation.
575 * The source storage element address field provides the address of the
576 * last storage element this unit of media was moved. This field is valid
577 * only if the SValid bit is one.
579 * The primary and alternate volume tag information fields provide for
580 * identifying the unit of media residing in this element (see 17.1.5.).
581 * Either or both of these fields may be omitted for all the element
582 * descriptor blocks that comprise an element status page as indicated by
583 * the PVolTag and AVolTag bits in the element status page header.
585 * 17.2.5.4 Storage element descriptor
587 * Table 337 defines the storage element descriptor.
589 * Table 337 - Storage element descriptor
590 * +=====-======-========-========-========-========-========-========-=======+
591 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
592 * |Byte| | | | | | | | |
593 * |====+====================================================================|
595 * |----+-- Element address --|
597 * |----+--------------------------------------------------------------------|
598 * | 2 | Reserved | Access | Except |Reserved| Full |
599 * |----+--------------------------------------------------------------------|
601 * |----+--------------------------------------------------------------------|
602 * | 4 | Additional sense code |
603 * |----+--------------------------------------------------------------------|
604 * | 5 | Additional sense code qualifier |
605 * |----+--------------------------------------------------------------------|
607 * | - -+-- Reserved --|
609 * |----+--------------------------------------------------------------------|
610 * | 9 |SValid| Invert | Reserved |
611 * |----+--------------------------------------------------------------------|
613 * |----+-- Source element address --|
615 * |----+--------------------------------------------------------------------|
617 * | - -+-- Primary volume tag information --|
618 * |47 | (Field omitted if PVolTag = 0) |
619 * |----+--------------------------------------------------------------------|
621 * | - -+-- Alternate volume tag information --|
622 * |83 | (Field omitted if PVolTag = 0) |
623 * |----+--------------------------------------------------------------------|
625 * | - -+-- Reserved --|
626 * |87 | (Field moved up if volume tag information field(s) are omitted.) |
627 * |----+--------------------------------------------------------------------|
629 * | - -+-- Vendor unique --|
630 * |z-1 | (Field moved up if volume tag information field(s) are omitted.) |
631 * +=========================================================================+
634 * An access bit value of one indicates that access to the element by a
635 * medium transport element is allowed. An access bit of zero indicates
636 * that access to the element by the medium transport element is denied.
638 * The source storage element address field provides the address of the
639 * last storage element this unit of media was moved from. This element
640 * address value may or may not be the same as this element. This field is
641 * valid only if the SValid bit is one.
643 * For fields not defined in this subclause, see 17.2.5.3.
645 * 17.2.5.5 Import export element descriptor
647 * Table 338 defines the import export element descriptor.
649 * Table 338 - Import export element descriptor
650 * +====-======-========-========-========-========-========-========-=======+
651 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
652 * |Byte| | | | | | | | |
653 * |====+====================================================================|
655 * |----+-- Element address --|
657 * |----+--------------------------------------------------------------------|
658 * | 2 | Reserved | InEnab | ExEnab | Access | Except | ImpExp | Full |
659 * |----+--------------------------------------------------------------------|
661 * |----+--------------------------------------------------------------------|
662 * | 4 | Additional sense code |
663 * |----+--------------------------------------------------------------------|
664 * | 5 | Additional sense code qualifier |
665 * |----+--------------------------------------------------------------------|
667 * |----+-- Reserved --|
669 * |----+--------------------------------------------------------------------|
670 * | 9 |SValid| Invert | Reserved |
671 * |----+--------------------------------------------------------------------|
673 * |----+-- Source storage element address --|
675 * |----+--------------------------------------------------------------------|
677 * | - -+-- Primary volume tag information --|
678 * |47 | (Field omitted if PVolTag = 0) |
679 * |----+--------------------------------------------------------------------|
681 * | - -+-- Alternate volume tag information --|
682 * |83 | (Field omitted if PVolTag = 0) |
683 * |----+--------------------------------------------------------------------|
685 * | - -+-- Reserved --|
686 * |87 | (Field moved up if volume tag information field(s) are omitted.) |
687 * |----+--------------------------------------------------------------------|
689 * | - -+-- Vendor unique --|
690 * |z-1 | (Field moved up if volume tag information field(s) are omitted.) |
691 * +=========================================================================+
694 * An import enable (InEnab) bit of one indicates that the import export
695 * element supports movement of media into the scope of the medium changer
696 * device. An InEnab bit of zero indicates that this element does not
697 * support import actions.
699 * An export enable (ExEnab) bit of one indicates that the import export
700 * element supports movement of media out of the scope of the medium
701 * changer device. An ExEnab bit of zero indicates that this element does
702 * not support export actions.
704 * An access bit of one indicates that access to the import export element
705 * by a medium transport element is allowed. An access bit of zero
706 * indicates access to the import export element by medium transport
707 * elements is denied.
709 * NOTE 203 An example of when access would be denied is when the operator
710 * has exclusive access to the import export element.
712 * An import export (ImpExp) bit of one indicates the unit of media in the
713 * import export element was placed there by an operator. An ImpExp bit
714 * of zero indicates the unit of media in the import export element was
715 * placed there by the medium transport element.
717 * For fields not defined in this clause, see 17.2.5.3.
719 * 17.2.5.6 Data transfer element descriptor
721 * Table 339 defines the data transfer element descriptor.
723 * Table 339 - Data transfer element descriptor
724 * +====-=======-========-========-========-========-========-========-=======+
725 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
726 * |Byte| | | | | | | | |
727 * |====+=====================================================================|
729 * |----+-- Element address --|
731 * |----+---------------------------------------------------------------------|
732 * | 2 | Reserved | Access | Except |Reserved| Full |
733 * |----+---------------------------------------------------------------------|
735 * |----+---------------------------------------------------------------------|
736 * | 4 | Additional sense code |
737 * |----+---------------------------------------------------------------------|
738 * | 5 | Additional sense code qualifier |
739 * |----+---------------------------------------------------------------------|
740 * | 6 Not bus|Reserved|ID valid|LU valid|Reserved| Logical unit number |
741 * |----+---------------------------------------------------------------------|
742 * | 7 | SCSI bus address |
743 * |----+---------------------------------------------------------------------|
745 * |----+---------------------------------------------------------------------|
746 * | 9 |SValid | Invert | Reserved |
747 * |----+---------------------------------------------------------------------|
749 * |----+-- Source storage element address --|
751 * |----+---------------------------------------------------------------------|
753 * | - -+-- Primary volume tag information --|
754 * |47 | (Field omitted if PVolTag = 0) |
755 * |----+---------------------------------------------------------------------|
757 * | - -+-- Alternate volume tag information --|
758 * |83 | (Field omitted if PVolTag = 0) |
759 * |----+---------------------------------------------------------------------|
761 * | - -+-- Reserved --|
762 * |87 | (Field moved up if volume tag information field(s) are omitted.) |
763 * |----+---------------------------------------------------------------------|
765 * | - -+-- Vendor unique --|
766 * |z-1 | (Field moved up if volume tag information field(s) are omitted.) |
767 * +==========================================================================+
770 * An access bit value of one indicates access to the data transfer
771 * element by the medium transport element is allowed. A value of zero
772 * indicates access to the data transfer element by a medium transport
775 * NOTE 204 Access to the data transfer element by medium transport elements
776 * might be denied if a data transfer operation was under way. Note that a
777 * one value in this bit may not be sufficient to ensure a successful
778 * operation. This bit can only reflect the best information available to the
779 * medium changer device, which may not accurately reflect the state of the
780 * primary (data transfer) device.
782 * A not this bus (not bus) bit value of one indicates that the SCSI bus
783 * address and logical unit number values are not valid for the SCSI bus
784 * used to select the medium changer device. A not bus bit value of zero
785 * indicates that the SCSI address and logical unit values, if valid, are
786 * on the same bus as the medium changer device.
788 * An ID Valid bit value of one indicates that the SCSI bus address field
789 * contains valid information. An LU Valid bit value of one indicates that
790 * the logical unit number field contains valid information.
792 * The SCSI bus address field, if valid, provides the SCSI address (binary
793 * representation) of the primary device served by the medium changer at
794 * this element address.
796 * The logical unit number field, if valid, provides the logical unit
797 * number within the SCSI bus device of the primary device served by the
798 * medium changer at this element address.
800 * For fields not defined in this clause, see 17.2.5.3.
803 struct smc_raw_element_status_data_header {
804 unsigned char first_elem[2];
805 unsigned char n_elem[2];
807 unsigned char byte_count[3];
810 struct smc_raw_element_status_page_header {
811 unsigned char element_type;
813 #define SMC_RAW_ESP_F1_PVolTag 0x80
814 #define SMC_RAW_ESP_F1_AVolTag 0x40
815 unsigned char elem_desc_len[2];
817 unsigned char byte_count[3];
820 struct smc_raw_element_descriptor {
821 unsigned char element_address[2];
822 unsigned char flags2;
823 #define SMC_RAW_ED_F2_Full 0x01
824 #define SMC_RAW_ED_F2_ImpExp 0x02
825 #define SMC_RAW_ED_F2_Except 0x04
826 #define SMC_RAW_ED_F2_Access 0x08
827 #define SMC_RAW_ED_F2_ExEnab 0x10
828 #define SMC_RAW_ED_F2_InEnab 0x20
833 unsigned char flags6;
834 #define SMC_RAW_ED_F6_LUN 0x07
835 #define SMC_RAW_ED_F6_LU_valid 0x10
836 #define SMC_RAW_ED_F6_ID_valid 0x20
837 #define SMC_RAW_ED_F6_Not_bus 0x80
839 unsigned char scsi_sid;
843 unsigned char flags9;
844 #define SMC_RAW_ED_F9_Invert 0x40
845 #define SMC_RAW_ED_F9_SValid 0x80
847 unsigned char src_se_addr[2];
849 struct smc_raw_volume_tag primary_vol_tag;
850 struct smc_raw_volume_tag alternate_vol_tag;
852 unsigned char resv84[4];
853 unsigned char vendor_specific[4];
858 * 17.3.3.2 Element address assignment page
860 * The element address assignment page (see table 352) is used to assign
861 * addresses to the elements of the medium changer (MODE SELECT) and to
862 * report those assignments (MODE SENSE). This page also defines the
863 * number of each type of element present.
865 * Table 352 - Element address assignment page
866 * +====-=======-========-========-========-========-========-========-=======+
867 * | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
868 * |Byte| | | | | | | | |
869 * |====+=======+========+====================================================|
870 * | 0 | PS |Reserved| Page code (1Dh) |
871 * |----+---------------------------------------------------------------------|
872 * | 1 | Parameter length (12h) |
873 * |----+---------------------------------------------------------------------|
875 * |----+-- Medium transport element address --|
877 * |----+---------------------------------------------------------------------|
879 * |----+-- Number of medium transport elements --|
881 * |----+---------------------------------------------------------------------|
883 * |----+-- First storage element address --|
885 * |----+---------------------------------------------------------------------|
887 * |----+-- Number of storage elements --|
889 * |----+---------------------------------------------------------------------|
891 * |----+-- First import export element address --|
893 * |----+---------------------------------------------------------------------|
895 * |----+-- Number of import export elements --|
897 * |----+---------------------------------------------------------------------|
899 * |----+-- First data transfer element address --|
901 * |----+---------------------------------------------------------------------|
903 * |----+-- Number of data transfer elements --|
905 * |----+---------------------------------------------------------------------|
907 * |----+-- Reserved --|
909 * +==========================================================================+
912 * The parameters savable (PS) bit is only used with the MODE SENSE
913 * command. This bit is reserved with the MODE SELECT command. A PS bit
914 * of one indicates that the target is capable of saving the page in a
915 * non-volatile vendor-specific location.
917 * The first medium transport element address field identifies the first
918 * medium transport element contained in the medium changer (other than
919 * the default medium transport address of zero). The number of medium
920 * transport elements field defines the total number of medium transport
921 * elements contained in the medium changer. If the number of medium
922 * transport elements field in a MODE SELECT command is greater than the
923 * default value returned in the MODE SENSE parameter data, the target
924 * shall return CHECK CONDITION status and set the sense key to ILLEGAL
927 * The first storage element address field identifies the first medium
928 * storage element contained in the medium changer. The number of storage
929 * elements field defines the total number of medium storage elements
930 * contained in the medium changer. If the number of medium storage
931 * elements field in a MODE SELECT command is greater than the default
932 * value returned in the MODE SENSE parameter data, the target shall
933 * return CHECK CONDITION status and set the sense key to ILLEGAL REQUEST.
935 * The first import export element address field identifies the first
936 * medium portal that is accessible both by the medium transport devices
937 * and also by an operator from outside the medium changer. The number of
938 * import export elements field defines the total number of import export
939 * elements contained in the medium changer and accessible to the medium
940 * transport elements. If the number of import export elements field in a
941 * MODE SELECT command is greater than the default value returned in the
942 * MODE SENSE parameter data, the target shall return CHECK CONDITION
943 * status and set the sense key to ILLEGAL REQUEST .
945 * NOTE 207 The number of import export elements may be zero.
947 * The first data transfer element address field identifies the first data
948 * transfer element contained in the medium changer. The data transfer
949 * elements may be either read/write or read-only devices. The number of
950 * data transfer field defines the total number of data transfer elements
951 * contained within the medium changer and accessible to the medium
952 * transport elements. If the number of data transfer elements field in a
953 * MODE SELECT command is greater than the default value returned in the
954 * MODE SENSE parameter data, the target shall return CHECK CONDITION
955 * status and set the sense key to ILLEGAL REQUEST .
957 * Each element in the medium changer must have a unique address. If the
958 * address ranges defined for any of the element types overlap, the target
959 * shall return CHECK CONDITION status and set the sense key to ILLEGAL
963 struct smc_raw_element_address_assignment_page {
964 unsigned char page_code; /* 0x1D */
965 #define SMC_RAW_EA_PC_PS 0x80
966 unsigned char param_length; /* 0x12 */
967 unsigned char mte_addr[2];
968 unsigned char mte_count[2];
969 unsigned char se_addr[2];
970 unsigned char se_count[2];
971 unsigned char iee_addr[2];
972 unsigned char iee_count[2];
973 unsigned char dte_addr[2];
974 unsigned char dte_count[2];
975 unsigned char resv18[2];
981 #define SMC_GET2(VEC) \
983 ( (((unsigned char)(VEC)[0] << 8)) \
984 + (((unsigned char)(VEC)[1])))
986 #define SMC_PUT2(VEC,VAL) \
987 ((VEC)[0] = (unsigned char)((VAL)>>8), \
988 (VEC)[1] = (unsigned char)((VAL)))
990 #define SMC_GET3(VEC) \
992 ( (((unsigned char)(VEC)[0] << 16)) \
993 + (((unsigned char)(VEC)[1] << 8)) \
994 + ((unsigned char)(VEC)[2]))
996 #define SMC_PUT3(VEC,VAL) \
997 ((VEC)[0] = (unsigned char)((VAL)>>16), \
998 (VEC)[1] = (unsigned char)((VAL)>>8), \
999 (VEC)[2] = (unsigned char)((VAL)))
1001 #define SMC_GET4(VEC) \
1003 ( (((unsigned char)(VEC)[0] << 24)) \
1004 + (((unsigned char)(VEC)[1] << 16)) \
1005 + (((unsigned char)(VEC)[2] << 8)) \
1006 + ((unsigned char)(VEC)[3]))
1008 #define SMC_PUT4(VEC,VAL) \
1009 ((VEC)[0] = (unsigned char)((VAL)>>24), \
1010 (VEC)[1] = (unsigned char)((VAL)>>16), \
1011 (VEC)[2] = (unsigned char)((VAL)>>8), \
1012 (VEC)[3] = (unsigned char)((VAL)))