xref: /titanic_44/usr/src/uts/common/sys/scsi/targets/smp.h (revision 96c4a178a18cd52ee5001195f1552d9cef0c38f0)
1936b7af6Sjw149990 /*
2936b7af6Sjw149990  * CDDL HEADER START
3936b7af6Sjw149990  *
4936b7af6Sjw149990  * The contents of this file are subject to the terms of the
5936b7af6Sjw149990  * Common Development and Distribution License (the "License").
6936b7af6Sjw149990  * You may not use this file except in compliance with the License.
7936b7af6Sjw149990  *
8936b7af6Sjw149990  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9936b7af6Sjw149990  * or http://www.opensolaris.org/os/licensing.
10936b7af6Sjw149990  * See the License for the specific language governing permissions
11936b7af6Sjw149990  * and limitations under the License.
12936b7af6Sjw149990  *
13936b7af6Sjw149990  * When distributing Covered Code, include this CDDL HEADER in each
14936b7af6Sjw149990  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15936b7af6Sjw149990  * If applicable, add the following below this CDDL HEADER, with the
16936b7af6Sjw149990  * fields enclosed by brackets "[]" replaced with your own identifying
17936b7af6Sjw149990  * information: Portions Copyright [yyyy] [name of copyright owner]
18936b7af6Sjw149990  *
19936b7af6Sjw149990  * CDDL HEADER END
20936b7af6Sjw149990  */
21936b7af6Sjw149990 
22936b7af6Sjw149990 /*
234c06356bSdh142964  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24936b7af6Sjw149990  * Use is subject to license terms.
25936b7af6Sjw149990  */
26936b7af6Sjw149990 
27936b7af6Sjw149990 #ifndef _SYS_SCSI_TARGETS_SMP_H
28936b7af6Sjw149990 #define	_SYS_SCSI_TARGETS_SMP_H
29936b7af6Sjw149990 
30936b7af6Sjw149990 #include <sys/types.h>
31936b7af6Sjw149990 #include <sys/scsi/scsi.h>
32936b7af6Sjw149990 
33936b7af6Sjw149990 #ifdef	__cplusplus
34936b7af6Sjw149990 extern "C" {
35936b7af6Sjw149990 #endif
36936b7af6Sjw149990 
37936b7af6Sjw149990 #if defined(_KERNEL)
38936b7af6Sjw149990 
39936b7af6Sjw149990 /*
40936b7af6Sjw149990  * smp_open_flag: field indicating open smp instance.
41936b7af6Sjw149990  *	0 = closed, 1 = shared open, 2 = exclusive open.
42936b7af6Sjw149990  */
43936b7af6Sjw149990 #define	SMP_CLOSED	0
44936b7af6Sjw149990 #define	SMP_SOPENED	1
45936b7af6Sjw149990 #define	SMP_EXOPENED	2
46936b7af6Sjw149990 
47936b7af6Sjw149990 typedef struct smp_state {
48*96c4a178SChris Horne 	struct smp_device	*smp_sd;	/* pointer to smp_device */
49936b7af6Sjw149990 	kmutex_t		smp_mutex;	/* mutex */
50936b7af6Sjw149990 	uint32_t		smp_open_flag;	/* open flag */
514c06356bSdh142964 	kcondvar_t		smp_cv;		/* condition variable */
524c06356bSdh142964 	uint32_t		smp_busy;	/* busy */
53936b7af6Sjw149990 } smp_state_t;
54936b7af6Sjw149990 
55936b7af6Sjw149990 #define	SMP_ESTIMATED_NUM_DEVS	4		/* for soft-state allocation */
564c06356bSdh142964 #define	SMP_DEFAULT_RETRY_TIMES	5
57936b7af6Sjw149990 
58936b7af6Sjw149990 #define	SMP_FLAG_REQBUF		0x1
59936b7af6Sjw149990 #define	SMP_FLAG_RSPBUF		0x2
60936b7af6Sjw149990 #define	SMP_FLAG_XFER		0x4
61936b7af6Sjw149990 
62936b7af6Sjw149990 #endif /* defined(_KERNEL) */
63936b7af6Sjw149990 
64936b7af6Sjw149990 
65936b7af6Sjw149990 #ifdef	__cplusplus
66936b7af6Sjw149990 }
67936b7af6Sjw149990 #endif
68936b7af6Sjw149990 
69936b7af6Sjw149990 #endif	/* _SYS_SCSI_TARGETS_SMP_H */
70