xref: /illumos-gate/usr/src/uts/common/io/comstar/stmf/stmf_state.h (revision 46b592853d0f4f11781b6b0a7533f267c6aee132)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 #ifndef	_STMF_STATE_H
26 #define	_STMF_STATE_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 typedef struct stmf_state {
33 	kmutex_t		stmf_lock;
34 	kcondvar_t		stmf_cv;
35 	dev_info_t		*stmf_dip;
36 	stmf_i_lu_provider_t	*stmf_ilplist;
37 	stmf_i_port_provider_t	*stmf_ipplist;
38 	stmf_i_lu_t		*stmf_ilulist;
39 	stmf_i_local_port_t	*stmf_ilportlist;
40 	int			stmf_nlps;
41 	int			stmf_npps;
42 	int			stmf_nlus;
43 	int			stmf_nlports;
44 	uint8_t			stmf_service_running:1,
45 				stmf_inventory_locked:1,
46 				stmf_exclusive_open:1,
47 				stmf_opened:1,
48 				stmf_process_initial_luns:1,
49 				rsvd:3;
50 	uint8_t			stmf_config_state; /* See stmf_ioctl.h */
51 	uint8_t			stmf_alua_state;
52 	uint16_t		stmf_alua_node;
53 	ddi_taskq_t		*stmf_svc_taskq;
54 	uint32_t		stmf_svc_flags;
55 	stmf_i_lu_t		*stmf_svc_ilu_draining;
56 	stmf_i_lu_t		*stmf_svc_ilu_timing;
57 	struct stmf_svc_req	*stmf_svc_active;
58 	struct stmf_svc_req	*stmf_svc_waiting;
59 
60 	stmf_id_list_t		stmf_hg_list;
61 	stmf_id_list_t		stmf_tg_list;
62 	stmf_id_list_t		stmf_luid_list;
63 
64 	stmf_ver_tg_t		*stmf_ver_tg_head;
65 
66 	stmf_pp_data_t		*stmf_ppdlist;
67 } stmf_state_t;
68 
69 /*
70  * svc flags
71  */
72 #define	STMF_SVC_STARTED		1
73 #define	STMF_SVC_ACTIVE			2
74 #define	STMF_SVC_TERMINATE		4
75 
76 /*
77  * svc request. We probably have to modify it once more services (and probably
78  * different types of services) are added to the stmf_svc_thread.
79  */
80 typedef struct stmf_svc_req {
81 	struct stmf_svc_req		*svc_next;
82 	int				svc_req_alloc_size;
83 	int				svc_cmd;
84 	void				*svc_obj;
85 	struct stmf_state_change_info	svc_info;
86 } stmf_svc_req_t;
87 
88 extern stmf_state_t stmf_state;
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif /* _STMF_STATE_H */
95