xref: /titanic_44/usr/src/uts/common/sys/scsi/generic/persist.h (revision 716c180559045549271833327182dc6a266134f1)
168941780Sjdunham /*
268941780Sjdunham  * CDDL HEADER START
368941780Sjdunham  *
468941780Sjdunham  * The contents of this file are subject to the terms of the
568941780Sjdunham  * Common Development and Distribution License (the "License").
668941780Sjdunham  * You may not use this file except in compliance with the License.
768941780Sjdunham  *
868941780Sjdunham  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
968941780Sjdunham  * or http://www.opensolaris.org/os/licensing.
1068941780Sjdunham  * See the License for the specific language governing permissions
1168941780Sjdunham  * and limitations under the License.
1268941780Sjdunham  *
1368941780Sjdunham  * When distributing Covered Code, include this CDDL HEADER in each
1468941780Sjdunham  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1568941780Sjdunham  * If applicable, add the following below this CDDL HEADER, with the
1668941780Sjdunham  * fields enclosed by brackets "[]" replaced with your own identifying
1768941780Sjdunham  * information: Portions Copyright [yyyy] [name of copyright owner]
1868941780Sjdunham  *
1968941780Sjdunham  * CDDL HEADER END
2068941780Sjdunham  */
2168941780Sjdunham /*
22*716c1805SNattuvetty Bhavyan  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2368941780Sjdunham  */
2468941780Sjdunham 
2568941780Sjdunham #ifndef	_SYS_SCSI_GENERIC_PERSIST_H
2668941780Sjdunham #define	_SYS_SCSI_GENERIC_PERSIST_H
2768941780Sjdunham 
2868941780Sjdunham #ifdef	__cplusplus
2968941780Sjdunham extern "C" {
3068941780Sjdunham #endif
3168941780Sjdunham 
3268941780Sjdunham /*
3368941780Sjdunham  * SCSI Persistence Data
3468941780Sjdunham  *
3568941780Sjdunham  * Format of data returned as a result of PERSISTENCE RESERVER { IN | OUT }
3668941780Sjdunham  */
3768941780Sjdunham 
3868941780Sjdunham /*
3968941780Sjdunham  * SPC-3 revision 23, Section 6.11.1, Table 102
4068941780Sjdunham  * Persistent Reservations
4168941780Sjdunham  * Persistent Reserve In service actions
4268941780Sjdunham  */
4368941780Sjdunham #define	PR_IN_READ_KEYS		0x0 /* Read all registered reservation keys */
4468941780Sjdunham #define	PR_IN_READ_RESERVATION	0x1 /* Reads th persistent reservations */
4568941780Sjdunham #define	PR_IN_REPORT_CAPABILITIES 0x2 /* Returns capability information */
4668941780Sjdunham #define	PR_IN_READ_FULL_STATUS	0x3 /* Reads complete information about all */
4768941780Sjdunham 				    /* registrations and the persistent */
4868941780Sjdunham 				    /* reservations, if any */
4968941780Sjdunham /*
5068941780Sjdunham  * SPC-3 revision 23, Section 6.11.3.3, Table 106
5168941780Sjdunham  * Persistent reservation scope codes
5268941780Sjdunham  */
5368941780Sjdunham #define	PR_LU_SCOPE		0x0	/* Persistent reservation applies to */
5468941780Sjdunham 					/* full logical unit */
5568941780Sjdunham /*
5668941780Sjdunham  * SPC-3 revision 23, Section 6.11.3.4, Table 107
5768941780Sjdunham  * Persistent Reservations
5868941780Sjdunham  * Persistent reservation type codes
5968941780Sjdunham  */
6068941780Sjdunham #define	PGR_TYPE_WR_EX		0x1	/* Write Exclusive */
6168941780Sjdunham #define	PGR_TYPE_EX_AC		0x3	/* Exclusive Access */
6268941780Sjdunham #define	PGR_TYPE_WR_EX_RO	0x5	/* Write Exclusive, Registrants Only */
6368941780Sjdunham #define	PGR_TYPE_EX_AC_RO	0x6	/* Exclusive Access, Registrants Only */
6468941780Sjdunham #define	PGR_TYPE_WR_EX_AR	0x7	/* Write Exclusive, All Registrants */
6568941780Sjdunham #define	PGR_TYPE_EX_AC_AR	0x8	/* Exclusive Access, All Registrants */
6668941780Sjdunham 
6768941780Sjdunham /*
68*716c1805SNattuvetty Bhavyan  * SPC-3 revision 23, Section 6.12.2, Table 113
69*716c1805SNattuvetty Bhavyan  * Persistent Reservations
70*716c1805SNattuvetty Bhavyan  * Persistent Reserve Out service action codes
71*716c1805SNattuvetty Bhavyan  */
72*716c1805SNattuvetty Bhavyan #define	PR_OUT_REGISTER		0x0	/* Register/unregister a reservation */
73*716c1805SNattuvetty Bhavyan 					/* key with the device server */
74*716c1805SNattuvetty Bhavyan #define	PR_OUT_RESERVE		0x1	/* Create a persistent reservation */
75*716c1805SNattuvetty Bhavyan 					/* having a specified SCOPE & TYPE */
76*716c1805SNattuvetty Bhavyan #define	PR_OUT_RELEASE		0x2	/* Release the selected persistent */
77*716c1805SNattuvetty Bhavyan 					/* reservation */
78*716c1805SNattuvetty Bhavyan #define	PR_OUT_CLEAR		0x3	/* Clears all reservation keys and */
79*716c1805SNattuvetty Bhavyan 					/* all persistent reservations */
80*716c1805SNattuvetty Bhavyan #define	PR_OUT_PREEMPT		0x4	/* Preempts persistent reservations */
81*716c1805SNattuvetty Bhavyan 					/* and/or removes reservations */
82*716c1805SNattuvetty Bhavyan #define	PR_OUT_PREEMPT_ABORT	0x5	/* Preempts persistent reservations */
83*716c1805SNattuvetty Bhavyan 					/* and/or removes reservations, and */
84*716c1805SNattuvetty Bhavyan 					/* aborts all tasks for all preempted */
85*716c1805SNattuvetty Bhavyan 					/* I_T nexuses */
86*716c1805SNattuvetty Bhavyan #define	PR_OUT_REGISTER_AND_IGNORE_EXISTING_KEY	0x06
87*716c1805SNattuvetty Bhavyan 					/* Register a reservation key with */
88*716c1805SNattuvetty Bhavyan 					/* the device server, or unregister a */
89*716c1805SNattuvetty Bhavyan 					/* reservation key */
90*716c1805SNattuvetty Bhavyan #define	PR_OUT_REGISTER_MOVE	0x7	/* Register a reservation key for */
91*716c1805SNattuvetty Bhavyan 					/* another I_T nexus with the device */
92*716c1805SNattuvetty Bhavyan 					/* server and move a persistent */
93*716c1805SNattuvetty Bhavyan 					/* reservation to the I_T nexus */
94*716c1805SNattuvetty Bhavyan 
95*716c1805SNattuvetty Bhavyan 
96*716c1805SNattuvetty Bhavyan /*
9768941780Sjdunham  * Information obtained from:
9868941780Sjdunham  *	SPC-3, Revision 23
9968941780Sjdunham  *	Section 6.11.5 PERSISTENCE RESERVE IN
10068941780Sjdunham  *	Table 111 - full status descriptor format
10168941780Sjdunham  */
10268941780Sjdunham /* Table 289 - iSCSI Initiator Device TransportID format */
10368941780Sjdunham 
10468941780Sjdunham #define	iSCSI_PROTOCOL_ID	0x5	/* Table 262 - iSCSI Protocol ID  */
10568941780Sjdunham #define	WW_UID_DEVICE_NAME	0x0	/* Table 288 - iSCSI Transport IDs */
10668941780Sjdunham 
107*716c1805SNattuvetty Bhavyan /*
108*716c1805SNattuvetty Bhavyan  * Definitions related SCSI Transport ID
109*716c1805SNattuvetty Bhavyan  * SPC3 rev 23, Tables 284-287
110*716c1805SNattuvetty Bhavyan  */
111*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_SIZE			24
112*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_FC_PORT_NAME_SIZE	8
113*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_SPI_ADDRESS_LEN	2
114*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_SPI_REL_TGTPTID_LEN	2
115*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_SBP_PORT_NAME_LEN	8
116*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_SRP_PORT_NAME_LEN	16
117*716c1805SNattuvetty Bhavyan #define	SCSI_TPTID_ISCSI_ISID_SEPERATOR	",i,0x"
11868941780Sjdunham 
11968941780Sjdunham #if defined(_BIT_FIELDS_LTOH)
12068941780Sjdunham /*
12168941780Sjdunham  * Information obtained from:
12268941780Sjdunham  *	SPC-3, Revision 23
12368941780Sjdunham  *	Section 6.11.1 PERSISTENCE RESERVE IN
12468941780Sjdunham  *	Table 101 - PERSISTENCE RESERVE IN command
12568941780Sjdunham  */
12668941780Sjdunham typedef struct scsi_cdb_prin {
12768941780Sjdunham 	uint8_t			cmd;
12868941780Sjdunham 	uint8_t			action : 5,
12968941780Sjdunham 				resbits : 3;
13068941780Sjdunham 	uint8_t			resbytes[5];
13168941780Sjdunham 	uint8_t			alloc_len[2];
13268941780Sjdunham 	uint8_t			control;
13368941780Sjdunham } scsi_cdb_prin_t;
13468941780Sjdunham 
13568941780Sjdunham /*
13668941780Sjdunham  * Information obtained from:
13768941780Sjdunham  *	SPC-3, Revision 23
13868941780Sjdunham  *	Section 6.11.2 PERSISTENCE RESERVE IN
13968941780Sjdunham  *	Table 103/104/105 - parameter data for READS KEYS
14068941780Sjdunham  */
14168941780Sjdunham typedef struct scsi_prin_rsrvdesc {
14268941780Sjdunham 	uint8_t			reservation_key[8];
14368941780Sjdunham 	uint8_t			obsolete1[4];
14468941780Sjdunham 	uint8_t			resbytes;
14568941780Sjdunham 	uint8_t			type : 4,
14668941780Sjdunham 				scope : 4;
14768941780Sjdunham 	uint8_t			obsolete2[2];
14868941780Sjdunham } scsi_prin_rsrvdesc_t;
14968941780Sjdunham typedef struct scsi_prin_readrsrv {
15068941780Sjdunham 	uint8_t			PRgeneration[4];
15168941780Sjdunham 	uint8_t			add_len[4];
15268941780Sjdunham 	union {
15368941780Sjdunham 		uint64_t		service_key[1];
15468941780Sjdunham 		scsi_prin_rsrvdesc_t	res_key_list[1];
15568941780Sjdunham 	} key_list;
15668941780Sjdunham } scsi_prin_readrsrv_t;
15768941780Sjdunham 
15868941780Sjdunham /*
15968941780Sjdunham  * Information obtained from:
16068941780Sjdunham  *	SPC-3, Revision 23
16168941780Sjdunham  *	Section 6.11.4 PERSISTENCE RESERVE IN
16268941780Sjdunham  * 	Table 108 - parameter data for REPORT CAPABILTIES
16368941780Sjdunham  */
16468941780Sjdunham typedef struct scsi_per_res_type {
16568941780Sjdunham 	uint8_t			resbits1 : 1,
16668941780Sjdunham 				wr_ex : 1,
16768941780Sjdunham 				resbits2 : 1,
16868941780Sjdunham 				ex_ac : 1,
16968941780Sjdunham 				resbits3 : 1,
17068941780Sjdunham 				wr_ex_ro : 1,
17168941780Sjdunham 				ex_ac_ro : 1,
17268941780Sjdunham 				wr_ex_ar : 1;
17368941780Sjdunham 	uint8_t			ex_ac_ar : 1,
17468941780Sjdunham 				resbits4 : 7;
17568941780Sjdunham } scsi_per_res_type_t;
17670c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 
17770c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States /*
17870c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States  * Refer SPC-3, Revision 23
17970c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States  * Section 6.11.4 REPORT CAPABILITIES service action
18070c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States  */
18168941780Sjdunham typedef struct scsi_prin_rpt_cap {
18268941780Sjdunham 	uint8_t			length[2];
18368941780Sjdunham 	uint8_t			ptpl_c : 1,
18468941780Sjdunham 				resbits1 : 1,
18568941780Sjdunham 				atp_c : 1,
18668941780Sjdunham 				sip_c : 1,
18768941780Sjdunham 				crh : 1,
18868941780Sjdunham 				resbits2 : 3;
18968941780Sjdunham 	uint8_t			ptpl_a : 1,
19068941780Sjdunham 				resbits3 : 6,
19168941780Sjdunham 				tmv : 1;
19268941780Sjdunham 	scsi_per_res_type_t	pr_type;
19368941780Sjdunham 	uint8_t			resbytes[2];
19468941780Sjdunham } scsi_prin_rpt_cap_t;
19568941780Sjdunham 
19668941780Sjdunham /*
1978fe96085Stim szeto  * Refer SPC-3, Revision 23
1988fe96085Stim szeto  * Section 7.5.4 TransportID identifiers
1998fe96085Stim szeto  */
2008fe96085Stim szeto typedef struct scsi_transport_id {
2018fe96085Stim szeto 	uint8_t			protocol_id : 4,
2028fe96085Stim szeto 				resbits : 2,
2038fe96085Stim szeto 				format_code : 2;
2048fe96085Stim szeto 	uint8_t			protocol_data[1];
2058fe96085Stim szeto } scsi_transport_id_t;
2068fe96085Stim szeto 
2078fe96085Stim szeto typedef struct scsi_fc_transport_id {
2088fe96085Stim szeto 	uint8_t			protocol_id : 4,
2098fe96085Stim szeto 				resbits : 2,
2108fe96085Stim szeto 				format_code : 2;
2118fe96085Stim szeto 	uint8_t			rsvbytes1[7];
2128fe96085Stim szeto 	uint8_t			port_name[8];
2138fe96085Stim szeto 	uint8_t			rsvbytes2[8];
2148fe96085Stim szeto } scsi_fc_transport_id_t;
2158fe96085Stim szeto 
2168fe96085Stim szeto typedef struct iscsi_transport_id {
2178fe96085Stim szeto 	uint8_t			protocol_id : 4,
2188fe96085Stim szeto 				resbits : 2,
2198fe96085Stim szeto 				format_code : 2;
2208fe96085Stim szeto 	uint8_t			rsvbyte1;
2218fe96085Stim szeto 	uint8_t			add_len[2];
2228fe96085Stim szeto 	char			iscsi_name[1];
2238fe96085Stim szeto } iscsi_transport_id_t;
2248fe96085Stim szeto 
22570c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States typedef struct scsi_srp_transport_id {
22670c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 	uint8_t			protocol_id : 4,
22770c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 				resbits : 2,
22870c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 				format_code : 2;
22970c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 	uint8_t			rsvbytes1[7];
23070c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 	uint8_t			srp_name[16];
23170c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States } scsi_srp_transport_id_t;
23270c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 
2338fe96085Stim szeto /*
23468941780Sjdunham  * Information obtained from:
23568941780Sjdunham  *	SPC-3, Revision 23
23668941780Sjdunham  *	Section 6.11.5 PERSISTENCE RESERVE IN
23768941780Sjdunham  * 	Table 110/111 - parameter data for READ FULL STATUS
23868941780Sjdunham  *	Table 281 - TransportId format
23968941780Sjdunham  */
2408fe96085Stim szeto 
24168941780Sjdunham typedef struct scsi_prin_status_t {
24268941780Sjdunham 	uint8_t			reservation_key[8];
24368941780Sjdunham 	uint8_t			resbytes1[4];
24468941780Sjdunham 	uint8_t			r_holder : 1,
24568941780Sjdunham 				all_tg_pt : 1,
24668941780Sjdunham 				resbits : 6;
24768941780Sjdunham 	uint8_t			type : 4,
24868941780Sjdunham 				scope : 4;
24968941780Sjdunham 	uint8_t			resbytes2[4];
25068941780Sjdunham 	uint8_t			rel_tgt_port_id[2];
25168941780Sjdunham 	uint8_t			add_len[4];
25268941780Sjdunham 	scsi_transport_id_t	trans_id;
25368941780Sjdunham } scsi_prin_status_t;
25470c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 
25568941780Sjdunham typedef struct scsi_prin_full_status {
25668941780Sjdunham 	uint8_t			PRgeneration[4];
25768941780Sjdunham 	uint8_t			add_len[4];
25868941780Sjdunham 	scsi_prin_status_t	full_desc[1];
25968941780Sjdunham } scsi_prin_full_status_t;
26068941780Sjdunham 
26168941780Sjdunham /*
26268941780Sjdunham  * Information obtained from:
26368941780Sjdunham  *	SPC-3, Revision 23
26468941780Sjdunham  *	Section 6.12.1 PERSISTENCE RESERVE OUT
26568941780Sjdunham  *	Table 112 - PERSISTENCE RESERVE OUT command
26668941780Sjdunham  */
26768941780Sjdunham typedef struct scsi_cdb_prout {
26868941780Sjdunham 	uint8_t			cmd;
26968941780Sjdunham 	uint8_t			action : 5,
27068941780Sjdunham 				resbits : 3;
27168941780Sjdunham 	uint8_t			type : 4,
27268941780Sjdunham 				scope : 4;
27368941780Sjdunham 	uint8_t			resbytes[2];
27468941780Sjdunham 	uint8_t			param_len[4];
27568941780Sjdunham 	uint8_t			control;
27668941780Sjdunham } scsi_cdb_prout_t;
27768941780Sjdunham 
27868941780Sjdunham /*
27968941780Sjdunham  * Information obtained from:
28068941780Sjdunham  *	SPC-3, Revision 23
28168941780Sjdunham  *	Section 6.12.3 PERSISTENCE RESERVE OUT
28268941780Sjdunham  *	Table 114 - PERSISTENCE RESERVE OUT parameter list
28368941780Sjdunham  */
28468941780Sjdunham typedef struct scsi_prout_plist {
28568941780Sjdunham 	uint8_t			reservation_key[8];
28668941780Sjdunham 	uint8_t			service_key[8];
28768941780Sjdunham 	uint8_t			obsolete1[4];
28868941780Sjdunham 	uint8_t			aptpl : 1,
28968941780Sjdunham 				resbits1 : 1,
29068941780Sjdunham 				all_tg_pt : 1,
29168941780Sjdunham 				spec_i_pt : 1,
29268941780Sjdunham 				resbits2 : 4;
29368941780Sjdunham 	uint8_t			resbytes1;
29468941780Sjdunham 	uint8_t			obsolete2[2];
29568941780Sjdunham 	uint8_t			apd[1];
29668941780Sjdunham } scsi_prout_plist_t;
29768941780Sjdunham 
2988fe96085Stim szeto /*
2998fe96085Stim szeto  * Information obtained from:
3008fe96085Stim szeto  *	SPC-3, Revision 23
3018fe96085Stim szeto  *	Section 6.12.4 PERSISTENCE RESERVE OUT command with REGISTER AND MOVE
3028fe96085Stim szeto  *	Table 117 - REGISTER and MOVE service action  parameter list
3038fe96085Stim szeto  */
3048fe96085Stim szeto typedef struct scsi_prout_reg_move_plist {
3058fe96085Stim szeto 	uint8_t			reservation_key[8];
3068fe96085Stim szeto 	uint8_t			service_key[8];
3078fe96085Stim szeto 	uint8_t			resbytes1;
3088fe96085Stim szeto 	uint8_t			aptpl : 1,
3098fe96085Stim szeto 				unreg : 1,
3108fe96085Stim szeto 				resbits1 : 6;
3118fe96085Stim szeto 	uint8_t			rel_tgt_port_id[2];
3128fe96085Stim szeto 	uint8_t			tptid_len[4];
3138fe96085Stim szeto 	uint8_t			tptid[1];
3148fe96085Stim szeto } scsi_prout_reg_move_plist_t;
3158fe96085Stim szeto 
31668941780Sjdunham #elif defined(_BIT_FIELDS_HTOL)
31768941780Sjdunham /*
31868941780Sjdunham  * Information obtained from:
31968941780Sjdunham  *	SPC-3, Revision 23
32068941780Sjdunham  *	Section 6.11.1 PERSISTENCE RESERVE IN
32168941780Sjdunham  *	Table 101 - PERSISTENCE RESERVE IN command
32268941780Sjdunham  */
32368941780Sjdunham typedef struct scsi_cdb_prin {
32468941780Sjdunham 	uint8_t			cmd;
32568941780Sjdunham 	uint8_t			resbits : 3,
32668941780Sjdunham 				action : 5;
32768941780Sjdunham 	uint8_t			resbytes[5];
32868941780Sjdunham 	uint8_t			alloc_len[2];
32968941780Sjdunham 	uint8_t			control;
33068941780Sjdunham } scsi_cdb_prin_t;
33168941780Sjdunham 
33268941780Sjdunham /*
33368941780Sjdunham  * Information obtained from:
33468941780Sjdunham  *	SPC-3, Revision 23
33568941780Sjdunham  *	Section 6.11.2 PERSISTENCE RESERVE IN
33668941780Sjdunham  *	Table 103/104/105 - parameter data for READS KEYS
33768941780Sjdunham  */
33868941780Sjdunham typedef struct scsi_prin_rsrvdesc {
33968941780Sjdunham 	uint8_t			reservation_key[8];
34068941780Sjdunham 	uint8_t			obsolete1[4];
34168941780Sjdunham 	uint8_t			resbytes;
34268941780Sjdunham 	uint8_t			scope : 4,
34368941780Sjdunham 				type : 4;
34468941780Sjdunham 	uint8_t			obsolete2[2];
34568941780Sjdunham } scsi_prin_rsrvdesc_t;
34668941780Sjdunham typedef struct scsi_prin_readrsrv {
34768941780Sjdunham 	uint8_t			PRgeneration[4];
34868941780Sjdunham 	uint8_t			add_len[4];
34968941780Sjdunham 	union {
35068941780Sjdunham 		uint64_t		service_key[1];
35168941780Sjdunham 		scsi_prin_rsrvdesc_t	res_key_list[1];
35268941780Sjdunham 	} key_list;
35368941780Sjdunham } scsi_prin_readrsrv_t;
35468941780Sjdunham 
35568941780Sjdunham /*
35668941780Sjdunham  * Information obtained from:
35768941780Sjdunham  *	SPC-3, Revision 23
35868941780Sjdunham  *	Section 6.11.4 PERSISTENCE RESERVE IN
35968941780Sjdunham  * 	Table 108 - parameter data for REPORT CAPABILTIES
36068941780Sjdunham  */
36168941780Sjdunham typedef struct scsi_per_res_type {
36268941780Sjdunham 	uint8_t			wr_ex_ar : 1,
36368941780Sjdunham 				ex_ac_ro : 1,
36468941780Sjdunham 				wr_ex_ro : 1,
36568941780Sjdunham 				resbits3 : 1,
36668941780Sjdunham 				ex_ac : 1,
36768941780Sjdunham 				resbits2 : 1,
36868941780Sjdunham 				wr_ex : 1,
36968941780Sjdunham 				resbits1 : 1;
37068941780Sjdunham 	uint8_t			resbits4 : 7,
37168941780Sjdunham 				ex_ac_ar : 1;
37268941780Sjdunham } scsi_per_res_type_t;
37370c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States /*
37470c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States  * Refer SPC-3, Revision 23
37570c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States  * Section 6.11.4 REPORT CAPABILITIES service action
37670c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States  */
37768941780Sjdunham typedef struct scsi_prin_rpt_cap {
37868941780Sjdunham 	uint8_t			length[2];
37968941780Sjdunham 	uint8_t			resbits2 : 3,
38068941780Sjdunham 				crh : 1,
38168941780Sjdunham 				sip_c : 1,
38268941780Sjdunham 				atp_c : 1,
38368941780Sjdunham 				resbits1 : 1,
38468941780Sjdunham 				ptpl_c : 1;
38568941780Sjdunham 	uint8_t			tmv : 1,
38668941780Sjdunham 				resbits3 : 6,
38768941780Sjdunham 				ptpl_a : 1;
38868941780Sjdunham 	scsi_per_res_type_t	pr_type;
38968941780Sjdunham 	uint8_t			resbytes[2];
39068941780Sjdunham } scsi_prin_rpt_cap_t;
39168941780Sjdunham 
39268941780Sjdunham /*
3938fe96085Stim szeto  * Refer SPC-3, Revision 23
3948fe96085Stim szeto  * Section 7.5.4 TransportID identifiers
3958fe96085Stim szeto  */
3968fe96085Stim szeto typedef struct scsi_transport_id {
3978fe96085Stim szeto 	uint8_t			format_code : 2,
3988fe96085Stim szeto 				resbits : 2,
3998fe96085Stim szeto 				protocol_id : 4;
4008fe96085Stim szeto 	uint8_t			protocol_data[1];
4018fe96085Stim szeto } scsi_transport_id_t;
4028fe96085Stim szeto 
4038fe96085Stim szeto typedef struct scsi_fc_transport_id {
4048fe96085Stim szeto 	uint8_t			format_code : 2,
4058fe96085Stim szeto 				resbits : 2,
4068fe96085Stim szeto 				protocol_id : 4;
4078fe96085Stim szeto 	uint8_t			rsvbytes1[7];
4088fe96085Stim szeto 	uint8_t			port_name[8];
4098fe96085Stim szeto 	uint8_t			rsvbytes2[8];
4108fe96085Stim szeto } scsi_fc_transport_id_t;
4118fe96085Stim szeto 
4128fe96085Stim szeto typedef struct iscsi_transport_id {
4138fe96085Stim szeto 	uint8_t			format_code : 2,
4148fe96085Stim szeto 				resbits : 2,
4158fe96085Stim szeto 				protocol_id : 4;
4168fe96085Stim szeto 	uint8_t			rsvbyte1;
4178fe96085Stim szeto 	uint8_t			add_len[2];
4188fe96085Stim szeto 	char			iscsi_name[1];
4198fe96085Stim szeto } iscsi_transport_id_t;
4208fe96085Stim szeto 
42170c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 
42270c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States typedef struct scsi_srp_transport_id {
42370c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 	uint8_t			format_code : 2,
42470c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 				resbits : 2,
42570c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 				protocol_id : 4;
42670c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 	uint8_t			rsvbytes1[7];
42770c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 	uint8_t			srp_name[16];
42870c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States } scsi_srp_transport_id_t;
42970c284caSPeter Cudhea - Sun Microsystems - Burlington, MA United States 
4308fe96085Stim szeto /*
43168941780Sjdunham  * Information obtained from:
43268941780Sjdunham  *	SPC-3, Revision 23
43368941780Sjdunham  *	Section 6.11.5 PERSISTENCE RESERVE IN
43468941780Sjdunham  * 	Table 110/111 - parameter data for READ FULL STATUS
43568941780Sjdunham  *	Table 281 - TransportId format
43668941780Sjdunham  */
4378fe96085Stim szeto 
43868941780Sjdunham typedef struct scsi_prin_status_t {
43968941780Sjdunham 	uint8_t			reservation_key[8];
44068941780Sjdunham 	uint8_t			resbytes1[4];
44168941780Sjdunham 	uint8_t			resbits : 6,
44268941780Sjdunham 				all_tg_pt : 1,
44368941780Sjdunham 				r_holder : 1;
44468941780Sjdunham 	uint8_t			scope : 4,
44568941780Sjdunham 				type : 4;
44668941780Sjdunham 	uint8_t			resbytes2[4];
44768941780Sjdunham 	uint8_t			rel_tgt_port_id[2];
44868941780Sjdunham 	uint8_t			add_len[4];
44968941780Sjdunham 	scsi_transport_id_t	trans_id;
45068941780Sjdunham } scsi_prin_status_t;
45168941780Sjdunham typedef struct scsi_prin_full_status {
45268941780Sjdunham 	uint8_t			PRgeneration[4];
45368941780Sjdunham 	uint8_t			add_len[4];
45468941780Sjdunham 	scsi_prin_status_t	full_desc[1];
45568941780Sjdunham } scsi_prin_full_status_t;
45668941780Sjdunham 
45768941780Sjdunham /*
45868941780Sjdunham  * Information obtained from:
45968941780Sjdunham  *	SPC-3, Revision 23
46068941780Sjdunham  *	Section 6.12.1 PERSISTENCE RESERVE OUT
46168941780Sjdunham  *	Table 112 - PERSISTENCE RESERVE OUT command
46268941780Sjdunham  */
46368941780Sjdunham typedef struct scsi_cdb_prout {
46468941780Sjdunham 	uint8_t			cmd;
46568941780Sjdunham 	uint8_t			resbits : 3,
46668941780Sjdunham 				action : 5;
46768941780Sjdunham 	uint8_t			scope : 4,
46868941780Sjdunham 				type : 4;
46968941780Sjdunham 	uint8_t			resbytes[2];
47068941780Sjdunham 	uint8_t			param_len[4];
47168941780Sjdunham 	uint8_t			control;
47268941780Sjdunham } scsi_cdb_prout_t;
47368941780Sjdunham 
47468941780Sjdunham /*
47568941780Sjdunham  * Information obtained from:
47668941780Sjdunham  *	SPC-3, Revision 23
47768941780Sjdunham  *	Section 6.12.3 PERSISTENCE RESERVE OUT
47868941780Sjdunham  *	Table 114 - PERSISTENCE RESERVE OUT parameter list
47968941780Sjdunham  */
48068941780Sjdunham typedef struct scsi_prout_plist {
48168941780Sjdunham 	uint8_t			reservation_key[8];
48268941780Sjdunham 	uint8_t			service_key[8];
48368941780Sjdunham 	uint8_t			obsolete1[4];
48468941780Sjdunham 	uint8_t			resbits1 : 4,
48568941780Sjdunham 				spec_i_pt : 1,
48668941780Sjdunham 				all_tg_pt : 1,
48768941780Sjdunham 				resbits2 : 1,
48868941780Sjdunham 				aptpl : 1;
48968941780Sjdunham 	uint8_t			resbytes1;
49068941780Sjdunham 	uint8_t			obsolete2[2];
49168941780Sjdunham 	uint8_t			apd[1];
49268941780Sjdunham } scsi_prout_plist_t;
49368941780Sjdunham 
4948fe96085Stim szeto /*
4958fe96085Stim szeto  * Information obtained from:
4968fe96085Stim szeto  *	SPC-3, Revision 23
4978fe96085Stim szeto  *	Section 6.12.4 PERSISTENCE RESERVE OUT command with REGISTER AND MOVE
4988fe96085Stim szeto  *	Table 117 - REGISTER and MOVE service action  parameter list
4998fe96085Stim szeto  */
5008fe96085Stim szeto typedef struct scsi_prout_reg_move_plist {
5018fe96085Stim szeto 	uint8_t			reservation_key[8];
5028fe96085Stim szeto 	uint8_t			service_key[8];
5038fe96085Stim szeto 	uint8_t			resbytes1;
5048fe96085Stim szeto 	uint8_t			resbits1 : 6,
5058fe96085Stim szeto 				unreg    : 1,
5068fe96085Stim szeto 				aptpl    : 1;
5078fe96085Stim szeto 	uint8_t			rel_tgt_port_id[2];
5088fe96085Stim szeto 	uint8_t			tptid_len[4];
5098fe96085Stim szeto 	uint8_t			tptid[1];
5108fe96085Stim szeto } scsi_prout_reg_move_plist_t;
5118fe96085Stim szeto 
51268941780Sjdunham #else
51368941780Sjdunham #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
51468941780Sjdunham #endif	/* _BIT_FIELDS_LTOH */
51568941780Sjdunham #ifdef	__cplusplus
51668941780Sjdunham }
51768941780Sjdunham #endif
51868941780Sjdunham 
51968941780Sjdunham #endif	/* _SYS_SCSI_GENERIC_PERSIST_H */
520