1996-10-18 20:22:31 +00:00
|
|
|
.\" Copyright (c) 1996
|
2000-10-26 15:30:44 +00:00
|
|
|
.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
|
1996-10-18 20:22:31 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\"
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1996-12-26 16:16:37 +00:00
|
|
|
.\"
|
2014-04-09 08:57:57 +00:00
|
|
|
.Dd April 9, 2014
|
1995-01-25 09:18:56 +00:00
|
|
|
.Dt CD 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1995-01-25 09:18:56 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm cd
|
1996-01-16 21:29:43 +00:00
|
|
|
.Nd SCSI CD-ROM driver
|
1995-01-25 09:18:56 +00:00
|
|
|
.Sh SYNOPSIS
|
1996-01-16 21:29:43 +00:00
|
|
|
.Cd device cd
|
1995-01-25 09:18:56 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
2001-07-14 19:41:16 +00:00
|
|
|
driver provides support for a
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn SCSI
|
|
|
|
.Tn CD-ROM
|
|
|
|
(Compact Disc-Read Only Memory) drive.
|
2001-07-14 19:41:16 +00:00
|
|
|
In an attempt to look like a regular disk, the
|
1995-01-25 09:18:56 +00:00
|
|
|
.Nm
|
1996-01-30 13:52:50 +00:00
|
|
|
driver synthesizes a partition table, with one partition covering the entire
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM .
|
|
|
|
It is possible to modify this partition table using
|
|
|
|
.Xr disklabel 8 ,
|
2001-07-14 19:41:16 +00:00
|
|
|
but it will only last until the
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM
|
|
|
|
is unmounted.
|
2001-07-14 19:41:16 +00:00
|
|
|
In general the interfaces are similar to those described by
|
2012-02-09 04:37:30 +00:00
|
|
|
.Xr ada 4
|
1996-01-16 21:29:43 +00:00
|
|
|
and
|
1998-10-12 03:27:51 +00:00
|
|
|
.Xr da 4 .
|
1995-01-25 09:18:56 +00:00
|
|
|
.Pp
|
1996-01-16 21:29:43 +00:00
|
|
|
As the
|
|
|
|
.Tn SCSI
|
2001-07-14 19:41:16 +00:00
|
|
|
adapter is probed during boot, the
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn SCSI
|
2000-03-01 14:50:24 +00:00
|
|
|
bus is scanned for devices.
|
|
|
|
Any devices found which answer as CDROM
|
2001-07-14 19:41:16 +00:00
|
|
|
(type 5) or WORM (type 4) type devices will be `attached' to the
|
1995-01-25 09:18:56 +00:00
|
|
|
.Nm
|
1995-03-01 22:32:38 +00:00
|
|
|
driver.
|
1997-03-21 20:14:15 +00:00
|
|
|
Prior to
|
|
|
|
.Fx 2.1 ,
|
|
|
|
the first device found will be attached as
|
1996-01-16 21:29:43 +00:00
|
|
|
.Li cd0
|
2001-07-14 19:41:16 +00:00
|
|
|
the next,
|
1996-01-16 21:29:43 +00:00
|
|
|
.Li cd1 ,
|
1995-01-25 09:18:56 +00:00
|
|
|
etc.
|
1997-03-21 20:14:15 +00:00
|
|
|
Beginning in
|
|
|
|
.Fx 2.1
|
|
|
|
it is possible to specify what cd unit a device should
|
1995-03-01 22:32:38 +00:00
|
|
|
come on line as; refer to
|
|
|
|
.Xr scsi 4
|
|
|
|
for details on kernel configuration.
|
1995-01-25 09:18:56 +00:00
|
|
|
.Pp
|
|
|
|
The system utility
|
1996-01-16 21:29:43 +00:00
|
|
|
.Xr disklabel 8
|
1995-01-25 09:18:56 +00:00
|
|
|
may be used to read the synthesized
|
1996-01-16 21:29:43 +00:00
|
|
|
disk label
|
2001-07-14 19:41:16 +00:00
|
|
|
structure, which will contain correct figures for the size of the
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM
|
1995-01-25 09:18:56 +00:00
|
|
|
should that information be required.
|
|
|
|
.Sh KERNEL CONFIGURATION
|
1996-01-16 21:29:43 +00:00
|
|
|
Any number of
|
|
|
|
.Tn CD-ROM
|
|
|
|
devices may be attached to the system regardless of system
|
1995-01-25 09:18:56 +00:00
|
|
|
configuration as all resources are dynamically allocated.
|
|
|
|
.Sh IOCTLS
|
2001-07-14 19:41:16 +00:00
|
|
|
The following
|
1995-01-25 09:18:56 +00:00
|
|
|
.Xr ioctl 2
|
1996-01-16 21:29:43 +00:00
|
|
|
calls which apply to
|
|
|
|
.Tn SCSI
|
|
|
|
.Tn CD-ROM
|
|
|
|
drives are defined
|
1995-01-25 09:18:56 +00:00
|
|
|
in the header files
|
2003-09-08 19:57:22 +00:00
|
|
|
.In sys/cdio.h
|
1995-01-25 09:18:56 +00:00
|
|
|
and
|
2003-09-08 19:57:22 +00:00
|
|
|
.In sys/disklabel.h .
|
2000-12-29 09:18:45 +00:00
|
|
|
.Bl -tag -width CDIOCREADSUBCHANNEL
|
|
|
|
.It Dv CDIOCPLAYTRACKS
|
1996-01-16 21:29:43 +00:00
|
|
|
.Pq Li "struct ioc_play_track"
|
2003-06-03 14:19:24 +00:00
|
|
|
Start audio playback given a track address and length.
|
|
|
|
The structure is defined as follows:
|
1996-01-16 21:29:43 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_play_track
|
|
|
|
{
|
|
|
|
u_char start_track;
|
|
|
|
u_char start_index;
|
|
|
|
u_char end_track;
|
|
|
|
u_char end_index;
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.It Dv CDIOCPLAYBLOCKS
|
|
|
|
.Pq Li "struct ioc_play_blocks"
|
2003-06-03 14:19:24 +00:00
|
|
|
Start audio playback given a block address and length.
|
|
|
|
The structure is defined as follows:
|
1996-01-16 21:29:43 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_play_blocks
|
|
|
|
{
|
|
|
|
int blk;
|
|
|
|
int len;
|
|
|
|
};
|
|
|
|
.Ed
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCPLAYMSF
|
1996-01-16 21:29:43 +00:00
|
|
|
.Pq Li "struct ioc_play_msf"
|
|
|
|
Start audio playback given a `minutes-seconds-frames' address and
|
2003-06-03 14:19:24 +00:00
|
|
|
length.
|
|
|
|
The structure is defined as follows:
|
1996-01-16 21:29:43 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_play_msf
|
|
|
|
{
|
|
|
|
u_char start_m;
|
|
|
|
u_char start_s;
|
|
|
|
u_char start_f;
|
|
|
|
u_char end_m;
|
|
|
|
u_char end_s;
|
|
|
|
u_char end_f;
|
|
|
|
};
|
|
|
|
.Ed
|
2001-07-14 19:41:16 +00:00
|
|
|
.It Dv CDIOCREADSUBCHANNEL
|
1996-01-16 21:29:43 +00:00
|
|
|
.Pq Li "struct ioc_read_subchannel"
|
|
|
|
Read information from the subchannel at the location specified by this
|
|
|
|
structure:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_read_subchannel {
|
|
|
|
u_char address_format;
|
|
|
|
#define CD_LBA_FORMAT 1
|
|
|
|
#define CD_MSF_FORMAT 2
|
|
|
|
u_char data_format;
|
|
|
|
#define CD_SUBQ_DATA 0
|
|
|
|
#define CD_CURRENT_POSITION 1
|
|
|
|
#define CD_MEDIA_CATALOG 2
|
|
|
|
#define CD_TRACK_INFO 3
|
|
|
|
u_char track;
|
|
|
|
int data_len;
|
|
|
|
struct cd_sub_channel_info *data;
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.It Dv CDIOREADTOCHEADER
|
|
|
|
.Pq Li "struct ioc_toc_header"
|
2001-07-14 19:41:16 +00:00
|
|
|
Return summary information about the table of contents for the mounted
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM .
|
|
|
|
The information is returned into the following structure:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_toc_header {
|
|
|
|
u_short len;
|
|
|
|
u_char starting_track;
|
|
|
|
u_char ending_track;
|
|
|
|
};
|
|
|
|
.Ed
|
2001-07-14 19:41:16 +00:00
|
|
|
.It Dv CDIOREADTOCENTRYS
|
1996-01-16 21:29:43 +00:00
|
|
|
.Pq Li "struct ioc_read_toc_entry"
|
2003-06-03 14:19:24 +00:00
|
|
|
Return information from the table of contents entries mentioned.
|
|
|
|
.Pq Yes, this command name is misspelled.
|
|
|
|
The argument structure is defined as follows:
|
1996-01-16 21:29:43 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_read_toc_entry {
|
|
|
|
u_char address_format;
|
|
|
|
u_char starting_track;
|
|
|
|
u_short data_len;
|
|
|
|
struct cd_toc_entry *data;
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
The requested data is written into an area of size
|
|
|
|
.Li data_len
|
|
|
|
and pointed to by
|
|
|
|
.Li data .
|
|
|
|
.It Dv CDIOCSETPATCH
|
|
|
|
.Pq Li "struct ioc_patch"
|
2003-06-03 14:19:24 +00:00
|
|
|
Attach various audio channels to various output channels.
|
|
|
|
The argument structure is defined thusly:
|
1996-01-16 21:29:43 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_patch {
|
|
|
|
u_char patch[4];
|
|
|
|
/* one for each channel */
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.It Dv CDIOCGETVOL
|
|
|
|
.It Dv CDIOCSETVOL
|
|
|
|
.Pq Li "struct ioc_vol"
|
2003-06-03 14:19:24 +00:00
|
|
|
Get (set) information about the volume settings of the output channels.
|
|
|
|
The argument structure is as follows:
|
1996-01-16 21:29:43 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct ioc_vol
|
|
|
|
{
|
|
|
|
u_char vol[4];
|
|
|
|
/* one for each channel */
|
|
|
|
};
|
|
|
|
.Ed
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCSETMONO
|
1996-01-16 21:29:43 +00:00
|
|
|
Patch all output channels to all source channels.
|
|
|
|
.It Dv CDIOCSETSTEREO
|
1995-01-25 09:18:56 +00:00
|
|
|
Patch left source channel to the left output channel and the right
|
|
|
|
source channel to the right output channel.
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCSETMUTE
|
1995-01-25 09:18:56 +00:00
|
|
|
Mute output without changing the volume settings.
|
1996-01-16 21:29:43 +00:00
|
|
|
.It Dv CDIOCSETLEFT
|
|
|
|
.It Dv CDIOCSETRIGHT
|
|
|
|
Attach both output channels to the left (right) source channel.
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCSETDEBUG
|
|
|
|
.It Dv CDIOCCLRDEBUG
|
1996-01-16 21:29:43 +00:00
|
|
|
Turn on (off) debugging for the appropriate device.
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCPAUSE
|
|
|
|
.It Dv CDIOCRESUME
|
1996-01-16 21:29:43 +00:00
|
|
|
Pause (resume) audio play, without resetting the location of the read-head.
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCRESET
|
1995-01-25 09:18:56 +00:00
|
|
|
Reset the drive.
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCSTART
|
|
|
|
.It Dv CDIOCSTOP
|
1996-01-16 21:29:43 +00:00
|
|
|
Tell the drive to spin-up (-down) the
|
|
|
|
.Tn CD-ROM .
|
|
|
|
.It Dv CDIOCALLOW
|
|
|
|
.It Dv CDIOCPREVENT
|
2001-07-14 19:41:16 +00:00
|
|
|
Tell the drive to allow (prevent) manual ejection of the
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM
|
2003-06-28 23:53:39 +00:00
|
|
|
disc.
|
|
|
|
Not all drives support this feature.
|
2000-12-29 09:18:45 +00:00
|
|
|
.It Dv CDIOCEJECT
|
2001-07-14 19:41:16 +00:00
|
|
|
Eject the
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM .
|
|
|
|
.It Dv CDIOCCLOSE
|
2003-06-03 14:19:24 +00:00
|
|
|
Tell the drive to close its door and load the media.
|
|
|
|
Not all drives support this feature.
|
1995-01-25 09:18:56 +00:00
|
|
|
.El
|
|
|
|
.Sh NOTES
|
2001-07-14 19:41:16 +00:00
|
|
|
When a
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM
|
|
|
|
is changed in a drive controlled by the
|
1995-01-25 09:18:56 +00:00
|
|
|
.Nm
|
1996-01-16 21:29:43 +00:00
|
|
|
driver, then the act of changing the media will invalidate the
|
2003-06-03 14:19:24 +00:00
|
|
|
disklabel and information held within the kernel.
|
|
|
|
To stop corruption,
|
1996-01-16 21:29:43 +00:00
|
|
|
all accesses to the device will be discarded until there are no more
|
2003-06-03 14:19:24 +00:00
|
|
|
open file descriptors referencing the device.
|
|
|
|
During this period, all
|
|
|
|
new open attempts will be rejected.
|
|
|
|
When no more open file descriptors
|
1995-01-25 09:18:56 +00:00
|
|
|
reference the device, the first next open will load a new set of
|
1996-01-16 21:29:43 +00:00
|
|
|
parameters (including disklabel) for the drive.
|
|
|
|
.Pp
|
|
|
|
The audio code in the
|
1995-01-25 09:18:56 +00:00
|
|
|
.Nm
|
1996-01-16 21:29:43 +00:00
|
|
|
driver only support
|
|
|
|
.Tn SCSI-2
|
2000-03-01 14:50:24 +00:00
|
|
|
standard audio commands.
|
2003-06-28 23:53:39 +00:00
|
|
|
As many
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM
|
|
|
|
manufacturers have not followed the standard, there are many
|
|
|
|
.Tn CD-ROM
|
2000-03-01 14:50:24 +00:00
|
|
|
drives for which audio will not work.
|
|
|
|
Some work is planned to support
|
2001-07-14 19:41:16 +00:00
|
|
|
some of the more common `broken'
|
1996-01-16 21:29:43 +00:00
|
|
|
.Tn CD-ROM
|
|
|
|
drives; however, this is not yet under way.
|
2009-01-08 15:20:32 +00:00
|
|
|
.Sh SYSCTL VARIABLES
|
|
|
|
The following variables are available as both
|
|
|
|
.Xr sysctl 8
|
|
|
|
variables and
|
|
|
|
.Xr loader 8
|
|
|
|
tunables:
|
|
|
|
.Bl -tag -width 12
|
|
|
|
.It kern.cam.cd.retry_count
|
|
|
|
.Pp
|
|
|
|
This variable determines how many times the
|
|
|
|
.Nm
|
|
|
|
driver will retry a READ or WRITE command.
|
|
|
|
This does not affect the number of retries used during probe time or for
|
|
|
|
the
|
|
|
|
.Nm
|
|
|
|
driver dump routine.
|
|
|
|
This value currently defaults to 4.
|
|
|
|
.It kern.cam.cd.%d.minimum_cmd_size
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver attempts to automatically determine whether the drive it is talking
|
|
|
|
to supports 6 byte or 10 byte MODE SENSE/MODE SELECT operations.
|
|
|
|
Many
|
|
|
|
.Tn SCSI
|
|
|
|
drives only support 6 byte commands, and
|
|
|
|
.Tn ATAPI
|
|
|
|
drives only support 10 byte commands.
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver first attempts to determine whether the protocol in use typically
|
|
|
|
supports 6 byte commands by issuing a CAM Path Inquiry CCB.
|
|
|
|
It will then default to 6 byte or 10 byte commands as appropriate.
|
|
|
|
After that, the
|
|
|
|
.Nm
|
|
|
|
driver defaults to using 6 byte commands (assuming the protocol the drive
|
|
|
|
speaks claims to support 6 byte commands), until one fails with a
|
|
|
|
.Tn SCSI
|
|
|
|
ILLEGAL REQUEST error.
|
|
|
|
Then it tries the 10 byte version of the command to
|
|
|
|
see if that works instead.
|
|
|
|
Users can change the default via per-drive
|
|
|
|
sysctl variables and loader tunables.
|
|
|
|
Where
|
|
|
|
.Dq %d
|
|
|
|
is the unit number of the drive in question.
|
|
|
|
Valid minimum command sizes
|
|
|
|
are 6 and 10.
|
|
|
|
Any value above 6 will be rounded to 10, and any value below
|
|
|
|
6 will be rounded to 6.
|
|
|
|
.El
|
1995-01-25 09:18:56 +00:00
|
|
|
.Sh FILES
|
2001-04-27 09:06:50 +00:00
|
|
|
.Bl -tag -width /dev/cd[0-9][a-h] -compact
|
1995-01-25 09:18:56 +00:00
|
|
|
.It Pa /dev/cd[0-9][a-h]
|
1996-01-16 21:29:43 +00:00
|
|
|
raw mode
|
|
|
|
.Tn CD-ROM
|
|
|
|
devices
|
1995-01-25 09:18:56 +00:00
|
|
|
.El
|
|
|
|
.Sh DIAGNOSTICS
|
|
|
|
None.
|
|
|
|
.Sh SEE ALSO
|
2010-03-04 11:09:49 +00:00
|
|
|
.Xr cam 4 ,
|
1998-10-12 03:27:51 +00:00
|
|
|
.Xr da 4 ,
|
1997-02-20 15:14:59 +00:00
|
|
|
.Xr disklabel 8 ,
|
|
|
|
.Xr cd 9
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
This
|
|
|
|
.Nm
|
|
|
|
driver is based upon the
|
|
|
|
.Nm
|
|
|
|
driver written by Julian Elischer, which appeared in
|
|
|
|
.Bx 386 0.1 .
|
|
|
|
The
|
|
|
|
CAM version of the
|
|
|
|
.Nm
|
|
|
|
driver was written by Kenneth Merry and first appeared in
|
|
|
|
.Fx 3.0 .
|
1996-01-16 21:29:43 +00:00
|
|
|
.Sh BUGS
|
|
|
|
The names of the structures used for the third argument to
|
|
|
|
.Fn ioctl
|
|
|
|
were poorly chosen, and a number of spelling errors have survived in
|
|
|
|
the names of the
|
|
|
|
.Fn ioctl
|
|
|
|
commands.
|