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