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 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* 35 * Definitions for multi-host device I/O control commands 36 */ 37 #define MHIOC ('M'<<8) 38 #define MHIOCENFAILFAST (MHIOC|1) 39 #define MHIOCTKOWN (MHIOC|2) 40 #define MHIOCRELEASE (MHIOC|3) 41 #define MHIOCSTATUS (MHIOC|4) 42 #define MHIOCGRP_INKEYS (MHIOC|5) 43 #define MHIOCGRP_INRESV (MHIOC|6) 44 #define MHIOCGRP_REGISTER (MHIOC|7) 45 #define MHIOCGRP_RESERVE (MHIOC|8) 46 #define MHIOCGRP_PREEMPTANDABORT (MHIOC|9) 47 #define MHIOCGRP_PREEMPT (MHIOC|10) 48 #define MHIOCGRP_CLEAR (MHIOC|11) 49 #define MHIOCGRP_REGISTERANDIGNOREKEY (MHIOC|14) 50 #define MHIOCQRESERVE (MHIOC|12) 51 #define MHIOCREREGISTERDEVID (MHIOC|13) 52 53 /* 54 * Following is the structure to specify the delay parameters in 55 * milliseconds, via the MHIOCTKOWN ioctl. 56 */ 57 struct mhioctkown { 58 int reinstate_resv_delay; 59 int min_ownership_delay; 60 int max_ownership_delay; 61 }; 62 63 #define MHIOC_RESV_KEY_SIZE 8 64 typedef struct mhioc_resv_key { 65 uchar_t key[MHIOC_RESV_KEY_SIZE]; 66 } mhioc_resv_key_t; 67 68 typedef struct mhioc_key_list { 69 uint32_t listsize; 70 uint32_t listlen; 71 mhioc_resv_key_t *list; 72 } mhioc_key_list_t; 73 74 typedef struct mhioc_inkeys { 75 uint32_t generation; 76 mhioc_key_list_t *li; 77 } mhioc_inkeys_t; 78 79 #if defined(_SYSCALL32) 80 typedef struct mhioc_key_list32 { 81 uint32_t listsize; 82 uint32_t listlen; 83 caddr32_t list; 84 } mhioc_key_list32_t; 85 86 typedef struct mhioc_inkeys32 { 87 uint32_t generation; 88 caddr32_t li; 89 } mhioc_inkeys32_t; 90 #endif 91 92 typedef struct mhioc_resv_desc { 93 mhioc_resv_key_t key; 94 uint8_t type; 95 uint8_t scope; 96 uint32_t scope_specific_addr; 97 } mhioc_resv_desc_t; 98 99 typedef struct mhioc_resv_desc_list { 100 uint32_t listsize; 101 uint32_t listlen; 102 mhioc_resv_desc_t *list; 103 } mhioc_resv_desc_list_t; 104 105 typedef struct mhioc_inresvs { 106 uint32_t generation; 107 mhioc_resv_desc_list_t *li; 108 } mhioc_inresvs_t; 109 110 #if defined(_SYSCALL32) 111 typedef struct mhioc_resv_desc_list32 { 112 uint32_t listsize; 113 uint32_t listlen; 114 caddr32_t list; 115 } mhioc_resv_desc_list32_t; 116 117 typedef struct mhioc_inresvs32 { 118 uint32_t generation; 119 caddr32_t li; 120 } mhioc_inresvs32_t; 121 #endif 122 123 typedef struct mhioc_register { 124 mhioc_resv_key_t oldkey; 125 mhioc_resv_key_t newkey; 126 boolean_t aptpl; /* True if persistent across power failures */ 127 } mhioc_register_t; 128 129 typedef struct mhioc_preemptandabort { 130 mhioc_resv_desc_t resvdesc; 131 mhioc_resv_key_t victim_key; 132 } mhioc_preemptandabort_t; 133 134 typedef struct mhioc_registerandignorekey { 135 mhioc_resv_key_t newkey; 136 boolean_t aptpl; /* True if persistent across power failures */ 137 } mhioc_registerandignorekey_t; 138 139 /* 140 * SCSI-3 PGR Reservation Type Codes. Codes with the _OBSOLETE suffix 141 * have been removed from the SCSI3 PGR standard. 142 */ 143 #define SCSI3_RESV_READSHARED_OBSOLETE 0 144 #define SCSI3_RESV_WRITEEXCLUSIVE 1 145 #define SCSI3_RESV_READEXCLUSIVE_OBSOLETE 2 146 #define SCSI3_RESV_EXCLUSIVEACCESS 3 147 #define SCSI3_RESV_SHAREDACCESS_OBSOLETE 4 148 #define SCSI3_RESV_WRITEEXCLUSIVEREGISTRANTSONLY 5 149 #define SCSI3_RESV_EXCLUSIVEACCESSREGISTRANTSONLY 6 150 151 #define SCSI3_SCOPE_LOGICALUNIT 0 152 #define SCSI3_SCOPE_EXTENT_OBSOLETE 1 153 #define SCSI3_SCOPE_ELEMENT 2 154 155 #ifdef __cplusplus 156 } 157 #endif 158 159 #endif /* _SYS_MHD_H */ 160