Initial import from FreeBSD RELENG_4:
[games.git] / share / man / man4 / ch.4
1 .\" $FreeBSD: src/share/man/man4/ch.4,v 1.18.2.7 2001/08/17 13:08:37 ru Exp $
2 .\" Copyright (c) 1996
3 .\"     Julian Elischer <julian@FreeBSD.org>.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\"
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .Dd May 14, 1998
28 .Dt CH 4
29 .Os
30 .Sh NAME
31 .Nm ch
32 .Nd SCSI media-changer (juke box) driver
33 .Sh SYNOPSIS
34 .Cd device ch
35 .Cd device ch1 target 4 unit 0
36 .Sh DESCRIPTION
37 The
38 .Xr ch
39 driver provides support for a
40 .Em SCSI
41 media changer.
42 It allows many slots of media to be multiplexed between
43 a number of drives.  The changer device may optionally be equipped
44 with a bar code reader, which reads label informationen attached to
45 the media.
46 .Pp
47 A SCSI adapter must also be separately configured into the system
48 before a SCSI changer can be configured.
49 .Pp
50 As the SCSI adapter is probed during boot, the
51 .Em SCSI
52 bus is scanned for devices.
53 Any devices found which answer as 'Changer'
54 type devices will be 'attached' to the
55 .Nm
56 driver.
57 In
58 .Fx
59 releases prior to 2.1, the first found will be attached as
60 .Em ch0
61 and the next,
62 .Em ch1
63 etc.
64 Beginning in 2.1 it is possible to specify what ch unit a device should
65 come on line as; refer to
66 .Xr scsi 4
67 for details on kernel configuration.
68 .Sh KERNEL CONFIGURATION
69 In configuring, if an optional
70 .Ar count
71 is given in the specification, that number of SCSI media changers
72 are configured; Most storage for them is allocated only when found
73 so a large number of configured devices is cheap.
74 (once the first
75 has included the driver).
76 .Sh IOCTLS
77 User mode programs communicate with the changer driver through a
78 number of ioctls which are described below.  Changer element addresses
79 used in the communcation between the kernel and the changer device are
80 mapped to zero-based logical addresses.  Element types are specified
81 as follows:
82 .Bl -tag -width CHET_MT
83 .It Dv CHET_MT
84 Medium transport element (picker).
85 .It Dv CHET_ST
86 Storage element (slot).
87 .It Dv CHET_IE
88 Import/export element (portal).
89 .It Dv CHET_DT
90 Data transfer element (drive).
91 .El
92 .Pp
93 The following
94 .Xr ioctl 2
95 calls apply to the changer.
96 They are defined
97 in the header file
98 .Aq Pa sys/chio.h .
99 .Pp
100 .Bl -tag -width CHIOEXCHANGE
101 .It Dv CHIOMOVE
102 .Pq Li "struct changer_move"
103 Move a medium from one element to another (\fBMOVE MEDIUM\fR) using
104 the current picker.  The source and destination elements are specified
105 in a changer_move structure, which includes at least the following
106 fields:
107 .Bd -literal -offset indent
108 u_int cm_fromtype; /* element type to move from */
109 u_int cm_fromunit; /* logical unit of from element */
110 u_int cm_totype;   /* element type to move to */
111 u_int cm_tounit;   /* logical unit of to element */
112 u_int cm_flags;    /* misc. flags */
113 .Ed
114 If the \fBCM_INVERT\fR in the \fBcm_flags\fR field is set, the medium
115 changer is instructed to flip the medium while moving it.
116 .It Dv CHIOEXCHANGE
117 .Pq Li "struct changer_exchange"
118 Move the medium located in the source element to the first destination
119 element, and move the medium that had been in the first destination
120 element to the second destination element.  In case of a simple
121 exchange, the source and second destination elements should be the
122 same.  The current picker is used to perform the operation.  The
123 addresses of the affected elements is specified to the ioctl in a
124 changer_exchange structure which includes at least the following
125 fields:
126 .Bd -literal -offset indent
127 u_int ce_srctype;        /* element type of source */
128 u_int ce_srcunit;        /* logical unit of source */
129 u_int ce_fdsttype; /* element type of first destination */
130 u_int ce_fdstunit; /* logical unit of first destination */
131 u_int ce_sdsttype; /* element type of second destination */
132 u_int ce_sdstunit; /* logical unit of second destination */
133 u_int ce_flags;  /* misc. flags */
134 .Ed
135 In \fBce_flags\fR, \fBCM_INVERT1\fR and/or \fBCM_INVERT2\fR may be set
136 to flip the first or second medium during the exchange operation,
137 respectively.
138 .Pp
139 \fIThis operation is untested.\fR
140 .It Dv CHIOPOSITION
141 .Pq Li "struct changer_position"
142 Position the current picker in front of the specified element.  The
143 element is specified with a changer_position structure, which includes
144 at least the following elements:
145 .Bd -literal -offset indent
146 u_int cp_type;  /* element type */
147 u_int cp_unit;  /* logical unit of element */
148 u_int cp_flags; /* misc. flags */
149 .Ed
150 The \fBcp_flags\fR field may be set to \fBCP_INVERT\fR to invert the
151 picker during the operation.
152 .It Dv CHIOGPICKER
153 .Pq Li "int"
154 Return the logical address of the current picker.
155 .It Dv CHIOSPICKER
156 .Pq Li "int"
157 Select the picker specified by the given logical address.
158 .It Dv CHIOGPARAMS
159 .Pq Li "struct changer_params"
160 Return the configuration parameters for the media changer.  This ioctl
161 fills the changer_params structure passed by the user with at least the
162 following fields:
163 .Bd -literal -offset indent
164 u_int cp_npickers; /* number of pickers */
165 u_int cp_nslots;   /* number of slots */
166 u_int cp_nportals; /* number of import/export portals */
167 u_int cp_ndrives;  /* number of drives */
168 .Ed
169 .Pp
170 This call can be used by applications to query the dimensions of
171 the jukebox before using the \fBCHIGSTATUS\fR
172 ioctl to query the jukebox' status.
173 .It Dv CHIOIELEM
174 Perform the \fBINITIALIZE ELEMENT STATUS\fR call on the media changer
175 device.  This forces the media changer to update its internal status
176 information with respect to loaded media.  It also scans any barcode
177 labels provided that it has a label reader.  The
178 .Nm
179 driver's status is not affected by this call.
180 .It Dv CHIOGSTATUS
181 .Pq Li "struct changer_element_status_request"
182 Perform the \fBREAD ELEMENT STATUS\fR call on the media changer
183 device.  This call reads the element status information of the media
184 changer and converts it to an array of \fBchanger_element_status\fR
185 structures.
186 .Pp
187 With each call to
188 .Dv CHIOGSTATUS ,
189 the status of one or more elements of one type may be queried.
190 .Pp
191 The application passes a changer_element_status_request structure to the
192 .Nm
193 driver which contains the following fields:
194 .Bd -literal -offset indent
195 u_int                          cesr_element_type;
196 u_int                          cesr_element_base;
197 u_int                          cesr_element_count;
198 u_int                          cesr_flags;
199 struct changer_element_status *cesr_element_status;
200 .Ed
201 .Pp
202 This structure is read by the driver to determine the type, logical
203 base address and number of elements for which information is to be
204 returned in the array of changer_element_status structures pointed to
205 by the cesr_element_status field.  The application must allocate enough
206 memory for cesr_element_count status structures (see below).
207 The cesr_flags can optionally be set to
208 .Dv CESR_VOLTAGS
209 to indicate that volume tag (bar code) information is to be read from
210 the jukebox and returned.
211 .Pp
212 The cesr_element_base and cesr_element_count fields must be valid with
213 respect to the physical configuration of the changer.  If they are
214 not, the
215 .Dv CHIOGSTATUS
216 ioctl returns the
217 .Er EINVAL
218 error code.
219 .Pp
220 The information about the elements is returned in an array of
221 changer_element_status structures.  This structure include at least
222 the following fields:
223 .Bd -literal -offset indent
224 u_int            ces_addr;      /* element address in media changer */
225 u_char           ces_flags;     /* see CESTATUS definitions below */
226 u_char           ces_sensecode; /* additional sense code for element */
227 u_char           ces_sensequal; /* additional sense code qualifier */
228 u_char           ces_invert;    /* invert bit */
229 u_char           ces_svalid;    /* source address (ces_source) valid */
230 u_short          ces_source;    /* source address of medium */
231 changer_voltag_t ces_pvoltag;   /* primary volume tag */
232 changer_voltag_t ces_avoltag;   /* alternate volume tag */
233 u_char           ces_idvalid;   /* ces_scsi_id is valid */
234 u_char           ces_scsi_id;   /* SCSI id of element (if ces_idvalid is nonzero) */
235 u_char           ces_lunvalid;  /* ces_scsi_lun is valid */
236 u_char           ces_scsi_lun;  /* SCSI lun of elemtne (if ces_lunvalid is nonzero) */
237 .Ed
238 .Pp
239 The ces_addr field contains the address of the element in the
240 coordinate system of the media changer.  It is not used by the driver,
241 and should be used for diagnostic purposes only.
242 .Pp
243 The following flags are defined for the \fBces_flags\fR field:
244 .Bl -tag -width CESTATUS_IMPEXP
245 .It Dv CESTATUS_FULL
246 A medium is present.
247 .It Dv CESTATUS_IMPEXP
248 The medium has been deposited by the operator (and not by a picker).
249 .It Dv CESTATUS_EXCEPT
250 The element is in an exceptional state (e.g. invalid barcode label,
251 barcode not yet scanned).
252 .It Dv CESTATUS_ACCESS
253 The element is accessible by the picker.
254 .It Dv CESTATUS_EXENAB
255 The element supports medium export.
256 .It Dv CESTATUS_INENAB
257 The element supports medium import.
258 .El
259 .Pp
260 Note that not all flags are valid for all element types.
261 .El
262 .Sh NOTES
263 This version of the
264 .Nm
265 driver has been tested with a DEC TZ875 (5 slot, one DLT drive) and a
266 and a Breece Hill Q47 (60 slot, four DLT drives, barcode reader).
267 .Pp
268 Many of the features the
269 .Nm
270 driver supports are not thouroghly tested due to the fact that the
271 devices available for testing do not support the necessary commands.
272 This is true for alternate volume tags, media flipping, import/export
273 element handling, multiple picker operation and other things.
274 .Sh AUTHORS
275 .An -nosplit
276 The
277 .Nm
278 driver was written by
279 .An Jason R. Thorpe Aq thorpej@and.com
280 for And Communications,
281 .Pa http://www.and.com/ .
282 It was added to the system by
283 .An Stefan Grefen Aq grefen@goofy.zdv.uni-mainz.de
284 who apparently had such a device.
285 It was ported to CAM by
286 .An Kenneth Merry Aq ken@FreeBSD.org .
287 It was updated to support volume tags by
288 .An Hans Huebner Aq hans@artcom.de .
289 .Sh FILES
290 .Bl -tag -width /dev/ch[0-9] -compact
291 .It Pa /dev/ch[0-9]
292 device entries
293 .El
294 .Sh DIAGNOSTICS
295 If the media changer does not support features requested by the
296 .Nm
297 driver, it will produce both console error messages and failure return
298 codes to the ioctls described here.
299 .Sh SEE ALSO
300 .Xr chio 1 ,
301 .Xr cd 4 ,
302 .Xr da 4 ,
303 .Xr sa 4
304 .Sh HISTORY
305 The
306 .Nm
307 driver appeared in
308 .Bx 386 0.1 .