cd - SCSI CD-ROM driver
As the SCSI adapter is probed during boot, the SCSI bus is scanned for devices. Any devices found which answer as CDROM (type 5) or WORM (type 4) type devices will be `attached' to the driver. Prior to Fx 2.1 , the first device found will be attached as cd0 the next, cd1 etc. Beginning in Fx 2.1 it is possible to specify what cd unit a device should come on line as; refer to scsi(4) for details on kernel configuration.
The system utility disklabel(8) may be used to read the synthesized disk label structure, which will contain correct figures for the size of the CD-ROM should that information be required.
struct ioc_capability { u_long play_function; #define CDDOPLAYTRK 0x00000001 /* Can play tracks/index */ #define CDDOPLAYMSF 0x00000002 /* Can play msf to msf */ #define CDDOPLAYBLOCKS 0x00000004 /* Can play range of blocks */ #define CDDOPAUSE 0x00000100 /* Output can be paused */ #define CDDORESUME 0x00000200 /* Output can be resumed */ #define CDDORESET 0x00000400 /* Drive can be completely reset */ #define CDDOSTART 0x00000800 /* Audio can be started */ #define CDDOSTOP 0x00001000 /* Audio can be stopped */ #define CDDOPITCH 0x00002000 /* Audio pitch can be changed */ u_long routing_function; #define CDREADVOLUME 0x00000001 /* Volume settings can be read */ #define CDSETVOLUME 0x00000002 /* Volume settings can be set */ #define CDSETMONO 0x00000100 /* Output can be set to mono */ #define CDSETSTEREO 0x00000200 /* Output can be set to stereo (def) */ #define CDSETLEFT 0x00000400 /* Output can be set to left only */ #define CDSETRIGHT 0x00000800 /* Output can be set to right only */ #define CDSETMUTE 0x00001000 /* Output can be muted */ #define CDSETPATCH 0x00008000 /* Direct routing control allowed */ u_long special_function; #define CDDOEJECT 0x00000001 /* The tray can be opened */ #define CDDOCLOSE 0x00000002 /* The tray can be closed */ #define CDDOLOCK 0x00000004 /* The tray can be locked */ #define CDREADHEADER 0x00000100 /* Can read Table of Contents */ #define CDREADENTRIES 0x00000200 /* Can read TOC Entries */ #define CDREADSUBQ 0x00000200 /* Can read Subchannel info */ #define CDREADRW 0x00000400 /* Can read subcodes R-W */ #define CDHASDEBUG 0x00004000 /* The tray has dynamic debugging */ };
struct ioc_play_track { u_char start_track; u_char start_index; u_char end_track; u_char end_index; };
struct ioc_play_blocks { int blk; int len; };
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; };
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; };
struct ioc_toc_header { u_short len; u_char starting_track; u_char ending_track; };
The requested data is written into an area of size data_len and pointed to by datastruct ioc_read_toc_entry { u_char address_format; u_char starting_track; u_short data_len; struct cd_toc_entry *data; };
struct ioc_patch { u_char patch[4]; /* one for each channel */ };
struct ioc_vol { u_char vol[4]; /* one for each channel */ };
struct ioc_pitch { short speed; };
The audio code in the driver only support SCSI-2 standard audio commands. As many CD-ROM manufacturers have not followed the standard, there are many CD-ROM drives for which audio will not work. Some work is planned to support some of the more common `broken' CD-ROM drives; however, this is not yet under way.
The driver attempts to automatically determine whether the drive it is talking to supports 6 byte or 10 byte MODE SENSE/MODE SELECT operations. Many SCSI drives only support 6 byte commands, and ATAPI drives only support 10 byte commands. The 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 driver defaults to using 6 byte commands (assuming the protocol the drive speaks claims to support 6 byte commands), until one fails with a 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. The variable names are the same in both instances:
kern.cam.cd.%d.minimum_cmd_size
Where ``%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.
The scheduler honors minimum and maximum time quanta that the driver will spend on a particular LUN. The minimum time is the guaranteed minimum amount of time that the driver will spend on a given LUN, even if there is no outstanding I/O for that LUN. The maximum time is the maximum amount of time the changer will spend on a LUN if there is outstanding I/O for another LUN. If there is no outstanding I/O for another LUN, the driver will allow indefinite access to a given LUN.
The minimum and maximum time quanta are configurable via kernel options and also via sysctl and kernel tunable variables. The kernel options are:
The sysctl/kernel tunable variables are:
It is suggested that the user try experimenting with the minimum and maximum timeouts via the sysctl variables to arrive at the proper values for your changer. Once you have settled on the proper timeouts for your changer, you can then put them in your kernel config file.
If your system does have a LUN-based changer, you may notice that the probe messages for the various LUNs of the changer will continue to appear while the boot process is going on. This is normal, and is caused by the changer scheduling code.
There is no mechanism currently to set different minimum and maximum timeouts for different CD changers; the timeout values set by the kernel options or the sysctl variables apply to all LUN-based CD changers in the system. It is possible to implement such support, but the sysctl implementation at least would be rather inelegant, because of the current inability of the sysctl code to handle the addition of nodes after compile time. Thus, it would take one dynamically sized sysctl variable and a userland utility to get/set the timeout values. Implementation of separate timeouts for different CD devices in the kernel config file would likely require modification of config(8) to support the two timeouts when hardwiring devices.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |