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.4 2006/05/26 19:39:39 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 .
121 .Bl -tag -width CDIOCREADSUBCHANNEL
124 .Pq Li "struct disklabel"
125 Read or write the in-core copy of the disklabel for the
127 The disklabel is initialized with information
128 read from the scsi inquiry commands, and should be the same as
129 the information printed at boot.
130 This structure is defined in
132 .It Dv CDIOCCAPABILITY
133 .Pq Li "struct ioc_capability"
134 Retrieve information from the drive on what features it supports.
135 The information is returned in the following structure:
136 .Bd -literal -offset indent
137 struct ioc_capability {
138 u_long play_function;
139 #define CDDOPLAYTRK 0x00000001
140 /* Can play tracks/index */
141 #define CDDOPLAYMSF 0x00000002
142 /* Can play msf to msf */
143 #define CDDOPLAYBLOCKS 0x00000004
144 /* Can play range of blocks */
145 #define CDDOPAUSE 0x00000100
146 /* Output can be paused */
147 #define CDDORESUME 0x00000200
148 /* Output can be resumed */
149 #define CDDORESET 0x00000400
150 /* Drive can be completely reset */
151 #define CDDOSTART 0x00000800
152 /* Audio can be started */
153 #define CDDOSTOP 0x00001000
154 /* Audio can be stopped */
155 #define CDDOPITCH 0x00002000
156 /* Audio pitch can be changed */
158 u_long routing_function;
159 #define CDREADVOLUME 0x00000001
160 /* Volume settings can be read */
161 #define CDSETVOLUME 0x00000002
162 /* Volume settings can be set */
163 #define CDSETMONO 0x00000100
164 /* Output can be set to mono */
165 #define CDSETSTEREO 0x00000200
166 /* Output can be set to stereo (def) */
167 #define CDSETLEFT 0x00000400
168 /* Output can be set to left only */
169 #define CDSETRIGHT 0x00000800
170 /* Output can be set to right only */
171 #define CDSETMUTE 0x00001000
172 /* Output can be muted */
173 #define CDSETPATCH 0x00008000
174 /* Direct routing control allowed */
176 u_long special_function;
177 #define CDDOEJECT 0x00000001
178 /* The tray can be opened */
179 #define CDDOCLOSE 0x00000002
180 /* The tray can be closed */
181 #define CDDOLOCK 0x00000004
182 /* The tray can be locked */
183 #define CDREADHEADER 0x00000100
184 /* Can read Table of Contents */
185 #define CDREADENTRIES 0x00000200
186 /* Can read TOC Entries */
187 #define CDREADSUBQ 0x00000200
188 /* Can read Subchannel info */
189 #define CDREADRW 0x00000400
190 /* Can read subcodes R-W */
191 #define CDHASDEBUG 0x00004000
192 /* The tray has dynamic debugging */
195 .It Dv CDIOCPLAYTRACKS
196 .Pq Li "struct ioc_play_track"
197 Start audio playback given a track address and length.
198 The structure is defined as follows:
199 .Bd -literal -offset indent
200 struct ioc_play_track
208 .It Dv CDIOCPLAYBLOCKS
209 .Pq Li "struct ioc_play_blocks"
210 Start audio playback given a block address and length.
211 The structure is defined as follows:
212 .Bd -literal -offset indent
213 struct ioc_play_blocks
220 .Pq Li "struct ioc_play_msf"
221 Start audio playback given a `minutes-seconds-frames' address and
223 The structure is defined as follows:
224 .Bd -literal -offset indent
235 .It Dv CDIOCREADSUBCHANNEL
236 .Pq Li "struct ioc_read_subchannel"
237 Read information from the subchannel at the location specified by this
239 .Bd -literal -offset indent
240 struct ioc_read_subchannel {
241 u_char address_format;
242 #define CD_LBA_FORMAT 1
243 #define CD_MSF_FORMAT 2
245 #define CD_SUBQ_DATA 0
246 #define CD_CURRENT_POSITION 1
247 #define CD_MEDIA_CATALOG 2
248 #define CD_TRACK_INFO 3
251 struct cd_sub_channel_info *data;
254 .It Dv CDIOREADTOCHEADER
255 .Pq Li "struct ioc_toc_header"
256 Return summary information about the table of contents for the mounted
258 The information is returned into the following structure:
259 .Bd -literal -offset indent
260 struct ioc_toc_header {
262 u_char starting_track;
266 .It Dv CDIOREADTOCENTRYS
267 .Pq Li "struct ioc_read_toc_entry"
268 Return information from the table of contents entries mentioned.
269 .Pq Yes, this command name is misspelled.
270 The argument structure is defined as follows:
271 .Bd -literal -offset indent
272 struct ioc_read_toc_entry {
273 u_char address_format;
274 u_char starting_track;
276 struct cd_toc_entry *data;
279 The requested data is written into an area of size
284 .Pq Li "struct ioc_patch"
285 Attach various audio channels to various output channels.
286 The argument structure is defined thusly:
287 .Bd -literal -offset indent
290 /* one for each channel */
295 .Pq Li "struct ioc_vol"
296 Get (set) information about the volume settings of the output channels.
297 The argument structure is as follows:
298 .Bd -literal -offset indent
302 /* one for each channel */
306 Patch all output channels to all source channels.
307 .It Dv CDIOCSETSTEREO
308 Patch left source channel to the left output channel and the right
309 source channel to the right output channel.
311 Mute output without changing the volume settings.
314 Attach both output channels to the left (right) source channel.
317 Turn on (off) debugging for the appropriate device.
320 Pause (resume) audio play, without resetting the location of the read-head.
325 Tell the drive to spin-up (-down) the
329 Tell the drive to allow (prevent) manual ejection of the
331 disc. Not all drives support this feature.
336 Tell the drive to close its door and load the media.
337 Not all drives support this feature.
339 .Pq Li "struct ioc_pitch"
340 For drives that support it, this command instructs the drive to play
341 the audio at a faster or slower rate than normal.
344 between -32767 and -1 result in slower playback; a zero value
345 indicates normal speed; and values from 1 to 32767 give faster
347 Drives with less than 16 bits of resolution will silently
348 ignore less-significant bits.
349 The structure is defined thusly:
350 .Bd -literal -offset indent
360 is changed in a drive controlled by the
362 driver, then the act of changing the media will invalidate the
363 disklabel and information held within the kernel.
365 all accesses to the device will be discarded until there are no more
366 open file descriptors referencing the device.
367 During this period, all
368 new open attempts will be rejected.
369 When no more open file descriptors
370 reference the device, the first next open will load a new set of
371 parameters (including disklabel) for the drive.
373 The audio code in the
377 standard audio commands.
380 manufacturers have not followed the standard, there are many
382 drives for which audio will not work.
383 Some work is planned to support
384 some of the more common `broken'
386 drives; however, this is not yet under way.
387 .Sh CHANGER OPERATION
388 This driver has built-in support for LUN-based CD changers.
390 changer is a drive that can hold two or more CDs, but only has one CD
392 Each CD in the drive shows up as a separate logical unit
397 driver automatically recognizes LUN-based changers, and routes commands for
398 changers through an internal scheduler.
399 The scheduler prevents changer
400 "thrashing", which is caused by sending commands to different LUNs in the
401 changer at the same time.
403 The scheduler honors minimum and maximum time
404 quanta that the driver will spend on a particular LUN.
406 is the guaranteed minimum amount of time that the driver will spend on a
407 given LUN, even if there is no outstanding I/O for that LUN.
409 time is the maximum amount of time the changer will spend on a LUN if there
410 is outstanding I/O for another LUN.
411 If there is no outstanding I/O for
412 another LUN, the driver will allow indefinite access to a given LUN.
414 The minimum and maximum time quanta are configurable via kernel options and
415 also via sysctl variables.
416 The kernel options are:
420 .Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
422 .Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
425 The sysctl variables are:
429 .Va kern.cam.cd.changer.min_busy_seconds
431 .Va kern.cam.cd.changer.max_busy_seconds
434 It is suggested that the user try experimenting with the minimum and
435 maximum timeouts via the sysctl variables to arrive at the proper values
437 Once you have settled on the proper timeouts for your
438 changer, you can then put them in your kernel config file.
440 If your system does have a LUN-based changer, you may notice that the
441 probe messages for the various LUNs of the changer will continue to appear
442 while the boot process is going on.
443 This is normal, and is caused by the
444 changer scheduling code.
446 .Bl -tag -width /dev/cd[0-9][a-h] -compact
447 .It Pa /dev/cd[0-9][a-h]
463 driver is based upon the
465 driver written by Julian Elischer, which appeared in
470 driver was written by Kenneth Merry and first appeared in
473 The names of the structures used for the third argument to
475 were poorly chosen, and a number of spelling errors have survived in
480 There is no mechanism currently to set different minimum and maximum
481 timeouts for different CD changers; the timeout values set by the kernel
482 options or the sysctl variables apply to all LUN-based CD changers in the
484 It is possible to implement such support, but the sysctl
485 implementation at least would be rather inelegant, because of the current
486 inability of the sysctl code to handle the addition of nodes after compile
488 Thus, it would take one dynamically sized sysctl variable and a
489 userland utility to get/set the timeout values.
490 Implementation of separate
491 timeouts for different CD devices in the kernel config file would likely
492 require modification of
494 to support the two timeouts when hardwiring