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.\" 282d8eb2c0SKenneth D. Merry.Dd October 10, 1998 29db35f309SDavid Greenman.Dt CD 4 30db35f309SDavid Greenman.Os FreeBSD 31db35f309SDavid Greenman.Sh NAME 32db35f309SDavid Greenman.Nm cd 335fc1fd70SGarrett Wollman.Nd SCSI CD-ROM driver 34db35f309SDavid Greenman.Sh SYNOPSIS 355fc1fd70SGarrett Wollman.Cd device cd 36acea8246SKenneth D. Merry.Cd device cd1 at scbus0 target 4 unit 0 373136363fSRuslan Ermilov.Cd "options ""CHANGER_MIN_BUSY_SECONDS=3""" 383136363fSRuslan Ermilov.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"" 39db35f309SDavid Greenman.Sh DESCRIPTION 40db35f309SDavid GreenmanThe 414b66483fSRuslan Ermilov.Nm 42db35f309SDavid Greenmandriver provides support for a 435fc1fd70SGarrett Wollman.Tn SCSI 445fc1fd70SGarrett Wollman.Tn CD-ROM 455fc1fd70SGarrett Wollman(Compact Disc-Read Only Memory) drive. 465fc1fd70SGarrett WollmanIn an attempt to look like a regular disk, the 47db35f309SDavid Greenman.Nm 484a8d0283SMike Pritcharddriver synthesizes a partition table, with one partition covering the entire 495fc1fd70SGarrett Wollman.Tn CD-ROM . 505fc1fd70SGarrett WollmanIt is possible to modify this partition table using 515fc1fd70SGarrett Wollman.Xr disklabel 8 , 525fc1fd70SGarrett Wollmanbut it will only last until the 535fc1fd70SGarrett Wollman.Tn CD-ROM 545fc1fd70SGarrett Wollmanis unmounted. 55db35f309SDavid GreenmanIn general the interfaces are similar to those described by 5665c14d9dSOllivier Robert.Xr ad 4 575fc1fd70SGarrett Wollmanand 582d8eb2c0SKenneth D. Merry.Xr da 4 . 59db35f309SDavid Greenman.Pp 605fc1fd70SGarrett WollmanAs the 615fc1fd70SGarrett Wollman.Tn SCSI 625fc1fd70SGarrett Wollmanadapter is probed during boot, the 635fc1fd70SGarrett Wollman.Tn SCSI 646d249eeeSSheldon Hearnbus is scanned for devices. 656d249eeeSSheldon HearnAny devices found which answer as CDROM 662d8eb2c0SKenneth D. Merry(type 5) or WORM (type 4) type devices will be `attached' to the 67db35f309SDavid Greenman.Nm 682460bdf0SPeter Dufaultdriver. 69dd5527c6SMike PritchardPrior to 70dd5527c6SMike Pritchard.Fx 2.1 , 71dd5527c6SMike Pritchardthe first device found will be attached as 725fc1fd70SGarrett Wollman.Li cd0 735fc1fd70SGarrett Wollmanthe next, 745fc1fd70SGarrett Wollman.Li cd1 , 75db35f309SDavid Greenmanetc. 76dd5527c6SMike PritchardBeginning in 77dd5527c6SMike Pritchard.Fx 2.1 78dd5527c6SMike Pritchardit is possible to specify what cd unit a device should 792460bdf0SPeter Dufaultcome on line as; refer to 802460bdf0SPeter Dufault.Xr scsi 4 812460bdf0SPeter Dufaultfor details on kernel configuration. 82db35f309SDavid Greenman.Pp 83db35f309SDavid GreenmanThe system utility 845fc1fd70SGarrett Wollman.Xr disklabel 8 85db35f309SDavid Greenmanmay be used to read the synthesized 865fc1fd70SGarrett Wollmandisk label 875fc1fd70SGarrett Wollmanstructure, which will contain correct figures for the size of the 885fc1fd70SGarrett Wollman.Tn CD-ROM 89db35f309SDavid Greenmanshould that information be required. 90db35f309SDavid Greenman.Pp 91db35f309SDavid Greenman.Sh KERNEL CONFIGURATION 925fc1fd70SGarrett WollmanAny number of 935fc1fd70SGarrett Wollman.Tn CD-ROM 945fc1fd70SGarrett Wollmandevices may be attached to the system regardless of system 95db35f309SDavid Greenmanconfiguration as all resources are dynamically allocated. 96db35f309SDavid Greenman.Sh IOCTLS 97db35f309SDavid GreenmanThe following 98db35f309SDavid Greenman.Xr ioctl 2 995fc1fd70SGarrett Wollmancalls which apply to 1005fc1fd70SGarrett Wollman.Tn SCSI 1015fc1fd70SGarrett Wollman.Tn CD-ROM 1025fc1fd70SGarrett Wollmandrives are defined 103db35f309SDavid Greenmanin the header files 1045fc1fd70SGarrett Wollman.Aq Pa sys/cdio.h 105db35f309SDavid Greenmanand 1065fc1fd70SGarrett Wollman.Aq Pa sys/disklabel.h . 1075fc1fd70SGarrett Wollman.Pp 1083136363fSRuslan Ermilov.Bl -tag -width CDIOCREADSUBCHANNEL 109db35f309SDavid Greenman.It Dv DIOCGDINFO 110db35f309SDavid Greenman.It Dv DIOCSDINFO 1115fc1fd70SGarrett Wollman.Pq Li "struct disklabel" 1125fc1fd70SGarrett WollmanRead or write the in-core copy of the disklabel for the 1135fc1fd70SGarrett Wollmandrive. The disklabel is initialized with information 1145fc1fd70SGarrett Wollmanread from the scsi inquiry commands, and should be the same as 1155fc1fd70SGarrett Wollmanthe information printed at boot. This structure is defined in 1165fc1fd70SGarrett Wollman.Xr disklabel 5 . 1175fc1fd70SGarrett Wollman.It Dv CDIOCCAPABILITY 1185fc1fd70SGarrett Wollman.Pq Li "struct ioc_capability" 1195fc1fd70SGarrett WollmanRetrieve information from the drive on what features it supports. The 1205fc1fd70SGarrett Wollmaninformation is returned in the following structure: 1215fc1fd70SGarrett Wollman.Bd -literal -offset indent 1225fc1fd70SGarrett Wollmanstruct ioc_capability { 1235fc1fd70SGarrett Wollman u_long play_function; 1245fc1fd70SGarrett Wollman#define CDDOPLAYTRK 0x00000001 1255fc1fd70SGarrett Wollman /* Can play tracks/index */ 1265fc1fd70SGarrett Wollman#define CDDOPLAYMSF 0x00000002 1275fc1fd70SGarrett Wollman /* Can play msf to msf */ 1285fc1fd70SGarrett Wollman#define CDDOPLAYBLOCKS 0x00000004 1295fc1fd70SGarrett Wollman /* Can play range of blocks */ 1305fc1fd70SGarrett Wollman#define CDDOPAUSE 0x00000100 1315fc1fd70SGarrett Wollman /* Output can be paused */ 1325fc1fd70SGarrett Wollman#define CDDORESUME 0x00000200 1335fc1fd70SGarrett Wollman /* Output can be resumed */ 1345fc1fd70SGarrett Wollman#define CDDORESET 0x00000400 1355fc1fd70SGarrett Wollman /* Drive can be completely reset */ 1365fc1fd70SGarrett Wollman#define CDDOSTART 0x00000800 1375fc1fd70SGarrett Wollman /* Audio can be started */ 1385fc1fd70SGarrett Wollman#define CDDOSTOP 0x00001000 1395fc1fd70SGarrett Wollman /* Audio can be stopped */ 1405fc1fd70SGarrett Wollman#define CDDOPITCH 0x00002000 1415fc1fd70SGarrett Wollman /* Audio pitch can be changed */ 1425fc1fd70SGarrett Wollman 1435fc1fd70SGarrett Wollman u_long routing_function; 1445fc1fd70SGarrett Wollman#define CDREADVOLUME 0x00000001 1455fc1fd70SGarrett Wollman /* Volume settings can be read */ 1465fc1fd70SGarrett Wollman#define CDSETVOLUME 0x00000002 1475fc1fd70SGarrett Wollman /* Volume settings can be set */ 1485fc1fd70SGarrett Wollman#define CDSETMONO 0x00000100 1495fc1fd70SGarrett Wollman /* Output can be set to mono */ 1505fc1fd70SGarrett Wollman#define CDSETSTEREO 0x00000200 1515fc1fd70SGarrett Wollman /* Output can be set to stereo (def) */ 1525fc1fd70SGarrett Wollman#define CDSETLEFT 0x00000400 1535fc1fd70SGarrett Wollman /* Output can be set to left only */ 1545fc1fd70SGarrett Wollman#define CDSETRIGHT 0x00000800 1555fc1fd70SGarrett Wollman /* Output can be set to right only */ 1565fc1fd70SGarrett Wollman#define CDSETMUTE 0x00001000 1575fc1fd70SGarrett Wollman /* Output can be muted */ 1585fc1fd70SGarrett Wollman#define CDSETPATCH 0x00008000 1594a8d0283SMike Pritchard /* Direct routing control allowed */ 1605fc1fd70SGarrett Wollman 1615fc1fd70SGarrett Wollman u_long special_function; 1625fc1fd70SGarrett Wollman#define CDDOEJECT 0x00000001 1635fc1fd70SGarrett Wollman /* The tray can be opened */ 1645fc1fd70SGarrett Wollman#define CDDOCLOSE 0x00000002 1655fc1fd70SGarrett Wollman /* The tray can be closed */ 1665fc1fd70SGarrett Wollman#define CDDOLOCK 0x00000004 1675fc1fd70SGarrett Wollman /* The tray can be locked */ 1685fc1fd70SGarrett Wollman#define CDREADHEADER 0x00000100 1695fc1fd70SGarrett Wollman /* Can read Table of Contents */ 1705fc1fd70SGarrett Wollman#define CDREADENTRIES 0x00000200 1715fc1fd70SGarrett Wollman /* Can read TOC Entries */ 1725fc1fd70SGarrett Wollman#define CDREADSUBQ 0x00000200 1735fc1fd70SGarrett Wollman /* Can read Subchannel info */ 1745fc1fd70SGarrett Wollman#define CDREADRW 0x00000400 1755fc1fd70SGarrett Wollman /* Can read subcodes R-W */ 1765fc1fd70SGarrett Wollman#define CDHASDEBUG 0x00004000 1775fc1fd70SGarrett Wollman /* The tray has dynamic debugging */ 1785fc1fd70SGarrett Wollman}; 1795fc1fd70SGarrett Wollman.Ed 1805fc1fd70SGarrett Wollman.It Dv CDIOCPLAYTRACKS 1815fc1fd70SGarrett Wollman.Pq Li "struct ioc_play_track" 1825fc1fd70SGarrett WollmanStart audio playback given a track address and length. The structure 1835fc1fd70SGarrett Wollmanis defined as follows: 1845fc1fd70SGarrett Wollman.Bd -literal -offset indent 1855fc1fd70SGarrett Wollmanstruct ioc_play_track 1865fc1fd70SGarrett Wollman{ 1875fc1fd70SGarrett Wollman u_char start_track; 1885fc1fd70SGarrett Wollman u_char start_index; 1895fc1fd70SGarrett Wollman u_char end_track; 1905fc1fd70SGarrett Wollman u_char end_index; 1915fc1fd70SGarrett Wollman}; 1925fc1fd70SGarrett Wollman.Ed 1935fc1fd70SGarrett Wollman.It Dv CDIOCPLAYBLOCKS 1945fc1fd70SGarrett Wollman.Pq Li "struct ioc_play_blocks" 1955fc1fd70SGarrett WollmanStart audio playback given a block address and length. The structure 1965fc1fd70SGarrett Wollmanis defined as follows: 1975fc1fd70SGarrett Wollman.Bd -literal -offset indent 1985fc1fd70SGarrett Wollmanstruct ioc_play_blocks 1995fc1fd70SGarrett Wollman{ 2005fc1fd70SGarrett Wollman int blk; 2015fc1fd70SGarrett Wollman int len; 2025fc1fd70SGarrett Wollman}; 2035fc1fd70SGarrett Wollman.Ed 2045fc1fd70SGarrett Wollman.It Dv CDIOCPLAYMSF 2055fc1fd70SGarrett Wollman.Pq Li "struct ioc_play_msf" 2065fc1fd70SGarrett WollmanStart audio playback given a `minutes-seconds-frames' address and 2075fc1fd70SGarrett Wollmanlength. The 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" 2525fc1fd70SGarrett WollmanReturn information from the table of contents entries mentioned. (Yes, this 2535fc1fd70SGarrett Wollmancommand name is misspelled.) The argument structure is defined as follows: 2545fc1fd70SGarrett Wollman.Bd -literal -offset indent 2555fc1fd70SGarrett Wollmanstruct ioc_read_toc_entry { 2565fc1fd70SGarrett Wollman u_char address_format; 2575fc1fd70SGarrett Wollman u_char starting_track; 2585fc1fd70SGarrett Wollman u_short data_len; 2595fc1fd70SGarrett Wollman struct cd_toc_entry *data; 2605fc1fd70SGarrett Wollman}; 2615fc1fd70SGarrett Wollman.Ed 2625fc1fd70SGarrett WollmanThe requested data is written into an area of size 2635fc1fd70SGarrett Wollman.Li data_len 2645fc1fd70SGarrett Wollmanand pointed to by 2655fc1fd70SGarrett Wollman.Li data . 2665fc1fd70SGarrett Wollman.It Dv CDIOCSETPATCH 2675fc1fd70SGarrett Wollman.Pq Li "struct ioc_patch" 2685fc1fd70SGarrett WollmanAttach various audio channels to various output channels. The 2695fc1fd70SGarrett Wollmanargument structure is defined thusly: 2705fc1fd70SGarrett Wollman.Bd -literal -offset indent 2715fc1fd70SGarrett Wollmanstruct ioc_patch { 2725fc1fd70SGarrett Wollman u_char patch[4]; 2735fc1fd70SGarrett Wollman /* one for each channel */ 2745fc1fd70SGarrett Wollman}; 2755fc1fd70SGarrett Wollman.Ed 2765fc1fd70SGarrett Wollman.It Dv CDIOCGETVOL 2775fc1fd70SGarrett Wollman.It Dv CDIOCSETVOL 2785fc1fd70SGarrett Wollman.Pq Li "struct ioc_vol" 2795fc1fd70SGarrett WollmanGet (set) information about the volume settings of the output channels. The 2805fc1fd70SGarrett Wollmanargument structure is as follows: 2815fc1fd70SGarrett Wollman.Bd -literal -offset indent 2825fc1fd70SGarrett Wollmanstruct ioc_vol 2835fc1fd70SGarrett Wollman{ 2845fc1fd70SGarrett Wollman u_char vol[4]; 2855fc1fd70SGarrett Wollman /* one for each channel */ 2865fc1fd70SGarrett Wollman}; 2875fc1fd70SGarrett Wollman.Ed 2885fc1fd70SGarrett Wollman.It Dv CDIOCSETMONO 2895fc1fd70SGarrett WollmanPatch all output channels to all source channels. 2905fc1fd70SGarrett Wollman.It Dv CDIOCSETSTEREO 291db35f309SDavid GreenmanPatch left source channel to the left output channel and the right 292db35f309SDavid Greenmansource channel to the right output channel. 2935fc1fd70SGarrett Wollman.It Dv CDIOCSETMUTE 294db35f309SDavid GreenmanMute output without changing the volume settings. 2955fc1fd70SGarrett Wollman.It Dv CDIOCSETLEFT 2965fc1fd70SGarrett Wollman.It Dv CDIOCSETRIGHT 2975fc1fd70SGarrett WollmanAttach both output channels to the left (right) source channel. 2985fc1fd70SGarrett Wollman.It Dv CDIOCSETDEBUG 2995fc1fd70SGarrett Wollman.It Dv CDIOCCLRDEBUG 3005fc1fd70SGarrett WollmanTurn on (off) debugging for the appropriate device. 3015fc1fd70SGarrett Wollman.It Dv CDIOCPAUSE 3025fc1fd70SGarrett Wollman.It Dv CDIOCRESUME 3035fc1fd70SGarrett WollmanPause (resume) audio play, without resetting the location of the read-head. 3045fc1fd70SGarrett Wollman.It Dv CDIOCRESET 305db35f309SDavid GreenmanReset the drive. 3065fc1fd70SGarrett Wollman.It Dv CDIOCSTART 3075fc1fd70SGarrett Wollman.It Dv CDIOCSTOP 3085fc1fd70SGarrett WollmanTell the drive to spin-up (-down) the 3095fc1fd70SGarrett Wollman.Tn CD-ROM . 3105fc1fd70SGarrett Wollman.It Dv CDIOCALLOW 3115fc1fd70SGarrett Wollman.It Dv CDIOCPREVENT 3125fc1fd70SGarrett WollmanTell the drive to allow (prevent) manual ejection of the 3135fc1fd70SGarrett Wollman.Tn CD-ROM 3145fc1fd70SGarrett Wollmandisc. Not all drives support this feature. 3155fc1fd70SGarrett Wollman.It Dv CDIOCEJECT 3165fc1fd70SGarrett WollmanEject the 3175fc1fd70SGarrett Wollman.Tn CD-ROM . 3185fc1fd70SGarrett Wollman.It Dv CDIOCCLOSE 3195fc1fd70SGarrett WollmanTell the drive to close its door and load the media. Not all drives 3205fc1fd70SGarrett Wollmansupport this feature. 3215fc1fd70SGarrett Wollman.It Dv CDIOCPITCH 3225fc1fd70SGarrett Wollman.Pq Li "struct ioc_pitch" 3235fc1fd70SGarrett WollmanFor drives that support it, this command instructs the drive to play 3245fc1fd70SGarrett Wollmanthe audio at a faster or slower rate than normal. Values of 3255fc1fd70SGarrett Wollman.Li speed 3265fc1fd70SGarrett Wollmanbetween -32767 and -1 result in slower playback; a zero value 3275fc1fd70SGarrett Wollmanindicates normal speed; and values from 1 to 32767 give faster 3285fc1fd70SGarrett Wollmanplayback. Drives with less than 16 bits of resolution will silently 3295fc1fd70SGarrett Wollmanignore less-significant bits. The structure is defined thusly: 3305fc1fd70SGarrett Wollman.Bd -literal -offset indent 3315fc1fd70SGarrett Wollmanstruct ioc_pitch 3325fc1fd70SGarrett Wollman{ 3335fc1fd70SGarrett Wollman short speed; 3345fc1fd70SGarrett Wollman}; 3355fc1fd70SGarrett Wollman.Ed 336db35f309SDavid Greenman.El 337db35f309SDavid Greenman.Sh NOTES 3385fc1fd70SGarrett WollmanWhen a 3395fc1fd70SGarrett Wollman.Tn CD-ROM 3405fc1fd70SGarrett Wollmanis changed in a drive controlled by the 341db35f309SDavid Greenman.Nm 342db35f309SDavid Greenmandriver, then the act of changing the media will invalidate the 343db35f309SDavid Greenmandisklabel and information held within the kernel. To stop corruption, 3445fc1fd70SGarrett Wollmanall accesses to the device will be discarded until there are no more 345db35f309SDavid Greenmanopen file descriptors referencing the device. During this period, all 3465fc1fd70SGarrett Wollmannew open attempts will be rejected. When no more open file descriptors 347db35f309SDavid Greenmanreference the device, the first next open will load a new set of 3485fc1fd70SGarrett Wollmanparameters (including disklabel) for the drive. 3495fc1fd70SGarrett Wollman.Pp 3505fc1fd70SGarrett WollmanThe audio code in the 351db35f309SDavid Greenman.Nm 3525fc1fd70SGarrett Wollmandriver only support 3535fc1fd70SGarrett Wollman.Tn SCSI-2 3546d249eeeSSheldon Hearnstandard audio commands. 3556d249eeeSSheldon HearnBecause many 3565fc1fd70SGarrett Wollman.Tn CD-ROM 3575fc1fd70SGarrett Wollmanmanufacturers have not followed the standard, there are many 3585fc1fd70SGarrett Wollman.Tn CD-ROM 3596d249eeeSSheldon Hearndrives for which audio will not work. 3606d249eeeSSheldon HearnSome work is planned to support 3615fc1fd70SGarrett Wollmansome of the more common `broken' 3625fc1fd70SGarrett Wollman.Tn CD-ROM 3635fc1fd70SGarrett Wollmandrives; however, this is not yet under way. 3642d8eb2c0SKenneth D. Merry.Sh CHANGER OPERATION 3652d8eb2c0SKenneth D. MerryThis driver has built-in support for LUN-based CD changers. A LUN-based CD 3662d8eb2c0SKenneth D. Merrychanger is a drive that can hold two or more CDs, but only has one CD 3672d8eb2c0SKenneth D. Merryplayer mechanism. Each CD in the drive shows up as a seperate logical unit 3682d8eb2c0SKenneth D. Merryon the 3692d8eb2c0SKenneth D. Merry.Tn SCSI 3702d8eb2c0SKenneth D. Merrybus. The 3714b66483fSRuslan Ermilov.Nm 3722d8eb2c0SKenneth D. Merrydriver automatically recognizes LUN-based changers, and routes commands for 3732d8eb2c0SKenneth D. Merrychangers through an internal scheduler. The scheduler prevents changer 3742d8eb2c0SKenneth D. Merry"thrashing", which is caused by sending commands to different LUNs in the 3752d8eb2c0SKenneth D. Merrychanger at the same time. 3762d8eb2c0SKenneth D. Merry.Pp 3772d8eb2c0SKenneth D. MerryThe scheduler honors minimum and maximum time 3782d8eb2c0SKenneth D. Merryquanta that the driver will spend on a particular LUN. The minimum time 3792d8eb2c0SKenneth D. Merryis the guaranteed minimum amount of time that the driver will spend on a 3802d8eb2c0SKenneth D. Merrygiven LUN, even if there is no oustanding I/O for that LUN. The maximum 3812d8eb2c0SKenneth D. Merrytime is the maximum amount of time the changer will spend on a LUN if there 3822d8eb2c0SKenneth D. Merryis oustdanding I/O for another LUN. If there is no outstanding I/O for 3832d8eb2c0SKenneth D. Merryanother LUN, the driver will allow indefinite access to a given LUN. 3842d8eb2c0SKenneth D. Merry.Pp 3852d8eb2c0SKenneth D. MerryThe minimum and maximum time quanta are configurable via kernel options and 3862d8eb2c0SKenneth D. Merryalso via sysctl variables. The kernel options are: 3873136363fSRuslan Ermilov.Pp 3883136363fSRuslan Ermilov.Bl -item -compact 3893136363fSRuslan Ermilov.It 3903136363fSRuslan Ermilov.Cd "options ""CHANGER_MIN_BUSY_SECONDS=3""" 3913136363fSRuslan Ermilov.It 3923136363fSRuslan Ermilov.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11""" 3932d8eb2c0SKenneth D. Merry.El 3942d8eb2c0SKenneth D. Merry.Pp 3952d8eb2c0SKenneth D. MerryThe sysctl variables are: 3962d8eb2c0SKenneth D. Merry.Pp 3973136363fSRuslan Ermilov.Bl -item -compact 3983136363fSRuslan Ermilov.It 3993136363fSRuslan Ermilov.Va kern.cam.cd.changer.min_busy_seconds 4003136363fSRuslan Ermilov.It 4013136363fSRuslan Ermilov.Va kern.cam.cd.changer.max_busy_seconds 4022d8eb2c0SKenneth D. Merry.El 4032d8eb2c0SKenneth D. Merry.Pp 4042d8eb2c0SKenneth D. MerryIt is suggested that the user try experimenting with the minimum and 4052d8eb2c0SKenneth D. Merrymaximum timeouts via the sysctl variables to arrive at the proper values 4062d8eb2c0SKenneth D. Merryfor your changer. Once you have settled on the proper timeouts for your 4072d8eb2c0SKenneth D. Merrychanger, you can then put them in your kernel config file. 4082d8eb2c0SKenneth D. Merry.Pp 4092d8eb2c0SKenneth D. MerryIf your system does have a LUN-based changer, you may notice that the 4102d8eb2c0SKenneth D. Merryprobe messages for the various LUNs of the changer will continue to appear 4112d8eb2c0SKenneth D. Merrywhile the boot process is going on. This is normal, and is caused by the 4122d8eb2c0SKenneth D. Merrychanger scheduling code. 413db35f309SDavid Greenman.Sh FILES 414db35f309SDavid Greenman.Bl -tag -width /dev/rcd[0-9][a-h] -compact 415db35f309SDavid Greenman.It Pa /dev/cd[0-9][a-h] 4165fc1fd70SGarrett Wollmanblock mode 4175fc1fd70SGarrett Wollman.Tn CD-ROM 4185fc1fd70SGarrett Wollmandevices 419db35f309SDavid Greenman.It Pa /dev/rcd[0-9][a-h] 4205fc1fd70SGarrett Wollmanraw mode 4215fc1fd70SGarrett Wollman.Tn CD-ROM 4225fc1fd70SGarrett Wollmandevices 423db35f309SDavid Greenman.El 424db35f309SDavid Greenman.Sh DIAGNOSTICS 425db35f309SDavid GreenmanNone. 426db35f309SDavid Greenman.Sh SEE ALSO 4272d8eb2c0SKenneth D. Merry.Xr da 4 , 428def37e7cSMike Pritchard.Xr scsi 4 , 42978b0b234SMike Pritchard.Xr disklabel 5 , 430f79219c3SJohn-Mark Gurney.Xr disklabel 8 , 431f79219c3SJohn-Mark Gurney.Xr cd 9 4325fc1fd70SGarrett Wollman.Sh BUGS 4335fc1fd70SGarrett WollmanThe names of the structures used for the third argument to 4345fc1fd70SGarrett Wollman.Fn ioctl 4355fc1fd70SGarrett Wollmanwere poorly chosen, and a number of spelling errors have survived in 4365fc1fd70SGarrett Wollmanthe names of the 4375fc1fd70SGarrett Wollman.Fn ioctl 4385fc1fd70SGarrett Wollmancommands. 4392d8eb2c0SKenneth D. Merry.Pp 4402d8eb2c0SKenneth D. MerryThere is no mechanism currently to set different minimum and maximum 4412d8eb2c0SKenneth D. Merrytimeouts for different CD changers; the timeout values set by the kernel 4422d8eb2c0SKenneth D. Merryoptions or the sysctl variables apply to all LUN-based CD changers in the 4432d8eb2c0SKenneth D. Merrysystem. It is possible to implement such support, but the sysctl 4442d8eb2c0SKenneth D. Merryimpelmentation at least would be rather inelegant, because of the current 4452d8eb2c0SKenneth D. Merryinability of the sysctl code to handle the addition of nodes after compile 4462d8eb2c0SKenneth D. Merrytime. Thus, it would take one dynamically sized sysctl variable and a 4472d8eb2c0SKenneth D. Merryuserland utility to get/set the timeout values. Implementation of separate 4482d8eb2c0SKenneth D. Merrytimeouts for different CD devices in the kernel config file would likely 4492d8eb2c0SKenneth D. Merryrequire modification of 4502d8eb2c0SKenneth D. Merry.Xr config 8 4512d8eb2c0SKenneth D. Merryto support the two timeouts when hardwiring 4524b66483fSRuslan Ermilov.Nm 4532d8eb2c0SKenneth D. Merrydevices. 454db35f309SDavid Greenman.Sh HISTORY 455db35f309SDavid GreenmanThis 4564b66483fSRuslan Ermilov.Nm 4572d8eb2c0SKenneth D. Merrydriver is based upon the 4584b66483fSRuslan Ermilov.Nm 459f9d04512SKenneth D. Merrydriver written by Julian Elischer, which appeared in 386BSD 0.1. The 4602d8eb2c0SKenneth D. MerryCAM version of the 4614b66483fSRuslan Ermilov.Nm 4622d8eb2c0SKenneth D. Merrydriver was written by Kenneth Merry and first appeared in 4632d8eb2c0SKenneth D. Merry.Fx 3.0 . 464