xref: /freebsd/sys/cam/scsi/scsi_sa.h (revision 42249ef2)
1 /*-
2  * Structure and function declarations for the
3  * SCSI Sequential Access Peripheral driver for CAM.
4  *
5  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
6  *
7  * Copyright (c) 1999, 2000 Matthew Jacob
8  * Copyright (c) 2013, 2014, 2015 Spectra Logic Corporation
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification, immediately at the beginning of the file.
17  * 2. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
24  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * $FreeBSD$
33  */
34 
35 #ifndef	_SCSI_SCSI_SA_H
36 #define _SCSI_SCSI_SA_H 1
37 
38 #include <sys/cdefs.h>
39 
40 struct scsi_read_block_limits
41 {
42 	u_int8_t opcode;
43 	u_int8_t byte2;
44 	u_int8_t unused[3];
45 	u_int8_t control;
46 };
47 
48 struct scsi_read_block_limits_data
49 {
50 	u_int8_t gran;
51 #define	RBL_GRAN_MASK	0x1F
52 #define RBL_GRAN(rblim) ((rblim)->gran & RBL_GRAN_MASK)
53 	u_int8_t maximum[3];
54 	u_int8_t minimum[2];
55 };
56 
57 struct scsi_sa_rw
58 {
59 	u_int8_t opcode;
60         u_int8_t sli_fixed;
61 #define SAR_SLI		0x02
62 #define SARW_FIXED	0x01
63 	u_int8_t length[3];
64         u_int8_t control;
65 };
66 
67 struct scsi_load_unload
68 {
69 	u_int8_t opcode;
70         u_int8_t immediate;
71 #define SLU_IMMED	0x01
72 	u_int8_t reserved[2];
73 	u_int8_t eot_reten_load;
74 #define SLU_EOT		0x04
75 #define SLU_RETEN	0x02
76 #define SLU_LOAD	0x01
77         u_int8_t control;
78 };
79 
80 struct scsi_rewind
81 {
82 	u_int8_t opcode;
83         u_int8_t immediate;
84 #define SREW_IMMED	0x01
85 	u_int8_t reserved[3];
86         u_int8_t control;
87 };
88 
89 typedef enum {
90 	SS_BLOCKS,
91 	SS_FILEMARKS,
92 	SS_SEQFILEMARKS,
93 	SS_EOD,
94 	SS_SETMARKS,
95 	SS_SEQSETMARKS
96 } scsi_space_code;
97 
98 struct scsi_space
99 {
100 	u_int8_t opcode;
101         u_int8_t code;
102 #define SREW_IMMED	0x01
103 	u_int8_t count[3];
104         u_int8_t control;
105 };
106 
107 struct scsi_write_filemarks
108 {
109 	u_int8_t opcode;
110         u_int8_t byte2;
111 #define SWFMRK_IMMED	0x01
112 #define SWFMRK_WSMK	0x02
113 	u_int8_t num_marks[3];
114         u_int8_t control;
115 };
116 
117 /*
118  * Reserve and release unit have the same exact cdb format, but different
119  * opcodes.
120  */
121 struct scsi_reserve_release_unit
122 {
123 	u_int8_t opcode;
124 	u_int8_t lun_thirdparty;
125 #define SRRU_LUN_MASK	0xE0
126 #define SRRU_3RD_PARTY	0x10
127 #define SRRU_3RD_SHAMT	1
128 #define SRRU_3RD_MASK	0xE
129 	u_int8_t reserved[3];
130 	u_int8_t control;
131 };
132 
133 /*
134  * Erase a tape
135  */
136 struct scsi_erase
137 {
138 	u_int8_t opcode;
139 	u_int8_t lun_imm_long;
140 #define SE_LUN_MASK	0xE0
141 #define SE_LONG		0x1
142 #define SE_IMMED	0x2
143 	u_int8_t reserved[3];
144 	u_int8_t control;
145 };
146 
147 /*
148  * Set tape capacity.
149  */
150 struct scsi_set_capacity
151 {
152 	u_int8_t opcode;
153 	u_int8_t byte1;
154 #define	SA_SSC_IMMED		0x01
155 	u_int8_t reserved;
156 	u_int8_t cap_proportion[2];
157 	u_int8_t control;
158 };
159 
160 /*
161  * Format tape media.  The CDB opcode is the same as the disk-specific
162  * FORMAT UNIT command, but the fields are different inside the CDB.  Thus
163  * the reason for a separate definition here.
164  */
165 struct scsi_format_medium
166 {
167 	u_int8_t opcode;
168 	u_int8_t byte1;
169 #define	SFM_IMMED		0x01
170 #define	SFM_VERIFY		0x02
171 	u_int8_t byte2;
172 #define	SFM_FORMAT_DEFAULT	0x00
173 #define	SFM_FORMAT_PARTITION	0x01
174 #define	SFM_FORMAT_DEF_PART	0x02
175 #define	SFM_FORMAT_MASK		0x0f
176 	u_int8_t length[2];
177 	u_int8_t control;
178 };
179 
180 struct scsi_allow_overwrite
181 {
182 	u_int8_t opcode;
183 	u_int8_t reserved1;
184 	u_int8_t allow_overwrite;
185 #define	SAO_ALLOW_OVERWRITE_DISABLED	0x00
186 #define	SAO_ALLOW_OVERWRITE_CUR_POS	0x01
187 #define	SAO_ALLOW_OVERWRITE_FORMAT	0x02
188 	u_int8_t partition;
189 	u_int8_t logical_id[8];
190 	u_int8_t reserved2[3];
191 	u_int8_t control;
192 };
193 
194 /*
195  * Dev specific mode page masks.
196  */
197 #define SMH_SA_WP		0x80
198 #define	SMH_SA_BUF_MODE_MASK	0x70
199 #define SMH_SA_BUF_MODE_NOBUF	0x00
200 #define SMH_SA_BUF_MODE_SIBUF	0x10	/* Single-Initiator buffering */
201 #define SMH_SA_BUF_MODE_MIBUF	0x20	/* Multi-Initiator buffering */
202 #define SMH_SA_SPEED_MASK	0x0F
203 #define SMH_SA_SPEED_DEFAULT	0x00
204 
205 /*
206  * Sequential-access specific mode page numbers.
207  */
208 #define SA_DEVICE_CONFIGURATION_PAGE	0x10
209 #define SA_MEDIUM_PARTITION_PAGE_1	0x11
210 #define SA_MEDIUM_PARTITION_PAGE_2	0x12
211 #define SA_MEDIUM_PARTITION_PAGE_3	0x13
212 #define SA_MEDIUM_PARTITION_PAGE_4	0x14
213 #define SA_DATA_COMPRESSION_PAGE	0x0f	/* SCSI-3 */
214 
215 /*
216  * Mode page definitions.
217  */
218 
219 /* See SCSI-II spec 9.3.3.1 */
220 struct scsi_dev_conf_page {
221 	u_int8_t pagecode;	/* 0x10 */
222 	u_int8_t pagelength;	/* 0x0e */
223 	u_int8_t byte2;		/* CAP, CAF, Active Format */
224 	u_int8_t active_partition;
225 	u_int8_t wb_full_ratio;
226 	u_int8_t rb_empty_ratio;
227 	u_int8_t wrdelay_time[2];
228 	u_int8_t byte8;
229 #define	SA_DBR			0x80	/* data buffer recovery */
230 #define	SA_BIS			0x40	/* block identifiers supported */
231 #define	SA_RSMK			0x20	/* report setmarks */
232 #define	SA_AVC			0x10	/* automatic velocity control */
233 #define	SA_SOCF_MASK		0x0c	/* stop on consecutive formats */
234 #define	SA_RBO			0x02	/* recover buffer order */
235 #define	SA_REW			0x01	/* report early warning */
236 	u_int8_t gap_size;
237 	u_int8_t byte10;
238 /* from SCSI-3: SSC-4 Working draft (2/14) 8.3.3 */
239 #define	SA_EOD_DEF_MASK		0xe0	/* EOD defined */
240 #define	SA_EEG			0x10	/* Enable EOD Generation */
241 #define	SA_SEW			0x08	/* Synchronize at Early Warning */
242 #define	SA_SOFT_WP		0x04	/* Software Write Protect */
243 #define	SA_BAML			0x02	/* Block Address Mode Lock */
244 #define	SA_BAM			0x01	/* Block Address Mode */
245 	u_int8_t ew_bufsize[3];
246 	u_int8_t sel_comp_alg;
247 #define	SA_COMP_NONE		0x00
248 #define	SA_COMP_DEFAULT		0x01
249 	/* the following is 'reserved' in SCSI-2 but is defined in SSC-r22 */
250 	u_int8_t extra_wp;
251 #define	SA_ASOC_WP		0x04	/* Associated Write Protect */
252 #define	SA_PERS_WP		0x02	/* Persistent Write Protect */
253 #define	SA_PERM_WP		0x01	/* Permanent Write Protect */
254 };
255 
256 /* from SCSI-3: SSC-Rev10 (6/97) */
257 struct scsi_data_compression_page {
258 	u_int8_t page_code;	/* 0x0f */
259 	u_int8_t page_length;	/* 0x0e */
260 	u_int8_t dce_and_dcc;
261 #define SA_DCP_DCE		0x80 	/* Data compression enable */
262 #define SA_DCP_DCC		0x40	/* Data compression capable */
263 	u_int8_t dde_and_red;
264 #define SA_DCP_DDE		0x80	/* Data decompression enable */
265 #define SA_DCP_RED_MASK		0x60	/* Report Exception on Decomp. */
266 #define SA_DCP_RED_SHAMT	5
267 #define SA_DCP_RED_0		0x00
268 #define SA_DCP_RED_1		0x20
269 #define SA_DCP_RED_2		0x40
270 	u_int8_t comp_algorithm[4];
271 	u_int8_t decomp_algorithm[4];
272 	u_int8_t reserved[4];
273 };
274 
275 typedef union {
276 	struct { u_int8_t pagecode, pagelength; } hdr;
277 	struct scsi_dev_conf_page dconf;
278 	struct scsi_data_compression_page dcomp;
279 } sa_comp_t;
280 
281 /*
282  * Control Data Protection subpage.  This is as defined in SSC3r03.
283  */
284 struct scsi_control_data_prot_subpage {
285 	uint8_t page_code;
286 #define	SA_CTRL_DP_PAGE_CODE		0x0a
287 	uint8_t subpage_code;
288 #define	SA_CTRL_DP_SUBPAGE_CODE		0xf0
289 	uint8_t length[2];
290 	uint8_t prot_method;
291 #define	SA_CTRL_DP_NO_LBP		0x00
292 #define	SA_CTRL_DP_REED_SOLOMON		0x01
293 #define	SA_CTRL_DP_METHOD_MAX		0xff
294 	uint8_t pi_length;
295 #define	SA_CTRL_DP_PI_LENGTH_MASK	0x3f
296 #define	SA_CTRL_DP_RS_LENGTH		4
297 	uint8_t prot_bits;
298 #define	SA_CTRL_DP_LBP_W		0x80
299 #define	SA_CTRL_DP_LBP_R		0x40
300 #define	SA_CTRL_DP_RBDP			0x20
301 	uint8_t reserved[];
302 };
303 
304 /*
305  * This is the Read/Write Control mode page used on IBM Enterprise Tape
306  * Drives.  They are known as 3592, TS, or Jaguar drives.  The SCSI inquiry
307  * data will show a Product ID "03592XXX", where XXX is 'J1A', 'E05' (TS1120),
308  * 'E06' (TS1130), 'E07' (TS1140) or 'E08' (TS1150).
309  *
310  * This page definition is current as of the 3592 SCSI Reference v6,
311  * released on December 16th, 2014.
312  */
313 struct scsi_tape_ibm_rw_control {
314 	uint8_t page_code;
315 #define SA_IBM_RW_CTRL_PAGE_CODE		0x25
316 	uint8_t page_length;
317 	uint8_t ignore_seq_checks;
318 #define	SA_IBM_RW_CTRL_LOC_IGNORE_SEQ		0x04
319 #define	SA_IBM_RW_CTRL_SPC_BLK_IGNORE_SEQ	0x02
320 #define	SA_IBM_RW_CTRL_SPC_FM_IGNORE_SEQ	0x01
321 	uint8_t ignore_data_checks;
322 #define	SA_IBM_RW_CTRL_LOC_IGNORE_DATA		0x04
323 #define	SA_IBM_RW_CTRL_SPC_BLK_IGNORE_DATA	0x02
324 #define	SA_IBM_RW_CTRL_SPC_FM_IGNORE_DATA	0x01
325 	uint8_t reserved1;
326 	uint8_t leop_method;
327 #define	SA_IBM_RW_CTRL_LEOP_DEFAULT		0x00
328 #define	SA_IBM_RW_CTRL_LEOP_MAX_CAP		0x01
329 #define	SA_IBM_RW_CTRL_LEOP_CONST_CAP		0x02
330 	uint8_t leop_ew[2];
331 	uint8_t byte8;
332 #define	SA_IBM_RW_CTRL_DISABLE_FASTSYNC		0x80
333 #define	SA_IBM_RW_CTRL_DISABLE_SKIPSYNC		0x40
334 #define	SA_IBM_RW_CTRL_DISABLE_CROSS_EOD	0x08
335 #define	SA_IBM_RW_CTRL_DISABLE_CROSS_PERM_ERR	0x04
336 #define	SA_IBM_RW_CTRL_REPORT_SEG_EW		0x02
337 #define	SA_IBM_RW_CTRL_REPORT_HOUSEKEEPING_ERR	0x01
338 	uint8_t default_write_dens_bop_0;
339 	uint8_t pending_write_dens_bop_0;
340 	uint8_t reserved2[21];
341 };
342 
343 struct scsi_tape_read_position {
344 	u_int8_t opcode;		/* READ_POSITION */
345 	u_int8_t byte1;			/* set LSB to read hardware block pos */
346 #define	SA_RPOS_SHORT_FORM	0x00
347 #define	SA_RPOS_SHORT_VENDOR	0x01
348 #define	SA_RPOS_LONG_FORM	0x06
349 #define	SA_RPOS_EXTENDED_FORM	0x08
350 	u_int8_t reserved[5];
351 	u_int8_t length[2];
352 	u_int8_t control;
353 };
354 
355 struct scsi_tape_position_data	{	/* Short Form */
356 	u_int8_t flags;
357 #define	SA_RPOS_BOP		0x80	/* Beginning of Partition */
358 #define	SA_RPOS_EOP		0x40	/* End of Partition */
359 #define	SA_RPOS_BCU		0x20	/* Block Count Unknown (SCSI3) */
360 #define	SA_RPOS_BYCU		0x10	/* Byte Count Unknown (SCSI3) */
361 #define	SA_RPOS_BPU		0x04	/* Block Position Unknown */
362 #define	SA_RPOS_PERR		0x02	/* Position Error (SCSI3) */
363 #define	SA_RPOS_BPEW		0x01	/* Beyond Programmable Early Warning */
364 #define	SA_RPOS_UNCERTAIN	SA_RPOS_BPU
365 	u_int8_t partition;
366 	u_int8_t reserved[2];
367 	u_int8_t firstblk[4];
368 	u_int8_t lastblk[4];
369 	u_int8_t reserved2;
370 	u_int8_t nbufblk[3];
371 	u_int8_t nbufbyte[4];
372 };
373 
374 struct scsi_tape_position_long_data {
375 	u_int8_t flags;
376 #define	SA_RPOS_LONG_BOP	0x80	/* Beginning of Partition */
377 #define	SA_RPOS_LONG_EOP	0x40	/* End of Partition */
378 #define	SA_RPOS_LONG_MPU	0x08	/* Mark Position Unknown */
379 #define	SA_RPOS_LONG_LONU	0x04	/* Logical Object Number Unknown */
380 #define	SA_RPOS_LONG_BPEW	0x01	/* Beyond Programmable Early Warning */
381 	u_int8_t reserved[3];
382 	u_int8_t partition[4];
383 	u_int8_t logical_object_num[8];
384 	u_int8_t logical_file_num[8];
385 	u_int8_t set_id[8];
386 };
387 
388 struct scsi_tape_position_ext_data {
389 	u_int8_t flags;
390 #define	SA_RPOS_EXT_BOP		0x80	/* Beginning of Partition */
391 #define	SA_RPOS_EXT_EOP		0x40	/* End of Partition */
392 #define	SA_RPOS_EXT_LOCU	0x20	/* Logical Object Count Unknown */
393 #define	SA_RPOS_EXT_BYCU	0x10	/* Byte Count Unknown */
394 #define	SA_RPOS_EXT_LOLU	0x04	/* Logical Object Location Unknown */
395 #define	SA_RPOS_EXT_PERR	0x02	/* Position Error */
396 #define	SA_RPOS_EXT_BPEW	0x01	/* Beyond Programmable Early Warning */
397 	u_int8_t partition;
398 	u_int8_t length[2];
399 	u_int8_t reserved;
400 	u_int8_t num_objects[3];
401 	u_int8_t first_object[8];
402 	u_int8_t last_object[8];
403 	u_int8_t bytes_in_buffer[8];
404 };
405 
406 struct scsi_tape_locate {
407 	u_int8_t opcode;
408 	u_int8_t byte1;
409 #define	SA_SPOS_IMMED		0x01
410 #define	SA_SPOS_CP		0x02
411 #define	SA_SPOS_BT		0x04
412 	u_int8_t reserved1;
413 	u_int8_t blkaddr[4];
414 #define	SA_SPOS_MAX_BLK		0xffffffff
415 	u_int8_t reserved2;
416 	u_int8_t partition;
417 	u_int8_t control;
418 };
419 
420 struct scsi_locate_16 {
421 	u_int8_t opcode;
422 	u_int8_t byte1;
423 #define	SA_LC_IMMEDIATE		0x01
424 #define	SA_LC_CP		0x02
425 #define	SA_LC_DEST_TYPE_MASK	0x38
426 #define	SA_LC_DEST_TYPE_SHIFT	3
427 #define	SA_LC_DEST_OBJECT	0x00
428 #define	SA_LC_DEST_FILE		0x01
429 #define	SA_LC_DEST_SET		0x02
430 #define	SA_LC_DEST_EOD		0x03
431 	u_int8_t byte2;
432 #define	SA_LC_BAM_IMPLICIT	0x00
433 #define	SA_LC_BAM_EXPLICIT	0x01
434 	u_int8_t partition;
435 	u_int8_t logical_id[8];
436 	u_int8_t reserved[3];
437 	u_int8_t control;
438 };
439 
440 struct scsi_report_density_support {
441 	u_int8_t opcode;
442 	u_int8_t byte1;
443 #define	SRDS_MEDIA		0x01
444 #define	SRDS_MEDIUM_TYPE	0x02
445 	u_int8_t reserved[5];
446 	u_int8_t length[2];
447 #define	SRDS_MAX_LENGTH		0xffff
448 	u_int8_t control;
449 };
450 
451 struct scsi_density_hdr {
452 	u_int8_t length[2];
453 	u_int8_t reserved[2];
454 	u_int8_t descriptor[];
455 };
456 
457 struct scsi_density_data {
458 	u_int8_t primary_density_code;
459 	u_int8_t secondary_density_code;
460 	u_int8_t byte2;
461 #define	SDD_DLV			0x01
462 #define	SDD_DEFLT		0x20
463 #define	SDD_DUP			0x40
464 #define SDD_WRTOK		0x80
465 	u_int8_t length[2];
466 #define	SDD_DEFAULT_LENGTH	52
467 	u_int8_t bits_per_mm[3];
468 	u_int8_t media_width[2];
469 	u_int8_t tracks[2];
470 	u_int8_t capacity[4];
471 	u_int8_t assigning_org[8];
472 	u_int8_t density_name[8];
473 	u_int8_t description[20];
474 };
475 
476 struct scsi_medium_type_data {
477 	u_int8_t medium_type;
478 	u_int8_t reserved1;
479 	u_int8_t length[2];
480 #define	SMTD_DEFAULT_LENGTH	52
481 	u_int8_t num_density_codes;
482 	u_int8_t primary_density_codes[9];
483 	u_int8_t media_width[2];
484 	u_int8_t medium_length[2];
485 	u_int8_t reserved2[2];
486 	u_int8_t assigning_org[8];
487 	u_int8_t medium_type_name[8];
488 	u_int8_t description[20];
489 };
490 
491 /*
492  * Manufacturer-assigned Serial Number VPD page.
493  * Current as of SSC-5r03, 28 September 2016.
494  */
495 struct scsi_vpd_mfg_serial_number
496 {
497 	u_int8_t device;
498 	u_int8_t page_code;
499 #define	SVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1
500 	u_int8_t page_length[2];
501 	u_int8_t mfg_serial_num[];
502 };
503 
504 /*
505  * Security Protocol Specific values for the Tape Data Encryption protocol
506  * (0x20) used with SECURITY PROTOCOL IN.  See below for values used with
507  * SECURITY PROTOCOL OUT.  Current as of SSC4r03.
508  */
509 #define	TDE_IN_SUPPORT_PAGE		0x0000
510 #define	TDE_OUT_SUPPORT_PAGE		0x0001
511 #define	TDE_DATA_ENC_CAP_PAGE		0x0010
512 #define	TDE_SUPPORTED_KEY_FORMATS_PAGE	0x0011
513 #define	TDE_DATA_ENC_MAN_CAP_PAGE	0x0012
514 #define	TDE_DATA_ENC_STATUS_PAGE	0x0020
515 #define	TDE_NEXT_BLOCK_ENC_STATUS_PAGE	0x0021
516 #define	TDE_GET_ENC_MAN_ATTR_PAGE	0x0022
517 #define	TDE_RANDOM_NUM_PAGE		0x0030
518 #define	TDE_KEY_WRAP_PK_PAGE		0x0031
519 
520 /*
521  * Tape Data Encryption protocol pages used with SECURITY PROTOCOL IN and
522  * SECURITY PROTOCOL OUT.
523  */
524 /*
525  * Tape Data Encryption In Support page (0x0000).
526  */
527 struct tde_in_support_page {
528 	uint8_t page_code[2];
529 	uint8_t page_length[2];
530 	uint8_t page_codes[];
531 };
532 
533 /*
534  * Tape Data Encryption Out Support page (0x0001).
535  */
536 struct tde_out_support_page {
537 	uint8_t page_code[2];
538 	uint8_t page_length[2];
539 	uint8_t page_codes[];
540 };
541 
542 /*
543  * Logical block encryption algorithm descriptor.  This is reported in the
544  * Data Encryption Capabilities page.
545  */
546 struct tde_block_enc_alg_desc {
547 	uint8_t alg_index;
548 	uint8_t reserved1;
549 	uint8_t desc_length[2];
550 	uint8_t byte4;
551 #define	TDE_BEA_AVFMV			0x80
552 #define	TDE_BEA_SDK_C			0x40
553 #define	TDE_BEA_MAC_C			0x20
554 #define	TDE_BEA_DELB_C			0x10
555 #define	TDE_BEA_DECRYPT_C_MASK		0x0c
556 #define	TDE_BEA_DECRYPT_C_EXT		0x0c
557 #define	TDE_BEA_DECRYPT_C_HARD		0x08
558 #define	TDE_BEA_DECRYPT_C_SOFT		0x04
559 #define	TDE_BEA_DECRYPT_C_NO_CAP	0x00
560 #define	TDE_BEA_ENCRYPT_C_MASK		0x03
561 #define	TDE_BEA_ENCRYPT_C_EXT		0x03
562 #define	TDE_BEA_ENCRYPT_C_HARD		0x02
563 #define	TDE_BEA_ENCRYPT_C_SOFT		0x01
564 #define	TDE_BEA_ENCRYPT_C_NO_CAP	0x00
565 	uint8_t byte5;
566 #define	TDE_BEA_AVFCLP_MASK		0xc0
567 #define	TDE_BEA_AVFCLP_VALID		0x80
568 #define	TDE_BEA_AVFCLP_NOT_VALID	0x40
569 #define	TDE_BEA_AVFCLP_NOT_APP		0x00
570 #define	TDE_BEA_NONCE_C_MASK		0x30
571 #define	TDE_BEA_NONCE_C_SUPPORTED	0x30
572 #define	TDE_BEA_NONCE_C_PROVIDED	0x20
573 #define	TDE_BEA_NONCE_C_GENERATED	0x10
574 #define	TDE_BEA_NONCE_C_NOT_REQUIRED	0x00
575 #define	TDE_BEA_KADF_C			0x08
576 #define	TDE_BEA_VCELB_C			0x04
577 #define	TDE_BEA_UKADF			0x02
578 #define	TDE_BEA_AKADF			0x01
579 	uint8_t max_unauth_key_bytes[2];
580 	uint8_t max_auth_key_bytes[2];
581 	uint8_t lbe_key_size[2];
582 	uint8_t byte12;
583 #define	TDE_BEA_DKAD_C_MASK		0xc0
584 #define	TDE_BEA_DKAD_C_CAPABLE		0xc0
585 #define	TDE_BEA_DKAD_C_NOT_ALLOWED	0x80
586 #define	TDE_BEA_DKAD_C_REQUIRED		0x40
587 #define	TDE_BEA_EEMC_C_MASK		0x30
588 #define	TDE_BEA_EEMC_C_ALLOWED		0x20
589 #define	TDE_BEA_EEMC_C_NOT_ALLOWED	0x10
590 #define	TDE_BEA_EEMC_C_NOT_SPECIFIED	0x00
591 	/*
592 	 * Raw Decryption Mode Control Capabilities (RDMC_C) field.  The
593 	 * descriptions are too complex to represent as a simple name.
594 	 */
595 #define	TDE_BEA_RDMC_C_MASK		0x0e
596 #define	TDE_BEA_RDMC_C_MODE_7		0x0e
597 #define	TDE_BEA_RDMC_C_MODE_6		0x0c
598 #define	TDE_BEA_RDMC_C_MODE_5		0x0a
599 #define	TDE_BEA_RDMC_C_MODE_4		0x08
600 #define	TDE_BEA_RDMC_C_MODE_1		0x02
601 #define	TDE_BEA_EAREM			0x01
602 	uint8_t byte13;
603 #define	TDE_BEA_MAX_EEDKS_MASK		0x0f
604 	uint8_t msdk_count[2];
605 	uint8_t max_eedk_size[2];
606 	uint8_t reserved2[2];
607 	uint8_t security_algo_code[4];
608 };
609 
610 /*
611  * Data Encryption Capabilities page (0x0010).
612  */
613 struct tde_data_enc_cap_page {
614 	uint8_t page_code[2];
615 	uint8_t page_length;
616 	uint8_t byte4;
617 #define	DATA_ENC_CAP_EXTDECC_MASK		0x0c
618 #define	DATA_ENC_CAP_EXTDECC_NOT_REPORTED	0x00
619 #define	DATA_ENC_CAP_EXTDECC_NOT_CAPABLE	0x04
620 #define	DATA_ENC_CAP_EXTDECC_CAPABLE		0x08
621 #define	DATA_ENC_CAP_CFG_P_MASK			0x03
622 #define	DATA_ENC_CAP_CFG_P_NOT_REPORTED		0x00
623 #define	DATA_ENC_CAP_CFG_P_ALLOWED		0x01
624 #define	DATA_ENC_CAP_CFG_P_NOT_ALLOWED		0x02
625 	uint8_t reserved[15];
626 	struct tde_block_enc_alg_desc alg_descs[];
627 };
628 
629 /*
630  * Tape Data Encryption Supported Key Formats page (0x0011).
631  */
632 struct tde_supported_key_formats_page {
633 	uint8_t page_code[2];
634 	uint8_t page_length[2];
635 	uint8_t key_formats_list[];
636 };
637 
638 /*
639  * Tape Data Encryption Management Capabilities page (0x0012).
640  */
641 struct tde_data_enc_man_cap_page {
642 	uint8_t page_code[2];
643 	uint8_t page_length[2];
644 	uint8_t byte4;
645 #define	TDE_DEMC_LOCK_C		0x01
646 	uint8_t byte5;
647 #define	TDE_DEMC_CKOD_C		0x04
648 #define	TDE_DEMC_CKORP_C	0x02
649 #define	TDE_DEMC_CKORL_C	0x01
650 	uint8_t reserved1;
651 	uint8_t byte7;
652 #define	TDE_DEMC_AITN_C		0x04
653 #define	TDE_DEMC_LOCAL_C	0x02
654 #define	TDE_DEMC_PUBLIC_C	0x01
655 	uint8_t reserved2[8];
656 };
657 
658 /*
659  * Tape Data Encryption Status Page (0x0020).
660  */
661 struct tde_data_enc_status_page {
662 	uint8_t page_code[2];
663 	uint8_t page_length[2];
664 	uint8_t scope;
665 #define	TDE_DES_IT_NEXUS_SCOPE_MASK	0xe0
666 #define	TDE_DES_LBE_SCOPE_MASK		0x07
667 	uint8_t encryption_mode;
668 	uint8_t decryption_mode;
669 	uint8_t algo_index;
670 	uint8_t key_instance_counter[4];
671 	uint8_t byte12;
672 #define	TDE_DES_PARAM_CTRL_MASK		0x70
673 #define	TDE_DES_PARAM_CTRL_MGMT		0x40
674 #define	TDE_DES_PARAM_CTRL_CHANGER	0x30
675 #define	TDE_DES_PARAM_CTRL_DRIVE	0x20
676 #define	TDE_DES_PARAM_CTRL_EXT		0x10
677 #define	TDE_DES_PARAM_CTRL_NOT_REPORTED	0x00
678 #define	TDE_DES_VCELB			0x08
679 #define	TDE_DES_CEEMS_MASK		0x06
680 #define	TDE_DES_RDMD			0x01
681 	uint8_t enc_params_kad_format;
682 	uint8_t asdk_count[2];
683 	uint8_t reserved[8];
684 	uint8_t key_assoc_data_desc[];
685 };
686 
687 /*
688  * Tape Data Encryption Next Block Encryption Status page (0x0021).
689  */
690 struct tde_next_block_enc_status_page {
691 	uint8_t page_code[2];
692 	uint8_t page_length[2];
693 	uint8_t logical_obj_number[8];
694 	uint8_t status;
695 #define	TDE_NBES_COMP_STATUS_MASK	0xf0
696 #define	TDE_NBES_COMP_INCAPABLE		0x00
697 #define	TDE_NBES_COMP_NOT_YET		0x10
698 #define	TDE_NBES_COMP_NOT_A_BLOCK	0x20
699 #define	TDE_NBES_COMP_NOT_COMPRESSED	0x30
700 #define	TDE_NBES_COMP_COMPRESSED	0x40
701 #define	TDE_NBES_ENC_STATUS_MASK	0x0f
702 #define	TDE_NBES_ENC_INCAPABLE		0x00
703 #define	TDE_NBES_ENC_NOT_YET		0x01
704 #define	TDE_NBES_ENC_NOT_A_BLOCK	0x02
705 #define	TDE_NBES_ENC_NOT_ENCRYPTED	0x03
706 #define	TDE_NBES_ENC_ALG_NOT_SUPPORTED	0x04
707 #define	TDE_NBES_ENC_SUPPORTED_ALG	0x05
708 #define	TDE_NBES_ENC_NO_KEY		0x06
709 	uint8_t algo_index;
710 	uint8_t byte14;
711 #define	TDE_NBES_EMES			0x02
712 #define	TDE_NBES_RDMDS			0x01
713 	uint8_t next_block_kad_format;
714 	uint8_t key_assoc_data_desc[];
715 };
716 
717 /*
718  * Tape Data Encryption Get Encryption Management Attributes page (0x0022).
719  */
720 struct tde_get_enc_man_attr_page {
721 	uint8_t page_code[2];
722 	uint8_t reserved[3];
723 	uint8_t byte5;
724 #define	TDE_GEMA_CAOD			0x01
725 	uint8_t page_length[2];
726 	uint8_t enc_mgmt_attr_desc[];
727 };
728 
729 /*
730  * Tape Data Encryption Random Number page (0x0030).
731  */
732 struct tde_random_num_page {
733 	uint8_t page_code[2];
734 	uint8_t page_length[2];
735 	uint8_t random_number[32];
736 };
737 
738 /*
739  * Tape Data Encryption Device Server Key Wrapping Public Key page (0x0031).
740  */
741 struct tde_key_wrap_pk_page {
742 	uint8_t page_code[2];
743 	uint8_t page_length[2];
744 	uint8_t public_key_type[4];
745 	uint8_t public_key_format[4];
746 	uint8_t public_key_length[2];
747 	uint8_t public_key[];
748 };
749 
750 /*
751  * Security Protocol Specific values for the Tape Data Encryption protocol
752  * (0x20) used with SECURITY PROTOCOL OUT.  See above for values used with
753  * SECURITY PROTOCOL IN.  Current as of SSCr03.
754  */
755 #define	TDE_SET_DATA_ENC_PAGE		0x0010
756 #define	TDE_SA_ENCAP_PAGE		0x0011
757 #define	TDE_SET_ENC_MGMT_ATTR_PAGE	0x0022
758 
759 /*
760  * Tape Data Encryption Set Data Encryption page (0x0010).
761  */
762 struct tde_set_data_enc_page {
763 	uint8_t page_code[2];
764 	uint8_t page_length[2];
765 	uint8_t byte4;
766 #define	TDE_SDE_SCOPE_MASK		0xe0
767 #define	TDE_SDE_SCOPE_ALL_IT_NEXUS	0x80
768 #define	TDE_SDE_SCOPE_LOCAL		0x40
769 #define	TDE_SDE_SCOPE_PUBLIC		0x00
770 #define	TDE_SDE_LOCK			0x01
771 	uint8_t byte5;
772 #define	TDE_SDE_CEEM_MASK		0xc0
773 #define	TDE_SDE_CEEM_ENCRYPT		0xc0
774 #define	TDE_SDE_CEEM_EXTERNAL		0x80
775 #define	TDE_SDE_CEEM_NO_CHECK		0x40
776 #define	TDE_SDE_RDMC_MASK		0x30
777 #define	TDE_SDE_RDMC_DISABLED		0x30
778 #define	TDE_SDE_RDMC_ENABLED		0x20
779 #define	TDE_SDE_RDMC_DEFAULT		0x00
780 #define	TDE_SDE_SDK			0x08
781 #define	TDE_SDE_CKOD			0x04
782 #define	TDE_SDE_CKORP			0x02
783 #define	TDE_SDE_CKORL			0x01
784 	uint8_t encryption_mode;
785 #define	TDE_SDE_ENC_MODE_DISABLE	0x00
786 #define	TDE_SDE_ENC_MODE_EXTERNAL	0x01
787 #define	TDE_SDE_ENC_MODE_ENCRYPT	0x02
788 	uint8_t decryption_mode;
789 #define	TDE_SDE_DEC_MODE_DISABLE	0x00
790 #define	TDE_SDE_DEC_MODE_RAW		0x01
791 #define	TDE_SDE_DEC_MODE_DECRYPT	0x02
792 #define	TDE_SDE_DEC_MODE_MIXED		0x03
793 	uint8_t algo_index;
794 	uint8_t lbe_key_format;
795 #define	TDE_SDE_KEY_PLAINTEXT		0x00
796 #define	TDE_SDE_KEY_VENDOR_SPEC		0x01
797 #define	TDE_SDE_KEY_PUBLIC_WRAP		0x02
798 #define	TDE_SDE_KEY_ESP_SCSI		0x03
799 	uint8_t kad_format;
800 #define	TDE_SDE_KAD_ASCII		0x02
801 #define	TDE_SDE_KAD_BINARY		0x01
802 #define	TDE_SDE_KAD_UNSPECIFIED		0x00
803 	uint8_t reserved[7];
804 	uint8_t lbe_key_length[2];
805 	uint8_t lbe_key[];
806 };
807 
808 /*
809  * Used for the Vendor Specific key format (0x01).
810  */
811 struct tde_key_format_vendor {
812 	uint8_t t10_vendor_id[8];
813 	uint8_t vendor_key[];
814 };
815 
816 /*
817  * Used for the public key wrapped format (0x02).
818  */
819 struct tde_key_format_public_wrap {
820 	uint8_t parameter_set[2];
821 #define	TDE_PARAM_SET_RSA2048		0x0000
822 #define	TDE_PARAM_SET_ECC521		0x0010
823 	uint8_t label_length[2];
824 	uint8_t label[];
825 };
826 
827 /*
828  * Tape Data Encryption SA Encapsulation page (0x0011).
829  */
830 struct tde_sa_encap_page {
831 	uint8_t page_code[2];
832 	uint8_t data_desc[];
833 };
834 
835 /*
836  * Tape Data Encryption Set Encryption Management Attributes page (0x0022).
837  */
838 struct tde_set_enc_mgmt_attr_page {
839 	uint8_t page_code[2];
840 	uint8_t reserved[3];
841 	uint8_t byte5;
842 #define	TDE_SEMA_CAOD			0x01
843 	uint8_t page_length[2];
844 	uint8_t attr_desc[];
845 };
846 
847 /*
848  * Tape Data Encryption descriptor format.
849  * SSC4r03 Section 8.5.4.2.1 Table 197
850  */
851 struct tde_data_enc_desc {
852 	uint8_t key_desc_type;
853 #define	TDE_KEY_DESC_WK_KAD		0x04
854 #define	TDE_KEY_DESC_M_KAD		0x03
855 #define	TDE_KEY_DESC_NONCE_VALUE	0x02
856 #define	TDE_KEY_DESC_A_KAD		0x01
857 #define	TDE_KEY_DESC_U_KAD		0x00
858 	uint8_t byte2;
859 #define	TDE_KEY_DESC_AUTH_MASK		0x07
860 #define	TDE_KEY_DESC_AUTH_FAILED	0x04
861 #define	TDE_KEY_DESC_AUTH_SUCCESS	0x03
862 #define	TDE_KEY_DESC_AUTH_NO_ATTEMPT	0x02
863 #define	TDE_KEY_DESC_AUTH_U_KAD		0x01
864 	uint8_t key_desc_length[2];
865 	uint8_t key_desc[];
866 };
867 
868 /*
869  * Wrapped Key descriptor format.
870  * SSC4r03 Section 8.5.4.3.1 Table 200
871  */
872 struct tde_wrapped_key_desc {
873 	uint8_t wrapped_key_type;
874 #define	TDE_WRAP_KEY_DESC_LENGTH	0x04
875 #define	TDE_WRAP_KEY_DESC_IDENT		0x03
876 #define	TDE_WRAP_KEY_DESC_INFO		0x02
877 #define	TDE_WRAP_KEY_DESC_ENTITY_ID	0x01
878 #define	TDE_WRAP_KEY_DESC_DEVICE_ID	0x00
879 	uint8_t reserved;
880 	uint8_t wrapped_desc_length[2];
881 	uint8_t wrapped_desc[];
882 };
883 
884 /*
885  * Encryption management attributes descriptor format.
886  * SSC4r03 Section 8.5.4.4.1 Table 202
887  */
888 struct tde_enc_mgmt_attr_desc {
889 	uint8_t enc_mgmt_attr_type[2];
890 #define	TDE_EMAD_DESIRED_KEY_MGR_OP	0x0000
891 #define	TDE_EMAD_LOG_BLOCK_ENC_KEY_CRIT	0x0001
892 #define	TDE_EMAD_LOG_BLOCK_ENC_KEY_WRAP	0x0002
893 	uint8_t reserved;
894 	uint8_t byte2;
895 #define	TDE_EMAD_CRIT			0x80
896 	uint8_t attr_length[2];
897 	uint8_t attributes[];
898 #define	TDE_EMAD_DESIRED_KEY_CREATE	0x0001
899 #define	TDE_EMAD_DESIRED_KEY_RESOLVE	0x0002
900 };
901 
902 /*
903  * Logical block encryption key selection criteria descriptor format.
904  * SSC4r03 Section 8.5.4.4.3.1 Table 206
905  */
906 struct tde_lb_enc_key_sel_desc {
907 	uint8_t lbe_key_sel_crit_type[2];
908 	/*
909 	 * The CRIT bit is the top bit of the first byte of the type.
910 	 */
911 #define	TDE_LBE_KEY_SEL_CRIT		0x80
912 #define	TDE_LBE_KEY_SEL_ALGO		0x0001
913 #define	TDE_LBE_KEY_SEL_ID		0x0002
914 	uint8_t lbe_key_sel_crit_length[2];
915 	uint8_t lbe_key_sel_crit[];
916 };
917 
918 /*
919  * Logical block encryption key wrapping attribute descriptor format.
920  * SSC4r03 Section 8.5.4.4.4.1 Table 209
921  */
922 struct tde_lb_enc_key_wrap_desc {
923 	uint8_t lbe_key_wrap_type[2];
924 	/*
925 	 * The CRIT bit is the top bit of the first byte of the type.
926 	 */
927 #define	TDE_LBE_KEY_WRAP_CRIT		0x80
928 #define	TDE_LBE_KEY_WRAP_KEKS		0x0001
929 	uint8_t lbe_key_wrap_length[2];
930 	uint8_t lbe_key_wrap_attr[];
931 };
932 
933 /*
934  * Opcodes
935  */
936 #define REWIND			0x01
937 #define FORMAT_MEDIUM		0x04
938 #define READ_BLOCK_LIMITS	0x05
939 #define SA_READ			0x08
940 #define SA_WRITE		0x0A
941 #define SET_CAPACITY		0x0B
942 #define WRITE_FILEMARKS		0x10
943 #define SPACE			0x11
944 #define RESERVE_UNIT		0x16
945 #define RELEASE_UNIT		0x17
946 #define ERASE			0x19
947 #define LOAD_UNLOAD		0x1B
948 #define	LOCATE			0x2B
949 #define	READ_POSITION		0x34
950 #define	REPORT_DENSITY_SUPPORT	0x44
951 #define	ALLOW_OVERWRITE		0x82
952 #define	LOCATE_16		0x92
953 
954 /*
955  * Tape specific density codes- only enough of them here to recognize
956  * some specific older units so we can choose 2FM@EOD or FIXED blocksize
957  * quirks.
958  */
959 #define SCSI_DENSITY_HALFINCH_800	0x01
960 #define SCSI_DENSITY_HALFINCH_1600	0x02
961 #define SCSI_DENSITY_HALFINCH_6250	0x03
962 #define SCSI_DENSITY_HALFINCH_6250C	0xC3	/* HP Compressed 6250 */
963 #define SCSI_DENSITY_QIC_11_4TRK	0x04
964 #define SCSI_DENSITY_QIC_11_9TRK	0x84	/* Vendor Unique Emulex */
965 #define SCSI_DENSITY_QIC_24		0x05
966 #define SCSI_DENSITY_HALFINCH_PE	0x06
967 #define SCSI_DENSITY_QIC_120		0x0f
968 #define SCSI_DENSITY_QIC_150		0x10
969 #define	SCSI_DENSITY_QIC_525_320	0x11
970 #define	SCSI_DENSITY_QIC_1320		0x12
971 #define	SCSI_DENSITY_QIC_2GB		0x22
972 #define	SCSI_DENSITY_QIC_4GB		0x26
973 #define	SCSI_DENSITY_QIC_3080		0x29
974 
975 __BEGIN_DECLS
976 void	scsi_read_block_limits(struct ccb_scsiio *, u_int32_t,
977 			       void (*cbfcnp)(struct cam_periph *, union ccb *),
978 			       u_int8_t, struct scsi_read_block_limits_data *,
979 			       u_int8_t , u_int32_t);
980 
981 void	scsi_sa_read_write(struct ccb_scsiio *csio, u_int32_t retries,
982 			   void (*cbfcnp)(struct cam_periph *, union ccb *),
983 			   u_int8_t tag_action, int readop, int sli,
984 			   int fixed, u_int32_t length, u_int8_t *data_ptr,
985 			   u_int32_t dxfer_len, u_int8_t sense_len,
986 			   u_int32_t timeout);
987 
988 void	scsi_rewind(struct ccb_scsiio *csio, u_int32_t retries,
989 		    void (*cbfcnp)(struct cam_periph *, union ccb *),
990 		    u_int8_t tag_action, int immediate, u_int8_t sense_len,
991 		    u_int32_t timeout);
992 
993 void	scsi_space(struct ccb_scsiio *csio, u_int32_t retries,
994 		   void (*cbfcnp)(struct cam_periph *, union ccb *),
995 		   u_int8_t tag_action, scsi_space_code code,
996 		   u_int32_t count, u_int8_t sense_len, u_int32_t timeout);
997 
998 void	scsi_load_unload(struct ccb_scsiio *csio, u_int32_t retries,
999 			 void (*cbfcnp)(struct cam_periph *, union ccb *),
1000 			 u_int8_t tag_action, int immediate,   int eot,
1001 			 int reten, int load, u_int8_t sense_len,
1002 			 u_int32_t timeout);
1003 
1004 void	scsi_write_filemarks(struct ccb_scsiio *csio, u_int32_t retries,
1005 			     void (*cbfcnp)(struct cam_periph *, union ccb *),
1006 			     u_int8_t tag_action, int immediate, int setmark,
1007 			     u_int32_t num_marks, u_int8_t sense_len,
1008 			     u_int32_t timeout);
1009 
1010 void	scsi_reserve_release_unit(struct ccb_scsiio *csio, u_int32_t retries,
1011 				  void (*cbfcnp)(struct cam_periph *,
1012 				  union ccb *), u_int8_t tag_action,
1013 				  int third_party, int third_party_id,
1014 				  u_int8_t sense_len, u_int32_t timeout,
1015 				  int reserve);
1016 
1017 void	scsi_erase(struct ccb_scsiio *csio, u_int32_t retries,
1018 		   void (*cbfcnp)(struct cam_periph *, union ccb *),
1019 		   u_int8_t tag_action, int immediate, int long_erase,
1020 		   u_int8_t sense_len, u_int32_t timeout);
1021 
1022 void	scsi_data_comp_page(struct scsi_data_compression_page *page,
1023 			    u_int8_t dce, u_int8_t dde, u_int8_t red,
1024 			    u_int32_t comp_algorithm,
1025 			    u_int32_t decomp_algorithm);
1026 
1027 void	scsi_read_position(struct ccb_scsiio *csio, u_int32_t retries,
1028                            void (*cbfcnp)(struct cam_periph *, union ccb *),
1029                            u_int8_t tag_action, int hardsoft,
1030                            struct scsi_tape_position_data *sbp,
1031                            u_int8_t sense_len, u_int32_t timeout);
1032 void	scsi_read_position_10(struct ccb_scsiio *csio, u_int32_t retries,
1033 			      void (*cbfcnp)(struct cam_periph *, union ccb *),
1034 			      u_int8_t tag_action, int service_action,
1035 			      u_int8_t *data_ptr, u_int32_t length,
1036 			      u_int32_t sense_len, u_int32_t timeout);
1037 
1038 void	scsi_set_position(struct ccb_scsiio *csio, u_int32_t retries,
1039                          void (*cbfcnp)(struct cam_periph *, union ccb *),
1040                          u_int8_t tag_action, int hardsoft, u_int32_t blkno,
1041                          u_int8_t sense_len, u_int32_t timeout);
1042 
1043 void	scsi_locate_10(struct ccb_scsiio *csio, u_int32_t retries,
1044 		       void (*cbfcnp)(struct cam_periph *, union ccb *),
1045 		       u_int8_t tag_action, int immed, int cp, int hard,
1046 		       int64_t partition, u_int32_t block_address,
1047 		       int sense_len, u_int32_t timeout);
1048 
1049 void	scsi_locate_16(struct ccb_scsiio *csio, u_int32_t retries,
1050 		       void (*cbfcnp)(struct cam_periph *, union ccb *),
1051 		       u_int8_t tag_action, int immed, int cp,
1052 		       u_int8_t dest_type, int bam, int64_t partition,
1053 		       u_int64_t logical_id, int sense_len,
1054 		       u_int32_t timeout);
1055 
1056 void	scsi_report_density_support(struct ccb_scsiio *csio, u_int32_t retries,
1057 				    void (*cbfcnp)(struct cam_periph *,
1058 						   union ccb *),
1059 				    u_int8_t tag_action, int media,
1060 				    int medium_type, u_int8_t *data_ptr,
1061 				    u_int32_t length, u_int32_t sense_len,
1062 				    u_int32_t timeout);
1063 
1064 void	scsi_set_capacity(struct ccb_scsiio *csio, u_int32_t retries,
1065 			  void (*cbfcnp)(struct cam_periph *, union ccb *),
1066 			  u_int8_t tag_action, int byte1, u_int32_t proportion,
1067 			  u_int32_t sense_len, u_int32_t timeout);
1068 
1069 void	scsi_format_medium(struct ccb_scsiio *csio, u_int32_t retries,
1070 			   void (*cbfcnp)(struct cam_periph *, union ccb *),
1071 			   u_int8_t tag_action, int byte1, int byte2,
1072 			   u_int8_t *data_ptr, u_int32_t length,
1073 			   u_int32_t sense_len, u_int32_t timeout);
1074 
1075 void	scsi_allow_overwrite(struct ccb_scsiio *csio, u_int32_t retries,
1076 			     void (*cbfcnp)(struct cam_periph *, union ccb *),
1077 			     u_int8_t tag_action, int allow_overwrite,
1078 			     int partition, u_int64_t logical_id,
1079 			     u_int32_t sense_len, u_int32_t timeout);
1080 
1081 __END_DECLS
1082 
1083 #endif /* _SCSI_SCSI_SA_H */
1084