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