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