xref: /illumos-gate/usr/src/uts/common/sys/mhd.h (revision 245cbc65)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_MHD_H
287c478bd9Sstevel@tonic-gate #define	_SYS_MHD_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef __cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Definitions for multi-host device I/O control commands
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate #define	MHIOC				('M'<<8)
387c478bd9Sstevel@tonic-gate #define	MHIOCENFAILFAST			(MHIOC|1)
397c478bd9Sstevel@tonic-gate #define	MHIOCTKOWN			(MHIOC|2)
407c478bd9Sstevel@tonic-gate #define	MHIOCRELEASE			(MHIOC|3)
417c478bd9Sstevel@tonic-gate #define	MHIOCSTATUS			(MHIOC|4)
42*245cbc65SToomas Soome #define	MHIOCGRP_INKEYS			(MHIOC|5)
43*245cbc65SToomas Soome #define	MHIOCGRP_INRESV			(MHIOC|6)
447c478bd9Sstevel@tonic-gate #define	MHIOCGRP_REGISTER		(MHIOC|7)
457c478bd9Sstevel@tonic-gate #define	MHIOCGRP_RESERVE		(MHIOC|8)
467c478bd9Sstevel@tonic-gate #define	MHIOCGRP_PREEMPTANDABORT	(MHIOC|9)
477c478bd9Sstevel@tonic-gate #define	MHIOCGRP_PREEMPT		(MHIOC|10)
487c478bd9Sstevel@tonic-gate #define	MHIOCGRP_CLEAR			(MHIOC|11)
497c478bd9Sstevel@tonic-gate #define	MHIOCGRP_REGISTERANDIGNOREKEY	(MHIOC|14)
507c478bd9Sstevel@tonic-gate #define	MHIOCQRESERVE			(MHIOC|12)
517c478bd9Sstevel@tonic-gate #define	MHIOCREREGISTERDEVID		(MHIOC|13)
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Following is the structure to specify the delay parameters in
557c478bd9Sstevel@tonic-gate  * milliseconds, via the MHIOCTKOWN ioctl.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate struct mhioctkown {
587c478bd9Sstevel@tonic-gate 	int reinstate_resv_delay;
597c478bd9Sstevel@tonic-gate 	int min_ownership_delay;
607c478bd9Sstevel@tonic-gate 	int max_ownership_delay;
617c478bd9Sstevel@tonic-gate };
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #define	MHIOC_RESV_KEY_SIZE	8
647c478bd9Sstevel@tonic-gate typedef struct mhioc_resv_key {
657c478bd9Sstevel@tonic-gate 	uchar_t	key[MHIOC_RESV_KEY_SIZE];
667c478bd9Sstevel@tonic-gate } mhioc_resv_key_t;
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate typedef struct mhioc_key_list {
697c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
707c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
717c478bd9Sstevel@tonic-gate 	mhioc_resv_key_t	*list;
727c478bd9Sstevel@tonic-gate } mhioc_key_list_t;
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate typedef struct mhioc_inkeys {
757c478bd9Sstevel@tonic-gate 	uint32_t		generation;
767c478bd9Sstevel@tonic-gate 	mhioc_key_list_t	*li;
777c478bd9Sstevel@tonic-gate } mhioc_inkeys_t;
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
80*245cbc65SToomas Soome typedef struct mhioc_key_list32 {
817c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
827c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
837c478bd9Sstevel@tonic-gate 	caddr32_t		list;
847c478bd9Sstevel@tonic-gate } mhioc_key_list32_t;
857c478bd9Sstevel@tonic-gate 
86*245cbc65SToomas Soome typedef struct mhioc_inkeys32 {
877c478bd9Sstevel@tonic-gate 	uint32_t		generation;
887c478bd9Sstevel@tonic-gate 	caddr32_t		li;
897c478bd9Sstevel@tonic-gate } mhioc_inkeys32_t;
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate typedef struct mhioc_resv_desc {
937c478bd9Sstevel@tonic-gate 	mhioc_resv_key_t	key;
947c478bd9Sstevel@tonic-gate 	uint8_t			type;
957c478bd9Sstevel@tonic-gate 	uint8_t			scope;
967c478bd9Sstevel@tonic-gate 	uint32_t		scope_specific_addr;
977c478bd9Sstevel@tonic-gate } mhioc_resv_desc_t;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate typedef struct mhioc_resv_desc_list {
1007c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
1017c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
1027c478bd9Sstevel@tonic-gate 	mhioc_resv_desc_t	*list;
1037c478bd9Sstevel@tonic-gate } mhioc_resv_desc_list_t;
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate typedef struct mhioc_inresvs {
1067c478bd9Sstevel@tonic-gate 	uint32_t		generation;
1077c478bd9Sstevel@tonic-gate 	mhioc_resv_desc_list_t	*li;
1087c478bd9Sstevel@tonic-gate } mhioc_inresvs_t;
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
111*245cbc65SToomas Soome typedef struct mhioc_resv_desc_list32 {
1127c478bd9Sstevel@tonic-gate 	uint32_t		listsize;
1137c478bd9Sstevel@tonic-gate 	uint32_t		listlen;
1147c478bd9Sstevel@tonic-gate 	caddr32_t		list;
1157c478bd9Sstevel@tonic-gate } mhioc_resv_desc_list32_t;
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate typedef struct mhioc_inresvs32 {
1187c478bd9Sstevel@tonic-gate 	uint32_t		generation;
1197c478bd9Sstevel@tonic-gate 	caddr32_t		li;
1207c478bd9Sstevel@tonic-gate } mhioc_inresvs32_t;
1217c478bd9Sstevel@tonic-gate #endif
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate typedef struct mhioc_register {
1247c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	oldkey;
1257c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	newkey;
1267c478bd9Sstevel@tonic-gate     boolean_t		aptpl;  /* True if persistent across power failures */
1277c478bd9Sstevel@tonic-gate } mhioc_register_t;
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate typedef struct mhioc_preemptandabort {
1307c478bd9Sstevel@tonic-gate     mhioc_resv_desc_t	resvdesc;
1317c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	victim_key;
1327c478bd9Sstevel@tonic-gate } mhioc_preemptandabort_t;
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate typedef struct mhioc_registerandignorekey {
1357c478bd9Sstevel@tonic-gate     mhioc_resv_key_t	newkey;
1367c478bd9Sstevel@tonic-gate     boolean_t		aptpl;  /* True if persistent across power failures */
1377c478bd9Sstevel@tonic-gate } mhioc_registerandignorekey_t;
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * SCSI-3 PGR Reservation Type Codes.  Codes with the _OBSOLETE suffix
1417c478bd9Sstevel@tonic-gate  * have been removed from the SCSI3 PGR standard.
1427c478bd9Sstevel@tonic-gate  */
1437c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_READSHARED_OBSOLETE			0
1447c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_WRITEEXCLUSIVE			1
1457c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_READEXCLUSIVE_OBSOLETE		2
1467c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_EXCLUSIVEACCESS			3
1477c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_SHAREDACCESS_OBSOLETE		4
1487c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_WRITEEXCLUSIVEREGISTRANTSONLY	5
1497c478bd9Sstevel@tonic-gate #define	SCSI3_RESV_EXCLUSIVEACCESSREGISTRANTSONLY	6
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate #define	SCSI3_SCOPE_LOGICALUNIT				0
1527c478bd9Sstevel@tonic-gate #define	SCSI3_SCOPE_EXTENT_OBSOLETE			1
1537c478bd9Sstevel@tonic-gate #define	SCSI3_SCOPE_ELEMENT				2
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1567c478bd9Sstevel@tonic-gate }
1577c478bd9Sstevel@tonic-gate #endif
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate #endif	/* _SYS_MHD_H */
160