summaryrefslogtreecommitdiffstats
path: root/sys/scsi/scsi_cd.h
blob: c35bdff7c06e70ecd9c6494d379101c963054f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
 * Written by Julian Elischer (julian@tfs.com)
 * for TRW Financial Systems.
 *
 * TRW Financial Systems, in accordance with their agreement with Carnegie
 * Mellon University, makes this software available to CMU to distribute
 * or use in any manner that they see fit as long as this message is kept with 
 * the software. For this reason TFS also grants any other persons or
 * organisations permission to use or modify this software.
 *
 * TFS supplies this software to be publicly redistributed
 * on the understanding that TFS is not responsible for the correct
 * functioning of this software in any circumstances.
 *
 *
 * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
 * --------------------         -----   ----------------------
 * CURRENT PATCH LEVEL:         1       00098
 * --------------------         -----   ----------------------
 *
 * 16 Feb 93	Julian Elischer		ADDED for SCSI system
 */



/*
 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
 */

/*
 * SCSI command format
 */

struct scsi_read_capacity_cd
{
	u_char	op_code;
	u_char	:5;
	u_char	lun:3;
	u_char	addr_3;	/* Most Significant */
	u_char	addr_2;
	u_char	addr_1;
	u_char	addr_0;	/* Least Significant */
	u_char	unused[3];
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;	
};

struct scsi_pause
{
	u_char	op_code;
	u_char	:5;
	u_char	lun:3;
	u_char	unused[6];
	u_char	resume:1;
	u_char	:7;
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};
#define	PA_PAUSE	1
#define PA_RESUME	0

struct scsi_play_msf
{
	u_char	op_code;
	u_char	:5;
	u_char	lun:3;
	u_char	unused;
	u_char	start_m;
	u_char	start_s;
	u_char	start_f;
	u_char	end_m;
	u_char	end_s;
	u_char	end_f;
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_play_track
{
	u_char	op_code;
	u_char	:5;
	u_char	lun:3;
	u_char	unused[2];
	u_char	start_track;
	u_char	start_index;
	u_char	unused1;
	u_char	end_track;
	u_char	end_index;
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_play
{
	u_char	op_code;
	u_char	reladdr:1;
	u_char	:4;
	u_char	lun:3;
	u_char	blk_addr[4];
	u_char	unused;
	u_char	xfer_len[2];
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_play_big	
{
	u_char	op_code;
	u_char	reladdr:1;
	u_char	:4;
	u_char	lun:3;
	u_char	blk_addr[4];
	u_char	xfer_len[4];
	u_char	unused;
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_play_rel_big
{
	u_char	op_code;
	u_char	reladdr:1;
	u_char	:4;
	u_char	lun:3;
	u_char	blk_addr[4];
	u_char	xfer_len[4];
	u_char	track;
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_read_header
{
	u_char	op_code;
	u_char	:1;
	u_char	msf:1;
	u_char	:3;
	u_char	lun:3;
	u_char	blk_addr[4];
	u_char	unused;
	u_char	data_len[2];
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_read_subchannel
{
	u_char	op_code;
	u_char	:1;
	u_char	msf:1;
	u_char	:3;
	u_char	lun:3;
	u_char	:6;
	u_char	subQ:1;
	u_char	:1;
	u_char	subchan_format;
	u_char	unused[2];
	u_char	track;
	u_char	data_len[2];
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};

struct scsi_read_toc
{
	u_char	op_code;
	u_char	:1;
	u_char	msf:1;
	u_char	:3;
	u_char	lun:3;
	u_char	unused[4];
	u_char	from_track;
	u_char	data_len[2];
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;
};
;

struct scsi_read_cd_capacity
{
	u_char	op_code;
	u_char	:5;
	u_char	lun:3;
	u_char	addr_3;	/* Most Significant */
	u_char	addr_2;
	u_char	addr_1;
	u_char	addr_0;	/* Least Significant */
	u_char	unused[3];
	u_char	link:1;
	u_char	flag:1;
	u_char	:6;	
};

/*
 * Opcodes
 */

#define READ_CD_CAPACITY	0x25	/* slightly different from disk */
#define READ_SUBCHANNEL		0x42	/* cdrom read Subchannel */
#define READ_TOC		0x43	/* cdrom read TOC */
#define READ_HEADER		0x44	/* cdrom read header */
#define PLAY			0x45	/* cdrom play  'play audio' mode */
#define PLAY_MSF		0x47	/* cdrom play Min,Sec,Frames mode */
#define PLAY_TRACK		0x48	/* cdrom play track/index mode */
#define PLAY_TRACK_REL		0x49	/* cdrom play track/index mode */
#define PAUSE			0x4b	/* cdrom pause in 'play audio' mode */
#define PLAY_BIG		0xa5	/* cdrom pause in 'play audio' mode */
#define PLAY_TRACK_REL_BIG	0xa9	/* cdrom play track/index mode */


struct	cd_inquiry_data	/* in case there is some special info */
{
	u_char	device_type:5;
	u_char	device_qualifier:3;
	u_char	dev_qual2:7;
	u_char	removable:1;
	u_char	ansii_version:3;
	u_char	:5;
	u_char	response_format;
	u_char	additional_length;
	u_char	unused[2];
	u_char	:3;
	u_char	can_link:1;
	u_char	can_sync:1;
	u_char	:3;
	char	vendor[8];
	char	product[16];
	char	revision[4];
	u_char	extra[8];
};

struct scsi_read_cd_cap_data
{
	u_char	addr_3;	/* Most significant */
	u_char	addr_2;
	u_char	addr_1;
	u_char	addr_0;	/* Least significant */
	u_char	length_3;	/* Most significant */
	u_char	length_2;
	u_char	length_1;
	u_char	length_0;	/* Least significant */
};

union	cd_pages
{
#define	AUDIO_PAGE	0x0e
	struct	audio_page
	{
		u_char	page_code:6;
		u_char	:1;
		u_char	ps:1;
		u_char	param_len;
		u_char	:1;
		u_char	sotc:1;
		u_char	immed:1;
		u_char	:5;
		u_char	unused[2];
		u_char	format_lba:4;
		u_char	:3;
		u_char	apr_valid:1;
		u_char	lb_per_sec[2];
		struct	port_control
		{
			u_char	channels:4;
#define	CHANNEL_0 1
#define	CHANNEL_1 2
#define	CHANNEL_2 4
#define	CHANNEL_3 8
#define	LEFT_CHANNEL	CHANNEL_0
#define	RIGHT_CHANNEL	CHANNEL_1
			u_char	:4;
			u_char	volume;
		} port[4];
#define	LEFT_PORT	0
#define	RIGHT_PORT	1
	}audio;
};

struct cd_mode_data
{
	struct scsi_mode_header header;
	struct blk_desc blk_desc;
	union cd_pages page;
};

OpenPOWER on IntegriCloud