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 $
33 .Nd SCSI CD-ROM driver
36 .Cd device cd1 at scbus0 target 4 unit 0
37 .Cd "options CHANGER_MIN_BUSY_SECONDS=3"
38 .Cd "options CHANGER_MAX_BUSY_SECONDS=11"
42 driver provides support for a
45 (Compact Disc-Read Only Memory) drive.
46 In an attempt to look like a regular disk, the
48 driver synthesizes a partition table, with one partition covering the entire
50 It is possible to modify this partition table using
52 but it will only last until the
55 In general the interfaces are similar to those described by
62 adapter is probed during boot, the
64 bus is scanned for devices.
65 Any devices found which answer as CDROM
66 (type 5) or WORM (type 4) type devices will be `attached' to the
71 the first device found will be attached as
78 it is possible to specify what cd unit a device should
79 come on line as; refer to
81 for details on kernel configuration.
85 string is followed by the device's standard
90 string is followed by the Logical Unit Number
94 device's sub-device, if any, or zero.
98 may be used to read the synthesized
100 structure, which will contain correct figures for the size of the
102 should that information be required.
113 .In sys/disklabel.h .
114 .Bl -tag -width ".Dv CDIOCREADSUBCHANNEL"
117 .Pq Li "struct disklabel"
118 Read or write the in-core copy of the disklabel for the
120 The disklabel is initialized with information
121 read from the scsi inquiry commands, and should be the same as
122 the information printed at boot.
123 This structure is defined in
125 .It Dv CDIOCPLAYTRACKS
126 .Pq Li "struct ioc_play_track"
127 Start audio playback given a track address and length.
128 The structure is defined as follows:
129 .Bd -literal -offset indent
130 struct ioc_play_track
138 .It Dv CDIOCPLAYBLOCKS
139 .Pq Li "struct ioc_play_blocks"
140 Start audio playback given a block address and length.
141 The structure is defined as follows:
142 .Bd -literal -offset indent
143 struct ioc_play_blocks
150 .Pq Li "struct ioc_play_msf"
151 Start audio playback given a `minutes-seconds-frames' address and
153 The structure is defined as follows:
154 .Bd -literal -offset indent
165 .It Dv CDIOCREADSUBCHANNEL
166 .Pq Li "struct ioc_read_subchannel"
167 Read information from the subchannel at the location specified by this
169 .Bd -literal -offset indent
170 struct ioc_read_subchannel {
171 u_char address_format;
172 #define CD_LBA_FORMAT 1
173 #define CD_MSF_FORMAT 2
175 #define CD_SUBQ_DATA 0
176 #define CD_CURRENT_POSITION 1
177 #define CD_MEDIA_CATALOG 2
178 #define CD_TRACK_INFO 3
181 struct cd_sub_channel_info *data;
184 .It Dv CDIOREADTOCHEADER
185 .Pq Li "struct ioc_toc_header"
186 Return summary information about the table of contents for the mounted
188 The information is returned into the following structure:
189 .Bd -literal -offset indent
190 struct ioc_toc_header {
192 u_char starting_track;
196 .It Dv CDIOREADTOCENTRYS
197 .Pq Li "struct ioc_read_toc_entry"
198 Return information from the table of contents entries mentioned.
199 .Pq Yes, this command name is misspelled.
200 The argument structure is defined as follows:
201 .Bd -literal -offset indent
202 struct ioc_read_toc_entry {
203 u_char address_format;
204 u_char starting_track;
206 struct cd_toc_entry *data;
209 The requested data is written into an area of size
214 .Pq Li "struct ioc_patch"
215 Attach various audio channels to various output channels.
216 The argument structure is defined thusly:
217 .Bd -literal -offset indent
220 /* one for each channel */
225 .Pq Li "struct ioc_vol"
226 Get (set) information about the volume settings of the output channels.
227 The argument structure is as follows:
228 .Bd -literal -offset indent
232 /* one for each channel */
236 Patch all output channels to all source channels.
237 .It Dv CDIOCSETSTEREO
238 Patch left source channel to the left output channel and the right
239 source channel to the right output channel.
241 Mute output without changing the volume settings.
244 Attach both output channels to the left (right) source channel.
247 Turn on (off) debugging for the appropriate device.
250 Pause (resume) audio play, without resetting the location of the read-head.
255 Tell the drive to spin-up (-down) the
259 Tell the drive to allow (prevent) manual ejection of the
261 disc. Not all drives support this feature.
266 Tell the drive to close its door and load the media.
267 Not all drives support this feature.
272 is changed in a drive controlled by the
274 driver, then the act of changing the media will invalidate the
275 disklabel and information held within the kernel.
277 all accesses to the device will be discarded until there are no more
278 open file descriptors referencing the device.
279 During this period, all
280 new open attempts will be rejected.
281 When no more open file descriptors
282 reference the device, the first next open will load a new set of
283 parameters (including disklabel) for the drive.
285 The audio code in the
289 standard audio commands.
292 manufacturers have not followed the standard, there are many
294 drives for which audio will not work.
295 Some work is planned to support
296 some of the more common `broken'
298 drives; however, this is not yet under way.
299 .Sh CHANGER OPERATION
300 This driver has built-in support for LUN-based CD changers.
302 changer is a drive that can hold two or more CDs, but only has one CD
304 Each CD in the drive shows up as a separate logical unit
309 driver automatically recognizes LUN-based changers, and routes commands for
310 changers through an internal scheduler.
311 The scheduler prevents changer
312 "thrashing", which is caused by sending commands to different LUNs in the
313 changer at the same time.
315 The scheduler honors minimum and maximum time
316 quanta that the driver will spend on a particular LUN.
318 is the guaranteed minimum amount of time that the driver will spend on a
319 given LUN, even if there is no outstanding I/O for that LUN.
321 time is the maximum amount of time the changer will spend on a LUN if there
322 is outstanding I/O for another LUN.
323 If there is no outstanding I/O for
324 another LUN, the driver will allow indefinite access to a given LUN.
326 The minimum and maximum time quanta are configurable via kernel options and
327 also via sysctl variables.
328 The kernel options are:
332 .Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
334 .Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
337 The sysctl variables are:
341 .Va kern.cam.cd.changer.min_busy_seconds
343 .Va kern.cam.cd.changer.max_busy_seconds
346 It is suggested that the user try experimenting with the minimum and
347 maximum timeouts via the sysctl variables to arrive at the proper values
349 Once you have settled on the proper timeouts for your
350 changer, you can then put them in your kernel config file.
352 If your system does have a LUN-based changer, you may notice that the
353 probe messages for the various LUNs of the changer will continue to appear
354 while the boot process is going on.
355 This is normal, and is caused by the
356 changer scheduling code.
358 .Bl -tag -width /dev/cd[0-9][a-h] -compact
359 .It Pa /dev/cd[0-9][a-h]
375 driver is based upon the
377 driver written by Julian Elischer, which appeared in
382 driver was written by Kenneth Merry and first appeared in
385 The names of the structures used for the third argument to
387 were poorly chosen, and a number of spelling errors have survived in
392 There is no mechanism currently to set different minimum and maximum
393 timeouts for different CD changers; the timeout values set by the kernel
394 options or the sysctl variables apply to all LUN-based CD changers in the
396 It is possible to implement such support, but the sysctl
397 implementation at least would be rather inelegant, because of the current
398 inability of the sysctl code to handle the addition of nodes after compile
400 Thus, it would take one dynamically sized sysctl variable and a
401 userland utility to get/set the timeout values.
402 Implementation of separate
403 timeouts for different CD devices in the kernel config file would likely
404 require modification of
406 to support the two timeouts when hardwiring