2 .\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" $FreeBSD: src/share/man/man4/cd.4,v 1.17.2.8 2003/06/03 14:32:09 hmp Exp $
27 .\" $DragonFly: src/share/man/man4/cd.4,v 1.6 2008/05/02 02:05:05 swildner Exp $
34 .Nd SCSI CD-ROM driver
37 .Cd device cd1 at scbus0 target 4 unit 0
38 .Cd "options CHANGER_MIN_BUSY_SECONDS=3"
39 .Cd "options CHANGER_MAX_BUSY_SECONDS=11"
43 driver provides support for a
46 (Compact Disc-Read Only Memory) drive.
47 In an attempt to look like a regular disk, the
49 driver synthesizes a partition table, with one partition covering the entire
51 It is possible to modify this partition table using
53 but it will only last until the
56 In general the interfaces are similar to those described by
63 adapter is probed during boot, the
65 bus is scanned for devices.
66 Any devices found which answer as CDROM
67 (type 5) or WORM (type 4) type devices will be `attached' to the
72 the first device found will be attached as
79 it is possible to specify what cd unit a device should
80 come on line as; refer to
82 for details on kernel configuration.
86 string is followed by the device's standard
91 string is followed by the Logical Unit Number
95 device's sub-device, if any, or zero.
99 may be used to read the synthesized
101 structure, which will contain correct figures for the size of the
103 should that information be required.
104 .Sh KERNEL CONFIGURATION
107 devices may be attached to the system regardless of system
108 configuration as all resources are dynamically allocated.
119 .In sys/disklabel.h .
120 .Bl -tag -width ".Dv CDIOCREADSUBCHANNEL"
123 .Pq Li "struct disklabel"
124 Read or write the in-core copy of the disklabel for the
126 The disklabel is initialized with information
127 read from the scsi inquiry commands, and should be the same as
128 the information printed at boot.
129 This structure is defined in
131 .It Dv CDIOCCAPABILITY
132 .Pq Li "struct ioc_capability"
133 Retrieve information from the drive on what features it supports.
134 The information is returned in the following structure:
135 .Bd -literal -offset indent
136 struct ioc_capability {
137 u_long play_function;
138 #define CDDOPLAYTRK 0x00000001
139 /* Can play tracks/index */
140 #define CDDOPLAYMSF 0x00000002
141 /* Can play msf to msf */
142 #define CDDOPLAYBLOCKS 0x00000004
143 /* Can play range of blocks */
144 #define CDDOPAUSE 0x00000100
145 /* Output can be paused */
146 #define CDDORESUME 0x00000200
147 /* Output can be resumed */
148 #define CDDORESET 0x00000400
149 /* Drive can be completely reset */
150 #define CDDOSTART 0x00000800
151 /* Audio can be started */
152 #define CDDOSTOP 0x00001000
153 /* Audio can be stopped */
154 #define CDDOPITCH 0x00002000
155 /* Audio pitch can be changed */
157 u_long routing_function;
158 #define CDREADVOLUME 0x00000001
159 /* Volume settings can be read */
160 #define CDSETVOLUME 0x00000002
161 /* Volume settings can be set */
162 #define CDSETMONO 0x00000100
163 /* Output can be set to mono */
164 #define CDSETSTEREO 0x00000200
165 /* Output can be set to stereo (def) */
166 #define CDSETLEFT 0x00000400
167 /* Output can be set to left only */
168 #define CDSETRIGHT 0x00000800
169 /* Output can be set to right only */
170 #define CDSETMUTE 0x00001000
171 /* Output can be muted */
172 #define CDSETPATCH 0x00008000
173 /* Direct routing control allowed */
175 u_long special_function;
176 #define CDDOEJECT 0x00000001
177 /* The tray can be opened */
178 #define CDDOCLOSE 0x00000002
179 /* The tray can be closed */
180 #define CDDOLOCK 0x00000004
181 /* The tray can be locked */
182 #define CDREADHEADER 0x00000100
183 /* Can read Table of Contents */
184 #define CDREADENTRIES 0x00000200
185 /* Can read TOC Entries */
186 #define CDREADSUBQ 0x00000200
187 /* Can read Subchannel info */
188 #define CDREADRW 0x00000400
189 /* Can read subcodes R-W */
190 #define CDHASDEBUG 0x00004000
191 /* The tray has dynamic debugging */
194 .It Dv CDIOCPLAYTRACKS
195 .Pq Li "struct ioc_play_track"
196 Start audio playback given a track address and length.
197 The structure is defined as follows:
198 .Bd -literal -offset indent
199 struct ioc_play_track
207 .It Dv CDIOCPLAYBLOCKS
208 .Pq Li "struct ioc_play_blocks"
209 Start audio playback given a block address and length.
210 The structure is defined as follows:
211 .Bd -literal -offset indent
212 struct ioc_play_blocks
219 .Pq Li "struct ioc_play_msf"
220 Start audio playback given a `minutes-seconds-frames' address and
222 The structure is defined as follows:
223 .Bd -literal -offset indent
234 .It Dv CDIOCREADSUBCHANNEL
235 .Pq Li "struct ioc_read_subchannel"
236 Read information from the subchannel at the location specified by this
238 .Bd -literal -offset indent
239 struct ioc_read_subchannel {
240 u_char address_format;
241 #define CD_LBA_FORMAT 1
242 #define CD_MSF_FORMAT 2
244 #define CD_SUBQ_DATA 0
245 #define CD_CURRENT_POSITION 1
246 #define CD_MEDIA_CATALOG 2
247 #define CD_TRACK_INFO 3
250 struct cd_sub_channel_info *data;
253 .It Dv CDIOREADTOCHEADER
254 .Pq Li "struct ioc_toc_header"
255 Return summary information about the table of contents for the mounted
257 The information is returned into the following structure:
258 .Bd -literal -offset indent
259 struct ioc_toc_header {
261 u_char starting_track;
265 .It Dv CDIOREADTOCENTRYS
266 .Pq Li "struct ioc_read_toc_entry"
267 Return information from the table of contents entries mentioned.
268 .Pq Yes, this command name is misspelled.
269 The argument structure is defined as follows:
270 .Bd -literal -offset indent
271 struct ioc_read_toc_entry {
272 u_char address_format;
273 u_char starting_track;
275 struct cd_toc_entry *data;
278 The requested data is written into an area of size
283 .Pq Li "struct ioc_patch"
284 Attach various audio channels to various output channels.
285 The argument structure is defined thusly:
286 .Bd -literal -offset indent
289 /* one for each channel */
294 .Pq Li "struct ioc_vol"
295 Get (set) information about the volume settings of the output channels.
296 The argument structure is as follows:
297 .Bd -literal -offset indent
301 /* one for each channel */
305 Patch all output channels to all source channels.
306 .It Dv CDIOCSETSTEREO
307 Patch left source channel to the left output channel and the right
308 source channel to the right output channel.
310 Mute output without changing the volume settings.
313 Attach both output channels to the left (right) source channel.
316 Turn on (off) debugging for the appropriate device.
319 Pause (resume) audio play, without resetting the location of the read-head.
324 Tell the drive to spin-up (-down) the
328 Tell the drive to allow (prevent) manual ejection of the
330 disc. Not all drives support this feature.
335 Tell the drive to close its door and load the media.
336 Not all drives support this feature.
338 .Pq Li "struct ioc_pitch"
339 For drives that support it, this command instructs the drive to play
340 the audio at a faster or slower rate than normal.
343 between -32767 and -1 result in slower playback; a zero value
344 indicates normal speed; and values from 1 to 32767 give faster
346 Drives with less than 16 bits of resolution will silently
347 ignore less-significant bits.
348 The structure is defined thusly:
349 .Bd -literal -offset indent
359 is changed in a drive controlled by the
361 driver, then the act of changing the media will invalidate the
362 disklabel and information held within the kernel.
364 all accesses to the device will be discarded until there are no more
365 open file descriptors referencing the device.
366 During this period, all
367 new open attempts will be rejected.
368 When no more open file descriptors
369 reference the device, the first next open will load a new set of
370 parameters (including disklabel) for the drive.
372 The audio code in the
376 standard audio commands.
379 manufacturers have not followed the standard, there are many
381 drives for which audio will not work.
382 Some work is planned to support
383 some of the more common `broken'
385 drives; however, this is not yet under way.
386 .Sh CHANGER OPERATION
387 This driver has built-in support for LUN-based CD changers.
389 changer is a drive that can hold two or more CDs, but only has one CD
391 Each CD in the drive shows up as a separate logical unit
396 driver automatically recognizes LUN-based changers, and routes commands for
397 changers through an internal scheduler.
398 The scheduler prevents changer
399 "thrashing", which is caused by sending commands to different LUNs in the
400 changer at the same time.
402 The scheduler honors minimum and maximum time
403 quanta that the driver will spend on a particular LUN.
405 is the guaranteed minimum amount of time that the driver will spend on a
406 given LUN, even if there is no outstanding I/O for that LUN.
408 time is the maximum amount of time the changer will spend on a LUN if there
409 is outstanding I/O for another LUN.
410 If there is no outstanding I/O for
411 another LUN, the driver will allow indefinite access to a given LUN.
413 The minimum and maximum time quanta are configurable via kernel options and
414 also via sysctl variables.
415 The kernel options are:
419 .Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
421 .Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
424 The sysctl variables are:
428 .Va kern.cam.cd.changer.min_busy_seconds
430 .Va kern.cam.cd.changer.max_busy_seconds
433 It is suggested that the user try experimenting with the minimum and
434 maximum timeouts via the sysctl variables to arrive at the proper values
436 Once you have settled on the proper timeouts for your
437 changer, you can then put them in your kernel config file.
439 If your system does have a LUN-based changer, you may notice that the
440 probe messages for the various LUNs of the changer will continue to appear
441 while the boot process is going on.
442 This is normal, and is caused by the
443 changer scheduling code.
445 .Bl -tag -width /dev/cd[0-9][a-h] -compact
446 .It Pa /dev/cd[0-9][a-h]
462 driver is based upon the
464 driver written by Julian Elischer, which appeared in
469 driver was written by Kenneth Merry and first appeared in
472 The names of the structures used for the third argument to
474 were poorly chosen, and a number of spelling errors have survived in
479 There is no mechanism currently to set different minimum and maximum
480 timeouts for different CD changers; the timeout values set by the kernel
481 options or the sysctl variables apply to all LUN-based CD changers in the
483 It is possible to implement such support, but the sysctl
484 implementation at least would be rather inelegant, because of the current
485 inability of the sysctl code to handle the addition of nodes after compile
487 Thus, it would take one dynamically sized sysctl variable and a
488 userland utility to get/set the timeout values.
489 Implementation of separate
490 timeouts for different CD devices in the kernel config file would likely
491 require modification of
493 to support the two timeouts when hardwiring