xref: /titanic_51/usr/src/uts/common/sys/mhd.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_MHD_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_MHD_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Definitions for multi-host device I/O control commands
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate #define	MHIOC				('M'<<8)
40*7c478bd9Sstevel@tonic-gate #define	MHIOCENFAILFAST			(MHIOC|1)
41*7c478bd9Sstevel@tonic-gate #define	MHIOCTKOWN			(MHIOC|2)
42*7c478bd9Sstevel@tonic-gate #define	MHIOCRELEASE			(MHIOC|3)
43*7c478bd9Sstevel@tonic-gate #define	MHIOCSTATUS			(MHIOC|4)
44*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_INKEYS 		(MHIOC|5)
45*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_INRESV 		(MHIOC|6)
46*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_REGISTER		(MHIOC|7)
47*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_RESERVE		(MHIOC|8)
48*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_PREEMPTANDABORT	(MHIOC|9)
49*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_PREEMPT		(MHIOC|10)
50*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_CLEAR			(MHIOC|11)
51*7c478bd9Sstevel@tonic-gate #define	MHIOCGRP_REGISTERANDIGNOREKEY	(MHIOC|14)
52*7c478bd9Sstevel@tonic-gate #define	MHIOCQRESERVE			(MHIOC|12)
53*7c478bd9Sstevel@tonic-gate #define	MHIOCREREGISTERDEVID		(MHIOC|13)
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * Following is the structure to specify the delay parameters in
57*7c478bd9Sstevel@tonic-gate  * milliseconds, via the MHIOCTKOWN ioctl.
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate struct mhioctkown {
60*7c478bd9Sstevel@tonic-gate 	int reinstate_resv_delay;
61*7c478bd9Sstevel@tonic-gate 	int min_ownership_delay;
62*7c478bd9Sstevel@tonic-gate 	int max_ownership_delay;
63*7c478bd9Sstevel@tonic-gate };
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate #define	MHIOC_RESV_KEY_SIZE	8
66*7c478bd9Sstevel@tonic-gate typedef struct mhioc_resv_key {
67*7c478bd9Sstevel@tonic-gate 	uchar_t	key[MHIOC_RESV_KEY_SIZE];
68*7c478bd9Sstevel@tonic-gate } mhioc_resv_key_t;
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate typedef struct mhioc_key_list {
71*7c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
72*7c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
73*7c478bd9Sstevel@tonic-gate 	mhioc_resv_key_t	*list;
74*7c478bd9Sstevel@tonic-gate } mhioc_key_list_t;
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate typedef struct mhioc_inkeys {
77*7c478bd9Sstevel@tonic-gate 	uint32_t		generation;
78*7c478bd9Sstevel@tonic-gate 	mhioc_key_list_t	*li;
79*7c478bd9Sstevel@tonic-gate } mhioc_inkeys_t;
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
82*7c478bd9Sstevel@tonic-gate struct mhioc_key_list32 {
83*7c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
84*7c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
85*7c478bd9Sstevel@tonic-gate 	caddr32_t		list;
86*7c478bd9Sstevel@tonic-gate } mhioc_key_list32_t;
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate struct mhioc_inkeys32 {
89*7c478bd9Sstevel@tonic-gate 	uint32_t		generation;
90*7c478bd9Sstevel@tonic-gate 	caddr32_t		li;
91*7c478bd9Sstevel@tonic-gate } mhioc_inkeys32_t;
92*7c478bd9Sstevel@tonic-gate #endif
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate typedef struct mhioc_resv_desc {
95*7c478bd9Sstevel@tonic-gate 	mhioc_resv_key_t	key;
96*7c478bd9Sstevel@tonic-gate 	uint8_t			type;
97*7c478bd9Sstevel@tonic-gate 	uint8_t			scope;
98*7c478bd9Sstevel@tonic-gate 	uint32_t		scope_specific_addr;
99*7c478bd9Sstevel@tonic-gate } mhioc_resv_desc_t;
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate typedef struct mhioc_resv_desc_list {
102*7c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
103*7c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
104*7c478bd9Sstevel@tonic-gate 	mhioc_resv_desc_t	*list;
105*7c478bd9Sstevel@tonic-gate } mhioc_resv_desc_list_t;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate typedef struct mhioc_inresvs {
108*7c478bd9Sstevel@tonic-gate 	uint32_t		generation;
109*7c478bd9Sstevel@tonic-gate 	mhioc_resv_desc_list_t	*li;
110*7c478bd9Sstevel@tonic-gate } mhioc_inresvs_t;
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
113*7c478bd9Sstevel@tonic-gate struct mhioc_resv_desc_list32 {
114*7c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
115*7c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
116*7c478bd9Sstevel@tonic-gate 	caddr32_t		list;
117*7c478bd9Sstevel@tonic-gate } mhioc_resv_desc_list32_t;
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate typedef struct mhioc_inresvs32 {
120*7c478bd9Sstevel@tonic-gate 	uint32_t		generation;
121*7c478bd9Sstevel@tonic-gate 	caddr32_t		li;
122*7c478bd9Sstevel@tonic-gate } mhioc_inresvs32_t;
123*7c478bd9Sstevel@tonic-gate #endif
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate typedef struct mhioc_register {
126*7c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	oldkey;
127*7c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	newkey;
128*7c478bd9Sstevel@tonic-gate     boolean_t		aptpl;  /* True if persistent across power failures */
129*7c478bd9Sstevel@tonic-gate } mhioc_register_t;
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate typedef struct mhioc_preemptandabort {
132*7c478bd9Sstevel@tonic-gate     mhioc_resv_desc_t	resvdesc;
133*7c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	victim_key;
134*7c478bd9Sstevel@tonic-gate } mhioc_preemptandabort_t;
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate typedef struct mhioc_registerandignorekey {
137*7c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	newkey;
138*7c478bd9Sstevel@tonic-gate     boolean_t		aptpl;  /* True if persistent across power failures */
139*7c478bd9Sstevel@tonic-gate } mhioc_registerandignorekey_t;
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate /*
142*7c478bd9Sstevel@tonic-gate  * SCSI-3 PGR Reservation Type Codes.  Codes with the _OBSOLETE suffix
143*7c478bd9Sstevel@tonic-gate  * have been removed from the SCSI3 PGR standard.
144*7c478bd9Sstevel@tonic-gate  */
145*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_READSHARED_OBSOLETE			0
146*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_WRITEEXCLUSIVE			1
147*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_READEXCLUSIVE_OBSOLETE		2
148*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_EXCLUSIVEACCESS			3
149*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_SHAREDACCESS_OBSOLETE		4
150*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_WRITEEXCLUSIVEREGISTRANTSONLY	5
151*7c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_EXCLUSIVEACCESSREGISTRANTSONLY	6
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate #define	SCSI3_SCOPE_LOGICALUNIT				0
154*7c478bd9Sstevel@tonic-gate #define	SCSI3_SCOPE_EXTENT_OBSOLETE			1
155*7c478bd9Sstevel@tonic-gate #define	SCSI3_SCOPE_ELEMENT				2
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
158*7c478bd9Sstevel@tonic-gate }
159*7c478bd9Sstevel@tonic-gate #endif
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_MHD_H */
162