102b636c6Sjdunham /*
202b636c6Sjdunham  * CDDL HEADER START
302b636c6Sjdunham  *
402b636c6Sjdunham  * The contents of this file are subject to the terms of the
502b636c6Sjdunham  * Common Development and Distribution License (the "License").
602b636c6Sjdunham  * You may not use this file except in compliance with the License.
702b636c6Sjdunham  *
802b636c6Sjdunham  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
902b636c6Sjdunham  * or http://www.opensolaris.org/os/licensing.
1002b636c6Sjdunham  * See the License for the specific language governing permissions
1102b636c6Sjdunham  * and limitations under the License.
1202b636c6Sjdunham  *
1302b636c6Sjdunham  * When distributing Covered Code, include this CDDL HEADER in each
1402b636c6Sjdunham  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1502b636c6Sjdunham  * If applicable, add the following below this CDDL HEADER, with the
1602b636c6Sjdunham  * fields enclosed by brackets "[]" replaced with your own identifying
1702b636c6Sjdunham  * information: Portions Copyright [yyyy] [name of copyright owner]
1802b636c6Sjdunham  *
1902b636c6Sjdunham  * CDDL HEADER END
2002b636c6Sjdunham  */
2102b636c6Sjdunham /*
22*8fe96085Stim szeto  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
2302b636c6Sjdunham  * Use is subject to license terms.
2402b636c6Sjdunham  */
2502b636c6Sjdunham 
2602b636c6Sjdunham #ifndef	_SYS_SCSI_GENERIC_PERSIST_H
2702b636c6Sjdunham #define	_SYS_SCSI_GENERIC_PERSIST_H
2802b636c6Sjdunham 
2902b636c6Sjdunham #ifdef	__cplusplus
3002b636c6Sjdunham extern "C" {
3102b636c6Sjdunham #endif
3202b636c6Sjdunham 
3302b636c6Sjdunham /*
3402b636c6Sjdunham  * SCSI Persistence Data
3502b636c6Sjdunham  *
3602b636c6Sjdunham  * Format of data returned as a result of PERSISTENCE RESERVER { IN | OUT }
3702b636c6Sjdunham  */
3802b636c6Sjdunham 
3902b636c6Sjdunham /*
4002b636c6Sjdunham  * SPC-3 revision 23, Section 6.11.1, Table 102
4102b636c6Sjdunham  * Persistent Reservations
4202b636c6Sjdunham  * Persistent Reserve In service actions
4302b636c6Sjdunham  */
4402b636c6Sjdunham #define	PR_IN_READ_KEYS		0x0 /* Read all registered reservation keys */
4502b636c6Sjdunham #define	PR_IN_READ_RESERVATION	0x1 /* Reads th persistent reservations */
4602b636c6Sjdunham #define	PR_IN_REPORT_CAPABILITIES 0x2 /* Returns capability information */
4702b636c6Sjdunham #define	PR_IN_READ_FULL_STATUS	0x3 /* Reads complete information about all */
4802b636c6Sjdunham 				    /* registrations and the persistent */
4902b636c6Sjdunham 				    /* reservations, if any */
5002b636c6Sjdunham /*
5102b636c6Sjdunham  * SPC-3 revision 23, Section 6.11.3.3, Table 106
5202b636c6Sjdunham  * Persistent reservation scope codes
5302b636c6Sjdunham  */
5402b636c6Sjdunham #define	PR_LU_SCOPE		0x0	/* Persistent reservation applies to */
5502b636c6Sjdunham 					/* full logical unit */
5602b636c6Sjdunham /*
5702b636c6Sjdunham  * SPC-3 revision 23, Section 6.11.3.4, Table 107
5802b636c6Sjdunham  * Persistent Reservations
5902b636c6Sjdunham  * Persistent reservation type codes
6002b636c6Sjdunham  */
6102b636c6Sjdunham #define	PGR_TYPE_WR_EX		0x1	/* Write Exclusive */
6202b636c6Sjdunham #define	PGR_TYPE_EX_AC		0x3	/* Exclusive Access */
6302b636c6Sjdunham #define	PGR_TYPE_WR_EX_RO	0x5	/* Write Exclusive, Registrants Only */
6402b636c6Sjdunham #define	PGR_TYPE_EX_AC_RO	0x6	/* Exclusive Access, Registrants Only */
6502b636c6Sjdunham #define	PGR_TYPE_WR_EX_AR	0x7	/* Write Exclusive, All Registrants */
6602b636c6Sjdunham #define	PGR_TYPE_EX_AC_AR	0x8	/* Exclusive Access, All Registrants */
6702b636c6Sjdunham 
6802b636c6Sjdunham /*
6902b636c6Sjdunham  * Information obtained from:
7002b636c6Sjdunham  *	SPC-3, Revision 23
7102b636c6Sjdunham  *	Section 6.11.5 PERSISTENCE RESERVE IN
7202b636c6Sjdunham  *	Table 111 - full status descriptor format
7302b636c6Sjdunham  */
7402b636c6Sjdunham /* Table 289 - iSCSI Initiator Device TransportID format */
7502b636c6Sjdunham 
7602b636c6Sjdunham #define	iSCSI_PROTOCOL_ID	0x5	/* Table 262 - iSCSI Protocol ID  */
7702b636c6Sjdunham #define	WW_UID_DEVICE_NAME	0x0	/* Table 288 - iSCSI Transport IDs */
7802b636c6Sjdunham 
7902b636c6Sjdunham 
8002b636c6Sjdunham #if defined(_BIT_FIELDS_LTOH)
8102b636c6Sjdunham /*
8202b636c6Sjdunham  * Information obtained from:
8302b636c6Sjdunham  *	SPC-3, Revision 23
8402b636c6Sjdunham  *	Section 6.11.1 PERSISTENCE RESERVE IN
8502b636c6Sjdunham  *	Table 101 - PERSISTENCE RESERVE IN command
8602b636c6Sjdunham  */
8702b636c6Sjdunham typedef struct scsi_cdb_prin {
8802b636c6Sjdunham 	uint8_t			cmd;
8902b636c6Sjdunham 	uint8_t			action : 5,
9002b636c6Sjdunham 				resbits : 3;
9102b636c6Sjdunham 	uint8_t			resbytes[5];
9202b636c6Sjdunham 	uint8_t			alloc_len[2];
9302b636c6Sjdunham 	uint8_t			control;
9402b636c6Sjdunham } scsi_cdb_prin_t;
9502b636c6Sjdunham 
9602b636c6Sjdunham /*
9702b636c6Sjdunham  * Information obtained from:
9802b636c6Sjdunham  *	SPC-3, Revision 23
9902b636c6Sjdunham  *	Section 6.11.2 PERSISTENCE RESERVE IN
10002b636c6Sjdunham  *	Table 103/104/105 - parameter data for READS KEYS
10102b636c6Sjdunham  */
10202b636c6Sjdunham typedef struct scsi_prin_rsrvdesc {
10302b636c6Sjdunham 	uint8_t			reservation_key[8];
10402b636c6Sjdunham 	uint8_t			obsolete1[4];
10502b636c6Sjdunham 	uint8_t			resbytes;
10602b636c6Sjdunham 	uint8_t			type : 4,
10702b636c6Sjdunham 				scope : 4;
10802b636c6Sjdunham 	uint8_t			obsolete2[2];
10902b636c6Sjdunham } scsi_prin_rsrvdesc_t;
11002b636c6Sjdunham typedef struct scsi_prin_readrsrv {
11102b636c6Sjdunham 	uint8_t			PRgeneration[4];
11202b636c6Sjdunham 	uint8_t			add_len[4];
11368941780Sjdunham 	union {
11468941780Sjdunham 		uint64_t		service_key[1];
11568941780Sjdunham 		scsi_prin_rsrvdesc_t	res_key_list[1];
11668941780Sjdunham 	} key_list;
11702b636c6Sjdunham } scsi_prin_readrsrv_t;
11802b636c6Sjdunham 
11902b636c6Sjdunham /*
12002b636c6Sjdunham  * Information obtained from:
12102b636c6Sjdunham  *	SPC-3, Revision 23
12202b636c6Sjdunham  *	Section 6.11.4 PERSISTENCE RESERVE IN
12302b636c6Sjdunham  * 	Table 108 - parameter data for REPORT CAPABILTIES
12402b636c6Sjdunham  */
12502b636c6Sjdunham typedef struct scsi_per_res_type {
12602b636c6Sjdunham 	uint8_t			resbits1 : 1,
12702b636c6Sjdunham 				wr_ex : 1,
12802b636c6Sjdunham 				resbits2 : 1,
12902b636c6Sjdunham 				ex_ac : 1,
13002b636c6Sjdunham 				resbits3 : 1,
13102b636c6Sjdunham 				wr_ex_ro : 1,
13202b636c6Sjdunham 				ex_ac_ro : 1,
13302b636c6Sjdunham 				wr_ex_ar : 1;
13402b636c6Sjdunham 	uint8_t			ex_ac_ar : 1,
13502b636c6Sjdunham 				resbits4 : 7;
13602b636c6Sjdunham } scsi_per_res_type_t;
13702b636c6Sjdunham typedef struct scsi_prin_rpt_cap {
13802b636c6Sjdunham 	uint8_t			length[2];
13902b636c6Sjdunham 	uint8_t			ptpl_c : 1,
14002b636c6Sjdunham 				resbits1 : 1,
14102b636c6Sjdunham 				atp_c : 1,
14202b636c6Sjdunham 				sip_c : 1,
14302b636c6Sjdunham 				crh : 1,
14402b636c6Sjdunham 				resbits2 : 3;
14502b636c6Sjdunham 	uint8_t			ptpl_a : 1,
14602b636c6Sjdunham 				resbits3 : 6,
14702b636c6Sjdunham 				tmv : 1;
14802b636c6Sjdunham 	scsi_per_res_type_t	pr_type;
14902b636c6Sjdunham 	uint8_t			resbytes[2];
15002b636c6Sjdunham } scsi_prin_rpt_cap_t;
15102b636c6Sjdunham 
15202b636c6Sjdunham /*
153*8fe96085Stim szeto  * Refer SPC-3, Revision 23
154*8fe96085Stim szeto  * Section 7.5.4 TransportID identifiers
15502b636c6Sjdunham  */
15602b636c6Sjdunham typedef struct scsi_transport_id {
15702b636c6Sjdunham 	uint8_t			protocol_id : 4,
15802b636c6Sjdunham 				resbits : 2,
15902b636c6Sjdunham 				format_code : 2;
160*8fe96085Stim szeto 	uint8_t			protocol_data[1];
161*8fe96085Stim szeto } scsi_transport_id_t;
162*8fe96085Stim szeto 
163*8fe96085Stim szeto typedef struct scsi_fc_transport_id {
164*8fe96085Stim szeto 	uint8_t			protocol_id : 4,
165*8fe96085Stim szeto 				resbits : 2,
166*8fe96085Stim szeto 				format_code : 2;
167*8fe96085Stim szeto 	uint8_t			rsvbytes1[7];
168*8fe96085Stim szeto 	uint8_t			port_name[8];
169*8fe96085Stim szeto 	uint8_t			rsvbytes2[8];
170*8fe96085Stim szeto } scsi_fc_transport_id_t;
171*8fe96085Stim szeto 
172*8fe96085Stim szeto typedef struct iscsi_transport_id {
173*8fe96085Stim szeto 	uint8_t			protocol_id : 4,
174*8fe96085Stim szeto 				resbits : 2,
175*8fe96085Stim szeto 				format_code : 2;
176*8fe96085Stim szeto 	uint8_t			rsvbyte1;
17702b636c6Sjdunham 	uint8_t			add_len[2];
17802b636c6Sjdunham 	char			iscsi_name[1];
179*8fe96085Stim szeto } iscsi_transport_id_t;
180*8fe96085Stim szeto 
181*8fe96085Stim szeto /*
182*8fe96085Stim szeto  * Information obtained from:
183*8fe96085Stim szeto  *	SPC-3, Revision 23
184*8fe96085Stim szeto  *	Section 6.11.5 PERSISTENCE RESERVE IN
185*8fe96085Stim szeto  * 	Table 110/111 - parameter data for READ FULL STATUS
186*8fe96085Stim szeto  *	Table 281 - TransportId format
187*8fe96085Stim szeto  */
188*8fe96085Stim szeto 
18902b636c6Sjdunham typedef struct scsi_prin_status_t {
19002b636c6Sjdunham 	uint8_t			reservation_key[8];
19102b636c6Sjdunham 	uint8_t			resbytes1[4];
19202b636c6Sjdunham 	uint8_t			r_holder : 1,
19302b636c6Sjdunham 				all_tg_pt : 1,
19402b636c6Sjdunham 				resbits : 6;
19502b636c6Sjdunham 	uint8_t			type : 4,
19602b636c6Sjdunham 				scope : 4;
19702b636c6Sjdunham 	uint8_t			resbytes2[4];
19802b636c6Sjdunham 	uint8_t			rel_tgt_port_id[2];
19902b636c6Sjdunham 	uint8_t			add_len[4];
20002b636c6Sjdunham 	scsi_transport_id_t	trans_id;
20102b636c6Sjdunham } scsi_prin_status_t;
20202b636c6Sjdunham typedef struct scsi_prin_full_status {
20302b636c6Sjdunham 	uint8_t			PRgeneration[4];
20402b636c6Sjdunham 	uint8_t			add_len[4];
20502b636c6Sjdunham 	scsi_prin_status_t	full_desc[1];
20602b636c6Sjdunham } scsi_prin_full_status_t;
20702b636c6Sjdunham 
20802b636c6Sjdunham /*
20902b636c6Sjdunham  * Information obtained from:
21002b636c6Sjdunham  *	SPC-3, Revision 23
21102b636c6Sjdunham  *	Section 6.12.1 PERSISTENCE RESERVE OUT
21202b636c6Sjdunham  *	Table 112 - PERSISTENCE RESERVE OUT command
21302b636c6Sjdunham  */
21402b636c6Sjdunham typedef struct scsi_cdb_prout {
21502b636c6Sjdunham 	uint8_t			cmd;
21602b636c6Sjdunham 	uint8_t			action : 5,
21702b636c6Sjdunham 				resbits : 3;
21802b636c6Sjdunham 	uint8_t			type : 4,
21902b636c6Sjdunham 				scope : 4;
22002b636c6Sjdunham 	uint8_t			resbytes[2];
22102b636c6Sjdunham 	uint8_t			param_len[4];
22202b636c6Sjdunham 	uint8_t			control;
22302b636c6Sjdunham } scsi_cdb_prout_t;
22402b636c6Sjdunham 
22502b636c6Sjdunham /*
22602b636c6Sjdunham  * Information obtained from:
22702b636c6Sjdunham  *	SPC-3, Revision 23
22802b636c6Sjdunham  *	Section 6.12.3 PERSISTENCE RESERVE OUT
22902b636c6Sjdunham  *	Table 114 - PERSISTENCE RESERVE OUT parameter list
23002b636c6Sjdunham  */
23102b636c6Sjdunham typedef struct scsi_prout_plist {
23202b636c6Sjdunham 	uint8_t			reservation_key[8];
23302b636c6Sjdunham 	uint8_t			service_key[8];
23402b636c6Sjdunham 	uint8_t			obsolete1[4];
23502b636c6Sjdunham 	uint8_t			aptpl : 1,
23602b636c6Sjdunham 				resbits1 : 1,
23702b636c6Sjdunham 				all_tg_pt : 1,
23802b636c6Sjdunham 				spec_i_pt : 1,
23902b636c6Sjdunham 				resbits2 : 4;
24002b636c6Sjdunham 	uint8_t			resbytes1;
24102b636c6Sjdunham 	uint8_t			obsolete2[2];
24202b636c6Sjdunham 	uint8_t			apd[1];
24302b636c6Sjdunham } scsi_prout_plist_t;
24402b636c6Sjdunham 
245*8fe96085Stim szeto /*
246*8fe96085Stim szeto  * Information obtained from:
247*8fe96085Stim szeto  *	SPC-3, Revision 23
248*8fe96085Stim szeto  *	Section 6.12.4 PERSISTENCE RESERVE OUT command with REGISTER AND MOVE
249*8fe96085Stim szeto  *	Table 117 - REGISTER and MOVE service action  parameter list
250*8fe96085Stim szeto  */
251*8fe96085Stim szeto typedef struct scsi_prout_reg_move_plist {
252*8fe96085Stim szeto 	uint8_t			reservation_key[8];
253*8fe96085Stim szeto 	uint8_t			service_key[8];
254*8fe96085Stim szeto 	uint8_t			resbytes1;
255*8fe96085Stim szeto 	uint8_t			aptpl : 1,
256*8fe96085Stim szeto 				unreg : 1,
257*8fe96085Stim szeto 				resbits1 : 6;
258*8fe96085Stim szeto 	uint8_t			rel_tgt_port_id[2];
259*8fe96085Stim szeto 	uint8_t			tptid_len[4];
260*8fe96085Stim szeto 	uint8_t			tptid[1];
261*8fe96085Stim szeto } scsi_prout_reg_move_plist_t;
262*8fe96085Stim szeto 
26302b636c6Sjdunham #elif defined(_BIT_FIELDS_HTOL)
26402b636c6Sjdunham /*
26502b636c6Sjdunham  * Information obtained from:
26602b636c6Sjdunham  *	SPC-3, Revision 23
26702b636c6Sjdunham  *	Section 6.11.1 PERSISTENCE RESERVE IN
26802b636c6Sjdunham  *	Table 101 - PERSISTENCE RESERVE IN command
26902b636c6Sjdunham  */
27002b636c6Sjdunham typedef struct scsi_cdb_prin {
27102b636c6Sjdunham 	uint8_t			cmd;
27202b636c6Sjdunham 	uint8_t			resbits : 3,
27302b636c6Sjdunham 				action : 5;
27402b636c6Sjdunham 	uint8_t			resbytes[5];
27502b636c6Sjdunham 	uint8_t			alloc_len[2];
27602b636c6Sjdunham 	uint8_t			control;
27702b636c6Sjdunham } scsi_cdb_prin_t;
27802b636c6Sjdunham 
27902b636c6Sjdunham /*
28002b636c6Sjdunham  * Information obtained from:
28102b636c6Sjdunham  *	SPC-3, Revision 23
28202b636c6Sjdunham  *	Section 6.11.2 PERSISTENCE RESERVE IN
28302b636c6Sjdunham  *	Table 103/104/105 - parameter data for READS KEYS
28402b636c6Sjdunham  */
28502b636c6Sjdunham typedef struct scsi_prin_rsrvdesc {
28602b636c6Sjdunham 	uint8_t			reservation_key[8];
28702b636c6Sjdunham 	uint8_t			obsolete1[4];
28802b636c6Sjdunham 	uint8_t			resbytes;
28902b636c6Sjdunham 	uint8_t			scope : 4,
29002b636c6Sjdunham 				type : 4;
29168941780Sjdunham 	uint8_t			obsolete2[2];
29202b636c6Sjdunham } scsi_prin_rsrvdesc_t;
29302b636c6Sjdunham typedef struct scsi_prin_readrsrv {
29402b636c6Sjdunham 	uint8_t			PRgeneration[4];
29502b636c6Sjdunham 	uint8_t			add_len[4];
29668941780Sjdunham 	union {
29768941780Sjdunham 		uint64_t		service_key[1];
29868941780Sjdunham 		scsi_prin_rsrvdesc_t	res_key_list[1];
29968941780Sjdunham 	} key_list;
30002b636c6Sjdunham } scsi_prin_readrsrv_t;
30102b636c6Sjdunham 
30202b636c6Sjdunham /*
30302b636c6Sjdunham  * Information obtained from:
30402b636c6Sjdunham  *	SPC-3, Revision 23
30502b636c6Sjdunham  *	Section 6.11.4 PERSISTENCE RESERVE IN
30602b636c6Sjdunham  * 	Table 108 - parameter data for REPORT CAPABILTIES
30702b636c6Sjdunham  */
30802b636c6Sjdunham typedef struct scsi_per_res_type {
30902b636c6Sjdunham 	uint8_t			wr_ex_ar : 1,
31002b636c6Sjdunham 				ex_ac_ro : 1,
31102b636c6Sjdunham 				wr_ex_ro : 1,
31202b636c6Sjdunham 				resbits3 : 1,
31302b636c6Sjdunham 				ex_ac : 1,
31402b636c6Sjdunham 				resbits2 : 1,
31502b636c6Sjdunham 				wr_ex : 1,
31602b636c6Sjdunham 				resbits1 : 1;
31702b636c6Sjdunham 	uint8_t			resbits4 : 7,
31802b636c6Sjdunham 				ex_ac_ar : 1;
31902b636c6Sjdunham } scsi_per_res_type_t;
32002b636c6Sjdunham typedef struct scsi_prin_rpt_cap {
32102b636c6Sjdunham 	uint8_t			length[2];
32202b636c6Sjdunham 	uint8_t			resbits2 : 3,
32302b636c6Sjdunham 				crh : 1,
32402b636c6Sjdunham 				sip_c : 1,
32502b636c6Sjdunham 				atp_c : 1,
32602b636c6Sjdunham 				resbits1 : 1,
32702b636c6Sjdunham 				ptpl_c : 1;
32802b636c6Sjdunham 	uint8_t			tmv : 1,
32902b636c6Sjdunham 				resbits3 : 6,
33002b636c6Sjdunham 				ptpl_a : 1;
33102b636c6Sjdunham 	scsi_per_res_type_t	pr_type;
33202b636c6Sjdunham 	uint8_t			resbytes[2];
33302b636c6Sjdunham } scsi_prin_rpt_cap_t;
33402b636c6Sjdunham 
33502b636c6Sjdunham /*
336*8fe96085Stim szeto  * Refer SPC-3, Revision 23
337*8fe96085Stim szeto  * Section 7.5.4 TransportID identifiers
33802b636c6Sjdunham  */
33902b636c6Sjdunham typedef struct scsi_transport_id {
34002b636c6Sjdunham 	uint8_t			format_code : 2,
34102b636c6Sjdunham 				resbits : 2,
34202b636c6Sjdunham 				protocol_id : 4;
343*8fe96085Stim szeto 	uint8_t			protocol_data[1];
344*8fe96085Stim szeto } scsi_transport_id_t;
345*8fe96085Stim szeto 
346*8fe96085Stim szeto typedef struct scsi_fc_transport_id {
347*8fe96085Stim szeto 	uint8_t			format_code : 2,
348*8fe96085Stim szeto 				resbits : 2,
349*8fe96085Stim szeto 				protocol_id : 4;
350*8fe96085Stim szeto 	uint8_t			rsvbytes1[7];
351*8fe96085Stim szeto 	uint8_t			port_name[8];
352*8fe96085Stim szeto 	uint8_t			rsvbytes2[8];
353*8fe96085Stim szeto } scsi_fc_transport_id_t;
354*8fe96085Stim szeto 
355*8fe96085Stim szeto typedef struct iscsi_transport_id {
356*8fe96085Stim szeto 	uint8_t			format_code : 2,
357*8fe96085Stim szeto 				resbits : 2,
358*8fe96085Stim szeto 				protocol_id : 4;
359*8fe96085Stim szeto 	uint8_t			rsvbyte1;
36002b636c6Sjdunham 	uint8_t			add_len[2];
36102b636c6Sjdunham 	char			iscsi_name[1];
362*8fe96085Stim szeto } iscsi_transport_id_t;
363*8fe96085Stim szeto 
364*8fe96085Stim szeto /*
365*8fe96085Stim szeto  * Information obtained from:
366*8fe96085Stim szeto  *	SPC-3, Revision 23
367*8fe96085Stim szeto  *	Section 6.11.5 PERSISTENCE RESERVE IN
368*8fe96085Stim szeto  * 	Table 110/111 - parameter data for READ FULL STATUS
369*8fe96085Stim szeto  *	Table 281 - TransportId format
370*8fe96085Stim szeto  */
371*8fe96085Stim szeto 
37202b636c6Sjdunham typedef struct scsi_prin_status_t {
37302b636c6Sjdunham 	uint8_t			reservation_key[8];
37402b636c6Sjdunham 	uint8_t			resbytes1[4];
37502b636c6Sjdunham 	uint8_t			resbits : 6,
37602b636c6Sjdunham 				all_tg_pt : 1,
37702b636c6Sjdunham 				r_holder : 1;
37802b636c6Sjdunham 	uint8_t			scope : 4,
37902b636c6Sjdunham 				type : 4;
38002b636c6Sjdunham 	uint8_t			resbytes2[4];
38102b636c6Sjdunham 	uint8_t			rel_tgt_port_id[2];
38202b636c6Sjdunham 	uint8_t			add_len[4];
38302b636c6Sjdunham 	scsi_transport_id_t	trans_id;
38402b636c6Sjdunham } scsi_prin_status_t;
38502b636c6Sjdunham typedef struct scsi_prin_full_status {
38602b636c6Sjdunham 	uint8_t			PRgeneration[4];
38702b636c6Sjdunham 	uint8_t			add_len[4];
38802b636c6Sjdunham 	scsi_prin_status_t	full_desc[1];
38902b636c6Sjdunham } scsi_prin_full_status_t;
39002b636c6Sjdunham 
39102b636c6Sjdunham /*
39202b636c6Sjdunham  * Information obtained from:
39302b636c6Sjdunham  *	SPC-3, Revision 23
39402b636c6Sjdunham  *	Section 6.12.1 PERSISTENCE RESERVE OUT
39502b636c6Sjdunham  *	Table 112 - PERSISTENCE RESERVE OUT command
39602b636c6Sjdunham  */
39702b636c6Sjdunham typedef struct scsi_cdb_prout {
39802b636c6Sjdunham 	uint8_t			cmd;
39902b636c6Sjdunham 	uint8_t			resbits : 3,
40002b636c6Sjdunham 				action : 5;
40102b636c6Sjdunham 	uint8_t			scope : 4,
40202b636c6Sjdunham 				type : 4;
40302b636c6Sjdunham 	uint8_t			resbytes[2];
40402b636c6Sjdunham 	uint8_t			param_len[4];
40502b636c6Sjdunham 	uint8_t			control;
40602b636c6Sjdunham } scsi_cdb_prout_t;
40702b636c6Sjdunham 
40802b636c6Sjdunham /*
40902b636c6Sjdunham  * Information obtained from:
41002b636c6Sjdunham  *	SPC-3, Revision 23
41102b636c6Sjdunham  *	Section 6.12.3 PERSISTENCE RESERVE OUT
41202b636c6Sjdunham  *	Table 114 - PERSISTENCE RESERVE OUT parameter list
41302b636c6Sjdunham  */
41402b636c6Sjdunham typedef struct scsi_prout_plist {
41502b636c6Sjdunham 	uint8_t			reservation_key[8];
41602b636c6Sjdunham 	uint8_t			service_key[8];
41702b636c6Sjdunham 	uint8_t			obsolete1[4];
41802b636c6Sjdunham 	uint8_t			resbits1 : 4,
41902b636c6Sjdunham 				spec_i_pt : 1,
42002b636c6Sjdunham 				all_tg_pt : 1,
42102b636c6Sjdunham 				resbits2 : 1,
42202b636c6Sjdunham 				aptpl : 1;
42302b636c6Sjdunham 	uint8_t			resbytes1;
42402b636c6Sjdunham 	uint8_t			obsolete2[2];
42502b636c6Sjdunham 	uint8_t			apd[1];
42602b636c6Sjdunham } scsi_prout_plist_t;
42702b636c6Sjdunham 
428*8fe96085Stim szeto /*
429*8fe96085Stim szeto  * Information obtained from:
430*8fe96085Stim szeto  *	SPC-3, Revision 23
431*8fe96085Stim szeto  *	Section 6.12.4 PERSISTENCE RESERVE OUT command with REGISTER AND MOVE
432*8fe96085Stim szeto  *	Table 117 - REGISTER and MOVE service action  parameter list
433*8fe96085Stim szeto  */
434*8fe96085Stim szeto typedef struct scsi_prout_reg_move_plist {
435*8fe96085Stim szeto 	uint8_t			reservation_key[8];
436*8fe96085Stim szeto 	uint8_t			service_key[8];
437*8fe96085Stim szeto 	uint8_t			resbytes1;
438*8fe96085Stim szeto 	uint8_t			resbits1 : 6,
439*8fe96085Stim szeto 				unreg    : 1,
440*8fe96085Stim szeto 				aptpl    : 1;
441*8fe96085Stim szeto 	uint8_t			rel_tgt_port_id[2];
442*8fe96085Stim szeto 	uint8_t			tptid_len[4];
443*8fe96085Stim szeto 	uint8_t			tptid[1];
444*8fe96085Stim szeto } scsi_prout_reg_move_plist_t;
445*8fe96085Stim szeto 
44602b636c6Sjdunham #else
44702b636c6Sjdunham #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
44802b636c6Sjdunham #endif	/* _BIT_FIELDS_LTOH */
44902b636c6Sjdunham 
45002b636c6Sjdunham 
45102b636c6Sjdunham /*
45202b636c6Sjdunham  * SPC-3 revision 23, Section 6.12.2, Table 113
45302b636c6Sjdunham  * Persistent Reservations
45402b636c6Sjdunham  * Persistent Reserve Out service action codes
45502b636c6Sjdunham  */
45602b636c6Sjdunham #define	PR_OUT_REGISTER		0x0	/* Register/unregister a reservation */
45702b636c6Sjdunham 					/* key with the device server */
45802b636c6Sjdunham #define	PR_OUT_RESERVE		0x1	/* Create a persistent reservation */
45902b636c6Sjdunham 					/* having a specified SCOPE & TYPE */
46002b636c6Sjdunham #define	PR_OUT_RELEASE		0x2	/* Release the selected persistent */
46102b636c6Sjdunham 					/* reservation */
46202b636c6Sjdunham #define	PR_OUT_CLEAR		0x3	/* Clears all reservation keys and */
46302b636c6Sjdunham 					/* all persistent reservations */
46402b636c6Sjdunham #define	PR_OUT_PREEMPT		0x4	/* Preempts persistent reservations */
46502b636c6Sjdunham 					/* and/or removes reservations */
46602b636c6Sjdunham #define	PR_OUT_PREEMPT_ABORT	0x5	/* Preempts persistent reservations */
46702b636c6Sjdunham 					/* and/or removes reservations, and */
46802b636c6Sjdunham 					/* aborts all tasks for all preempted */
46902b636c6Sjdunham 					/* I_T nexuses */
47002b636c6Sjdunham #define	PR_OUT_REGISTER_AND_IGNORE_EXISTING_KEY	0x06
47102b636c6Sjdunham 					/* Register a reservation key with */
47202b636c6Sjdunham 					/* the device server, or unregister a */
47302b636c6Sjdunham 					/* reservation key */
47402b636c6Sjdunham #define	PR_OUT_REGISTER_MOVE	0x7	/* Register a reservation key for */
47502b636c6Sjdunham 					/* another I_T nexus with the device */
47602b636c6Sjdunham 					/* server and move a persistent */
47702b636c6Sjdunham 					/* reservation to the I_T nexus */
47802b636c6Sjdunham 
47902b636c6Sjdunham 
48002b636c6Sjdunham #ifdef	__cplusplus
48102b636c6Sjdunham }
48202b636c6Sjdunham #endif
48302b636c6Sjdunham 
48402b636c6Sjdunham #endif	/* _SYS_SCSI_GENERIC_PERSIST_H */
485