4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_SCSI_GENERIC_PERSIST_H
27 #define _SYS_SCSI_GENERIC_PERSIST_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
36 * SCSI Persistence Data
38 * Format of data returned as a result of PERSISTENCE RESERVER { IN | OUT }
42 * SPC-3 revision 23, Section 6.11.1, Table 102
43 * Persistent Reservations
44 * Persistent Reserve In service actions
46 #define PR_IN_READ_KEYS 0x0 /* Read all registered reservation keys */
47 #define PR_IN_READ_RESERVATION 0x1 /* Reads th persistent reservations */
48 #define PR_IN_REPORT_CAPABILITIES 0x2 /* Returns capability information */
49 #define PR_IN_READ_FULL_STATUS 0x3 /* Reads complete information about all */
50 /* registrations and the persistent */
51 /* reservations, if any */
53 * SPC-3 revision 23, Section 6.11.3.3, Table 106
54 * Persistent reservation scope codes
56 #define PR_LU_SCOPE 0x0 /* Persistent reservation applies to */
57 /* full logical unit */
59 * SPC-3 revision 23, Section 6.11.3.4, Table 107
60 * Persistent Reservations
61 * Persistent reservation type codes
63 #define PGR_TYPE_WR_EX 0x1 /* Write Exclusive */
64 #define PGR_TYPE_EX_AC 0x3 /* Exclusive Access */
65 #define PGR_TYPE_WR_EX_RO 0x5 /* Write Exclusive, Registrants Only */
66 #define PGR_TYPE_EX_AC_RO 0x6 /* Exclusive Access, Registrants Only */
67 #define PGR_TYPE_WR_EX_AR 0x7 /* Write Exclusive, All Registrants */
68 #define PGR_TYPE_EX_AC_AR 0x8 /* Exclusive Access, All Registrants */
71 * Information obtained from:
73 * Section 6.11.5 PERSISTENCE RESERVE IN
74 * Table 111 - full status descriptor format
76 /* Table 289 - iSCSI Initiator Device TransportID format */
78 #define iSCSI_PROTOCOL_ID 0x5 /* Table 262 - iSCSI Protocol ID */
79 #define WW_UID_DEVICE_NAME 0x0 /* Table 288 - iSCSI Transport IDs */
82 #if defined(_BIT_FIELDS_LTOH)
84 * Information obtained from:
86 * Section 6.11.1 PERSISTENCE RESERVE IN
87 * Table 101 - PERSISTENCE RESERVE IN command
89 typedef struct scsi_cdb_prin
{
99 * Information obtained from:
101 * Section 6.11.2 PERSISTENCE RESERVE IN
102 * Table 103/104/105 - parameter data for READS KEYS
104 typedef struct scsi_prin_rsrvdesc
{
105 uint8_t reservation_key
[8];
106 uint8_t obsolete1
[4];
110 uint8_t obsolete2
[2];
111 } scsi_prin_rsrvdesc_t
;
112 typedef struct scsi_prin_readrsrv
{
113 uint8_t PRgeneration
[4];
116 uint64_t service_key
[1];
117 scsi_prin_rsrvdesc_t res_key_list
[1];
119 } scsi_prin_readrsrv_t
;
122 * Information obtained from:
124 * Section 6.11.4 PERSISTENCE RESERVE IN
125 * Table 108 - parameter data for REPORT CAPABILTIES
127 typedef struct scsi_per_res_type
{
128 uint8_t resbits1
: 1,
136 uint8_t ex_ac_ar
: 1,
138 } scsi_per_res_type_t
;
139 typedef struct scsi_prin_rpt_cap
{
150 scsi_per_res_type_t pr_type
;
152 } scsi_prin_rpt_cap_t
;
155 * Information obtained from:
157 * Section 6.11.5 PERSISTENCE RESERVE IN
158 * Table 110/111 - parameter data for READ FULL STATUS
159 * Table 281 - TransportId format
161 typedef struct scsi_transport_id
{
162 uint8_t protocol_id
: 4,
167 } scsi_transport_id_t
;
168 typedef struct scsi_prin_status_t
{
169 uint8_t reservation_key
[8];
170 uint8_t resbytes1
[4];
171 uint8_t r_holder
: 1,
176 uint8_t resbytes2
[4];
177 uint8_t rel_tgt_port_id
[2];
179 scsi_transport_id_t trans_id
;
180 } scsi_prin_status_t
;
181 typedef struct scsi_prin_full_status
{
182 uint8_t PRgeneration
[4];
184 scsi_prin_status_t full_desc
[1];
185 } scsi_prin_full_status_t
;
188 * Information obtained from:
190 * Section 6.12.1 PERSISTENCE RESERVE OUT
191 * Table 112 - PERSISTENCE RESERVE OUT command
193 typedef struct scsi_cdb_prout
{
200 uint8_t param_len
[4];
205 * Information obtained from:
207 * Section 6.12.3 PERSISTENCE RESERVE OUT
208 * Table 114 - PERSISTENCE RESERVE OUT parameter list
210 typedef struct scsi_prout_plist
{
211 uint8_t reservation_key
[8];
212 uint8_t service_key
[8];
213 uint8_t obsolete1
[4];
220 uint8_t obsolete2
[2];
222 } scsi_prout_plist_t
;
224 #elif defined(_BIT_FIELDS_HTOL)
226 * Information obtained from:
228 * Section 6.11.1 PERSISTENCE RESERVE IN
229 * Table 101 - PERSISTENCE RESERVE IN command
231 typedef struct scsi_cdb_prin
{
236 uint8_t alloc_len
[2];
241 * Information obtained from:
243 * Section 6.11.2 PERSISTENCE RESERVE IN
244 * Table 103/104/105 - parameter data for READS KEYS
246 typedef struct scsi_prin_rsrvdesc
{
247 uint8_t reservation_key
[8];
248 uint8_t obsolete1
[4];
252 uint8_t obsolete2
[2];
253 } scsi_prin_rsrvdesc_t
;
254 typedef struct scsi_prin_readrsrv
{
255 uint8_t PRgeneration
[4];
258 uint64_t service_key
[1];
259 scsi_prin_rsrvdesc_t res_key_list
[1];
261 } scsi_prin_readrsrv_t
;
264 * Information obtained from:
266 * Section 6.11.4 PERSISTENCE RESERVE IN
267 * Table 108 - parameter data for REPORT CAPABILTIES
269 typedef struct scsi_per_res_type
{
270 uint8_t wr_ex_ar
: 1,
278 uint8_t resbits4
: 7,
280 } scsi_per_res_type_t
;
281 typedef struct scsi_prin_rpt_cap
{
283 uint8_t resbits2
: 3,
292 scsi_per_res_type_t pr_type
;
294 } scsi_prin_rpt_cap_t
;
297 * Information obtained from:
299 * Section 6.11.5 PERSISTENCE RESERVE IN
300 * Table 110/111 - parameter data for READ FULL STATUS
301 * Table 281 - TransportId format
303 typedef struct scsi_transport_id
{
304 uint8_t format_code
: 2,
309 } scsi_transport_id_t
;
310 typedef struct scsi_prin_status_t
{
311 uint8_t reservation_key
[8];
312 uint8_t resbytes1
[4];
318 uint8_t resbytes2
[4];
319 uint8_t rel_tgt_port_id
[2];
321 scsi_transport_id_t trans_id
;
322 } scsi_prin_status_t
;
323 typedef struct scsi_prin_full_status
{
324 uint8_t PRgeneration
[4];
326 scsi_prin_status_t full_desc
[1];
327 } scsi_prin_full_status_t
;
330 * Information obtained from:
332 * Section 6.12.1 PERSISTENCE RESERVE OUT
333 * Table 112 - PERSISTENCE RESERVE OUT command
335 typedef struct scsi_cdb_prout
{
342 uint8_t param_len
[4];
347 * Information obtained from:
349 * Section 6.12.3 PERSISTENCE RESERVE OUT
350 * Table 114 - PERSISTENCE RESERVE OUT parameter list
352 typedef struct scsi_prout_plist
{
353 uint8_t reservation_key
[8];
354 uint8_t service_key
[8];
355 uint8_t obsolete1
[4];
356 uint8_t resbits1
: 4,
362 uint8_t obsolete2
[2];
364 } scsi_prout_plist_t
;
367 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
368 #endif /* _BIT_FIELDS_LTOH */
372 * SPC-3 revision 23, Section 6.12.2, Table 113
373 * Persistent Reservations
374 * Persistent Reserve Out service action codes
376 #define PR_OUT_REGISTER 0x0 /* Register/unregister a reservation */
377 /* key with the device server */
378 #define PR_OUT_RESERVE 0x1 /* Create a persistent reservation */
379 /* having a specified SCOPE & TYPE */
380 #define PR_OUT_RELEASE 0x2 /* Release the selected persistent */
382 #define PR_OUT_CLEAR 0x3 /* Clears all reservation keys and */
383 /* all persistent reservations */
384 #define PR_OUT_PREEMPT 0x4 /* Preempts persistent reservations */
385 /* and/or removes reservations */
386 #define PR_OUT_PREEMPT_ABORT 0x5 /* Preempts persistent reservations */
387 /* and/or removes reservations, and */
388 /* aborts all tasks for all preempted */
390 #define PR_OUT_REGISTER_AND_IGNORE_EXISTING_KEY 0x06
391 /* Register a reservation key with */
392 /* the device server, or unregister a */
393 /* reservation key */
394 #define PR_OUT_REGISTER_MOVE 0x7 /* Register a reservation key for */
395 /* another I_T nexus with the device */
396 /* server and move a persistent */
397 /* reservation to the I_T nexus */
404 #endif /* _SYS_SCSI_GENERIC_PERSIST_H */