cd.4 revision 5884
1.Dd August 27, 1993
2.Dt CD 4
3.Os FreeBSD
4.Sh NAME
5.Nm cd
6.Nd scsi cdrom driver
7.Sh SYNOPSIS
8.Nm device-driver cd
9.Op Ar count
10.Sh DESCRIPTION
11The
12.Xr cd
13driver provides support for a 
14.Em scsi
15cdrom. It allows the cdrom
16to be divided up into a set of pseudo devices called
17.Em partitions.
18In an attempt to look like regular disks the 
19.Nm
20driver synthesises a partition table, with one partition covering the entire
21cdrom. A user might (for some amazing reason) add another partition to the
22cdrom by using disklabel, but it will last only until the cdrom is unmounted.
23A Partition can have both a 
24.Em raw
25interface
26and a
27.Em Block mode
28interface.
29In general the interfaces are similar to those described by 
30.Xr wd 4 
31or 
32.Xr sd 4 .
33
34.Pp
35Where the 
36.Xr wd 4
37device has a fairly low level interface to the system, 
38.Em SCSI
39devices have a much higher level interface and talk to the system via
40a 
41.Em SCSI Adapter
42and a
43.Em Scsi Adapter driver
44e.g. 
45.Xr AHA1542 .
46A scsi adapter must also be separatly configured into the system
47before a scsi cdrom can be configured.
48.Pp
49As the scsi adapter is probed during boot, the 
50.Em SCSI
51bus is scanned for devices. Any devices found which answer as 'Readonly'
52type devices will be 'attached' to the 
53.Nm
54driver. The first found will be attached as
55.Em cd0
56and the next, 
57.Em cd1
58etc.
59.Pp
60The system utility
61.Xr disklabel 1
62may be used to read the synthesized
63.Xr disklabel 5
64structure, which will contain correct figures for the size of the cdrom
65should that information be required.
66.Pp
67.Sh KERNEL CONFIGURATION
68Any number of cdroms may be attached to the system regardless of system
69configuration as all resources are dynamically allocated.
70
71.Pp
72.Sh IOCTLS
73The following 
74.Xr ioctl 2
75calls apply to scsi cdroms
76in the header files
77.Em sys/cdio.h.
78and
79.Em sys/disklabel.h
80
81.Bl -tag -width CDIOCPLAYAUDIO____
82
83.It Dv DIOCGDINFO
84Read, from the kernel, the in-core copy of the disklabel for the
85drive. This will be a ficticious disklabel it will contain information
86read from the scsi inquiry commands, and should be the same as
87the information printed at boot.
88.It Dv DIOCSDINFO
89Give the driver a new disklabel to use. The driver will NOT try write the new
90disklabel to the disk. (ok?)
91.It CDIOCPLAYTRACKS	
92Start Audio playback given a track address and length.
93.It CDIOCPLAYBLOCKS	
94Start Audio playback given a block address and length.
95.It CDIOCPLAYMSF	
96Start Audio playback given a 'Minutes/ seconds/ frames' address and length.
97.It CDIOCREADSUBCHANNEL 
98Read information from the subchannel at the location specified.
99.It CDIOREADTOCHEADER 
100Return summary information about the table of contents for the mounted cdrom.
101.It CDIOREADTOCENTRYS 
102Return information from the table of contents entries mentionned.
103.It CDIOCSETPATCH	
104Attach various audio channels to various output channels.
105.It CDIOCGETVOL	
106Get information about the volume settings of the output channels.
107.It CDIOCSETVOL	
108Change the volume settings of the output channels.
109.It CDIOCSETMONO	
110Patch all out[put channels to all source channels.
111.It CDIOCSETSTERIO	
112Patch left source channel to the left output channel and the right
113source channel to the right output channel.
114.It CDIOCSETMUTE	
115Mute output without changing the volume settings.
116.It CDIOCSETLEFT	
117Attach both output channels to the left source channel.
118.It CDIOCSETRIGHT	
119Attach both output channels to the right source channel.
120.It CDIOCSETDEBUG	
121Turn on debugging for the appropriate device.
122.It CDIOCCLRDEBUG	
123Turn off debugging for the appropriate device.
124.It CDIOCPAUSE	
125Pause audio play, do not reset the location of the read-head.
126.It CDIOCRESUME	
127Resume audio play, Start at the location of the pause.
128.It CDIOCRESET	
129Reset the drive.
130.It CDIOCSTART	
131Tell the drive to spin-up the cdrom.
132.It CDIOCSTOP	
133Tell the drive to spin-down the cdrom.
134.It CDIOCEJECT	
135Eject the cdrom.
136.El
137.Pp
138In addition the general 
139.Xr scsi 4
140ioctls may be used with the 
141.Nm
142driver, if used against the fourth (raw/whole disk) partiton. (e.g. rcd0d)
143.Sh NOTES
144When a cdrom is changed in a drive controlled by the
145.Nm
146driver, then the act of changing the media will invalidate the 
147disklabel and information held within the kernel. To stop corruption,
148All accesses to the device will be discarded until there are no more
149open file descriptors referencing the device. During this period, all 
150new open attempts will be rejected. When No more open file descriptors
151reference the device, the first next open will load a new set of
152figures (including disklabel) for the drive.
153
154The Audio code in the
155.Nm
156driver only support SCSI2 standard audio commands. As there are many cdrom
157manufacturers who have not followed the standard well, there are many
158cdroms for which audio will not work. Some work is planned to support
159some of the more common 'broken' cdrom drives however this is not yet
160under way.
161
162.Sh FILES
163.Bl -tag -width /dev/rcd[0-9][a-h] -compact
164.It Pa /dev/cd[0-9][a-h]
165block mode scsi disks
166.It Pa /dev/rcd[0-9][a-h]
167raw scsi disks
168.El
169.Sh DIAGNOSTICS
170None.
171.Sh SEE ALSO
172.Xr disklabel 1
173.Xr disklabel 5
174.Xr wd 4
175.Xr sd 4
176.Sh HISTORY
177This
178.Nm
179driver appeared in 386BSD 0.1.
180