xref: /freebsd/share/man/man4/cd.4 (revision 814b16ba92c4194ac76eaeb0537fc7190dc9d1a0)
1a77a7ee0SJulian Elischer.\" Copyright (c) 1996
2eddc45e7SJeroen Ruigrok van der Werven.\"	Julian Elischer <julian@FreeBSD.org>.  All rights reserved.
3a77a7ee0SJulian Elischer.\"
4a77a7ee0SJulian Elischer.\" Redistribution and use in source and binary forms, with or without
5a77a7ee0SJulian Elischer.\" modification, are permitted provided that the following conditions
6a77a7ee0SJulian Elischer.\" are met:
7a77a7ee0SJulian Elischer.\" 1. Redistributions of source code must retain the above copyright
8a77a7ee0SJulian Elischer.\"    notice, this list of conditions and the following disclaimer.
9a77a7ee0SJulian Elischer.\"
10a77a7ee0SJulian Elischer.\" 2. Redistributions in binary form must reproduce the above copyright
11a77a7ee0SJulian Elischer.\"    notice, this list of conditions and the following disclaimer in the
12a77a7ee0SJulian Elischer.\"    documentation and/or other materials provided with the distribution.
13a77a7ee0SJulian Elischer.\"
14a77a7ee0SJulian Elischer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15a77a7ee0SJulian Elischer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16a77a7ee0SJulian Elischer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17a77a7ee0SJulian Elischer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18a77a7ee0SJulian Elischer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19a77a7ee0SJulian Elischer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20a77a7ee0SJulian Elischer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21a77a7ee0SJulian Elischer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22a77a7ee0SJulian Elischer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23a77a7ee0SJulian Elischer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24a77a7ee0SJulian Elischer.\" SUCH DAMAGE.
25a77a7ee0SJulian Elischer.\"
267f3dea24SPeter Wemm.\" $FreeBSD$
270b992c1dSWolfram Schneider.\"
28*814b16baSGlen Barber.Dd February 8, 2012
29db35f309SDavid Greenman.Dt CD 4
303d45e180SRuslan Ermilov.Os
31db35f309SDavid Greenman.Sh NAME
32db35f309SDavid Greenman.Nm cd
335fc1fd70SGarrett Wollman.Nd SCSI CD-ROM driver
34db35f309SDavid Greenman.Sh SYNOPSIS
355fc1fd70SGarrett Wollman.Cd device cd
363136363fSRuslan Ermilov.Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
373136363fSRuslan Ermilov.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11""
38db35f309SDavid Greenman.Sh DESCRIPTION
39db35f309SDavid GreenmanThe
404b66483fSRuslan Ermilov.Nm
41db35f309SDavid Greenmandriver provides support for a
425fc1fd70SGarrett Wollman.Tn SCSI
435fc1fd70SGarrett Wollman.Tn CD-ROM
445fc1fd70SGarrett Wollman(Compact Disc-Read Only Memory) drive.
455fc1fd70SGarrett WollmanIn an attempt to look like a regular disk, the
46db35f309SDavid Greenman.Nm
474a8d0283SMike Pritcharddriver synthesizes a partition table, with one partition covering the entire
485fc1fd70SGarrett Wollman.Tn CD-ROM .
495fc1fd70SGarrett WollmanIt is possible to modify this partition table using
505fc1fd70SGarrett Wollman.Xr disklabel 8 ,
515fc1fd70SGarrett Wollmanbut it will only last until the
525fc1fd70SGarrett Wollman.Tn CD-ROM
535fc1fd70SGarrett Wollmanis unmounted.
54db35f309SDavid GreenmanIn general the interfaces are similar to those described by
55*814b16baSGlen Barber.Xr ada 4
565fc1fd70SGarrett Wollmanand
572d8eb2c0SKenneth D. Merry.Xr da 4 .
58db35f309SDavid Greenman.Pp
595fc1fd70SGarrett WollmanAs the
605fc1fd70SGarrett Wollman.Tn SCSI
615fc1fd70SGarrett Wollmanadapter is probed during boot, the
625fc1fd70SGarrett Wollman.Tn SCSI
636d249eeeSSheldon Hearnbus is scanned for devices.
646d249eeeSSheldon HearnAny devices found which answer as CDROM
652d8eb2c0SKenneth D. Merry(type 5) or WORM (type 4) type devices will be `attached' to the
66db35f309SDavid Greenman.Nm
672460bdf0SPeter Dufaultdriver.
68dd5527c6SMike PritchardPrior to
69dd5527c6SMike Pritchard.Fx 2.1 ,
70dd5527c6SMike Pritchardthe first device found will be attached as
715fc1fd70SGarrett Wollman.Li cd0
725fc1fd70SGarrett Wollmanthe next,
735fc1fd70SGarrett Wollman.Li cd1 ,
74db35f309SDavid Greenmanetc.
75dd5527c6SMike PritchardBeginning in
76dd5527c6SMike Pritchard.Fx 2.1
77dd5527c6SMike Pritchardit is possible to specify what cd unit a device should
782460bdf0SPeter Dufaultcome on line as; refer to
792460bdf0SPeter Dufault.Xr scsi 4
802460bdf0SPeter Dufaultfor details on kernel configuration.
81db35f309SDavid Greenman.Pp
82db35f309SDavid GreenmanThe system utility
835fc1fd70SGarrett Wollman.Xr disklabel 8
84db35f309SDavid Greenmanmay be used to read the synthesized
855fc1fd70SGarrett Wollmandisk label
865fc1fd70SGarrett Wollmanstructure, which will contain correct figures for the size of the
875fc1fd70SGarrett Wollman.Tn CD-ROM
88db35f309SDavid Greenmanshould that information be required.
89db35f309SDavid Greenman.Sh KERNEL CONFIGURATION
905fc1fd70SGarrett WollmanAny number of
915fc1fd70SGarrett Wollman.Tn CD-ROM
925fc1fd70SGarrett Wollmandevices may be attached to the system regardless of system
93db35f309SDavid Greenmanconfiguration as all resources are dynamically allocated.
94db35f309SDavid Greenman.Sh IOCTLS
95db35f309SDavid GreenmanThe following
96db35f309SDavid Greenman.Xr ioctl 2
975fc1fd70SGarrett Wollmancalls which apply to
985fc1fd70SGarrett Wollman.Tn SCSI
995fc1fd70SGarrett Wollman.Tn CD-ROM
1005fc1fd70SGarrett Wollmandrives are defined
101db35f309SDavid Greenmanin the header files
102fe08efe6SRuslan Ermilov.In sys/cdio.h
103db35f309SDavid Greenmanand
104fe08efe6SRuslan Ermilov.In sys/disklabel.h .
1053136363fSRuslan Ermilov.Bl -tag -width CDIOCREADSUBCHANNEL
106db35f309SDavid Greenman.It Dv DIOCGDINFO
107db35f309SDavid Greenman.It Dv DIOCSDINFO
1085fc1fd70SGarrett Wollman.Pq Li "struct disklabel"
1095fc1fd70SGarrett WollmanRead or write the in-core copy of the disklabel for the
110f6c211aeSHiten Pandyadrive.
111f6c211aeSHiten PandyaThe disklabel is initialized with information
1125fc1fd70SGarrett Wollmanread from the scsi inquiry commands, and should be the same as
113f6c211aeSHiten Pandyathe information printed at boot.
114603c2b9bSSergey KandaurovThis structure is defined in the header file
115603c2b9bSSergey Kandaurov.In sys/disklabel.h .
1165fc1fd70SGarrett Wollman.It Dv CDIOCCAPABILITY
1175fc1fd70SGarrett Wollman.Pq Li "struct ioc_capability"
118f6c211aeSHiten PandyaRetrieve information from the drive on what features it supports.
119f6c211aeSHiten PandyaThe information is returned in the following structure:
1205fc1fd70SGarrett Wollman.Bd -literal -offset indent
1215fc1fd70SGarrett Wollmanstruct ioc_capability {
1225fc1fd70SGarrett Wollman	u_long	play_function;
1235fc1fd70SGarrett Wollman#define CDDOPLAYTRK	0x00000001
1245fc1fd70SGarrett Wollman	/* Can play tracks/index */
1255fc1fd70SGarrett Wollman#define	CDDOPLAYMSF	0x00000002
1265fc1fd70SGarrett Wollman	/* Can play msf to msf */
1275fc1fd70SGarrett Wollman#define	CDDOPLAYBLOCKS	0x00000004
1285fc1fd70SGarrett Wollman	/* Can play range of blocks */
1295fc1fd70SGarrett Wollman#define	CDDOPAUSE	0x00000100
1305fc1fd70SGarrett Wollman	/* Output can be paused */
1315fc1fd70SGarrett Wollman#define	CDDORESUME	0x00000200
1325fc1fd70SGarrett Wollman	/* Output can be resumed */
1335fc1fd70SGarrett Wollman#define	CDDORESET	0x00000400
1345fc1fd70SGarrett Wollman	/* Drive can be completely reset */
1355fc1fd70SGarrett Wollman#define	CDDOSTART	0x00000800
1365fc1fd70SGarrett Wollman	/* Audio can be started */
1375fc1fd70SGarrett Wollman#define CDDOSTOP	0x00001000
1385fc1fd70SGarrett Wollman	/* Audio can be stopped */
1395fc1fd70SGarrett Wollman#define CDDOPITCH	0x00002000
1405fc1fd70SGarrett Wollman	/* Audio pitch can be changed */
1415fc1fd70SGarrett Wollman
1425fc1fd70SGarrett Wollman	u_long	routing_function;
1435fc1fd70SGarrett Wollman#define CDREADVOLUME	0x00000001
1445fc1fd70SGarrett Wollman	/* Volume settings can be read */
1455fc1fd70SGarrett Wollman#define CDSETVOLUME	0x00000002
1465fc1fd70SGarrett Wollman	/* Volume settings can be set */
1475fc1fd70SGarrett Wollman#define	CDSETMONO	0x00000100
1485fc1fd70SGarrett Wollman	/* Output can be set to mono */
1495fc1fd70SGarrett Wollman#define CDSETSTEREO	0x00000200
1505fc1fd70SGarrett Wollman	/* Output can be set to stereo (def) */
1515fc1fd70SGarrett Wollman#define	CDSETLEFT	0x00000400
1525fc1fd70SGarrett Wollman	/* Output can be set to left only */
1535fc1fd70SGarrett Wollman#define	CDSETRIGHT	0x00000800
1545fc1fd70SGarrett Wollman	/* Output can be set to right only */
1555fc1fd70SGarrett Wollman#define	CDSETMUTE	0x00001000
1565fc1fd70SGarrett Wollman	/* Output can be muted */
1575fc1fd70SGarrett Wollman#define CDSETPATCH	0x00008000
1584a8d0283SMike Pritchard	/* Direct routing control allowed */
1595fc1fd70SGarrett Wollman
1605fc1fd70SGarrett Wollman	u_long	special_function;
1615fc1fd70SGarrett Wollman#define	CDDOEJECT	0x00000001
1625fc1fd70SGarrett Wollman	/* The tray can be opened */
1635fc1fd70SGarrett Wollman#define	CDDOCLOSE	0x00000002
1645fc1fd70SGarrett Wollman	/* The tray can be closed */
1655fc1fd70SGarrett Wollman#define	CDDOLOCK	0x00000004
1665fc1fd70SGarrett Wollman	/* The tray can be locked */
1675fc1fd70SGarrett Wollman#define CDREADHEADER	0x00000100
1685fc1fd70SGarrett Wollman	/* Can read Table of Contents */
1695fc1fd70SGarrett Wollman#define	CDREADENTRIES	0x00000200
1705fc1fd70SGarrett Wollman	/* Can read TOC Entries */
1715fc1fd70SGarrett Wollman#define	CDREADSUBQ	0x00000200
1725fc1fd70SGarrett Wollman	/* Can read Subchannel info */
1735fc1fd70SGarrett Wollman#define CDREADRW	0x00000400
1745fc1fd70SGarrett Wollman	/* Can read subcodes R-W */
1755fc1fd70SGarrett Wollman#define	CDHASDEBUG	0x00004000
1765fc1fd70SGarrett Wollman	/* The tray has dynamic debugging */
1775fc1fd70SGarrett Wollman};
1785fc1fd70SGarrett Wollman.Ed
1795fc1fd70SGarrett Wollman.It Dv CDIOCPLAYTRACKS
1805fc1fd70SGarrett Wollman.Pq Li "struct ioc_play_track"
181f6c211aeSHiten PandyaStart audio playback given a track address and length.
182f6c211aeSHiten PandyaThe structure is defined as follows:
1835fc1fd70SGarrett Wollman.Bd -literal -offset indent
1845fc1fd70SGarrett Wollmanstruct ioc_play_track
1855fc1fd70SGarrett Wollman{
1865fc1fd70SGarrett Wollman	u_char	start_track;
1875fc1fd70SGarrett Wollman	u_char	start_index;
1885fc1fd70SGarrett Wollman	u_char	end_track;
1895fc1fd70SGarrett Wollman	u_char	end_index;
1905fc1fd70SGarrett Wollman};
1915fc1fd70SGarrett Wollman.Ed
1925fc1fd70SGarrett Wollman.It Dv CDIOCPLAYBLOCKS
1935fc1fd70SGarrett Wollman.Pq Li "struct ioc_play_blocks"
194f6c211aeSHiten PandyaStart audio playback given a block address and length.
195f6c211aeSHiten PandyaThe structure is defined as follows:
1965fc1fd70SGarrett Wollman.Bd -literal -offset indent
1975fc1fd70SGarrett Wollmanstruct ioc_play_blocks
1985fc1fd70SGarrett Wollman{
1995fc1fd70SGarrett Wollman	int	blk;
2005fc1fd70SGarrett Wollman	int	len;
2015fc1fd70SGarrett Wollman};
2025fc1fd70SGarrett Wollman.Ed
2035fc1fd70SGarrett Wollman.It Dv CDIOCPLAYMSF
2045fc1fd70SGarrett Wollman.Pq Li "struct ioc_play_msf"
2055fc1fd70SGarrett WollmanStart audio playback given a `minutes-seconds-frames' address and
206f6c211aeSHiten Pandyalength.
207f6c211aeSHiten PandyaThe structure is defined as follows:
2085fc1fd70SGarrett Wollman.Bd -literal -offset indent
2095fc1fd70SGarrett Wollmanstruct ioc_play_msf
2105fc1fd70SGarrett Wollman{
2115fc1fd70SGarrett Wollman	u_char	start_m;
2125fc1fd70SGarrett Wollman	u_char	start_s;
2135fc1fd70SGarrett Wollman	u_char	start_f;
2145fc1fd70SGarrett Wollman	u_char	end_m;
2155fc1fd70SGarrett Wollman	u_char	end_s;
2165fc1fd70SGarrett Wollman	u_char	end_f;
2175fc1fd70SGarrett Wollman};
2185fc1fd70SGarrett Wollman.Ed
2195fc1fd70SGarrett Wollman.It Dv CDIOCREADSUBCHANNEL
2205fc1fd70SGarrett Wollman.Pq Li "struct ioc_read_subchannel"
2215fc1fd70SGarrett WollmanRead information from the subchannel at the location specified by this
2225fc1fd70SGarrett Wollmanstructure:
2235fc1fd70SGarrett Wollman.Bd -literal -offset indent
2245fc1fd70SGarrett Wollmanstruct ioc_read_subchannel {
2255fc1fd70SGarrett Wollman	u_char address_format;
2265fc1fd70SGarrett Wollman#define CD_LBA_FORMAT	1
2275fc1fd70SGarrett Wollman#define CD_MSF_FORMAT	2
2285fc1fd70SGarrett Wollman	u_char data_format;
2295fc1fd70SGarrett Wollman#define CD_SUBQ_DATA		0
2305fc1fd70SGarrett Wollman#define CD_CURRENT_POSITION	1
2315fc1fd70SGarrett Wollman#define CD_MEDIA_CATALOG	2
2325fc1fd70SGarrett Wollman#define CD_TRACK_INFO		3
2335fc1fd70SGarrett Wollman	u_char track;
2345fc1fd70SGarrett Wollman	int	data_len;
2355fc1fd70SGarrett Wollman	struct  cd_sub_channel_info *data;
2365fc1fd70SGarrett Wollman};
2375fc1fd70SGarrett Wollman.Ed
2385fc1fd70SGarrett Wollman.It Dv CDIOREADTOCHEADER
2395fc1fd70SGarrett Wollman.Pq Li "struct ioc_toc_header"
2405fc1fd70SGarrett WollmanReturn summary information about the table of contents for the mounted
2415fc1fd70SGarrett Wollman.Tn CD-ROM .
2425fc1fd70SGarrett WollmanThe information is returned into the following structure:
2435fc1fd70SGarrett Wollman.Bd -literal -offset indent
2445fc1fd70SGarrett Wollmanstruct ioc_toc_header {
2455fc1fd70SGarrett Wollman	u_short len;
2465fc1fd70SGarrett Wollman	u_char  starting_track;
2475fc1fd70SGarrett Wollman	u_char  ending_track;
2485fc1fd70SGarrett Wollman};
2495fc1fd70SGarrett Wollman.Ed
2505fc1fd70SGarrett Wollman.It Dv CDIOREADTOCENTRYS
2515fc1fd70SGarrett Wollman.Pq Li "struct ioc_read_toc_entry"
252f6c211aeSHiten PandyaReturn information from the table of contents entries mentioned.
253f6c211aeSHiten Pandya.Pq Yes, this command name is misspelled.
254f6c211aeSHiten PandyaThe argument structure is defined as follows:
2555fc1fd70SGarrett Wollman.Bd -literal -offset indent
2565fc1fd70SGarrett Wollmanstruct ioc_read_toc_entry {
2575fc1fd70SGarrett Wollman	u_char	address_format;
2585fc1fd70SGarrett Wollman	u_char	starting_track;
2595fc1fd70SGarrett Wollman	u_short	data_len;
2605fc1fd70SGarrett Wollman	struct  cd_toc_entry *data;
2615fc1fd70SGarrett Wollman};
2625fc1fd70SGarrett Wollman.Ed
2635fc1fd70SGarrett WollmanThe requested data is written into an area of size
2645fc1fd70SGarrett Wollman.Li data_len
2655fc1fd70SGarrett Wollmanand pointed to by
2665fc1fd70SGarrett Wollman.Li data .
2675fc1fd70SGarrett Wollman.It Dv CDIOCSETPATCH
2685fc1fd70SGarrett Wollman.Pq Li "struct ioc_patch"
269f6c211aeSHiten PandyaAttach various audio channels to various output channels.
270f6c211aeSHiten PandyaThe argument structure is defined thusly:
2715fc1fd70SGarrett Wollman.Bd -literal -offset indent
2725fc1fd70SGarrett Wollmanstruct ioc_patch {
2735fc1fd70SGarrett Wollman	u_char	patch[4];
2745fc1fd70SGarrett Wollman	/* one for each channel */
2755fc1fd70SGarrett Wollman};
2765fc1fd70SGarrett Wollman.Ed
2775fc1fd70SGarrett Wollman.It Dv CDIOCGETVOL
2785fc1fd70SGarrett Wollman.It Dv CDIOCSETVOL
2795fc1fd70SGarrett Wollman.Pq Li "struct ioc_vol"
280f6c211aeSHiten PandyaGet (set) information about the volume settings of the output channels.
281f6c211aeSHiten PandyaThe argument structure is as follows:
2825fc1fd70SGarrett Wollman.Bd -literal -offset indent
2835fc1fd70SGarrett Wollmanstruct	ioc_vol
2845fc1fd70SGarrett Wollman{
2855fc1fd70SGarrett Wollman	u_char	vol[4];
2865fc1fd70SGarrett Wollman	/* one for each channel */
2875fc1fd70SGarrett Wollman};
2885fc1fd70SGarrett Wollman.Ed
2895fc1fd70SGarrett Wollman.It Dv CDIOCSETMONO
2905fc1fd70SGarrett WollmanPatch all output channels to all source channels.
2915fc1fd70SGarrett Wollman.It Dv CDIOCSETSTEREO
292db35f309SDavid GreenmanPatch left source channel to the left output channel and the right
293db35f309SDavid Greenmansource channel to the right output channel.
2945fc1fd70SGarrett Wollman.It Dv CDIOCSETMUTE
295db35f309SDavid GreenmanMute output without changing the volume settings.
2965fc1fd70SGarrett Wollman.It Dv CDIOCSETLEFT
2975fc1fd70SGarrett Wollman.It Dv CDIOCSETRIGHT
2985fc1fd70SGarrett WollmanAttach both output channels to the left (right) source channel.
2995fc1fd70SGarrett Wollman.It Dv CDIOCSETDEBUG
3005fc1fd70SGarrett Wollman.It Dv CDIOCCLRDEBUG
3015fc1fd70SGarrett WollmanTurn on (off) debugging for the appropriate device.
3025fc1fd70SGarrett Wollman.It Dv CDIOCPAUSE
3035fc1fd70SGarrett Wollman.It Dv CDIOCRESUME
3045fc1fd70SGarrett WollmanPause (resume) audio play, without resetting the location of the read-head.
3055fc1fd70SGarrett Wollman.It Dv CDIOCRESET
306db35f309SDavid GreenmanReset the drive.
3075fc1fd70SGarrett Wollman.It Dv CDIOCSTART
3085fc1fd70SGarrett Wollman.It Dv CDIOCSTOP
3095fc1fd70SGarrett WollmanTell the drive to spin-up (-down) the
3105fc1fd70SGarrett Wollman.Tn CD-ROM .
3115fc1fd70SGarrett Wollman.It Dv CDIOCALLOW
3125fc1fd70SGarrett Wollman.It Dv CDIOCPREVENT
3135fc1fd70SGarrett WollmanTell the drive to allow (prevent) manual ejection of the
3145fc1fd70SGarrett Wollman.Tn CD-ROM
315b5e7e999SRuslan Ermilovdisc.
316b5e7e999SRuslan ErmilovNot all drives support this feature.
3175fc1fd70SGarrett Wollman.It Dv CDIOCEJECT
3185fc1fd70SGarrett WollmanEject the
3195fc1fd70SGarrett Wollman.Tn CD-ROM .
3205fc1fd70SGarrett Wollman.It Dv CDIOCCLOSE
321f6c211aeSHiten PandyaTell the drive to close its door and load the media.
322f6c211aeSHiten PandyaNot all drives support this feature.
3235fc1fd70SGarrett Wollman.It Dv CDIOCPITCH
3245fc1fd70SGarrett Wollman.Pq Li "struct ioc_pitch"
3255fc1fd70SGarrett WollmanFor drives that support it, this command instructs the drive to play
326f6c211aeSHiten Pandyathe audio at a faster or slower rate than normal.
327f6c211aeSHiten PandyaValues of
3285fc1fd70SGarrett Wollman.Li speed
3295fc1fd70SGarrett Wollmanbetween -32767 and -1 result in slower playback; a zero value
3305fc1fd70SGarrett Wollmanindicates normal speed; and values from 1 to 32767 give faster
331f6c211aeSHiten Pandyaplayback.
332f6c211aeSHiten PandyaDrives with less than 16 bits of resolution will silently
333f6c211aeSHiten Pandyaignore less-significant bits.
334f6c211aeSHiten PandyaThe structure is defined thusly:
3355fc1fd70SGarrett Wollman.Bd -literal -offset indent
3365fc1fd70SGarrett Wollmanstruct	ioc_pitch
3375fc1fd70SGarrett Wollman{
3385fc1fd70SGarrett Wollman	short	speed;
3395fc1fd70SGarrett Wollman};
3405fc1fd70SGarrett Wollman.Ed
341db35f309SDavid Greenman.El
342db35f309SDavid Greenman.Sh NOTES
3435fc1fd70SGarrett WollmanWhen a
3445fc1fd70SGarrett Wollman.Tn CD-ROM
3455fc1fd70SGarrett Wollmanis changed in a drive controlled by the
346db35f309SDavid Greenman.Nm
347db35f309SDavid Greenmandriver, then the act of changing the media will invalidate the
348f6c211aeSHiten Pandyadisklabel and information held within the kernel.
349f6c211aeSHiten PandyaTo stop corruption,
3505fc1fd70SGarrett Wollmanall accesses to the device will be discarded until there are no more
351f6c211aeSHiten Pandyaopen file descriptors referencing the device.
352f6c211aeSHiten PandyaDuring this period, all
353f6c211aeSHiten Pandyanew open attempts will be rejected.
354f6c211aeSHiten PandyaWhen no more open file descriptors
355db35f309SDavid Greenmanreference the device, the first next open will load a new set of
3565fc1fd70SGarrett Wollmanparameters (including disklabel) for the drive.
3575fc1fd70SGarrett Wollman.Pp
3585fc1fd70SGarrett WollmanThe audio code in the
359db35f309SDavid Greenman.Nm
3605fc1fd70SGarrett Wollmandriver only support
3615fc1fd70SGarrett Wollman.Tn SCSI-2
3626d249eeeSSheldon Hearnstandard audio commands.
363b5e7e999SRuslan ErmilovAs many
3645fc1fd70SGarrett Wollman.Tn CD-ROM
3655fc1fd70SGarrett Wollmanmanufacturers have not followed the standard, there are many
3665fc1fd70SGarrett Wollman.Tn CD-ROM
3676d249eeeSSheldon Hearndrives for which audio will not work.
3686d249eeeSSheldon HearnSome work is planned to support
3695fc1fd70SGarrett Wollmansome of the more common `broken'
3705fc1fd70SGarrett Wollman.Tn CD-ROM
3715fc1fd70SGarrett Wollmandrives; however, this is not yet under way.
3722d8eb2c0SKenneth D. Merry.Sh CHANGER OPERATION
373f6c211aeSHiten PandyaThis driver has built-in support for LUN-based CD changers.
374f6c211aeSHiten PandyaA LUN-based CD
3752d8eb2c0SKenneth D. Merrychanger is a drive that can hold two or more CDs, but only has one CD
376f6c211aeSHiten Pandyaplayer mechanism.
377f6c211aeSHiten PandyaEach CD in the drive shows up as a separate logical unit
3782d8eb2c0SKenneth D. Merryon the
3792d8eb2c0SKenneth D. Merry.Tn SCSI
380b5e7e999SRuslan Ermilovbus.
381b5e7e999SRuslan ErmilovThe
3824b66483fSRuslan Ermilov.Nm
3832d8eb2c0SKenneth D. Merrydriver automatically recognizes LUN-based changers, and routes commands for
384f6c211aeSHiten Pandyachangers through an internal scheduler.
385f6c211aeSHiten PandyaThe scheduler prevents changer
3862d8eb2c0SKenneth D. Merry"thrashing", which is caused by sending commands to different LUNs in the
3872d8eb2c0SKenneth D. Merrychanger at the same time.
3882d8eb2c0SKenneth D. Merry.Pp
3892d8eb2c0SKenneth D. MerryThe scheduler honors minimum and maximum time
390f6c211aeSHiten Pandyaquanta that the driver will spend on a particular LUN.
391f6c211aeSHiten PandyaThe minimum time
3922d8eb2c0SKenneth D. Merryis the guaranteed minimum amount of time that the driver will spend on a
393f6c211aeSHiten Pandyagiven LUN, even if there is no outstanding I/O for that LUN.
394f6c211aeSHiten PandyaThe maximum
3952d8eb2c0SKenneth D. Merrytime is the maximum amount of time the changer will spend on a LUN if there
396f6c211aeSHiten Pandyais outstanding I/O for another LUN.
397f6c211aeSHiten PandyaIf there is no outstanding I/O for
3982d8eb2c0SKenneth D. Merryanother LUN, the driver will allow indefinite access to a given LUN.
3992d8eb2c0SKenneth D. Merry.Pp
4002d8eb2c0SKenneth D. MerryThe minimum and maximum time quanta are configurable via kernel options and
401cb32189eSKenneth D. Merryalso via sysctl and kernel tunable variables.
402f6c211aeSHiten PandyaThe kernel options are:
4033136363fSRuslan Ermilov.Pp
4043136363fSRuslan Ermilov.Bl -item -compact
4053136363fSRuslan Ermilov.It
4063136363fSRuslan Ermilov.Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
4073136363fSRuslan Ermilov.It
4083136363fSRuslan Ermilov.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
4092d8eb2c0SKenneth D. Merry.El
4102d8eb2c0SKenneth D. Merry.Pp
411cb32189eSKenneth D. MerryThe sysctl/kernel tunable variables are:
4122d8eb2c0SKenneth D. Merry.Pp
4133136363fSRuslan Ermilov.Bl -item -compact
4143136363fSRuslan Ermilov.It
4153136363fSRuslan Ermilov.Va kern.cam.cd.changer.min_busy_seconds
4163136363fSRuslan Ermilov.It
4173136363fSRuslan Ermilov.Va kern.cam.cd.changer.max_busy_seconds
4182d8eb2c0SKenneth D. Merry.El
4192d8eb2c0SKenneth D. Merry.Pp
4202d8eb2c0SKenneth D. MerryIt is suggested that the user try experimenting with the minimum and
4212d8eb2c0SKenneth D. Merrymaximum timeouts via the sysctl variables to arrive at the proper values
422f6c211aeSHiten Pandyafor your changer.
423f6c211aeSHiten PandyaOnce you have settled on the proper timeouts for your
4242d8eb2c0SKenneth D. Merrychanger, you can then put them in your kernel config file.
4252d8eb2c0SKenneth D. Merry.Pp
4262d8eb2c0SKenneth D. MerryIf your system does have a LUN-based changer, you may notice that the
4272d8eb2c0SKenneth D. Merryprobe messages for the various LUNs of the changer will continue to appear
428f6c211aeSHiten Pandyawhile the boot process is going on.
429f6c211aeSHiten PandyaThis is normal, and is caused by the
4302d8eb2c0SKenneth D. Merrychanger scheduling code.
431ba181a0eSWarner Losh.Sh SYSCTL VARIABLES
432ba181a0eSWarner LoshThe following variables are available as both
433ba181a0eSWarner Losh.Xr sysctl 8
434ba181a0eSWarner Loshvariables and
435ba181a0eSWarner Losh.Xr loader 8
436ba181a0eSWarner Loshtunables:
437ba181a0eSWarner Losh.Bl -tag -width 12
438ba181a0eSWarner Losh.It kern.cam.cd.retry_count
439ba181a0eSWarner Losh.Pp
440ba181a0eSWarner LoshThis variable determines how many times the
441ba181a0eSWarner Losh.Nm
442ba181a0eSWarner Loshdriver will retry a READ or WRITE command.
443ba181a0eSWarner LoshThis does not affect the number of retries used during probe time or for
444ba181a0eSWarner Loshthe
445ba181a0eSWarner Losh.Nm
446ba181a0eSWarner Loshdriver dump routine.
447ba181a0eSWarner LoshThis value currently defaults to 4.
448ba181a0eSWarner Losh.It kern.cam.cd.%d.minimum_cmd_size
449ba181a0eSWarner Losh.Pp
450ba181a0eSWarner LoshThe
451ba181a0eSWarner Losh.Nm
452ba181a0eSWarner Loshdriver attempts to automatically determine whether the drive it is talking
453ba181a0eSWarner Loshto supports 6 byte or 10 byte MODE SENSE/MODE SELECT operations.
454ba181a0eSWarner LoshMany
455ba181a0eSWarner Losh.Tn SCSI
456ba181a0eSWarner Loshdrives only support 6 byte commands, and
457ba181a0eSWarner Losh.Tn ATAPI
458ba181a0eSWarner Loshdrives only support 10 byte commands.
459ba181a0eSWarner LoshThe
460ba181a0eSWarner Losh.Nm
461ba181a0eSWarner Loshdriver first attempts to determine whether the protocol in use typically
462ba181a0eSWarner Loshsupports 6 byte commands by issuing a CAM Path Inquiry CCB.
463ba181a0eSWarner LoshIt will then default to 6 byte or 10 byte commands as appropriate.
464ba181a0eSWarner LoshAfter that, the
465ba181a0eSWarner Losh.Nm
466ba181a0eSWarner Loshdriver defaults to using 6 byte commands (assuming the protocol the drive
467ba181a0eSWarner Loshspeaks claims to support 6 byte commands), until one fails with a
468ba181a0eSWarner Losh.Tn SCSI
469ba181a0eSWarner LoshILLEGAL REQUEST error.
470ba181a0eSWarner LoshThen it tries the 10 byte version of the command to
471ba181a0eSWarner Loshsee if that works instead.
472ba181a0eSWarner LoshUsers can change the default via per-drive
473ba181a0eSWarner Loshsysctl variables and loader tunables.
474ba181a0eSWarner LoshWhere
475ba181a0eSWarner Losh.Dq %d
476ba181a0eSWarner Loshis the unit number of the drive in question.
477ba181a0eSWarner LoshValid minimum command sizes
478ba181a0eSWarner Loshare 6 and 10.
479ba181a0eSWarner LoshAny value above 6 will be rounded to 10, and any value below
480ba181a0eSWarner Losh6 will be rounded to 6.
481ba181a0eSWarner Losh.It kern.cam.cd.changer.min_busy_seconds
482ba181a0eSWarner Losh.It kern.cam.cd.changer.max_busy_seconds
483ba181a0eSWarner Losh.Pp
484ba181a0eSWarner LoshTune how long individual LUNs are 'locked' for I/O operations to
485ba181a0eSWarner Loshoptimize changer operation.
486ba181a0eSWarner LoshSee CHANGER OPERATION section for information on how to use these items.
487ba181a0eSWarner Losh.El
488db35f309SDavid Greenman.Sh FILES
48930934e7dSRuslan Ermilov.Bl -tag -width /dev/cd[0-9][a-h] -compact
490db35f309SDavid Greenman.It Pa /dev/cd[0-9][a-h]
4915fc1fd70SGarrett Wollmanraw mode
4925fc1fd70SGarrett Wollman.Tn CD-ROM
4935fc1fd70SGarrett Wollmandevices
494db35f309SDavid Greenman.El
495db35f309SDavid Greenman.Sh DIAGNOSTICS
496db35f309SDavid GreenmanNone.
497db35f309SDavid Greenman.Sh SEE ALSO
4982baf3a13SAlexander Motin.Xr cam 4 ,
4992d8eb2c0SKenneth D. Merry.Xr da 4 ,
500f79219c3SJohn-Mark Gurney.Xr disklabel 8 ,
501f79219c3SJohn-Mark Gurney.Xr cd 9
5029cbda590SRuslan Ermilov.Sh HISTORY
5039cbda590SRuslan ErmilovThis
5049cbda590SRuslan Ermilov.Nm
5059cbda590SRuslan Ermilovdriver is based upon the
5069cbda590SRuslan Ermilov.Nm
5079cbda590SRuslan Ermilovdriver written by Julian Elischer, which appeared in
5089cbda590SRuslan Ermilov.Bx 386 0.1 .
5099cbda590SRuslan ErmilovThe
5109cbda590SRuslan ErmilovCAM version of the
5119cbda590SRuslan Ermilov.Nm
5129cbda590SRuslan Ermilovdriver was written by Kenneth Merry and first appeared in
5139cbda590SRuslan Ermilov.Fx 3.0 .
5145fc1fd70SGarrett Wollman.Sh BUGS
5155fc1fd70SGarrett WollmanThe names of the structures used for the third argument to
5165fc1fd70SGarrett Wollman.Fn ioctl
5175fc1fd70SGarrett Wollmanwere poorly chosen, and a number of spelling errors have survived in
5185fc1fd70SGarrett Wollmanthe names of the
5195fc1fd70SGarrett Wollman.Fn ioctl
5205fc1fd70SGarrett Wollmancommands.
5212d8eb2c0SKenneth D. Merry.Pp
5222d8eb2c0SKenneth D. MerryThere is no mechanism currently to set different minimum and maximum
5232d8eb2c0SKenneth D. Merrytimeouts for different CD changers; the timeout values set by the kernel
5242d8eb2c0SKenneth D. Merryoptions or the sysctl variables apply to all LUN-based CD changers in the
525f6c211aeSHiten Pandyasystem.
526f6c211aeSHiten PandyaIt is possible to implement such support, but the sysctl
527f87717faSMike Pritchardimplementation at least would be rather inelegant, because of the current
5282d8eb2c0SKenneth D. Merryinability of the sysctl code to handle the addition of nodes after compile
529f6c211aeSHiten Pandyatime.
530f6c211aeSHiten PandyaThus, it would take one dynamically sized sysctl variable and a
531f6c211aeSHiten Pandyauserland utility to get/set the timeout values.
532f6c211aeSHiten PandyaImplementation of separate
5332d8eb2c0SKenneth D. Merrytimeouts for different CD devices in the kernel config file would likely
5342d8eb2c0SKenneth D. Merryrequire modification of
5352d8eb2c0SKenneth D. Merry.Xr config 8
5362d8eb2c0SKenneth D. Merryto support the two timeouts when hardwiring
5374b66483fSRuslan Ermilov.Nm
5382d8eb2c0SKenneth D. Merrydevices.
539