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