1 /* $NetBSD: scsipi_cd.h,v 1.20 2008/09/08 23:36:54 gmcgarry Exp $ */
4 * Written by Julian Elischer (julian@tfs.com)
5 * for TRW Financial Systems.
7 * TRW Financial Systems, in accordance with their agreement with Carnegie
8 * Mellon University, makes this software available to CMU to distribute
9 * or use in any manner that they see fit as long as this message is kept with
10 * the software. For this reason TFS also grants any other persons or
11 * organisations permission to use or modify this software.
13 * TFS supplies this software to be publicly redistributed
14 * on the understanding that TFS is not responsible for the correct
15 * functioning of this software in any circumstances.
17 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
21 * Define two bits always in the same place in byte 2 (flag byte)
23 #define CD_RELADDR 0x01
27 * SCSI and SCSI-like command format
30 #define LOAD_UNLOAD 0xa6
31 struct scsipi_load_unload
{
40 #define PAUSE 0x4b /* cdrom pause in 'play audio' mode */
49 #define PA_RESUME 0x01
51 #define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */
52 struct scsipi_play_msf
{
65 #define PLAY 0x45 /* cdrom play 'play audio' mode */
75 #define READ_HEADER 0x44 /* cdrom read header */
76 struct scsipi_read_header
{
85 #define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */
86 struct scsipi_read_subchannel
{
91 u_int8_t subchan_format
;
98 #define READ_TOC 0x43 /* cdrom read TOC */
99 struct scsipi_read_toc
{
102 u_int8_t resp_format
;
104 u_int8_t from_track
; /* session nr in format 2 */
105 u_int8_t data_len
[2];
109 struct scsipi_toc_header
{
111 uint8_t first
; /* track or session */
115 /* read TOC form 0 result entries */
116 struct scsipi_toc_formatted
{
121 uint8_t msf_lba
[4]; /* union msf_lba from cdio.h */
124 /* read TOC form 1 result entries */
125 struct scsipi_toc_msinfo
{
128 uint8_t tracknr
; /* first track last compl. session */
130 uint8_t msf_lba
[4]; /* union msf_lba from cdio.h */
133 /* read TOC form 2 result entries */
134 struct scsipi_toc_rawtoc
{
142 uint8_t zero
; /* zero/unused */
148 /* read TOC form 3, 4 and 5 obmitted yet */
150 #define GET_CONFIGURATION 0x46 /* Get configuration */
151 #define GET_CONF_NO_FEATURES_LEN 8
152 struct scsipi_get_configuration
{
154 uint8_t request_type
;
155 uint8_t start_at_feature
[2];
161 struct scsipi_get_conf_data
{
164 uint8_t mmc_profile
[2]; /* current mmc profile for disk */
165 uint8_t feature_desc
[1]; /* feature descriptors follow */
168 struct scsipi_get_conf_feature
{ /* feature descriptor */
169 uint8_t featurecode
[2];
171 uint8_t additional_length
; /* length of feature dependent */
172 uint8_t feature_dependent
[256];
174 #define FEATUREFLAG_CURRENT 1
175 #define FEATUREFLAG_PERSISTENT 2
178 #define READ_DISCINFO 0x51
179 struct scsipi_read_discinfo
{
186 #define READ_DISCINFO_SMALLSIZE 12
187 #define READ_DISCINFO_BIGSIZE 34 /* + entries */
188 struct scsipi_read_discinfo_data
{
192 uint8_t num_sessions_lsb
;
193 uint8_t first_track_last_session_lsb
;
194 uint8_t last_track_last_session_lsb
;
197 uint8_t num_sessions_msb
;
198 uint8_t first_track_last_session_msb
;
199 uint8_t last_track_last_session_msb
;
201 uint8_t last_session_leadin_hmsf
[4];
202 uint8_t last_possible_start_leadout_hmsf
[4];
203 uint8_t disc_bar_code
[8];
204 uint8_t application_code
;
205 uint8_t num_opc_table_entries
;
206 uint8_t opc_table_entries
[1]; /* opc table entries follow */
210 #define READ_TRACKINFO 0x52
211 struct scsipi_read_trackinfo
{
219 #define READ_TRACKINFO_ADDR_LBA 0
220 #define READ_TRACKINFO_ADDR_TRACK 1
221 #define READ_TRACKINFO_ADDR_SESS 2
223 struct scsipi_read_trackinfo_data
{
228 uint8_t track_info_1
;
229 uint8_t track_info_2
;
231 uint8_t track_start
[4];
232 uint8_t next_writable
[4];
233 uint8_t free_blocks
[4];
234 uint8_t packet_size
[4];
235 uint8_t track_size
[4];
236 uint8_t last_recorded
[4];
241 #define READ_TRACKINFO_RETURNSIZE 36
244 #define CLOSE_TRACKSESSION 0x5B
245 struct scsipi_close_tracksession
{
247 uint8_t addr_type
; /* bit 1 holds immediate */
248 uint8_t function
; /* bits 2,1,0 */
250 uint8_t tracksessionnr
[2];
256 #define RESERVE_TRACK 0x53
257 struct scsipi_reserve_track
{
260 uint8_t reservation_size
[4];
265 #define REPAIR_TRACK 0x58
266 struct scsipi_repair_track
{
268 uint8_t reserved1
; /* bit 1 holds immediate */
269 uint8_t reserved2
[2];
270 uint8_t tracknr
[2]; /* logical track nr */
271 uint8_t reserved3
[3];
276 #define READ_CD_CAPACITY 0x25 /* slightly different from disk */
277 struct scsipi_read_cd_capacity
{
285 struct scsipi_read_cd_cap_data
{
291 /* mod pages common to scsi and atapi */
292 struct cd_audio_page
{
294 #define AUDIO_PAGE 0x0e
297 #define CD_PA_SOTC 0x02
298 #define CD_PA_IMMED 0x04
300 u_int8_t format_lba
; /* valid only for SCSI CDs */
301 #define CD_PA_FORMAT_LBA 0x0F
302 #define CD_PA_APR_VALID 0x80
303 u_int8_t lb_per_sec
[2];
304 struct port_control
{
311 #define LEFT_CHANNEL CHANNEL_0
312 #define RIGHT_CHANNEL CHANNEL_1
313 #define MUTE_CHANNEL 0x0
314 #define BOTH_CHANNEL LEFT_CHANNEL | RIGHT_CHANNEL